css-zero 0.0.37 → 0.0.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) 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 +46 -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 +12 -4
  8. data/lib/generators/css_zero/add/templates/app/assets/images/check.svg +1 -0
  9. data/lib/generators/css_zero/add/templates/app/assets/images/search.svg +1 -0
  10. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/accordion.css +4 -2
  11. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/avatar.css +16 -26
  12. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css +10 -11
  13. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/carousel.css +1 -12
  14. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/command.css +56 -0
  15. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/dialog.css +1 -1
  16. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input.css +12 -12
  17. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/layouts.css +0 -4
  18. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/lightbox.css +3 -7
  19. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/sheet.css +1 -1
  20. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/tabs.css +7 -15
  21. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/toggle.css +1 -3
  22. data/lib/generators/css_zero/add/templates/app/javascript/controllers/check_all_controller.js +1 -1
  23. data/lib/generators/css_zero/add/templates/app/javascript/controllers/command_controller.js +42 -0
  24. data/lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js +30 -5
  25. data/lib/generators/css_zero/add/templates/app/javascript/controllers/hotkey_controller.js +1 -3
  26. data/lib/generators/css_zero/add/templates/app/javascript/controllers/local_time_controller.js +29 -0
  27. data/lib/generators/css_zero/add/templates/app/javascript/controllers/revealable_input_controller.js +13 -8
  28. data/lib/generators/css_zero/add/templates/app/javascript/controllers/tabs_controller.js +1 -1
  29. data/lib/generators/css_zero/install/install_generator.rb +14 -0
  30. data/lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js +18 -0
  31. data/lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js +39 -0
  32. metadata +9 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d03cbc1032455ed1426a832bd3f71fcc6091275b6a6a75fa1d2111cf0105f24
4
- data.tar.gz: e4aae85c8fdcea540a262ae0de03546c367afabb6a3bbb0e769eceff328e3a2b
3
+ metadata.gz: c1bd36382642c26e7ccfb6659948ab080b708909dd80e8168b3e7149dc2f27ab
4
+ data.tar.gz: cb7f89e2c79deb6b134accafbcc012928045d6f155a331cd7a11abdba45bc771
5
5
  SHA512:
6
- metadata.gz: eae8de16d7008f3c47960c19a90840e236b9846505b3e988d20c10c41f21e5319200bb10b1fd0154d9dc61072bddb479efd8369597c9051bd1724ac32b64ecb0
7
- data.tar.gz: 8fcecce58a61bfa94b08879bd9338357988cb217da22c3398f6832b2a2842fc2d0802c9403502b70f80531dc7100b6d8fd591d0dc10211c4ba2185f994494c6e
6
+ metadata.gz: c7b281b3c1fd86decc8cd6df0a14859c6ee2565625f933a14e0f18d9a733d8cb89a75303e7500450af83eda10f82ea9aa744c9d7284c252b3488412aabb92797
7
+ data.tar.gz: 73ce63baeb7fef096081772831efcdff2319262c5f59ab3bcf8ca04d8951811c8b1b8e5738f3c8e41f717186ed218cc52ab1491b231427a8a16ca58d42c1b0e0
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 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,88 @@
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 based on media query size
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
+
307
334
  /****************************************************************
308
335
  * Accessibility
309
336
  *****************************************************************/
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.37"
2
+ VERSION = "0.0.39"
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 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:
@@ -39,23 +43,27 @@ input:
39
43
  - app/assets/images/select-arrow.svg
40
44
  - app/javascript/controllers/check_all_controller.js
41
45
  input_concerns:
42
- - app/javascript/controllers/autoselect_controller.js
43
46
  - app/javascript/controllers/copyable_input_controller.js
47
+ - app/assets/images/copy.svg
48
+ - app/assets/images/check.svg
44
49
  - app/javascript/controllers/clearable_input_controller.js
50
+ - app/assets/images/x.svg
45
51
  - app/javascript/controllers/revealable_input_controller.js
46
- - app/assets/images/copy.svg
47
52
  - app/assets/images/eye.svg
48
53
  - app/assets/images/eye-off.svg
49
- - app/assets/images/x.svg
54
+ - app/javascript/controllers/autoselect_controller.js
50
55
  layouts:
51
56
  - app/assets/stylesheets/layouts.css
52
57
  - app/assets/images/menu.svg
53
58
  lightbox:
54
59
  - app/assets/stylesheets/lightbox.css
55
60
  - app/javascript/controllers/lightbox_controller.js
61
+ - app/javascript/controllers/web_share_controller.js
56
62
  - app/assets/images/download.svg
57
63
  - app/assets/images/share.svg
58
64
  - app/assets/images/x.svg
65
+ local_time:
66
+ - app/javascript/controllers/local_time_controller.js
59
67
  pagination:
60
68
  - app/assets/images/chevron-right.svg
61
69
  - app/assets/images/chevron-left.svg
@@ -70,9 +78,9 @@ sheet:
70
78
  - app/assets/images/x.svg
71
79
  skeleton:
72
80
  - app/assets/stylesheets/skeleton.css
73
- - app/javascript/controllers/form_controller.js
74
81
  switch:
75
82
  - app/assets/stylesheets/switch.css
83
+ - app/javascript/controllers/form_controller.js
76
84
  table:
77
85
  - app/assets/stylesheets/table.css
78
86
  tabs:
@@ -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-check"><path d="M20 6 9 17l-5-5"/></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,8 +1,9 @@
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);
@@ -14,33 +15,22 @@
14
15
  inline-size: var(--size-full);
15
16
  object-fit: cover;
16
17
  }
17
- }
18
-
19
- .avatar--btn {
20
- cursor: pointer;
21
18
 
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
-
31
- &:disabled {
32
- pointer-events: none;
19
+ span[role=img] {
20
+ align-items: center;
21
+ background-color: var(--color-border-light);
22
+ block-size: var(--size-full);
23
+ border-radius: var(--radius);
24
+ display: flex;
25
+ font-size: calc(var(--size) * .4);
26
+ inline-size: var(--size-full);
27
+ justify-content: center;
28
+ user-select: none;
33
29
  }
34
30
  }
35
31
 
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;
32
+ .btn--avatar {
33
+ --btn-padding: 0;
34
+ --btn-icon-color: none;
35
+ --btn-radius: var(--radius);
46
36
  }
@@ -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,18 +68,15 @@
66
68
  .btn--plain {
67
69
  --btn-background: transparent;
68
70
  --btn-border-color: transparent;
71
+ --btn-hover-lightness: 100%;
69
72
  --btn-padding: 0;
70
73
  }
71
74
 
72
- .btn--rounded {
75
+ .btn--icon {
73
76
  --btn-padding: var(--size-2);
74
77
  --btn-radius: var(--rounded-full);
75
78
  }
76
79
 
77
- .btn--pressed:active {
78
- opacity: var(--opacity-50);
79
- }
80
-
81
80
  [aria-busy] .btn--loading:disabled {
82
81
  > * {
83
82
  visibility: hidden;
@@ -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
 
@@ -14,10 +14,6 @@
14
14
  }
15
15
  }
16
16
 
17
- .sidebar__toggle {
18
- @media (width >= 48rem) { display: none; }
19
- }
20
-
21
17
  .pancake-stack {
22
18
  display: grid;
23
19
  grid-template-rows: auto 1fr auto;
@@ -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
  }
@@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
3
3
  export default class extends Controller {
4
4
  static targets = [ "dependent" ]
5
5
 
6
- check({target}) {
6
+ check({ target }) {
7
7
  this.dependentTargets.forEach(element => element.checked = target.checked)
8
8
  }
9
9
  }
@@ -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,13 +1,38 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
+ import { debounce } from "helpers/timing_helpers"
2
3
 
3
4
  export default class extends Controller {
4
- static targets = [ "input" ]
5
+ static targets = [ "input", "copyIcon", "successIcon" ]
6
+ static values = { copied: Boolean }
5
7
 
6
- async copy() {
8
+ initialize() {
9
+ this.reset = debounce(this.reset.bind(this), 2500)
10
+ }
11
+
12
+ copiedValueChanged() {
13
+ this.#update()
14
+ }
15
+
16
+ copy() {
17
+ this.#copyToClipboard()
18
+ this.reset()
19
+ }
20
+
21
+ reset() {
22
+ this.copiedValue = false
23
+ }
24
+
25
+ #copyToClipboard() {
7
26
  try {
8
- await navigator.clipboard.writeText(this.inputTarget.value)
9
- } catch (error) {
10
- console.warn(error.message);
27
+ navigator.clipboard.writeText(this.inputTarget.value)
28
+ this.copiedValue = true
29
+ } catch {
30
+ this.copiedValue = false
11
31
  }
12
32
  }
33
+
34
+ #update() {
35
+ this.copyIconTarget.hidden = this.copiedValue
36
+ this.successIconTarget.hidden = !this.copiedValue
37
+ }
13
38
  }
@@ -2,9 +2,7 @@ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
4
  click(event) {
5
- if (this.#isClickable && !this.#shouldIgnore(event)) {
6
- this.element.click()
7
- }
5
+ if (this.#isClickable && !this.#shouldIgnore(event)) this.element.click()
8
6
  }
9
7
 
10
8
  #shouldIgnore(event) {
@@ -0,0 +1,29 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static targets = [ "time", "date", "datetime" ]
5
+
6
+ initialize() {
7
+ this.timeFormatter = new Intl.DateTimeFormat(undefined, { timeStyle: "short" })
8
+ this.dateFormatter = new Intl.DateTimeFormat(undefined, { dateStyle: "long" })
9
+ this.dateTimeFormatter = new Intl.DateTimeFormat(undefined, { timeStyle: "short", dateStyle: "short" })
10
+ }
11
+
12
+ timeTargetConnected(target) {
13
+ this.#formatTime(this.timeFormatter, target)
14
+ }
15
+
16
+ dateTargetConnected(target) {
17
+ this.#formatTime(this.dateFormatter, target)
18
+ }
19
+
20
+ datetimeTargetConnected(target) {
21
+ this.#formatTime(this.dateTimeFormatter, target)
22
+ }
23
+
24
+ #formatTime(formatter, target) {
25
+ const dt = new Date(target.getAttribute("datetime"))
26
+ target.textContent = formatter.format(dt)
27
+ target.title = this.dateTimeFormatter.format(dt)
28
+ }
29
+ }
@@ -1,19 +1,24 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
- static targets = [ "input", "image" ]
5
- static values = { showImage: String, hideImage: String }
4
+ static targets = [ "input", "showIcon", "hideIcon" ]
5
+ static values = { revealed: Boolean }
6
+
7
+ revealedValueChanged() {
8
+ this.#update()
9
+ }
6
10
 
7
11
  reveal() {
8
- this.inputTarget.type = this.#inputType
9
- this.imageTarget.src = this.#imageSrc
12
+ this.revealedValue = !this.revealedValue
10
13
  }
11
14
 
12
- get #inputType() {
13
- return this.inputTarget.type === "text" ? "password" : "text"
15
+ #update() {
16
+ this.inputTarget.type = this.#inputType
17
+ this.showIconTarget.hidden = this.revealedValue
18
+ this.hideIconTarget.hidden = !this.revealedValue
14
19
  }
15
20
 
16
- get #imageSrc() {
17
- return this.inputTarget.type === "text" ? this.hideImageValue : this.showImageValue
21
+ get #inputType() {
22
+ return this.revealedValue ? "text" : "password"
18
23
  }
19
24
  }
@@ -2,7 +2,7 @@ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
4
  static targets = [ "button", "tab" ]
5
- static values = { index: Number, default: 0 }
5
+ static values = { index: Number }
6
6
 
7
7
  indexValueChanged() {
8
8
  this.#showSelectedTab()
@@ -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.37
4
+ version: 0.0.39
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-23 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lazaronixon@hotmail.com
@@ -38,6 +38,7 @@ files:
38
38
  - lib/generators/css_zero/add/templates/app/assets/images/arrow-left.svg
39
39
  - lib/generators/css_zero/add/templates/app/assets/images/arrow-right.svg
40
40
  - lib/generators/css_zero/add/templates/app/assets/images/camera.svg
41
+ - lib/generators/css_zero/add/templates/app/assets/images/check.svg
41
42
  - lib/generators/css_zero/add/templates/app/assets/images/chevron-down.svg
42
43
  - lib/generators/css_zero/add/templates/app/assets/images/chevron-left.svg
43
44
  - lib/generators/css_zero/add/templates/app/assets/images/chevron-right.svg
@@ -52,6 +53,7 @@ files:
52
53
  - lib/generators/css_zero/add/templates/app/assets/images/maximize.svg
53
54
  - lib/generators/css_zero/add/templates/app/assets/images/menu.svg
54
55
  - lib/generators/css_zero/add/templates/app/assets/images/minus.svg
56
+ - lib/generators/css_zero/add/templates/app/assets/images/search.svg
55
57
  - lib/generators/css_zero/add/templates/app/assets/images/select-arrow.svg
56
58
  - lib/generators/css_zero/add/templates/app/assets/images/share.svg
57
59
  - lib/generators/css_zero/add/templates/app/assets/images/x.svg
@@ -63,6 +65,7 @@ files:
63
65
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css
64
66
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/card.css
65
67
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/carousel.css
68
+ - lib/generators/css_zero/add/templates/app/assets/stylesheets/command.css
66
69
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/dialog.css
67
70
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/flash.css
68
71
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/input.css
@@ -81,6 +84,7 @@ files:
81
84
  - lib/generators/css_zero/add/templates/app/javascript/controllers/check_all_controller.js
82
85
  - lib/generators/css_zero/add/templates/app/javascript/controllers/clearable_input_controller.js
83
86
  - lib/generators/css_zero/add/templates/app/javascript/controllers/collapsible_controller.js
87
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/command_controller.js
84
88
  - lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js
85
89
  - lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js
86
90
  - lib/generators/css_zero/add/templates/app/javascript/controllers/element_removal_controller.js
@@ -88,6 +92,7 @@ files:
88
92
  - lib/generators/css_zero/add/templates/app/javascript/controllers/fullscreen_controller.js
89
93
  - lib/generators/css_zero/add/templates/app/javascript/controllers/hotkey_controller.js
90
94
  - lib/generators/css_zero/add/templates/app/javascript/controllers/lightbox_controller.js
95
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/local_time_controller.js
91
96
  - lib/generators/css_zero/add/templates/app/javascript/controllers/revealable_input_controller.js
92
97
  - lib/generators/css_zero/add/templates/app/javascript/controllers/tabs_controller.js
93
98
  - lib/generators/css_zero/add/templates/app/javascript/controllers/upload_preview_controller.js
@@ -95,6 +100,8 @@ files:
95
100
  - lib/generators/css_zero/install/USAGE
96
101
  - lib/generators/css_zero/install/install_generator.rb
97
102
  - lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css
103
+ - lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js
104
+ - lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js
98
105
  homepage: https://github.com/lazaronixon/css-zero
99
106
  licenses:
100
107
  - MIT