css-zero 0.0.50 → 0.0.52

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/_reset.css +1 -1
  3. data/app/assets/stylesheets/typography.css +1 -1
  4. data/lib/css_zero/version.rb +1 -1
  5. data/lib/generators/css_zero/add/USAGE +1 -1
  6. data/lib/generators/css_zero/add/resources.yml +11 -0
  7. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/badge.css +2 -2
  8. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css +4 -4
  9. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/command.css +6 -3
  10. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input.css +1 -2
  11. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/menu.css +2 -2
  12. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/tabs.css +2 -1
  13. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/tom-select.css +411 -0
  14. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/zcombobox.css +100 -0
  15. data/lib/generators/css_zero/add/templates/app/assets/stylesheets/ztrix.css +170 -0
  16. data/lib/generators/css_zero/add/templates/app/javascript/controllers/autosave_controller.js +64 -0
  17. data/lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js +48 -0
  18. data/lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js +11 -1
  19. data/lib/generators/css_zero/add/templates/app/javascript/controllers/filter_controller.js +11 -1
  20. data/lib/generators/css_zero/add/templates/app/javascript/controllers/inputmask_controller.js +46 -0
  21. data/lib/generators/css_zero/add/templates/app/javascript/controllers/list_controller.js +15 -15
  22. data/lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js +5 -5
  23. data/lib/generators/css_zero/install/install_generator.rb +0 -24
  24. data/lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css +2 -2
  25. metadata +8 -5
  26. data/lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js +0 -18
  27. data/lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js +0 -39
  28. data/lib/generators/css_zero/install/templates/app/javascript/initializers/index.js +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91b801a2c291cc802d00718d9ab4cade87e214b4ba369b11f6f5a479cab99701
4
- data.tar.gz: dca783296168520201298efa156a848e37667b08b275015e4ca216c9baaa091b
3
+ metadata.gz: c157fd23d2088eadf6b3ddd2301b2c6bb5e819e0fcebb3e2fd92bde924469a64
4
+ data.tar.gz: a68db27229c7b3c9118a008dc2f4417ff84b2dd99a54a637ed156a01c5aabd46
5
5
  SHA512:
6
- metadata.gz: 84e0431f0af1beb34e11a7ee0cd1e8a247b469880a832185b4f2d555c15133ebe622741949f51686869d3bb98673b5664503f71d0de72f702301e412a3f99dfd
7
- data.tar.gz: cc5ed39f59c52469fbb6bb5e162f04da66d570350ff83982d2a211d8790b4e1424a9e4567d79f6bc8e2cf0ec8c2b14f5c4f45792a76b80909cdbf4ffb898e5e6
6
+ metadata.gz: 6d06cd1f0e6c178496ecca303119b7d880f1d384c3ebd7549bedf3ae18c19bc90a8702016fd8bd9c0d913ffc48b68081d10b5e2e17e21eb2844644b80c331c36
7
+ data.tar.gz: 5bcd076df9a20544d488289894c858f426d88b0805a79fe47c326c48bf679de340542924510df37c6b06707ee537e0d396033a3db6bb082dd9ce7cf9142af90f
@@ -291,7 +291,7 @@ textarea {
291
291
 
292
292
  ::placeholder {
293
293
  opacity: 1; /* 1 */
294
- color: color-mix(in srgb, currentColor 50%, transparent); /* 2 */
294
+ color: color-mix(in oklch, currentColor 50%, transparent); /* 2 */
295
295
  }
296
296
 
297
297
  /*
@@ -46,7 +46,7 @@
46
46
  --leading-none: 1;
47
47
  --leading-tight: 1.25;
48
48
  --leading-snug: 1.375;
49
- --leading-normal: 1.4;
49
+ --leading-normal: 1.5;
50
50
  --leading-relaxed: 1.625;
51
51
  --leading-loose: 2;
52
52
  --leading-3: .75rem; /* 12px */
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.50"
2
+ VERSION = "0.0.52"
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 check_all command collapsible dialog dropdown flash form 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 autosave avatar badge breadcrumb button card carousel combobox check_all command collapsible dialog dropdown flash form fullscreen hotkey input input_concerns inputmask layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs trix upload_preview toggle web_share
6
6
 
7
7
  Example:
8
8
  bin/rails generate css_zero:add [components...]
@@ -3,6 +3,8 @@ accordion:
3
3
  - app/assets/images/chevron-down.svg
4
4
  alert:
5
5
  - app/assets/stylesheets/alert.css
6
+ autosave:
7
+ - app/javascript/controllers/autosave_controller.js
6
8
  avatar:
7
9
  - app/assets/stylesheets/avatar.css
8
10
  badge:
@@ -20,6 +22,11 @@ carousel:
20
22
  - app/javascript/controllers/carousel_controller.js
21
23
  - app/assets/images/arrow-left.svg
22
24
  - app/assets/images/arrow-right.svg
25
+ combobox:
26
+ - app/assets/stylesheets/tom-select.css
27
+ - app/assets/stylesheets/zcombobox.css
28
+ - app/javascript/controllers/combobox_controller.js
29
+ - app/assets/images/select-arrow.svg
23
30
  check_all:
24
31
  - app/javascript/controllers/check_all_controller.js
25
32
  command:
@@ -60,6 +67,8 @@ input_concerns:
60
67
  - app/javascript/controllers/revealable_input_controller.js
61
68
  - app/assets/images/eye.svg
62
69
  - app/assets/images/eye-off.svg
70
+ inputmask:
71
+ - app/javascript/controllers/inputmask_controller.js
63
72
  layouts:
64
73
  - app/assets/stylesheets/layouts.css
65
74
  - app/assets/images/menu.svg
@@ -96,6 +105,8 @@ table:
96
105
  tabs:
97
106
  - app/assets/stylesheets/tabs.css
98
107
  - app/javascript/controllers/tabs_controller.js
108
+ trix:
109
+ - app/assets/stylesheets/ztrix.css
99
110
  upload_preview:
100
111
  - app/javascript/controllers/upload_preview_controller.js
101
112
  - app/assets/images/default-picture.webp
@@ -24,11 +24,11 @@
24
24
  .badge--positive {
25
25
  --badge-background: var(--color-positive);
26
26
  --badge-border-color: transparent;
27
- --badge-color: white;
27
+ --badge-color: var(--color-text-reversed);
28
28
  }
29
29
 
30
30
  .badge--negative {
31
31
  --badge-background: var(--color-negative);
32
32
  --badge-border-color: transparent;
33
- --badge-color: white;
33
+ --badge-color: var(--color-text-reversed);
34
34
  }
@@ -20,9 +20,9 @@
20
20
  }
21
21
 
22
22
  &:hover {
23
- --hover-color: var(--btn-background, var(--color-bg));
24
- --hover-color-l: var(--btn-hover-lightness, calc(l * .96));
25
- background-color: oklch(from var(--hover-color) var(--hover-color-l) c h);
23
+ --hover-color-from: var(--btn-background, var(--color-bg));
24
+ --hover-color: oklch(from var(--hover-color-from) calc(l * .96) c h);
25
+ background-color: var(--btn-hover-color, var(--hover-color));
26
26
  }
27
27
 
28
28
  &:focus-visible {
@@ -69,7 +69,7 @@
69
69
  .btn--plain {
70
70
  --btn-background: transparent;
71
71
  --btn-border-color: transparent;
72
- --btn-hover-lightness: l;
72
+ --btn-hover-color: transparent;
73
73
  --btn-padding: 0;
74
74
  }
75
75
 
@@ -19,8 +19,11 @@
19
19
  overflow-y: auto;
20
20
  }
21
21
 
22
- .command__group {
22
+ .command__group:not(:first-child) {
23
23
  border-block-start-width: var(--border);
24
+ }
25
+
26
+ .command__group {
24
27
  display: flex;
25
28
  flex-direction: column;
26
29
  padding: var(--size-1);
@@ -42,12 +45,12 @@
42
45
  .command__item {
43
46
  --btn-border-color: transparent;
44
47
  --btn-font-weight: var(--font-normal);
45
- --btn-hover-lightness: l;
48
+ --btn-hover-color: var(--color-secondary);
46
49
  --btn-justify-content: start;
47
50
  --btn-outline-size: 0;
48
51
  --btn-padding: var(--size-1_5) var(--size-2);
49
52
 
50
- &:is(:hover, [aria-selected=true]) {
53
+ &[aria-selected=true] {
51
54
  --btn-background: var(--color-secondary);
52
55
  }
53
56
  }
@@ -66,8 +66,7 @@
66
66
 
67
67
  /* Checkbox, radio, and range */
68
68
  .checkbox, .radio {
69
- accent-color: var(--color-primary);
70
- block-size: 16px; inline-size: 18px;
69
+ accent-color: var(--color-primary); transform: scale(1.15);
71
70
  }
72
71
 
73
72
  .range {
@@ -23,12 +23,12 @@
23
23
  .menu__item {
24
24
  --btn-border-color: transparent;
25
25
  --btn-font-weight: var(--font-normal);
26
- --btn-hover-lightness: l;
26
+ --btn-hover-color: var(--color-secondary);
27
27
  --btn-justify-content: start;
28
28
  --btn-outline-size: 0;
29
29
  --btn-padding: var(--size-1_5) var(--size-2);
30
30
 
31
- &:is(:hover, :focus-visible) {
31
+ &:focus-visible {
32
32
  --btn-background: var(--color-secondary);
33
33
  }
34
34
  }
@@ -11,10 +11,11 @@
11
11
  .btn--tab {
12
12
  --btn-background: transparent;
13
13
  --btn-border-color: transparent;
14
- --btn-hover-lightness: l;
14
+ --btn-hover-color: transparent;
15
15
  --btn-inline-size: var(--size-full);
16
16
 
17
17
  &[aria-selected=true] {
18
18
  --btn-background: var(--color-bg);
19
+ --btn-hover-color: var(--color-bg);
19
20
  }
20
21
  }
@@ -0,0 +1,411 @@
1
+ /**
2
+ * tom-select.css (v2.3.1)
3
+ * Copyright (c) contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ */
15
+ .ts-control {
16
+ border: 1px solid #d0d0d0;
17
+ padding: 8px 8px;
18
+ width: 100%;
19
+ overflow: hidden;
20
+ position: relative;
21
+ z-index: 1;
22
+ box-sizing: border-box;
23
+ box-shadow: none;
24
+ border-radius: 3px;
25
+ display: flex;
26
+ flex-wrap: wrap;
27
+ }
28
+ .ts-wrapper.multi.has-items .ts-control {
29
+ padding: calc(8px - 2px - 0) 8px calc(8px - 2px - 3px - 0);
30
+ }
31
+ .full .ts-control {
32
+ background-color: #fff;
33
+ }
34
+ .disabled .ts-control, .disabled .ts-control * {
35
+ cursor: default !important;
36
+ }
37
+ .focus .ts-control {
38
+ box-shadow: none;
39
+ }
40
+ .ts-control > * {
41
+ vertical-align: baseline;
42
+ display: inline-block;
43
+ }
44
+ .ts-wrapper.multi .ts-control > div {
45
+ cursor: pointer;
46
+ margin: 0 3px 3px 0;
47
+ padding: 2px 6px;
48
+ background: #f2f2f2;
49
+ color: #303030;
50
+ border: 0 solid #d0d0d0;
51
+ }
52
+ .ts-wrapper.multi .ts-control > div.active {
53
+ background: #e8e8e8;
54
+ color: #303030;
55
+ border: 0 solid #cacaca;
56
+ }
57
+ .ts-wrapper.multi.disabled .ts-control > div, .ts-wrapper.multi.disabled .ts-control > div.active {
58
+ color: #7d7d7d;
59
+ background: white;
60
+ border: 0 solid white;
61
+ }
62
+ .ts-control > input {
63
+ flex: 1 1 auto;
64
+ min-width: 7rem;
65
+ display: inline-block !important;
66
+ padding: 0 !important;
67
+ min-height: 0 !important;
68
+ max-height: none !important;
69
+ max-width: 100% !important;
70
+ margin: 0 !important;
71
+ text-indent: 0 !important;
72
+ border: 0 none !important;
73
+ background: none !important;
74
+ line-height: inherit !important;
75
+ -webkit-user-select: auto !important;
76
+ -moz-user-select: auto !important;
77
+ -ms-user-select: auto !important;
78
+ user-select: auto !important;
79
+ box-shadow: none !important;
80
+ }
81
+ .ts-control > input::-ms-clear {
82
+ display: none;
83
+ }
84
+ .ts-control > input:focus {
85
+ outline: none !important;
86
+ }
87
+ .has-items .ts-control > input {
88
+ margin: 0 4px !important;
89
+ }
90
+ .ts-control.rtl {
91
+ text-align: right;
92
+ }
93
+ .ts-control.rtl.single .ts-control:after {
94
+ left: 15px;
95
+ right: auto;
96
+ }
97
+ .ts-control.rtl .ts-control > input {
98
+ margin: 0 4px 0 -2px !important;
99
+ }
100
+ .disabled .ts-control {
101
+ opacity: 0.5;
102
+ background-color: #fafafa;
103
+ }
104
+ .input-hidden .ts-control > input {
105
+ opacity: 0;
106
+ position: absolute;
107
+ left: -10000px;
108
+ }
109
+
110
+ .ts-dropdown {
111
+ position: absolute;
112
+ top: 100%;
113
+ left: 0;
114
+ width: 100%;
115
+ z-index: 10;
116
+ border: 1px solid #d0d0d0;
117
+ background: #fff;
118
+ margin: 0.25rem 0 0;
119
+ border-top: 0 none;
120
+ box-sizing: border-box;
121
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
122
+ border-radius: 0 0 3px 3px;
123
+ }
124
+ .ts-dropdown [data-selectable] {
125
+ cursor: pointer;
126
+ overflow: hidden;
127
+ }
128
+ .ts-dropdown [data-selectable] .highlight {
129
+ background: rgba(125, 168, 208, 0.2);
130
+ border-radius: 1px;
131
+ }
132
+ .ts-dropdown .option,
133
+ .ts-dropdown .optgroup-header,
134
+ .ts-dropdown .no-results,
135
+ .ts-dropdown .create {
136
+ padding: 5px 8px;
137
+ }
138
+ .ts-dropdown .option, .ts-dropdown [data-disabled], .ts-dropdown [data-disabled] [data-selectable].option {
139
+ cursor: inherit;
140
+ opacity: 0.5;
141
+ }
142
+ .ts-dropdown [data-selectable].option {
143
+ opacity: 1;
144
+ cursor: pointer;
145
+ }
146
+ .ts-dropdown .optgroup:first-child .optgroup-header {
147
+ border-top: 0 none;
148
+ }
149
+ .ts-dropdown .optgroup-header {
150
+ color: #303030;
151
+ background: #fff;
152
+ cursor: default;
153
+ }
154
+ .ts-dropdown .active {
155
+ background-color: #f5fafd;
156
+ color: #495c68;
157
+ }
158
+ .ts-dropdown .active.create {
159
+ color: #495c68;
160
+ }
161
+ .ts-dropdown .create {
162
+ color: rgba(48, 48, 48, 0.5);
163
+ }
164
+ .ts-dropdown .spinner {
165
+ display: inline-block;
166
+ width: 30px;
167
+ height: 30px;
168
+ margin: 5px 8px;
169
+ }
170
+ .ts-dropdown .spinner::after {
171
+ content: " ";
172
+ display: block;
173
+ width: 24px;
174
+ height: 24px;
175
+ margin: 3px;
176
+ border-radius: 50%;
177
+ border: 5px solid #d0d0d0;
178
+ border-color: #d0d0d0 transparent #d0d0d0 transparent;
179
+ animation: lds-dual-ring 1.2s linear infinite;
180
+ }
181
+ @keyframes lds-dual-ring {
182
+ 0% {
183
+ transform: rotate(0deg);
184
+ }
185
+ 100% {
186
+ transform: rotate(360deg);
187
+ }
188
+ }
189
+
190
+ .ts-dropdown-content {
191
+ overflow: hidden auto;
192
+ max-height: 200px;
193
+ scroll-behavior: smooth;
194
+ }
195
+
196
+ .ts-wrapper.plugin-drag_drop .ts-dragging {
197
+ color: transparent !important;
198
+ }
199
+ .ts-wrapper.plugin-drag_drop .ts-dragging > * {
200
+ visibility: hidden !important;
201
+ }
202
+
203
+ .plugin-checkbox_options:not(.rtl) .option input {
204
+ margin-right: 0.5rem;
205
+ }
206
+
207
+ .plugin-checkbox_options.rtl .option input {
208
+ margin-left: 0.5rem;
209
+ }
210
+
211
+ /* stylelint-disable function-name-case */
212
+ .plugin-clear_button {
213
+ --ts-pr-clear-button: 1em;
214
+ }
215
+ .plugin-clear_button .clear-button {
216
+ opacity: 0;
217
+ position: absolute;
218
+ top: 50%;
219
+ transform: translateY(-50%);
220
+ right: calc(8px - 6px);
221
+ margin-right: 0 !important;
222
+ background: transparent !important;
223
+ transition: opacity 0.5s;
224
+ cursor: pointer;
225
+ }
226
+ .plugin-clear_button.form-select .clear-button, .plugin-clear_button.single .clear-button {
227
+ right: max(var(--ts-pr-caret), 8px);
228
+ }
229
+ .plugin-clear_button.focus.has-items .clear-button, .plugin-clear_button:not(.disabled):hover.has-items .clear-button {
230
+ opacity: 1;
231
+ }
232
+
233
+ .ts-wrapper .dropdown-header {
234
+ position: relative;
235
+ padding: 10px 8px;
236
+ border-bottom: 1px solid #d0d0d0;
237
+ background: color-mix(#fff, #d0d0d0, 85%);
238
+ border-radius: 3px 3px 0 0;
239
+ }
240
+ .ts-wrapper .dropdown-header-close {
241
+ position: absolute;
242
+ right: 8px;
243
+ top: 50%;
244
+ color: #303030;
245
+ opacity: 0.4;
246
+ margin-top: -12px;
247
+ line-height: 20px;
248
+ font-size: 20px !important;
249
+ }
250
+ .ts-wrapper .dropdown-header-close:hover {
251
+ color: black;
252
+ }
253
+
254
+ .plugin-dropdown_input.focus.dropdown-active .ts-control {
255
+ box-shadow: none;
256
+ border: 1px solid #d0d0d0;
257
+ }
258
+ .plugin-dropdown_input .dropdown-input {
259
+ border: 1px solid #d0d0d0;
260
+ border-width: 0 0 1px;
261
+ display: block;
262
+ padding: 8px 8px;
263
+ box-shadow: none;
264
+ width: 100%;
265
+ background: transparent;
266
+ }
267
+ .plugin-dropdown_input .items-placeholder {
268
+ border: 0 none !important;
269
+ box-shadow: none !important;
270
+ width: 100%;
271
+ }
272
+ .plugin-dropdown_input.has-items .items-placeholder, .plugin-dropdown_input.dropdown-active .items-placeholder {
273
+ display: none !important;
274
+ }
275
+
276
+ .ts-wrapper.plugin-input_autogrow.has-items .ts-control > input {
277
+ min-width: 0;
278
+ }
279
+ .ts-wrapper.plugin-input_autogrow.has-items.focus .ts-control > input {
280
+ flex: none;
281
+ min-width: 4px;
282
+ }
283
+ .ts-wrapper.plugin-input_autogrow.has-items.focus .ts-control > input::-ms-input-placeholder {
284
+ color: transparent;
285
+ }
286
+ .ts-wrapper.plugin-input_autogrow.has-items.focus .ts-control > input::placeholder {
287
+ color: transparent;
288
+ }
289
+
290
+ .ts-dropdown.plugin-optgroup_columns .ts-dropdown-content {
291
+ display: flex;
292
+ }
293
+ .ts-dropdown.plugin-optgroup_columns .optgroup {
294
+ border-right: 1px solid #f2f2f2;
295
+ border-top: 0 none;
296
+ flex-grow: 1;
297
+ flex-basis: 0;
298
+ min-width: 0;
299
+ }
300
+ .ts-dropdown.plugin-optgroup_columns .optgroup:last-child {
301
+ border-right: 0 none;
302
+ }
303
+ .ts-dropdown.plugin-optgroup_columns .optgroup::before {
304
+ display: none;
305
+ }
306
+ .ts-dropdown.plugin-optgroup_columns .optgroup-header {
307
+ border-top: 0 none;
308
+ }
309
+
310
+ .ts-wrapper.plugin-remove_button .item {
311
+ display: inline-flex;
312
+ align-items: center;
313
+ }
314
+ .ts-wrapper.plugin-remove_button .item .remove {
315
+ color: inherit;
316
+ text-decoration: none;
317
+ vertical-align: middle;
318
+ display: inline-block;
319
+ padding: 0 6px;
320
+ border-radius: 0 2px 2px 0;
321
+ box-sizing: border-box;
322
+ }
323
+ .ts-wrapper.plugin-remove_button .item .remove:hover {
324
+ background: rgba(0, 0, 0, 0.05);
325
+ }
326
+ .ts-wrapper.plugin-remove_button.disabled .item .remove:hover {
327
+ background: none;
328
+ }
329
+ .ts-wrapper.plugin-remove_button .remove-single {
330
+ position: absolute;
331
+ right: 0;
332
+ top: 0;
333
+ font-size: 23px;
334
+ }
335
+
336
+ .ts-wrapper.plugin-remove_button:not(.rtl) .item {
337
+ padding-right: 0 !important;
338
+ }
339
+ .ts-wrapper.plugin-remove_button:not(.rtl) .item .remove {
340
+ border-left: 1px solid #d0d0d0;
341
+ margin-left: 6px;
342
+ }
343
+ .ts-wrapper.plugin-remove_button:not(.rtl) .item.active .remove {
344
+ border-left-color: #cacaca;
345
+ }
346
+ .ts-wrapper.plugin-remove_button:not(.rtl).disabled .item .remove {
347
+ border-left-color: white;
348
+ }
349
+
350
+ .ts-wrapper.plugin-remove_button.rtl .item {
351
+ padding-left: 0 !important;
352
+ }
353
+ .ts-wrapper.plugin-remove_button.rtl .item .remove {
354
+ border-right: 1px solid #d0d0d0;
355
+ margin-right: 6px;
356
+ }
357
+ .ts-wrapper.plugin-remove_button.rtl .item.active .remove {
358
+ border-right-color: #cacaca;
359
+ }
360
+ .ts-wrapper.plugin-remove_button.rtl.disabled .item .remove {
361
+ border-right-color: white;
362
+ }
363
+
364
+ :root {
365
+ --ts-pr-clear-button: 0;
366
+ --ts-pr-caret: 0;
367
+ --ts-pr-min: .75rem;
368
+ }
369
+
370
+ .ts-wrapper.single .ts-control, .ts-wrapper.single .ts-control input {
371
+ cursor: pointer;
372
+ }
373
+
374
+ .ts-control:not(.rtl) {
375
+ padding-right: max(var(--ts-pr-min), var(--ts-pr-clear-button) + var(--ts-pr-caret)) !important;
376
+ }
377
+
378
+ .ts-control.rtl {
379
+ padding-left: max(var(--ts-pr-min), var(--ts-pr-clear-button) + var(--ts-pr-caret)) !important;
380
+ }
381
+
382
+ .ts-wrapper {
383
+ position: relative;
384
+ }
385
+
386
+ .ts-dropdown,
387
+ .ts-control,
388
+ .ts-control input {
389
+ color: #303030;
390
+ font-family: inherit;
391
+ font-size: 13px;
392
+ line-height: 18px;
393
+ }
394
+
395
+ .ts-control,
396
+ .ts-wrapper.single.input-active .ts-control {
397
+ background: #fff;
398
+ cursor: text;
399
+ }
400
+
401
+ .ts-hidden-accessible {
402
+ border: 0 !important;
403
+ clip: rect(0 0 0 0) !important;
404
+ -webkit-clip-path: inset(50%) !important;
405
+ clip-path: inset(50%) !important;
406
+ overflow: hidden !important;
407
+ padding: 0 !important;
408
+ position: absolute !important;
409
+ width: 1px !important;
410
+ white-space: nowrap !important;
411
+ }
@@ -0,0 +1,100 @@
1
+ .ts-control {
2
+ align-items: center;
3
+ background-color: var(--color-bg);
4
+ border: 1px solid var(--color-border);
5
+ border-radius: var(--rounded-md);
6
+ min-block-size: var(--size-10);
7
+ color: var(--color-text);
8
+ display: flex;
9
+ font-size: var(--text-sm);
10
+ font-weight: var(--font-medium);
11
+ gap: var(--size-1);
12
+ line-height: inherit;
13
+ padding: var(--size-1_5) var(--size-2);
14
+
15
+ > input {
16
+ color: inherit; font-size: inherit;
17
+ }
18
+ }
19
+
20
+ .ts-dropdown {
21
+ background-color: var(--color-bg);
22
+ border: 1px solid var(--color-border);
23
+ border-radius: var(--rounded-md);
24
+ box-shadow: var(--shadow-md);
25
+ color: var(--color-text);
26
+ font-size: var(--text-sm);
27
+ line-height: inherit;
28
+
29
+ .ts-dropdown-content:not(:has(.optgroup)) {
30
+ padding: var(--size-1);
31
+ }
32
+
33
+ .optgroup:not(:first-child) {
34
+ border-block-start-width: var(--border);
35
+ }
36
+
37
+ .optgroup {
38
+ padding: var(--size-1);
39
+ }
40
+
41
+ .optgroup-header {
42
+ color: var(--color-text-subtle);
43
+ font-size: var(--text-xs);
44
+ padding: var(--size-1_5) var(--size-2);
45
+ }
46
+
47
+ .create {
48
+ padding: var(--size-1_5) var(--size-2);
49
+ }
50
+
51
+ .option {
52
+ border: 1px solid transparent;
53
+ border-radius: var(--rounded-md);
54
+ padding: var(--size-1_5) var(--size-2);
55
+ }
56
+
57
+ .active {
58
+ background-color: var(--color-secondary);
59
+ color: inherit !important;
60
+ }
61
+
62
+ .highlight {
63
+ background-color: transparent !important;
64
+ }
65
+
66
+ .spinner {
67
+ margin: var(--size-1_5) 0 0;
68
+ }
69
+
70
+ .spinner::after {
71
+ border-block-color: var(--color-border-dark);
72
+ }
73
+ }
74
+
75
+ .ts-wrapper.single .ts-control {
76
+ background-color: var(--color-bg) !important;
77
+ background-image: url("select-arrow.svg") !important;
78
+ background-position: center right var(--size-2) !important;
79
+ background-repeat: no-repeat !important;
80
+ background-size: var(--size-4) auto !important;
81
+ }
82
+
83
+ .ts-wrapper.multi .ts-control > .item {
84
+ background: var(--color-secondary);
85
+ border-radius: var(--rounded-md);
86
+ color: inherit;
87
+ margin: 0;
88
+ }
89
+
90
+ .disabled .ts-control {
91
+ opacity: var(--opacity-50);
92
+ }
93
+
94
+ .disabled .ts-control * {
95
+ cursor: not-allowed !important;
96
+ }
97
+
98
+ .invalid .ts-control {
99
+ border-color: var(--color-negative);
100
+ }
@@ -0,0 +1,170 @@
1
+ trix-toolbar {
2
+ inset-block-start: 0;
3
+ position: sticky;
4
+
5
+ .trix-button-row {
6
+ background-color: var(--color-bg);
7
+ border-block-width: 1px;
8
+ padding-block: var(--size-1_5);
9
+ gap: 1px;
10
+ }
11
+
12
+ .trix-button-group {
13
+ border: 0 !important;
14
+ margin: 0 !important;
15
+ gap: 1px;
16
+ }
17
+
18
+ .trix-button {
19
+ background-color: var(--color-bg);
20
+ border: 0 !important;
21
+ border-radius: var(--rounded-md);
22
+ color: var(--color-text);
23
+
24
+ &.trix-active {
25
+ background-color: var(--color-secondary);
26
+ }
27
+
28
+ &.trix-button--icon::before {
29
+ filter: var(--color-filter-text);
30
+ opacity: 1;
31
+ }
32
+
33
+ &.trix-button--icon:disabled::before {
34
+ opacity: 0.125;
35
+ }
36
+ }
37
+
38
+ .trix-dialog {
39
+ background-color: var(--color-border-light);
40
+ border: 1px solid var(--color-border);
41
+ border-radius: var(--rounded-md);
42
+ margin: var(--size-1);
43
+ box-shadow: var(--shadow-md);
44
+ }
45
+
46
+ .trix-input--dialog {
47
+ border-color: var(--color-border);
48
+ background-color: var(--color-bg);
49
+ margin: 0;
50
+ }
51
+
52
+ .trix-button--dialog {
53
+ margin-inline-start: var(--size-1_5);
54
+ background-color: var(--color-primary);
55
+ color: var(--color-text-reversed);
56
+ }
57
+
58
+ @media (max-width: 768px) {
59
+ .trix-button-group--history-tools { display: none; }
60
+ }
61
+ }
62
+
63
+ trix-editor {
64
+ border: 0;
65
+ min-block-size: var(--size-72);
66
+ padding-block: var(--size-6) var(--size-2);
67
+
68
+ &:empty:not(:focus)::before {
69
+ color: color-mix(in oklch, currentColor 50%, transparent);
70
+ }
71
+
72
+ [data-trix-mutable].attachment img,
73
+ [data-trix-mutable].attachment--content,
74
+ [data-trix-mutable].attachment--file {
75
+ box-shadow: 0 0 0 2px var(--color-selected-dark);
76
+ }
77
+
78
+ .attachment__metadata {
79
+ background-color: var(--color-border-light);
80
+ color: var(--color-text);
81
+ }
82
+
83
+ &:focus-visible {
84
+ outline: 0;
85
+ }
86
+ }
87
+
88
+ .trix-content {
89
+ & {
90
+ line-height: var(--leading-7);
91
+ }
92
+
93
+ a {
94
+ color: var(--color-link);
95
+ text-decoration: underline;
96
+ }
97
+
98
+ h1 {
99
+ font-size: var(--text-2xl);
100
+ font-weight: var(--font-semibold);
101
+ line-height: var(--leading-8);
102
+ margin-block-end: var(--size-6);
103
+ }
104
+
105
+ blockquote {
106
+ border-inline-start: 2px solid var(--color-border);
107
+ font-style: italic;
108
+ margin: 0;
109
+ padding-inline-start: var(--size-6);
110
+ padding-inline-end: 0;
111
+ }
112
+
113
+ pre {
114
+ background-color: var(--color-border-light);
115
+ border-radius: var(--rounded-lg);
116
+ font-family: var(--font-monospace-code);
117
+ font-size: var(--text-sm);
118
+ line-height: var(--leading-5);
119
+ padding: var(--size-4);
120
+ }
121
+
122
+ ul {
123
+ list-style-type: disc;
124
+ margin-inline-start: var(--size-6);
125
+ }
126
+
127
+ ol {
128
+ list-style-type: decimal;
129
+ margin-inline-start: var(--size-6);
130
+ }
131
+
132
+ li {
133
+ margin: 0;
134
+ }
135
+
136
+ img {
137
+ display: inline;
138
+ }
139
+
140
+ action-text-attachment {
141
+ display: contents;
142
+ }
143
+
144
+ .attachment:not(.attachment--file) {
145
+ .attachment__caption { display: none; }
146
+ }
147
+
148
+ .attachment--file {
149
+ color: var(--color--text);
150
+ border: 1px solid var(--color-border);
151
+ }
152
+
153
+ .attachment__progress {
154
+ background-color: var(--color-border-light);
155
+ border-radius: var(--rounded-full);
156
+ overflow: hidden;
157
+
158
+ &::-webkit-progress-bar {
159
+ background-color: var(--color-border-light);
160
+ }
161
+
162
+ &::-webkit-progress-value {
163
+ background-color: var(--color-primary);
164
+ }
165
+
166
+ &::-moz-progress-bar {
167
+ background-color: var(--color-primary);
168
+ }
169
+ }
170
+ }
@@ -0,0 +1,64 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+ import { FetchRequest } from "@rails/request.js"
3
+
4
+ const AUTOSAVE_INTERVAL = 3000
5
+
6
+ export default class extends Controller {
7
+ static targets = [ "submitter" ]
8
+
9
+ #timer
10
+
11
+ disconnect() {
12
+ this.#submit()
13
+ }
14
+
15
+ change() {
16
+ !this.#dirty && this.#scheduleSave()
17
+ !this.#dirty && this.#updateAppearance()
18
+ }
19
+
20
+ async #submit() {
21
+ this.#dirty && await this.#save()
22
+ }
23
+
24
+ async #save() {
25
+ this.#updateAppearance(true)
26
+ this.#resetTimer()
27
+ await submitForm(this.element)
28
+ this.#updateAppearance()
29
+ }
30
+
31
+ #updateAppearance(saving = false) {
32
+ if (saving) {
33
+ this.element.setAttribute("aria-busy", true)
34
+ this.submitterTarget.setAttribute("aria-disabled", true)
35
+ this.submitterTarget.disabled = true
36
+ } else {
37
+ this.element.removeAttribute("aria-busy")
38
+ this.submitterTarget.removeAttribute("aria-disabled")
39
+ this.submitterTarget.disabled = false
40
+ }
41
+ }
42
+
43
+ #scheduleSave() {
44
+ this.#timer = setTimeout(() => this.#save(), AUTOSAVE_INTERVAL)
45
+ }
46
+
47
+ #resetTimer() {
48
+ clearTimeout(this.#timer); this.#timer = null
49
+ }
50
+
51
+ get #dirty() {
52
+ return !!this.#timer
53
+ }
54
+ }
55
+
56
+ // Helpers
57
+
58
+ async function submitForm(form) {
59
+ const request = new FetchRequest(form.method, form.action, {
60
+ body: new FormData(form)
61
+ })
62
+
63
+ return await request.perform()
64
+ }
@@ -0,0 +1,48 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+ import { get } from "@rails/request.js"
3
+ import TomSelect from "tom-select"
4
+
5
+ export default class extends Controller {
6
+ static values = { url: String, optionCreate: { type: String, default: "Add" }, noResults: { type: String, default: "No results found" } }
7
+
8
+ initialize() {
9
+ this.load = this.load.bind(this)
10
+ }
11
+
12
+ connect() {
13
+ if (this.element.nodeName === "INPUT") {
14
+ this.tomSelect = new TomSelect(this.element, this.#inputSettings)
15
+ } else {
16
+ this.tomSelect = new TomSelect(this.element, this.#selectSettings)
17
+ }
18
+ }
19
+
20
+ disconnect() {
21
+ this.tomSelect.destroy()
22
+ }
23
+
24
+ async load(query, callback) {
25
+ const response = await get(this.urlValue, { responseKind: "json", query: { q: query } })
26
+ const jsonResponse = await response.json
27
+ callback(jsonResponse)
28
+ }
29
+
30
+ get #inputSettings() {
31
+ return { render: this.#render, load: this.hasUrlValue && this.load, persist: false, createOnBlur: true, create: true }
32
+ }
33
+
34
+ get #selectSettings() {
35
+ return { render: this.#render, load: this.hasUrlValue && this.load }
36
+ }
37
+
38
+ get #render() {
39
+ return {
40
+ option_create: (data, escape) => {
41
+ return `<div class="create">${this.optionCreateValue} <b>${escape(data.input)}</b>...</div>`
42
+ },
43
+ no_results: () => {
44
+ return `<div class="no-results">${this.noResultsValue}</div>`
45
+ }
46
+ }
47
+ }
48
+ }
@@ -1,5 +1,4 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { debounce } from "helpers/timing_helpers"
3
2
 
4
3
  export default class extends Controller {
5
4
  static targets = [ "input", "copyIcon", "successIcon" ]
@@ -36,3 +35,14 @@ export default class extends Controller {
36
35
  this.successIconTarget.hidden = !this.copiedValue
37
36
  }
38
37
  }
38
+
39
+ // Helpers
40
+
41
+ function debounce(fn, delay = 1000) {
42
+ let timeoutId = null
43
+
44
+ return (...args) => {
45
+ clearTimeout(timeoutId)
46
+ timeoutId = setTimeout(() => fn.apply(this, args), delay)
47
+ }
48
+ }
@@ -1,5 +1,4 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { debounce } from "helpers/timing_helpers"
3
2
 
4
3
  export default class extends Controller {
5
4
  static targets = [ "list" ]
@@ -42,3 +41,14 @@ export default class extends Controller {
42
41
  this.dispatch("after")
43
42
  }
44
43
  }
44
+
45
+ // Helpers
46
+
47
+ function debounce(fn, delay = 1000) {
48
+ let timeoutId = null
49
+
50
+ return (...args) => {
51
+ clearTimeout(timeoutId)
52
+ timeoutId = setTimeout(() => fn.apply(this, args), delay)
53
+ }
54
+ }
@@ -0,0 +1,46 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+ import Inputmask from "inputmask"
3
+
4
+ export default class extends Controller {
5
+ static values = {
6
+ mask: String,
7
+ alias: String,
8
+ groupSeparator: { type: String, default: "" },
9
+ radixPoint: { type: String, default: "." },
10
+ digits: { type: String, default: "*" },
11
+ digitsOptional: { type: Boolean, default: true },
12
+ inputFormat: { type: String, default: "mm/dd/yyyy HH:MM" },
13
+ outputFormat: { type: String, default: "yyyy-mm-dd HH:MM" }
14
+ }
15
+
16
+ connect() {
17
+ if (this.hasMaskValue) {
18
+ Inputmask.default({ mask: this.maskValue }).mask(this.element)
19
+ } else if (this.aliasValue == "numeric") {
20
+ Inputmask.default(this.#numericOptions).mask(this.element)
21
+ } else if (this.aliasValue == "datetime") {
22
+ Inputmask.default(this.#datetimeOptions).mask(this.element)
23
+ }
24
+ }
25
+
26
+ get #numericOptions() {
27
+ return {
28
+ alias: "numeric",
29
+ unmaskAsNumber: true,
30
+ removeMaskOnSubmit: true,
31
+ groupSeparator: this.groupSeparatorValue,
32
+ radixPoint: this.radixPointValue,
33
+ digits: this.digitsValue,
34
+ digitsOptional: this.digitsOptionalValue
35
+ }
36
+ }
37
+
38
+ get #datetimeOptions() {
39
+ return {
40
+ alias: "datetime",
41
+ removeMaskOnSubmit: true,
42
+ inputFormat: this.inputFormatValue,
43
+ outputFormat: this.outputFormatValue
44
+ }
45
+ }
46
+ }
@@ -1,12 +1,17 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
- static targets = [ "list", "option" ]
4
+ static targets = [ "option" ]
5
5
  static values = { index: Number }
6
6
 
7
7
  connect() {
8
8
  this.#removeTabstops()
9
- this.#selectFirstItem()
9
+ this.#selectFirstOption()
10
+ }
11
+
12
+ reset() {
13
+ this.indexValue = 0
14
+ this.#selectCurrentOption()
10
15
  }
11
16
 
12
17
  navigate(event) {
@@ -26,22 +31,17 @@ export default class extends Controller {
26
31
  }
27
32
  }
28
33
 
29
- reset() {
30
- this.indexValue = 0
31
- this.#selectCurrentItem()
32
- }
33
-
34
34
  #prev() {
35
35
  if (this.indexValue > 0) {
36
36
  this.indexValue--
37
- this.#selectCurrentItem()
37
+ this.#selectCurrentOption()
38
38
  }
39
39
  }
40
40
 
41
41
  #next() {
42
42
  if (this.indexValue < this.#lastIndex) {
43
43
  this.indexValue++
44
- this.#selectCurrentItem()
44
+ this.#selectCurrentOption()
45
45
  }
46
46
  }
47
47
 
@@ -53,13 +53,13 @@ export default class extends Controller {
53
53
  this.optionTargets.forEach(e => e.tabIndex = -1)
54
54
  }
55
55
 
56
- #selectFirstItem() {
56
+ #selectFirstOption() {
57
57
  this.optionTargets.forEach((element, index) => {
58
58
  element.ariaSelected = index === 0
59
59
  })
60
60
  }
61
61
 
62
- #selectCurrentItem() {
62
+ #selectCurrentOption() {
63
63
  this.optionTargets.forEach((element, index) => {
64
64
  element.ariaSelected = false
65
65
  })
@@ -69,11 +69,11 @@ export default class extends Controller {
69
69
  })
70
70
  }
71
71
 
72
- get #lastIndex() {
73
- return this.#visibleOptions.length -1
74
- }
75
-
76
72
  get #visibleOptions() {
77
73
  return this.optionTargets.filter(e => e.offsetParent != null)
78
74
  }
75
+
76
+ get #lastIndex() {
77
+ return this.#visibleOptions.length -1
78
+ }
79
79
  }
@@ -8,6 +8,11 @@ export default class extends Controller {
8
8
  this.#updateTabstops()
9
9
  }
10
10
 
11
+ reset() {
12
+ this.indexValue = 0
13
+ this.#updateTabstops()
14
+ }
15
+
11
16
  prev() {
12
17
  if (this.indexValue > 0) {
13
18
  this.indexValue--
@@ -24,11 +29,6 @@ export default class extends Controller {
24
29
  }
25
30
  }
26
31
 
27
- reset() {
28
- this.indexValue = 0
29
- this.#updateTabstops()
30
- }
31
-
32
32
  #updateTabstops() {
33
33
  this.itemTargets.forEach((element, index) => {
34
34
  element.tabIndex = index === this.indexValue ? 0 : -1
@@ -6,28 +6,4 @@ 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
- def copy_javascript_initializers
20
- copy_file "app/javascript/initializers/index.js"
21
- end
22
-
23
- def pin_javascript_initializers
24
- return unless install_with_importmap?
25
- append_to_file "config/importmap.rb", %(pin_all_from "app/javascript/initializers", under: "initializers"\n)
26
- append_to_file "app/javascript/application.js", %(import "initializers"\n)
27
- end
28
-
29
- private
30
- def install_with_importmap?
31
- Rails.root.join("config/importmap.rb").exist?
32
- end
33
9
  end
@@ -47,8 +47,8 @@
47
47
  --color-filter-text: invert(100%);
48
48
  --color-filter-text-reversed: invert(2%) sepia(3%) saturate(3904%) hue-rotate(201deg) brightness(98%) contrast(97%);
49
49
  --color-filter-text-subtle: invert(76%) sepia(8%) saturate(230%) hue-rotate(201deg) brightness(84%) contrast(87%);
50
- --color-filter-negative: invert(16%) sepia(62%) saturate(2100%) hue-rotate(337deg) brightness(92%) contrast(100%);
51
- --color-filter-positive: invert(21%) sepia(62%) saturate(549%) hue-rotate(91deg) brightness(101%) contrast(91%);
50
+ --color-filter-negative: invert(54%) sepia(16%) saturate(2119%) hue-rotate(313deg) brightness(111%) contrast(94%);
51
+ --color-filter-positive: invert(81%) sepia(23%) saturate(1237%) hue-rotate(80deg) brightness(95%) contrast(83%);
52
52
  }
53
53
  }
54
54
 
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.50
4
+ version: 0.0.52
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-10-18 00:00:00.000000000 Z
11
+ date: 2024-10-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lazaronixon@hotmail.com
@@ -80,11 +80,16 @@ files:
80
80
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/table.css
81
81
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/tabs.css
82
82
  - lib/generators/css_zero/add/templates/app/assets/stylesheets/toggle.css
83
+ - lib/generators/css_zero/add/templates/app/assets/stylesheets/tom-select.css
84
+ - lib/generators/css_zero/add/templates/app/assets/stylesheets/zcombobox.css
85
+ - lib/generators/css_zero/add/templates/app/assets/stylesheets/ztrix.css
86
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/autosave_controller.js
83
87
  - lib/generators/css_zero/add/templates/app/javascript/controllers/autoselect_controller.js
84
88
  - lib/generators/css_zero/add/templates/app/javascript/controllers/carousel_controller.js
85
89
  - lib/generators/css_zero/add/templates/app/javascript/controllers/check_all_controller.js
86
90
  - lib/generators/css_zero/add/templates/app/javascript/controllers/clearable_input_controller.js
87
91
  - lib/generators/css_zero/add/templates/app/javascript/controllers/collapsible_controller.js
92
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js
88
93
  - lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js
89
94
  - lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js
90
95
  - lib/generators/css_zero/add/templates/app/javascript/controllers/element_removal_controller.js
@@ -92,6 +97,7 @@ files:
92
97
  - lib/generators/css_zero/add/templates/app/javascript/controllers/form_controller.js
93
98
  - lib/generators/css_zero/add/templates/app/javascript/controllers/fullscreen_controller.js
94
99
  - lib/generators/css_zero/add/templates/app/javascript/controllers/hotkey_controller.js
100
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/inputmask_controller.js
95
101
  - lib/generators/css_zero/add/templates/app/javascript/controllers/lightbox_controller.js
96
102
  - lib/generators/css_zero/add/templates/app/javascript/controllers/list_controller.js
97
103
  - lib/generators/css_zero/add/templates/app/javascript/controllers/local_time_controller.js
@@ -104,9 +110,6 @@ files:
104
110
  - lib/generators/css_zero/install/USAGE
105
111
  - lib/generators/css_zero/install/install_generator.rb
106
112
  - lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css
107
- - lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js
108
- - lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js
109
- - lib/generators/css_zero/install/templates/app/javascript/initializers/index.js
110
113
  homepage: https://github.com/lazaronixon/css-zero
111
114
  licenses:
112
115
  - MIT
@@ -1,18 +0,0 @@
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
- }
@@ -1,39 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- // import "initializers/current"
2
- // import "initializers/time_zone_cookie"