css-zero 1.1.15 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/app/assets/stylesheets/css-zero/reset.css +30 -14
- data/app/assets/stylesheets/css-zero/transitions.css +8 -0
- data/app/assets/stylesheets/css-zero/utilities.css +9 -15
- data/app/assets/stylesheets/css-zero/variables.css +1 -1
- data/lib/css_zero/version.rb +1 -1
- data/lib/generators/css_zero/add/USAGE +1 -1
- data/lib/generators/css_zero/add/add_generator.rb +7 -1
- data/lib/generators/css_zero/add/resources.yml +54 -34
- data/lib/generators/css_zero/add/templates/app/assets/images/avatar.svg +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/camera.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/chevron-down-zinc-500.svg +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/chevron-down.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/chevron-left.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/chevron-right.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/chevrons-up-down.svg +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/copy.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/download.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/ellipsis.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/eye-off.svg +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/eye.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/grip-horizontal-zink-500.svg +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/grip-vertical-zink-500.svg +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/loading.svg +4 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/menu.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/minus.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/moon.svg +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/search.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/share.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/sun.svg +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/x.svg +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/accordion.css +4 -8
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/alert.css +8 -11
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/avatar.css +1 -3
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/badge.css +11 -2
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/breadcrumb.css +1 -9
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css +12 -19
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/card.css +4 -4
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/carousel.css +5 -5
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/color_scheme.css +33 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/combobox.css +3 -3
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/command.css +2 -4
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/datepicker.css +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/dialog.css +2 -6
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/dropzone.css +14 -13
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/flash.css +3 -4
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/group.css +33 -6
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/icons.css +41 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input-clearable.css +7 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input-copyable.css +4 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input-revealable.css +7 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input.css +24 -30
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/menu.css +2 -4
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/progress.css +2 -2
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/prose.css +1 -5
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/range.css +27 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/resizable.css +22 -7
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/sheet.css +2 -2
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/sidebar_menu.css +6 -8
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/skeleton.css +1 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/table.css +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/tabs.css +1 -1
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/toggle.css +8 -10
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/trix.css +24 -3
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/autosave_controller.js +4 -4
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/back_navigation_controller.js +13 -0
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/chart_controller.js +10 -14
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/color_scheme_controller.js +26 -0
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js +1 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/context_menu_controller.js +5 -5
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/datepicker_controller.js +0 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js +4 -4
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/dropzone_controller.js +1 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/dual_range_controller.js +15 -0
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/form_controller.js +10 -5
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/{copyable_input_controller.js → input_copyable_controller.js} +4 -4
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/{revealable_input_controller.js → input_revealable_controller.js} +2 -2
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/inputmask_controller.js +1 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js +42 -7
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/popover_controller.js +13 -13
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/resizable_controller.js +31 -0
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/sortable_controller.js +1 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/timezone_cookie_controller.js +11 -0
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/turbo_confirm_controller.js +1 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/{otp_input_controller.js → web_otp_controller.js} +5 -7
- data/lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css +16 -51
- metadata +26 -15
- data/lib/generators/css_zero/add/templates/app/assets/images/arrow-left.svg +0 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/arrow-right.svg +0 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/circle-alert.svg +0 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/default-picture.webp +0 -0
- data/lib/generators/css_zero/add/templates/app/assets/images/loader-circle.svg +0 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/off.svg +0 -1
- data/lib/generators/css_zero/add/templates/app/assets/images/select-arrow.svg +0 -1
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input_concerns.css +0 -19
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/navigation_controller.js +0 -16
- /data/lib/generators/css_zero/add/templates/app/javascript/controllers/{clearable_input_controller.js → input_clearable_controller.js} +0 -0
@@ -1,10 +1,10 @@
|
|
1
1
|
.progress {
|
2
|
-
--track: var(--color-
|
2
|
+
--track: rgb(from var(--color-primary) r g b / .2);
|
3
3
|
--progress: var(--color-primary);
|
4
4
|
|
5
5
|
background-color: var(--track);
|
6
6
|
border-radius: var(--rounded-full);
|
7
|
-
block-size: var(--size-
|
7
|
+
block-size: var(--size-2);
|
8
8
|
inline-size: var(--size-full);
|
9
9
|
overflow: hidden;
|
10
10
|
|
@@ -1,11 +1,7 @@
|
|
1
|
-
.prose {
|
1
|
+
:where(.prose) {
|
2
2
|
font-size: var(--text-fluid-base);
|
3
3
|
max-inline-size: 65ch;
|
4
4
|
|
5
|
-
/* Antialiased fonts */
|
6
|
-
-moz-osx-font-smoothing: grayscale;
|
7
|
-
-webkit-font-smoothing: antialiased;
|
8
|
-
|
9
5
|
:is(h1, h2, h3, h4, h5, h6) {
|
10
6
|
font-weight: var(--font-extrabold);
|
11
7
|
hyphens: auto;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
@import url("https://esm.sh/@stanko/dual-range-input@1.0.0/dist/index.css");
|
2
|
+
|
3
|
+
.dual-range-input {
|
4
|
+
--dri-height: 1rem;
|
5
|
+
--dri-thumb-width: var(--dri-height);
|
6
|
+
--dri-thumb-height: var(--dri-height);
|
7
|
+
--dri-thumb-color: var(--color-primary);
|
8
|
+
--dri-thumb-hover-color: var(--dri-thumb-color);
|
9
|
+
--dri-thumb-active-color: var(--color-selected-dark);
|
10
|
+
--dri-thumb-border-color: var(--dri-thumb-color);
|
11
|
+
--dri-thumb-border-hover-color: var(--dri-thumb-border-color);
|
12
|
+
--dri-thumb-border-active-color: var(--dri-thumb-border-color);
|
13
|
+
--dri-thumb-border-radius: 1rem;
|
14
|
+
--dri-thumb-border-width: 1px;
|
15
|
+
--dri-track-height: calc(var(--dri-height) * .45);
|
16
|
+
--dri-track-border-radius: 1rem;
|
17
|
+
--dri-track-color: var(--color-border);
|
18
|
+
--dri-track-filled-color: var(--color-primary);
|
19
|
+
}
|
20
|
+
|
21
|
+
.range {
|
22
|
+
accent-color: var(--color-primary);
|
23
|
+
}
|
24
|
+
|
25
|
+
.range:focus-visible {
|
26
|
+
outline: var(--input-outline-size, 2px) solid var(--color-selected-dark);
|
27
|
+
}
|
@@ -1,12 +1,27 @@
|
|
1
|
-
.resizable-
|
2
|
-
|
1
|
+
.resizable-horizontal {
|
2
|
+
display: flex;
|
3
|
+
flex-direction: row;
|
3
4
|
}
|
4
5
|
|
5
|
-
.resizable-
|
6
|
-
|
6
|
+
.resizable-vertical {
|
7
|
+
display: flex;
|
8
|
+
flex-direction: column;
|
7
9
|
}
|
8
10
|
|
9
|
-
|
10
|
-
background-
|
11
|
-
|
11
|
+
.gutter {
|
12
|
+
background-position: center;
|
13
|
+
background-repeat: no-repeat;
|
14
|
+
background-size: contain;
|
15
|
+
}
|
16
|
+
|
17
|
+
.gutter-horizontal {
|
18
|
+
background-image: url("grip-vertical-zink-500.svg");
|
19
|
+
border-inline-width: var(--border);
|
20
|
+
cursor: col-resize;
|
21
|
+
}
|
22
|
+
|
23
|
+
.gutter-vertical {
|
24
|
+
background-image: url("grip-horizontal-zink-500.svg");
|
25
|
+
border-block-width: var(--border);
|
26
|
+
cursor: row-resize;
|
12
27
|
}
|
@@ -9,10 +9,10 @@
|
|
9
9
|
max-block-size: unset;
|
10
10
|
|
11
11
|
&::backdrop {
|
12
|
-
background-color: rgba(0, 0, 0, .
|
12
|
+
background-color: rgba(0, 0, 0, .5);
|
13
13
|
}
|
14
14
|
|
15
|
-
/* Setup
|
15
|
+
/* Setup transition */
|
16
16
|
transition-behavior: allow-discrete;
|
17
17
|
transition-duration: var(--time-300);
|
18
18
|
transition-property: display, overlay, transform;
|
@@ -10,30 +10,28 @@
|
|
10
10
|
--btn-border-color: transparent;
|
11
11
|
--btn-box-shadow: none;
|
12
12
|
--btn-font-weight: var(--font-normal);
|
13
|
-
--btn-hover-color: var(--color-secondary);
|
14
13
|
--btn-justify-content: start;
|
15
14
|
--btn-outline-size: 0;
|
16
15
|
--btn-inline-size: var(--size-full);
|
17
16
|
--btn-padding: var(--size-1) var(--size-2);
|
18
|
-
--btn-text-align: start;
|
19
17
|
|
20
|
-
&[aria-current=page] {
|
21
|
-
--btn-background: var(--color-
|
18
|
+
&[aria-current="page"] {
|
19
|
+
--btn-background: var(--color-border-light);
|
22
20
|
}
|
23
21
|
|
24
22
|
&:focus-visible {
|
25
|
-
--btn-background: var(--color-
|
23
|
+
--btn-background: var(--color-border-light);
|
26
24
|
}
|
27
25
|
|
28
26
|
&:is(summary) {
|
29
27
|
&::after {
|
30
|
-
background-
|
31
|
-
background-size: cover;
|
28
|
+
background-color: currentColor;
|
32
29
|
block-size: var(--size-4);
|
33
30
|
content: "";
|
34
|
-
filter: var(--color-filter-text);
|
35
31
|
inline-size: var(--size-4);
|
36
32
|
margin-inline-start: auto;
|
33
|
+
mask-image: url("chevron-right.svg");
|
34
|
+
mask-size: cover;
|
37
35
|
min-inline-size: var(--size-4);
|
38
36
|
transition: transform var(--time-200);
|
39
37
|
}
|
@@ -21,7 +21,7 @@
|
|
21
21
|
--btn-hover-color: transparent;
|
22
22
|
--btn-inline-size: var(--size-full);
|
23
23
|
|
24
|
-
&:is([aria-selected=true], [aria-current=page]) {
|
24
|
+
&:is([aria-selected="true"], [aria-current="page"]) {
|
25
25
|
--btn-background: var(--color-bg);
|
26
26
|
--btn-box-shadow: var(--shadow-sm);
|
27
27
|
--btn-hover-color: var(--color-bg);
|
@@ -1,13 +1,11 @@
|
|
1
|
-
.btn--toggle {
|
2
|
-
|
3
|
-
|
4
|
-
}
|
1
|
+
.btn--toggle [type="checkbox"] {
|
2
|
+
position: absolute; clip: rect(0, 0, 0, 0);
|
3
|
+
}
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
.btn--toggle:has(:checked) {
|
6
|
+
--btn-background: var(--color-border-light);
|
7
|
+
}
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
}
|
9
|
+
.btn--toggle:has(:focus-visible) {
|
10
|
+
outline: var(--border-2) solid var(--color-selected-dark);
|
13
11
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
@import url("https://esm.sh/trix@2.1.
|
1
|
+
@import url("https://esm.sh/trix@2.1.15/dist/trix.css");
|
2
2
|
|
3
3
|
/* Action Text */
|
4
4
|
|
@@ -48,17 +48,28 @@ trix-toolbar {
|
|
48
48
|
color: var(--color-text);
|
49
49
|
|
50
50
|
&.trix-active {
|
51
|
-
background-color: var(--color-
|
51
|
+
background-color: var(--color-border-light);
|
52
52
|
}
|
53
53
|
|
54
54
|
&.trix-button--icon::before {
|
55
|
-
filter: var(--color-filter-text);
|
56
55
|
opacity: 1;
|
57
56
|
}
|
58
57
|
|
59
58
|
&.trix-button--icon:disabled::before {
|
60
59
|
opacity: 0.125;
|
61
60
|
}
|
61
|
+
|
62
|
+
[data-color-scheme="light"] & {
|
63
|
+
&.trix-button--icon::before { filter: invert(0); }
|
64
|
+
}
|
65
|
+
|
66
|
+
[data-color-scheme="dark"] & {
|
67
|
+
&.trix-button--icon::before { filter: invert(1); }
|
68
|
+
}
|
69
|
+
|
70
|
+
@media (prefers-color-scheme: dark) {
|
71
|
+
&.trix-button--icon::before { filter: invert(1); }
|
72
|
+
}
|
62
73
|
}
|
63
74
|
|
64
75
|
.trix-dialog {
|
@@ -195,3 +206,13 @@ trix-editor {
|
|
195
206
|
}
|
196
207
|
}
|
197
208
|
}
|
209
|
+
|
210
|
+
.trix--minimal {
|
211
|
+
.trix-button-group--file-tools {
|
212
|
+
display: none;
|
213
|
+
}
|
214
|
+
|
215
|
+
.trix-button-group--history-tools {
|
216
|
+
display: none;
|
217
|
+
}
|
218
|
+
}
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/autosave_controller.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
-
import { FetchRequest } from "https://esm.sh/@rails/request.js@0.0.
|
2
|
+
import { FetchRequest } from "https://esm.sh/@rails/request.js@0.0.12?standalone"
|
3
3
|
|
4
4
|
const AUTOSAVE_INTERVAL = 3000
|
5
5
|
|
@@ -29,8 +29,7 @@ export default class extends Controller {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
async #submitForm(form) {
|
32
|
-
|
33
|
-
return await request.perform()
|
32
|
+
return await new FetchRequest(form.method, form.action, { body: new FormData(form) }).perform()
|
34
33
|
}
|
35
34
|
|
36
35
|
#updateAppearance(saving) {
|
@@ -44,7 +43,8 @@ export default class extends Controller {
|
|
44
43
|
}
|
45
44
|
|
46
45
|
#resetTimer() {
|
47
|
-
clearTimeout(this.#timer)
|
46
|
+
clearTimeout(this.#timer)
|
47
|
+
this.#timer = null
|
48
48
|
}
|
49
49
|
|
50
50
|
get #dirty() {
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/back_navigation_controller.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
static values = { fallbackDestination: String }
|
5
|
+
|
6
|
+
connect() {
|
7
|
+
if (history.state.turbo?.restorationIndex > 0) {
|
8
|
+
this.element.href = "javascript:history.back()"
|
9
|
+
} else {
|
10
|
+
this.element.href = this.fallbackDestinationValue
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
@@ -1,22 +1,18 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
-
import { Chart, registerables } from "https://esm.sh/chart.js@4.
|
3
|
-
|
4
|
-
Chart.register(...registerables)
|
5
|
-
|
6
|
-
Chart.defaults.backgroundColor = getCssVariableValue("--color-primary")
|
7
|
-
Chart.defaults.borderColor = getCssVariableValue("--color-border")
|
8
|
-
Chart.defaults.color = getCssVariableValue("--color-text")
|
9
|
-
|
10
|
-
Chart.defaults.font.family = getCssVariableValue("--font-system-ui")
|
11
|
-
Chart.defaults.font.size = 12
|
12
|
-
|
13
|
-
function getCssVariableValue(variableName) {
|
14
|
-
return getComputedStyle(document.documentElement).getPropertyValue(variableName).trim()
|
15
|
-
}
|
2
|
+
import { Chart, registerables } from "https://esm.sh/chart.js@4.5.0?standalone"
|
16
3
|
|
17
4
|
export default class extends Controller {
|
18
5
|
static values = { type: { type: String, default: "line" }, data: Object, options: Object }
|
19
6
|
|
7
|
+
initialize() {
|
8
|
+
Chart.register(...registerables)
|
9
|
+
Chart.defaults.backgroundColor = getComputedStyle(document.body).backgroundColor
|
10
|
+
Chart.defaults.borderColor = getComputedStyle(document.body).borderColor
|
11
|
+
Chart.defaults.color = getComputedStyle(document.body).color
|
12
|
+
Chart.defaults.font.family = getComputedStyle(document.body).fontFamily
|
13
|
+
Chart.defaults.font.size = 12
|
14
|
+
}
|
15
|
+
|
20
16
|
connect() {
|
21
17
|
this.chart = new Chart(this.element, this.#settings)
|
22
18
|
}
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/color_scheme_controller.js
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
connect() {
|
5
|
+
this.element.dataset.colorScheme = this.#colorScheme
|
6
|
+
}
|
7
|
+
|
8
|
+
setLight() {
|
9
|
+
this.element.dataset.colorScheme = "light"
|
10
|
+
localStorage.setItem("color_scheme", "light")
|
11
|
+
}
|
12
|
+
|
13
|
+
setDark() {
|
14
|
+
this.element.dataset.colorScheme = "dark"
|
15
|
+
localStorage.setItem("color_scheme", "dark")
|
16
|
+
}
|
17
|
+
|
18
|
+
setSystem() {
|
19
|
+
this.element.dataset.colorScheme = "system"
|
20
|
+
localStorage.setItem("color_scheme", "system")
|
21
|
+
}
|
22
|
+
|
23
|
+
get #colorScheme() {
|
24
|
+
return localStorage.getItem("color_scheme") || "system"
|
25
|
+
}
|
26
|
+
}
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
-
import { get } from "https://esm.sh/@rails/request.js@0.0.
|
2
|
+
import { get } from "https://esm.sh/@rails/request.js@0.0.12?standalone"
|
3
3
|
import TomSelect from "https://esm.sh/tom-select@2.4.3/base?standalone"
|
4
4
|
|
5
5
|
export default class extends Controller {
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/context_menu_controller.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
|
-
static targets = [ "
|
4
|
+
static targets = [ "content" ]
|
5
5
|
|
6
6
|
show({ clientX, clientY }) {
|
7
|
-
this.
|
8
|
-
this.
|
9
|
-
this.
|
7
|
+
this.contentTarget.style.insetInlineStart = `${clientX}px`
|
8
|
+
this.contentTarget.style.insetBlockStart = `${clientY}px`
|
9
|
+
this.contentTarget.showPopover()
|
10
10
|
}
|
11
11
|
|
12
12
|
hide({ target }) {
|
13
|
-
!this.
|
13
|
+
!this.contentTarget.contains(target) && this.contentTarget.hidePopover()
|
14
14
|
}
|
15
15
|
}
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/datepicker_controller.js
CHANGED
@@ -2,7 +2,6 @@ import { Controller } from "@hotwired/stimulus"
|
|
2
2
|
import flatpickr from "https://esm.sh/flatpickr@4.6.13?standalone"
|
3
3
|
|
4
4
|
export default class extends Controller {
|
5
|
-
static targets = [ "details" ]
|
6
5
|
static values = {
|
7
6
|
type: String, disable: Array,
|
8
7
|
mode: { type: String, default: "single" },
|
@@ -1,18 +1,18 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
|
-
static targets = [ "
|
4
|
+
static targets = [ "content" ]
|
5
5
|
|
6
6
|
show() {
|
7
|
-
this.
|
7
|
+
this.contentTarget.show()
|
8
8
|
}
|
9
9
|
|
10
10
|
showModal() {
|
11
|
-
this.
|
11
|
+
this.contentTarget.showModal()
|
12
12
|
}
|
13
13
|
|
14
14
|
close() {
|
15
|
-
this.
|
15
|
+
this.contentTarget.close()
|
16
16
|
}
|
17
17
|
|
18
18
|
closeOnClickOutside({ target }) {
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/dropzone_controller.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
-
import { DirectUpload } from "https://esm.sh/@rails/activestorage@8.0.
|
2
|
+
import { DirectUpload } from "https://esm.sh/@rails/activestorage@8.0.200?standalone"
|
3
3
|
import Dropzone from "https://esm.sh/dropzone@6.0.0-beta.2?standalone"
|
4
4
|
|
5
5
|
export default class extends Controller {
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/dual_range_controller.js
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
import DualRangeInput from "https://esm.sh/@stanko/dual-range-input@1.0.0?standalone"
|
3
|
+
|
4
|
+
export default class extends Controller {
|
5
|
+
static targets = [ "min", "max" ]
|
6
|
+
static values = { precision: Number, default: 3 }
|
7
|
+
|
8
|
+
connect() {
|
9
|
+
this.dualRangeInput = new DualRangeInput(this.minTarget, this.maxTarget, this.precisionValue)
|
10
|
+
}
|
11
|
+
|
12
|
+
disconnect() {
|
13
|
+
this.dualRangeInput.destroy()
|
14
|
+
}
|
15
|
+
}
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
+
import debounce from "https://esm.sh/just-debounce-it@3.2.0?standalone"
|
2
3
|
|
3
4
|
export default class extends Controller {
|
4
5
|
static targets = [ "cancel" ]
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
initialize() {
|
8
|
+
this.debouncedSubmit = debounce(this.submit.bind(this), 300)
|
9
|
+
}
|
10
|
+
|
11
|
+
submit({ params: { submitter } }) {
|
12
|
+
if (submitter) {
|
13
|
+
this.element.requestSubmit(this.#find(submitter))
|
9
14
|
} else {
|
10
15
|
this.element.requestSubmit()
|
11
16
|
}
|
@@ -19,11 +24,11 @@ export default class extends Controller {
|
|
19
24
|
event.preventDefault()
|
20
25
|
}
|
21
26
|
|
22
|
-
#
|
27
|
+
#find(id) {
|
23
28
|
return document.getElementById(id) || this.#notFound(id)
|
24
29
|
}
|
25
30
|
|
26
31
|
#notFound(id) {
|
27
|
-
throw new Error(`
|
32
|
+
throw new Error(`Submitter with ID "${id}" not found`)
|
28
33
|
}
|
29
34
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
|
-
static targets = [ "input"
|
4
|
+
static targets = [ "input" ]
|
5
5
|
|
6
6
|
async copy() {
|
7
7
|
this.#reset()
|
@@ -11,16 +11,16 @@ export default class extends Controller {
|
|
11
11
|
async #writeToClipboard() {
|
12
12
|
try {
|
13
13
|
await navigator.clipboard.writeText(this.inputTarget.value)
|
14
|
-
this.
|
14
|
+
this.element.classList.add("input--copied")
|
15
15
|
} catch {}
|
16
16
|
}
|
17
17
|
|
18
18
|
#reset() {
|
19
|
-
this.
|
19
|
+
this.element.classList.remove("input--copied")
|
20
20
|
this.#forceReflow()
|
21
21
|
}
|
22
22
|
|
23
23
|
#forceReflow() {
|
24
|
-
this.
|
24
|
+
this.element.offsetWidth
|
25
25
|
}
|
26
26
|
}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
|
-
static targets = [ "input"
|
4
|
+
static targets = [ "input" ]
|
5
5
|
|
6
6
|
reveal() {
|
7
|
-
this.
|
7
|
+
this.element.classList.toggle("input--revealed")
|
8
8
|
this.inputTarget.type = this.#type
|
9
9
|
}
|
10
10
|
|
@@ -18,25 +18,60 @@ export default class extends Controller {
|
|
18
18
|
this.#observer.disconnect()
|
19
19
|
}
|
20
20
|
|
21
|
-
|
21
|
+
navigate(event) {
|
22
|
+
switch (event.key) {
|
23
|
+
case "ArrowUp":
|
24
|
+
this.#cancel(event)
|
25
|
+
this.#prev()
|
26
|
+
break
|
27
|
+
case "ArrowDown":
|
28
|
+
this.#cancel(event)
|
29
|
+
this.#next()
|
30
|
+
break
|
31
|
+
case "PageUp":
|
32
|
+
case "Home":
|
33
|
+
this.#cancel(event)
|
34
|
+
this.#first()
|
35
|
+
break
|
36
|
+
case "PageDown":
|
37
|
+
case "End":
|
38
|
+
this.#cancel(event)
|
39
|
+
this.#last()
|
40
|
+
break
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
#cancel(event) {
|
45
|
+
event.stopPropagation()
|
46
|
+
event.preventDefault()
|
47
|
+
}
|
48
|
+
|
49
|
+
#reset([ entry ]) {
|
50
|
+
entry.isIntersecting && this.#first()
|
51
|
+
}
|
52
|
+
|
53
|
+
#prev() {
|
22
54
|
if (this.indexValue > 0) {
|
23
55
|
this.indexValue--
|
24
56
|
this.#update()
|
25
57
|
}
|
26
58
|
}
|
27
59
|
|
28
|
-
next() {
|
60
|
+
#next() {
|
29
61
|
if (this.indexValue < this.#lastIndex) {
|
30
62
|
this.indexValue++
|
31
63
|
this.#update()
|
32
64
|
}
|
33
65
|
}
|
34
66
|
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
67
|
+
#first() {
|
68
|
+
this.indexValue = 0
|
69
|
+
this.#update()
|
70
|
+
}
|
71
|
+
|
72
|
+
#last() {
|
73
|
+
this.indexValue = this.#lastIndex
|
74
|
+
this.#update()
|
40
75
|
}
|
41
76
|
|
42
77
|
#update() {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
-
import { computePosition, flip, shift, offset, autoUpdate } from "https://esm.sh/@floating-ui/dom@1.
|
2
|
+
import { computePosition, flip, shift, offset, autoUpdate } from "https://esm.sh/@floating-ui/dom@1.7.2?standalone"
|
3
3
|
|
4
4
|
export default class extends Controller {
|
5
|
-
static targets = [ "
|
5
|
+
static targets = [ "trigger", "content" ]
|
6
6
|
static values = { placement: { type: String, default: "bottom" } }
|
7
7
|
|
8
8
|
#showTimer = null
|
@@ -13,7 +13,7 @@ export default class extends Controller {
|
|
13
13
|
}
|
14
14
|
|
15
15
|
connect() {
|
16
|
-
this.cleanup = autoUpdate(this.
|
16
|
+
this.cleanup = autoUpdate(this.triggerTarget, this.contentTarget, this.orient)
|
17
17
|
}
|
18
18
|
|
19
19
|
disconnect() {
|
@@ -21,31 +21,31 @@ export default class extends Controller {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
show() {
|
24
|
-
this.
|
24
|
+
this.contentTarget.showPopover({ source: this.triggerTarget })
|
25
25
|
}
|
26
26
|
|
27
27
|
hide() {
|
28
|
-
this.
|
28
|
+
this.contentTarget.hidePopover()
|
29
29
|
}
|
30
30
|
|
31
31
|
toggle() {
|
32
|
-
this.
|
32
|
+
this.contentTarget.togglePopover({ source: this.triggerTarget })
|
33
33
|
}
|
34
34
|
|
35
|
-
|
35
|
+
debouncedShow() {
|
36
36
|
clearTimeout(this.#hideTimer)
|
37
|
-
this.#showTimer = setTimeout(() => this.show(),
|
37
|
+
this.#showTimer = setTimeout(() => this.show(), 150)
|
38
38
|
}
|
39
39
|
|
40
|
-
|
40
|
+
debouncedHide() {
|
41
41
|
clearTimeout(this.#showTimer)
|
42
|
-
this.#hideTimer = setTimeout(() => this.hide(),
|
42
|
+
this.#hideTimer = setTimeout(() => this.hide(), 150)
|
43
43
|
}
|
44
44
|
|
45
45
|
orient() {
|
46
|
-
computePosition(this.
|
47
|
-
this.
|
48
|
-
this.
|
46
|
+
computePosition(this.triggerTarget, this.contentTarget, this.#options).then(({x, y}) => {
|
47
|
+
this.contentTarget.style.insetInlineStart = `${x}px`
|
48
|
+
this.contentTarget.style.insetBlockStart = `${y}px`
|
49
49
|
})
|
50
50
|
}
|
51
51
|
|