css-zero 0.0.38 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/stylesheets/sizes.css +14 -14
  4. data/app/assets/stylesheets/zutilities.css +51 -19
  5. data/lib/css_zero/version.rb +1 -1
  6. data/lib/generators/css_zero/add/USAGE +1 -1
  7. data/lib/generators/css_zero/add/resources.yml +8 -5
  8. data/lib/generators/css_zero/add/templates/app/assets/images/search.svg +1 -0
  9. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/accordion.css +4 -2
  10. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/avatar.css +22 -28
  11. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css +11 -8
  12. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/carousel.css +1 -12
  13. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/command.css +56 -0
  14. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/dialog.css +1 -1
  15. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input.css +12 -12
  16. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/layouts.css +38 -10
  17. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/lightbox.css +3 -7
  18. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/sheet.css +1 -1
  19. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/tabs.css +7 -15
  20. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/toggle.css +1 -3
  21. data/lib/generators/css_zero/add/templates/app/javascript/controllers/command_controller.js +42 -0
  22. data/lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js +11 -9
  23. data/lib/generators/css_zero/install/install_generator.rb +14 -0
  24. data/lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js +18 -0
  25. data/lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js +39 -0
  26. metadata +7 -3
  27. data/lib/generators/css_zero/add/templates/app/javascript/controllers/check_all_controller.js +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 609a6d11cfe6b31670eda63d7104d2d76069f0fe352bc4b6f7b0d00e5e7c2ea1
4
- data.tar.gz: b118ad5a3842de5ab4df410b5516e62d52b9e241d559ec88f9146cdcc729b68a
3
+ metadata.gz: 4b3d3e06335e4a698ebc061696a679ed778bb627ec9d7d7ecf860aab7e802212
4
+ data.tar.gz: f78370339a7f2608e198498814810f3601b5ee77556fc548edf6461a611a7e4d
5
5
  SHA512:
6
- metadata.gz: 4dafa265f72d212202676d56ae7e3b5d20ee92516829c802a78794c43d3786aa68a7ed274361a2e3077df2e893cd75d298610f3a420e83de2703c0498419771f
7
- data.tar.gz: fd08c640bdc6b4409b046e86a8e817dd916fef129c28cc8cb8f0a04c77080bb27c4f372fec509897d17706473e7ef334c081fce1d0e7157717189e7c864a5f95
6
+ metadata.gz: 25d4acd29c0c630f307c20e49d1650b4f54df0f5afe49cfd20016c293edbdc54e296b631fa3e66cad4b5f90adec0fd3383f9252107716bc90c9fd353cad7c736
7
+ data.tar.gz: d4b932c7b8114c315634fe90f52f30f6570faa360c6ef9bdeaabf2fe1432b1ea791cff439b8d97a0b2aa1ed78da940c1eb0633d698c3dfdbb3de8eea9ea88693
data/README.md CHANGED
@@ -19,7 +19,7 @@ bin/rails generate css_zero:install
19
19
  Add only the components you need. (Optional)
20
20
 
21
21
  ```
22
- bin/rails generate css_zero:add accordion alert avatar badge breadcrumb button card carousel collapsible dialog flash fullscreen hotkey input input_concerns layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
22
+ bin/rails generate css_zero:add accordion alert avatar badge breadcrumb button card carousel command collapsible dialog flash fullscreen hotkey input input_concerns layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
23
23
  ```
24
24
 
25
25
  ### Requirements
@@ -68,21 +68,21 @@
68
68
  --size-full: 100%;
69
69
 
70
70
  /****************************************************************
71
- * Widths
71
+ * Max Inline Sizes
72
72
  *****************************************************************/
73
- --width-3xs: 16rem; /* 256px */
74
- --width-2xs: 18rem; /* 288px */
75
- --width-xs: 20rem; /* 320px */
76
- --width-sm: 24rem; /* 384px */
77
- --width-md: 28rem; /* 448px */
78
- --width-lg: 32rem; /* 512px */
79
- --width-xl: 36rem; /* 576px */
80
- --width-2xl: 42rem; /* 672px */
81
- --width-3xl: 48rem; /* 768px */
82
- --width-4xl: 56rem; /* 896px */
83
- --width-5xl: 64rem; /* 1024px */
84
- --width-6xl: 72rem; /* 1152px */
85
- --width-7xl: 80rem; /* 1280px */
73
+ --max-i-3xs: 16rem; /* 256px */
74
+ --max-i-2xs: 18rem; /* 288px */
75
+ --max-i-xs: 20rem; /* 320px */
76
+ --max-i-sm: 24rem; /* 384px */
77
+ --max-i-md: 28rem; /* 448px */
78
+ --max-i-lg: 32rem; /* 512px */
79
+ --max-i-xl: 36rem; /* 576px */
80
+ --max-i-2xl: 42rem; /* 672px */
81
+ --max-i-3xl: 48rem; /* 768px */
82
+ --max-i-4xl: 56rem; /* 896px */
83
+ --max-i-5xl: 64rem; /* 1024px */
84
+ --max-i-6xl: 72rem; /* 1152px */
85
+ --max-i-7xl: 80rem; /* 1280px */
86
86
 
87
87
  /****************************************************************
88
88
  * Aspect Ratio
@@ -148,12 +148,12 @@
148
148
  .relative { position: relative; }
149
149
  .sticky { position: sticky; }
150
150
 
151
- .min-w-0 { min-inline-size: 0; }
152
- .max-w-full { max-inline-size: 100%; }
151
+ .min-i-0 { min-inline-size: 0; }
152
+ .max-i-full { max-inline-size: 100%; }
153
153
 
154
- .h-full { block-size: 100%; }
155
- .w-full { inline-size: 100%; }
156
- .w-min { inline-size: min-content; }
154
+ .b-full { block-size: 100%; }
155
+ .i-full { inline-size: 100%; }
156
+ .i-min { inline-size: min-content; }
157
157
 
158
158
  .overflow-x-auto { overflow-x: auto; scroll-snap-type: x mandatory; }
159
159
  .overflow-y-auto { overflow-y: auto; scroll-snap-type: y mandatory; }
@@ -169,70 +169,77 @@
169
169
  * Margin
170
170
  *****************************************************************/
171
171
  .m-0 { margin: 0; }
172
- .m-0\.5 { margin: var(--size-0_5); }
173
172
  .m-1 { margin: var(--size-1); }
174
173
  .m-2 { margin: var(--size-2); }
174
+ .m-3 { margin: var(--size-3); }
175
175
  .m-4 { margin: var(--size-4); }
176
+ .m-5 { margin: var(--size-5); }
176
177
  .m-6 { margin: var(--size-6); }
177
178
  .m-8 { margin: var(--size-8); }
178
179
  .m-10 { margin: var(--size-10); }
179
180
  .m-auto { margin: auto; }
180
181
 
181
182
  .mb-0 { margin-block: 0; }
182
- .mb-0\.5 { margin-block: var(--size-0_5); }
183
183
  .mb-1 { margin-block: var(--size-1); }
184
184
  .mb-2 { margin-block: var(--size-2); }
185
+ .mb-3 { margin-block: var(--size-3); }
185
186
  .mb-4 { margin-block: var(--size-4); }
187
+ .mb-5 { margin-block: var(--size-5); }
186
188
  .mb-6 { margin-block: var(--size-6); }
187
189
  .mb-8 { margin-block: var(--size-8); }
188
190
  .mb-10 { margin-block: var(--size-10); }
189
191
  .mb-auto { margin-block: auto; }
190
192
 
191
193
  .mbs-0 { margin-block-start: 0; }
192
- .mbs-0\.5 { margin-block-start: var(--size-0_5); }
193
194
  .mbs-1 { margin-block-start: var(--size-1); }
194
195
  .mbs-2 { margin-block-start: var(--size-2); }
196
+ .mbs-3 { margin-block-start: var(--size-3); }
195
197
  .mbs-4 { margin-block-start: var(--size-4); }
198
+ .mbs-5 { margin-block-start: var(--size-5); }
196
199
  .mbs-6 { margin-block-start: var(--size-6); }
197
200
  .mbs-8 { margin-block-start: var(--size-8); }
198
201
  .mbs-10 { margin-block-start: var(--size-10); }
199
202
  .mbs-auto { margin-block-start: auto; }
200
203
 
201
204
  .mbe-0 { margin-block-end: 0; }
202
- .mbe-0\.5 { margin-block-end: var(--size-0_5); }
203
205
  .mbe-1 { margin-block-end: var(--size-1); }
204
206
  .mbe-2 { margin-block-end: var(--size-2); }
207
+ .mbe-3 { margin-block-end: var(--size-3); }
205
208
  .mbe-4 { margin-block-end: var(--size-4); }
209
+ .mbe-5 { margin-block-end: var(--size-5); }
206
210
  .mbe-6 { margin-block-end: var(--size-6); }
207
211
  .mbe-8 { margin-block-end: var(--size-8); }
208
212
  .mbe-10 { margin-block-end: var(--size-10); }
209
213
  .mbe-auto { margin-block-end: auto; }
210
214
 
211
215
  .mi-0 { margin-inline: 0; }
212
- .mi-0\.5 { margin-inline: var(--size-0_5); }
213
216
  .mi-1 { margin-inline: var(--size-1); }
214
217
  .mi-2 { margin-inline: var(--size-2); }
218
+ .mi-3 { margin-inline: var(--size-3); }
215
219
  .mi-4 { margin-inline: var(--size-4); }
220
+ .mi-5 { margin-inline: var(--size-5); }
216
221
  .mi-6 { margin-inline: var(--size-6); }
217
222
  .mi-8 { margin-inline: var(--size-8); }
218
223
  .mi-10 { margin-inline: var(--size-10); }
219
224
  .mi-auto { margin-inline: auto; }
220
225
 
221
226
  .mis-0 { margin-inline-start: 0; }
222
- .mis-0\.5 { margin-inline-start: var(--size-0_5); }
223
227
  .mis-1 { margin-inline-start: var(--size-1); }
224
228
  .mis-2 { margin-inline-start: var(--size-2); }
229
+ .mis-3 { margin-inline-start: var(--size-3); }
225
230
  .mis-4 { margin-inline-start: var(--size-4); }
231
+ .mis-5 { margin-inline-start: var(--size-5); }
226
232
  .mis-6 { margin-inline-start: var(--size-6); }
227
233
  .mis-8 { margin-inline-start: var(--size-8); }
228
234
  .mis-10 { margin-inline-start: var(--size-10); }
229
235
  .mis-auto { margin-inline-start: auto; }
230
236
 
231
237
  .mie-0 { margin-inline-end: 0; }
232
- .mie-0\.5 { margin-inline-end: var(--size-0_5); }
233
238
  .mie-1 { margin-inline-end: var(--size-1); }
234
239
  .mie-2 { margin-inline-end: var(--size-2); }
240
+ .mie-3 { margin-inline-end: var(--size-3); }
235
241
  .mie-4 { margin-inline-end: var(--size-4); }
242
+ .mie-5 { margin-inline-end: var(--size-5); }
236
243
  .mie-6 { margin-inline-end: var(--size-6); }
237
244
  .mie-8 { margin-inline-end: var(--size-8); }
238
245
  .mie-10 { margin-inline-end: var(--size-10); }
@@ -242,68 +249,93 @@
242
249
  * Padding
243
250
  *****************************************************************/
244
251
  .p-0 { padding: 0; }
245
- .p-0\.5 { padding: var(--size-0_5); }
246
252
  .p-1 { padding: var(--size-1); }
247
253
  .p-2 { padding: var(--size-2); }
254
+ .p-3 { padding: var(--size-3); }
248
255
  .p-4 { padding: var(--size-4); }
256
+ .p-5 { padding: var(--size-5); }
249
257
  .p-6 { padding: var(--size-6); }
250
258
  .p-8 { padding: var(--size-8); }
251
259
  .p-10 { padding: var(--size-10); }
252
260
 
253
261
  .pb-0 { padding-block: 0; }
254
- .pb-0\.5 { padding-block: var(--size-0_5); }
255
262
  .pb-1 { padding-block: var(--size-1); }
256
263
  .pb-2 { padding-block: var(--size-2); }
264
+ .pb-3 { padding-block: var(--size-3); }
257
265
  .pb-4 { padding-block: var(--size-4); }
266
+ .pb-5 { padding-block: var(--size-5); }
258
267
  .pb-6 { padding-block: var(--size-6); }
259
268
  .pb-8 { padding-block: var(--size-8); }
260
269
  .pb-10 { padding-block: var(--size-10); }
261
270
 
262
271
  .pbs-0 { padding-block-start: 0; }
263
- .pbs-0\.5 { padding-block-start: var(--size-0_5); }
264
272
  .pbs-1 { padding-block-start: var(--size-1); }
265
273
  .pbs-2 { padding-block-start: var(--size-2); }
274
+ .pbs-3 { padding-block-start: var(--size-3); }
266
275
  .pbs-4 { padding-block-start: var(--size-4); }
276
+ .pbs-5 { padding-block-start: var(--size-5); }
267
277
  .pbs-6 { padding-block-start: var(--size-6); }
268
278
  .pbs-8 { padding-block-start: var(--size-8); }
269
279
  .pbs-10 { padding-block-start: var(--size-10); }
270
280
 
271
281
  .pbe-0 { padding-block-end: 0; }
272
- .pbe-0\.5 { padding-block-end: var(--size-0_5); }
273
282
  .pbe-1 { padding-block-end: var(--size-1); }
274
283
  .pbe-2 { padding-block-end: var(--size-2); }
284
+ .pbe-3 { padding-block-end: var(--size-3); }
275
285
  .pbe-4 { padding-block-end: var(--size-4); }
286
+ .pbe-5 { padding-block-end: var(--size-5); }
276
287
  .pbe-6 { padding-block-end: var(--size-6); }
277
288
  .pbe-8 { padding-block-end: var(--size-8); }
278
289
  .pbe-10 { padding-block-end: var(--size-10); }
279
290
 
280
291
  .pi-0 { padding-inline: 0; }
281
- .pi-0\.5 { padding-inline: var(--size-0_5); }
282
292
  .pi-1 { padding-inline: var(--size-1); }
283
293
  .pi-2 { padding-inline: var(--size-2); }
294
+ .pi-3 { padding-inline: var(--size-3); }
284
295
  .pi-4 { padding-inline: var(--size-4); }
296
+ .pi-5 { padding-inline: var(--size-5); }
285
297
  .pi-6 { padding-inline: var(--size-6); }
286
298
  .pi-8 { padding-inline: var(--size-8); }
287
299
  .pi-10 { padding-inline: var(--size-10); }
288
300
 
289
301
  .pis-0 { padding-inline-start: 0; }
290
- .pis-0\.5 { padding-inline-start: var(--size-0_5); }
291
302
  .pis-1 { padding-inline-start: var(--size-1); }
292
303
  .pis-2 { padding-inline-start: var(--size-2); }
304
+ .pis-3 { padding-inline-start: var(--size-3); }
293
305
  .pis-4 { padding-inline-start: var(--size-4); }
306
+ .pis-5 { padding-inline-start: var(--size-5); }
294
307
  .pis-6 { padding-inline-start: var(--size-6); }
295
308
  .pis-8 { padding-inline-start: var(--size-8); }
296
309
  .pis-10 { padding-inline-start: var(--size-10); }
297
310
 
298
311
  .pie-0 { padding-inline-end: 0; }
299
- .pie-0\.5 { padding-inline-end: var(--size-0_5); }
300
312
  .pie-1 { padding-inline-end: var(--size-1); }
301
313
  .pie-2 { padding-inline-end: var(--size-2); }
314
+ .pie-3 { padding-inline-end: var(--size-3); }
302
315
  .pie-4 { padding-inline-end: var(--size-4); }
316
+ .pie-5 { padding-inline-end: var(--size-5); }
303
317
  .pie-6 { padding-inline-end: var(--size-6); }
304
318
  .pie-8 { padding-inline-end: var(--size-8); }
305
319
  .pie-10 { padding-inline-end: var(--size-10); }
306
320
 
321
+ /****************************************************************
322
+ * Hiding/Showing
323
+ *****************************************************************/
324
+ .show\@sm, .show\@md, .show\@lg { display: none; }
325
+
326
+ .show\@sm { @media (width >= 40rem) { display: flex; } }
327
+ .show\@md { @media (width >= 48rem) { display: flex; } }
328
+ .show\@lg { @media (width >= 64rem) { display: flex; } }
329
+
330
+ .hide\@sm { @media (width >= 40rem) { display: none; } }
331
+ .hide\@md { @media (width >= 48rem) { display: none; } }
332
+ .hide\@lg { @media (width >= 64rem) { display: none; } }
333
+
334
+ .hide\@pwa { @media (display-mode: standalone) { display: none; } }
335
+ .hide\@browser { @media (display-mode: browser) { display: none; } }
336
+
337
+ .hide\@print { @media print { display: none; } }
338
+
307
339
  /****************************************************************
308
340
  * Accessibility
309
341
  *****************************************************************/
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.38"
2
+ VERSION = "0.0.40"
3
3
  end
@@ -2,7 +2,7 @@ Description:
2
2
  This will add components into your project.
3
3
 
4
4
  Components:
5
- accordion alert avatar badge breadcrumb button card carousel collapsible dialog flash fullscreen hotkey input input_concerns layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
5
+ accordion alert avatar badge breadcrumb button card carousel command collapsible dialog flash fullscreen hotkey input input_concerns layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
6
6
 
7
7
  Example:
8
8
  bin/rails generate css_zero:add [components...]
@@ -20,6 +20,10 @@ carousel:
20
20
  - app/javascript/controllers/carousel_controller.js
21
21
  - app/assets/images/arrow-left.svg
22
22
  - app/assets/images/arrow-right.svg
23
+ command:
24
+ - app/assets/stylesheets/command.css
25
+ - app/javascript/controllers/command_controller.js
26
+ - app/assets/images/search.svg
23
27
  collapsible:
24
28
  - app/javascript/controllers/collapsible_controller.js
25
29
  dialog:
@@ -37,17 +41,16 @@ hotkey:
37
41
  input:
38
42
  - app/assets/stylesheets/input.css
39
43
  - app/assets/images/select-arrow.svg
40
- - app/javascript/controllers/check_all_controller.js
41
44
  input_concerns:
42
- - app/javascript/controllers/autoselect_controller.js
43
45
  - app/javascript/controllers/copyable_input_controller.js
44
- - app/javascript/controllers/clearable_input_controller.js
45
- - app/javascript/controllers/revealable_input_controller.js
46
46
  - app/assets/images/copy.svg
47
47
  - app/assets/images/check.svg
48
+ - app/javascript/controllers/clearable_input_controller.js
49
+ - app/assets/images/x.svg
50
+ - app/javascript/controllers/revealable_input_controller.js
48
51
  - app/assets/images/eye.svg
49
52
  - app/assets/images/eye-off.svg
50
- - app/assets/images/x.svg
53
+ - app/javascript/controllers/autoselect_controller.js
51
54
  layouts:
52
55
  - app/assets/stylesheets/layouts.css
53
56
  - app/assets/images/menu.svg
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-search"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
@@ -1,16 +1,18 @@
1
1
  :where(.accordion) {
2
2
  details {
3
3
  border-block-end-width: var(--border);
4
+ interpolate-size: allow-keywords;
4
5
 
5
6
  &::details-content {
6
- block-size: 0; overflow: hidden;
7
+ block-size: 0;
8
+ overflow-y: clip;
7
9
  transition-behavior: allow-discrete;
8
10
  transition-duration: var(--time-150);
9
11
  transition-property: content-visibility height;
10
12
  }
11
13
 
12
14
  &[open]::details-content {
13
- block-size: calc-size(auto);
15
+ block-size: auto;
14
16
  }
15
17
 
16
18
  &[open] summary::after {
@@ -1,46 +1,40 @@
1
1
  .avatar {
2
+ --radius: var(--rounded-full);
2
3
  --size: var(--avatar-size, var(--size-10));
3
4
 
4
5
  block-size: var(--size);
5
- border-radius: var(--rounded-full);
6
+ border-radius: var(--radius);
6
7
  display: flex;
7
8
  flex-shrink: 0;
8
9
  inline-size: var(--size);
9
10
  overflow: hidden;
10
11
 
12
+ &:is(.btn) {
13
+ --btn-padding: 0;
14
+ --btn-icon-color: none;
15
+ --btn-radius: var(--radius);
16
+ }
17
+
18
+ &:is(.btn):hover {
19
+ filter: var(--brightness-90);
20
+ }
21
+
11
22
  img {
12
23
  aspect-ratio: var(--aspect-square);
13
24
  block-size: var(--size-full);
14
25
  inline-size: var(--size-full);
15
26
  object-fit: cover;
16
27
  }
17
- }
18
-
19
- .avatar--btn {
20
- cursor: pointer;
21
-
22
- &:hover {
23
- filter: var(--brightness-75);
24
- }
25
-
26
- &:focus-visible {
27
- outline: var(--border-2) solid var(--color-selected-dark);
28
- outline-offset: var(--border-2);
29
- }
30
28
 
31
- &:disabled {
32
- pointer-events: none;
29
+ span[role=img] {
30
+ align-items: center;
31
+ background-color: var(--color-border-light);
32
+ block-size: var(--size-full);
33
+ border-radius: var(--radius);
34
+ display: flex;
35
+ font-size: calc(var(--size) * .4);
36
+ inline-size: var(--size-full);
37
+ justify-content: center;
38
+ user-select: none;
33
39
  }
34
40
  }
35
-
36
- .avatar__fallback {
37
- align-items: center;
38
- background-color: var(--color-border-light);
39
- block-size: var(--size-full);
40
- border-radius: var(--rounded-full);
41
- display: flex;
42
- font-size: calc(var(--size) * .4);
43
- inline-size: var(--size-full);
44
- justify-content: center;
45
- user-select: none;
46
- }
@@ -6,10 +6,10 @@
6
6
  color: var(--btn-color, var(--color-text));
7
7
  cursor: pointer;
8
8
  display: inline-flex;
9
- font-size: var(--text-sm);
10
- font-weight: var(--font-medium);
9
+ font-size: var(--btn-font-size, var(--text-sm));
10
+ font-weight: var(--btn-font-weight, var(--font-medium));
11
11
  gap: var(--size-2);
12
- justify-content: center;
12
+ justify-content: var(--btn-justify-content, center);
13
13
  white-space: nowrap;
14
14
  padding: var(--btn-padding, 0.5rem 1rem);
15
15
  text-align: center;
@@ -19,15 +19,17 @@
19
19
  }
20
20
 
21
21
  &:hover {
22
- filter: var(--btn-filter-hover, var(--brightness-95));
22
+ --hover-color: var(--btn-background, var(--color-bg));
23
+ --hover-color-l: var(--btn-hover-lightness, calc(l * .96));
24
+ background-color: oklch(from var(--hover-color) var(--hover-color-l) c h);
23
25
  }
24
26
 
25
27
  &:focus-visible {
26
- outline: var(--border-2) solid var(--color-selected-dark);
28
+ outline: var(--btn-outline-size, 2px) solid var(--color-selected-dark);
27
29
  outline-offset: var(--border-2);
28
30
  }
29
31
 
30
- &:disabled {
32
+ &:is(:disabled, [aria-disabled]) {
31
33
  opacity: var(--opacity-50);
32
34
  pointer-events: none;
33
35
  }
@@ -66,11 +68,12 @@
66
68
  .btn--plain {
67
69
  --btn-background: transparent;
68
70
  --btn-border-color: transparent;
69
- --btn-filter-hover: none;
71
+ --btn-hover-lightness: 100%;
70
72
  --btn-padding: 0;
71
73
  }
72
74
 
73
- .btn--rounded {
75
+ .btn--icon {
76
+ --btn-padding: var(--size-2);
74
77
  --btn-radius: var(--rounded-full);
75
78
  }
76
79
 
@@ -1,21 +1,10 @@
1
- .carousel {
2
- align-items: center;
3
- display: flex;
4
- gap: var(--size-4);
5
- }
6
-
7
1
  .carousel__content {
8
2
  display: flex;
9
3
  gap: var(--size-6);
10
- overflow-x: auto;
4
+ overflow: hidden;
11
5
  padding: var(--size-1);
12
- scrollbar-width: none;
13
6
  scroll-snap-type: x mandatory;
14
7
 
15
- &::-webkit-scrollbar {
16
- display: none;
17
- }
18
-
19
8
  > * {
20
9
  flex: 0 0 100%;
21
10
  scroll-snap-stop: always;
@@ -0,0 +1,56 @@
1
+ .command {
2
+ border-width: var(--border);
3
+ border-radius: var(--rounded-lg);
4
+ box-shadow: var(--shadow-sm);
5
+ display: flex;
6
+ flex-direction: column;
7
+ }
8
+
9
+ .command__input {
10
+ --input-background: transparent;
11
+ --input-border-color: transparent;
12
+ --input-outline-size: 0;
13
+ }
14
+
15
+ .command__list {
16
+ max-block-size: 300px;
17
+ overflow-y: auto;
18
+ }
19
+
20
+ .command__group {
21
+ border-block-start-width: var(--border);
22
+ display: flex;
23
+ flex-direction: column;
24
+ padding: var(--size-1);
25
+ }
26
+
27
+ .command__group-header {
28
+ color: var(--color-text-subtle);
29
+ font-size: var(--text-xs);
30
+ padding: var(--size-1_5) var(--size-2);
31
+ }
32
+
33
+ .command__item {
34
+ --btn-border-color: transparent;
35
+ --btn-font-weight: var(--font-normal);
36
+ --btn-justify-content: start;
37
+ --btn-outline-size: 0;
38
+ --btn-padding: var(--size-1_5) var(--size-2);
39
+
40
+ &:focus-visible {
41
+ --btn-background: var(--color-secondary);
42
+ }
43
+ }
44
+
45
+ .command__item-key {
46
+ color: var(--color-text-subtle);
47
+ font-size: var(--text-xs);
48
+ margin-inline-start: auto;
49
+ }
50
+
51
+ .command__list--filtering {
52
+ .command__group { display: none; }
53
+ .command__group:has(.selected) { display: flex; }
54
+ .command__item { display: none; }
55
+ .command__item:is(.selected) { display: flex; }
56
+ }
@@ -6,7 +6,7 @@
6
6
  color: var(--color-text);
7
7
  inline-size: var(--size-full);
8
8
  margin: auto;
9
- max-inline-size: var(--dialog-width, var(--width-lg));
9
+ max-inline-size: var(--dialog-width, var(--max-i-lg));
10
10
 
11
11
  &::backdrop {
12
12
  background-color: rgba(0, 0, 0, .8);
@@ -1,11 +1,11 @@
1
1
  .input {
2
2
  appearance: none;
3
- background-color: var(--color-bg);
4
- border: var(--border) solid var(--color-border);
5
- border-radius: var(--rounded-md);
6
- font-size: var(--text-sm);
3
+ background-color: var(--input-background, var(--color-bg));
4
+ border: 1px solid var(--input-border-color, var(--color-border));
5
+ border-radius: var(--input-radius, var(--rounded-md));
6
+ font-size: var(--input-font-size, var(--text-sm));
7
7
  inline-size: var(--size-full);
8
- padding: var(--size-2) var(--size-3);
8
+ padding: var(--input-padding, 0.5rem 1rem);
9
9
 
10
10
  option {
11
11
  padding-block: revert;
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  &:user-invalid ~ .invalid-feedback {
37
- display: block;
37
+ display: flex;
38
38
  }
39
39
 
40
40
  &:disabled {
@@ -50,13 +50,13 @@
50
50
 
51
51
  /* Containers that act like (and contain) inputs */
52
52
  .input--actor {
53
- &:focus-within {
54
- outline: var(--border-2) solid var(--color-selected-dark);
55
- outline-offset: var(--border-2);
53
+ input {
54
+ border: 0; inline-size: 100%; outline: 0;
56
55
  }
57
56
 
58
- .input__character {
59
- border: 0; inline-size: 100%; outline: 0;
57
+ &:focus-within {
58
+ outline: var(--input-outline-size, 2px) solid var(--color-selected-dark);
59
+ outline-offset: var(--border-2);
60
60
  }
61
61
  }
62
62
 
@@ -73,7 +73,7 @@
73
73
  /* Styles that are shared between components */
74
74
  :is(.input, .checkbox, .radio, .range) {
75
75
  &:focus-visible {
76
- outline: var(--border-2) solid var(--color-selected-dark);
76
+ outline: var(--input-outline-size, 2px) solid var(--color-selected-dark);
77
77
  outline-offset: var(--border-2);
78
78
  }
79
79
 
@@ -4,48 +4,76 @@
4
4
  grid-template-columns: var(--sidebar-width, 0) 1fr;
5
5
  grid-template-rows: auto 1fr;
6
6
  min-block-size: 100dvh;
7
+ max-block-size: 100dvh;
7
8
 
8
9
  @media (width >= 48rem) {
10
+ --sidebar-border-width: var(--border);
11
+ --sidebar-padding: var(--size-2);
9
12
  --sidebar-width: 220px;
10
13
  }
11
14
 
12
15
  @media (width >= 64rem) {
16
+ --sidebar-border-width: var(--border);
17
+ --sidebar-padding: var(--size-4);
13
18
  --sidebar-width: 280px;
14
19
  }
15
20
  }
16
21
 
17
- .sidebar__toggle {
18
- @media (width >= 48rem) { display: none; }
19
- }
20
-
21
- .pancake-stack {
22
+ .header-layout {
22
23
  display: grid;
23
- grid-template-rows: auto 1fr auto;
24
+ grid-template-areas: "header" "main";
25
+ grid-template-rows: auto 1fr;
24
26
  min-block-size: 100dvh;
25
27
  }
26
28
 
27
- .super-centered {
29
+ .centered-layout {
28
30
  display: grid;
29
31
  place-items: center;
30
32
  min-block-size: 100dvh;
31
33
  }
32
34
 
33
35
  .container {
36
+ inline-size: 100%;
34
37
  margin-inline: auto;
35
38
  max-inline-size: var(--container-width, 64rem);
36
- min-block-size: 100dvh;
37
39
  }
38
40
 
39
- /* Grid areas definition */
40
-
41
41
  #header {
42
+ align-items: center;
43
+ background-color: var(--color-bg);
44
+ border-block-end-width: var(--border);
45
+ block-size: var(--size-16);
46
+ display: flex;
47
+ gap: var(--size-4);
42
48
  grid-area: header;
49
+ inset-block-start: 0;
50
+ padding-inline: var(--size-4);
51
+ position: sticky;
52
+
53
+ @media (width >= 64rem) {
54
+ padding-inline: var(--size-6);
55
+ }
43
56
  }
44
57
 
45
58
  #sidebar {
59
+ border-inline-end-width: var(--sidebar-border-width, 0);
60
+ display: flex;
61
+ flex-direction: column;
46
62
  grid-area: sidebar;
63
+ gap: var(--size-2);
64
+ overflow-x: hidden;
65
+ padding: var(--sidebar-padding, 0);
47
66
  }
48
67
 
49
68
  #main {
69
+ display: flex;
70
+ flex-direction: column;
71
+ gap: var(--size-4);
50
72
  grid-area: main;
73
+ overflow-y: auto;
74
+ padding: var(--size-4);
75
+
76
+ @media (width >= 64rem) {
77
+ gap: var(--size-6); padding: var(--size-6);
78
+ }
51
79
  }
@@ -1,14 +1,10 @@
1
- :root {
2
- --lightbox-padding: var(--size-4);
3
- }
4
-
5
1
  .lightbox {
6
2
  background-color: rgba(0, 0, 0, .8);
7
3
  block-size: 100dvh;
8
4
  max-block-size: unset;
9
5
  inline-size: 100dvw;
10
6
  max-inline-size: unset;
11
- padding: var(--lightbox-padding);
7
+ padding: var(--size-4);
12
8
 
13
9
  &[open] {
14
10
  display: grid;
@@ -36,6 +32,6 @@
36
32
 
37
33
  .lightbox__image {
38
34
  grid-area: 1/1;
39
- max-inline-size: calc(100dvw - (var(--lightbox-padding) * 2));
40
- max-block-size: calc(100dvh - (var(--lightbox-padding) * 2));
35
+ max-inline-size: calc(100dvw - (var(--size-4) * 2));
36
+ max-block-size: calc(100dvh - (var(--size-4) * 2));
41
37
  }
@@ -7,7 +7,7 @@
7
7
  inline-size: var(--size-3-4);
8
8
  margin-inline: var(--sheet-margin);
9
9
  max-block-size: unset;
10
- max-inline-size: var(--width-sm);
10
+ max-inline-size: var(--max-i-sm);
11
11
 
12
12
  &::backdrop {
13
13
  background-color: rgba(0, 0, 0, .8);
@@ -1,9 +1,3 @@
1
- .tabs {
2
- display: flex;
3
- flex-direction: column;
4
- gap: var(--size-2);
5
- }
6
-
7
1
  .tabs__list {
8
2
  background-color: var(--color-border-light);
9
3
  block-size: var(--size-10);
@@ -12,18 +6,16 @@
12
6
  display: inline-flex;
13
7
  gap: var(--size-2);
14
8
  padding: var(--size-1);
9
+ }
15
10
 
16
- button {
17
- inline-size: var(--size-full);
18
- }
11
+ .btn--tab {
12
+ --btn-background: transparent;
13
+ --btn-border-color: transparent;
14
+ --btn-hover-lightness: 100%;
19
15
 
20
- button {
21
- --btn-background: transparent;
22
- --btn-border-color: transparent;
23
- --btn-filter-hover: none;
24
- }
16
+ inline-size: var(--size-full);
25
17
 
26
- button[aria-selected=true] {
18
+ &[aria-selected=true] {
27
19
  --btn-background: var(--color-bg);
28
20
  }
29
21
  }
@@ -1,6 +1,4 @@
1
- .toggle {
2
- display: inline-flex;
3
-
1
+ .btn--toggle {
4
2
  [type="checkbox"] {
5
3
  position: absolute; clip: rect(0, 0, 0, 0);
6
4
  }
@@ -0,0 +1,42 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+ import { debounce } from "helpers/timing_helpers"
3
+
4
+ export default class extends Controller {
5
+ static targets = [ "list" ]
6
+ static classes = [ "active", "selected" ]
7
+
8
+ initialize() {
9
+ this.filter = debounce(this.filter.bind(this), 300)
10
+ }
11
+
12
+ filter(event) {
13
+ this.#reset()
14
+
15
+ if (event.target.value != "") {
16
+ this.#selectMatches(event.target.value)
17
+ this.#activate()
18
+ } else {
19
+ this.#deactivate()
20
+ }
21
+ }
22
+
23
+ #activate() {
24
+ this.listTarget.classList.add(this.activeClass)
25
+ }
26
+
27
+ #deactivate() {
28
+ this.listTarget.classList.remove(this.activeClass)
29
+ }
30
+
31
+ #selectMatches(value) {
32
+ this.listTarget.querySelectorAll(`[data-value*=${value.toLowerCase()}]`).forEach((element) => {
33
+ element.classList.add(this.selectedClass)
34
+ })
35
+ }
36
+
37
+ #reset() {
38
+ this.listTarget.querySelectorAll(`.${this.selectedClass}`).forEach((element) => {
39
+ element.classList.remove(this.selectedClass)
40
+ })
41
+ }
42
+ }
@@ -1,10 +1,13 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
+ import { debounce } from "helpers/timing_helpers"
2
3
 
3
4
  export default class extends Controller {
4
5
  static targets = [ "input", "copyIcon", "successIcon" ]
5
6
  static values = { copied: Boolean }
6
7
 
7
- #copiedTimeout = null
8
+ initialize() {
9
+ this.reset = debounce(this.reset.bind(this), 2500)
10
+ }
8
11
 
9
12
  copiedValueChanged() {
10
13
  this.#update()
@@ -12,23 +15,22 @@ export default class extends Controller {
12
15
 
13
16
  copy() {
14
17
  this.#copyToClipboard()
15
- this.#reset()
18
+ this.reset()
19
+ }
20
+
21
+ reset() {
22
+ this.copiedValue = false
16
23
  }
17
24
 
18
25
  #copyToClipboard() {
19
26
  try {
20
27
  navigator.clipboard.writeText(this.inputTarget.value)
21
28
  this.copiedValue = true
22
- } catch (error) {
23
- console.warn(error.message);
29
+ } catch {
30
+ this.copiedValue = false
24
31
  }
25
32
  }
26
33
 
27
- #reset() {
28
- clearTimeout(this.#copiedTimeout)
29
- this.#copiedTimeout = setTimeout(() => { this.copiedValue = false }, 3000)
30
- }
31
-
32
34
  #update() {
33
35
  this.copyIconTarget.hidden = this.copiedValue
34
36
  this.successIconTarget.hidden = !this.copiedValue
@@ -6,4 +6,18 @@ class CssZero::InstallGenerator < Rails::Generators::Base
6
6
  def copy_base_css
7
7
  copy_file "app/assets/stylesheets/base.css"
8
8
  end
9
+
10
+ def copy_javascript_helpers
11
+ directory "app/javascript/helpers"
12
+ end
13
+
14
+ def pin_javascript_helpers
15
+ return unless install_with_importmap?
16
+ append_to_file "config/importmap.rb", %(pin_all_from "app/javascript/helpers", under: "helpers"\n)
17
+ end
18
+
19
+ private
20
+ def install_with_importmap?
21
+ Rails.root.join("config/importmap.rb").exist?
22
+ end
9
23
  end
@@ -0,0 +1,18 @@
1
+ export function getCookie(name) {
2
+ const cookies = document.cookie ? document.cookie.split("; ") : []
3
+ const prefix = `${encodeURIComponent(name)}=`
4
+ const cookie = cookies.find(cookie => cookie.startsWith(prefix))
5
+
6
+ if (cookie) {
7
+ const value = cookie.split("=").slice(1).join("=")
8
+ return value ? decodeURIComponent(value) : undefined
9
+ }
10
+ }
11
+
12
+ export function setCookie(name, value) {
13
+ const twentyYears = 20 * 365 * 24 * 60 * 60 * 1000
14
+ const body = [ name, value ].map(encodeURIComponent).join("=")
15
+ const expires = new Date(Date.now() + twentyYears).toUTCString()
16
+ const cookie = `${body}; path=/; expires=${expires}`
17
+ document.cookie = cookie
18
+ }
@@ -0,0 +1,39 @@
1
+ export function throttle(fn, delay = 1000) {
2
+ let timeoutId = null
3
+
4
+ return (...args) => {
5
+ if (!timeoutId) {
6
+ fn(...args)
7
+ timeoutId = setTimeout(() => timeoutId = null, delay)
8
+ }
9
+ }
10
+ }
11
+
12
+ export function debounce(fn, delay = 1000) {
13
+ let timeoutId = null
14
+
15
+ return (...args) => {
16
+ clearTimeout(timeoutId)
17
+ timeoutId = setTimeout(() => fn.apply(this, args), delay)
18
+ }
19
+ }
20
+
21
+ export function nextEventLoopTick() {
22
+ return delay(0)
23
+ }
24
+
25
+ export function onNextEventLoopTick(callback) {
26
+ setTimeout(callback, 0)
27
+ }
28
+
29
+ export function nextFrame() {
30
+ return new Promise(requestAnimationFrame)
31
+ }
32
+
33
+ export function nextEventNamed(eventName, element = window) {
34
+ return new Promise(resolve => element.addEventListener(eventName, resolve, { once: true }))
35
+ }
36
+
37
+ export function delay(ms) {
38
+ return new Promise(resolve => setTimeout(resolve, ms))
39
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38
4
+ version: 0.0.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lázaro Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-24 00:00:00.000000000 Z
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lazaronixon@hotmail.com
@@ -53,6 +53,7 @@ files:
53
53
  - lib/generators/css_zero/add/templates/app/assets/images/maximize.svg
54
54
  - lib/generators/css_zero/add/templates/app/assets/images/menu.svg
55
55
  - lib/generators/css_zero/add/templates/app/assets/images/minus.svg
56
+ - lib/generators/css_zero/add/templates/app/assets/images/search.svg
56
57
  - lib/generators/css_zero/add/templates/app/assets/images/select-arrow.svg
57
58
  - lib/generators/css_zero/add/templates/app/assets/images/share.svg
58
59
  - lib/generators/css_zero/add/templates/app/assets/images/x.svg
@@ -64,6 +65,7 @@ files:
64
65
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css
65
66
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/card.css
66
67
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/carousel.css
68
+ - lib/generators/css_zero/add/templates/app/assets/stylesheets/command.css
67
69
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/dialog.css
68
70
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/flash.css
69
71
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/input.css
@@ -79,9 +81,9 @@ files:
79
81
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/toggle.css
80
82
  - lib/generators/css_zero/add/templates/app/javascript/controllers/autoselect_controller.js
81
83
  - lib/generators/css_zero/add/templates/app/javascript/controllers/carousel_controller.js
82
- - lib/generators/css_zero/add/templates/app/javascript/controllers/check_all_controller.js
83
84
  - lib/generators/css_zero/add/templates/app/javascript/controllers/clearable_input_controller.js
84
85
  - lib/generators/css_zero/add/templates/app/javascript/controllers/collapsible_controller.js
86
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/command_controller.js
85
87
  - lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js
86
88
  - lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js
87
89
  - lib/generators/css_zero/add/templates/app/javascript/controllers/element_removal_controller.js
@@ -97,6 +99,8 @@ files:
97
99
  - lib/generators/css_zero/install/USAGE
98
100
  - lib/generators/css_zero/install/install_generator.rb
99
101
  - lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css
102
+ - lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js
103
+ - lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js
100
104
  homepage: https://github.com/lazaronixon/css-zero
101
105
  licenses:
102
106
  - MIT
@@ -1,9 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- static targets = [ "dependent" ]
5
-
6
- check({ target }) {
7
- this.dependentTargets.forEach(element => element.checked = target.checked)
8
- }
9
- }