css-zero 0.0.85 → 0.0.86

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d55393b875fa276f7e2ea8a7968c8cbcc3d09a3321a8c5e779c6a15dd698820
4
- data.tar.gz: bd3e87ca9591451c225ef969da3c1a165eab5d3922b79380b99dbb46973ad31e
3
+ metadata.gz: 9db39d993375c71281634dcc6d4cf952d063cc91fa06a5dac1d570ed73970b4c
4
+ data.tar.gz: b317d56e8be1be45f5eb781c8db8a776acd43f8cf6c49058758bc65ed5573fdb
5
5
  SHA512:
6
- metadata.gz: bd4379518ff6301804054816b1d55f76d2b625892630e1b20de2c4e4699f87d822786b158063397319162505abb699ff1f97d11c121b7b80aaeba2f95b75621f
7
- data.tar.gz: 64d396a25c47d11e0e868880ad756c799628850e92baad28cf6689fce0b829835b4670827a41f341e7fa943fd2e9681e7da1eeb6e2019b12d52a9b26629f27de
6
+ metadata.gz: 80cd9c9f10bd5dc571ebb119606cfc3c2555243157a85d1175054f3ebbed55524f5ee22d9a84e54de02eccc7d6e1855a6cf77e481f2f7ebd228259180b02b3a9
7
+ data.tar.gz: 97792e3a516b4eab80d530fa5f01e4f7e429c4f5201b61636ca85b4033bd6946f4109a79620620723a6760dd01d0666da44ba4fd2eee65a480dcfe3ec34ebee6
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.85"
2
+ VERSION = "0.0.86"
3
3
  end
@@ -52,6 +52,7 @@ dropdown:
52
52
  - app/javascript/controllers/popover_controller.js
53
53
  - app/assets/stylesheets/menu.css
54
54
  - app/javascript/controllers/menu_controller.js
55
+ - app/javascript/controllers/context_menu_controller.js
55
56
  flash:
56
57
  - app/assets/stylesheets/flash.css
57
58
  - app/javascript/controllers/element_removal_controller.js
@@ -37,7 +37,7 @@
37
37
  }
38
38
 
39
39
  h6 {
40
- font-size: 0.9em;
40
+ font-size: 0.8em;
41
41
  }
42
42
 
43
43
  :is(ul, ol, menu) {
@@ -99,8 +99,3 @@
99
99
  .invalid .ts-control {
100
100
  border-color: var(--color-negative);
101
101
  }
102
-
103
- [data-controller*="combobox"] {
104
- clip: rect(0 0 0 0);
105
- position: absolute;
106
- }
@@ -0,0 +1,11 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static targets = [ "menu" ]
5
+
6
+ show(event) {
7
+ this.menuTarget.style.insetInlineStart = `${event.clientX - 5}px`
8
+ this.menuTarget.style.insetBlockStart = `${event.clientY - 5}px`
9
+ setTimeout(() => this.menuTarget.showPopover(), 150)
10
+ }
11
+ }
@@ -4,31 +4,46 @@ export default class extends Controller {
4
4
  static targets = [ "item" ]
5
5
  static values = { index: Number }
6
6
 
7
+ #observer
8
+
9
+ initialize() {
10
+ this.#observer = new IntersectionObserver(this.#reset.bind(this))
11
+ }
12
+
7
13
  connect() {
8
- this.#updateTabstops()
14
+ this.#observer.observe(this.element)
9
15
  }
10
16
 
11
- reset() {
12
- this.indexValue = 0
13
- this.#updateTabstops()
17
+ disconnect() {
18
+ this.#observer.disconnect()
14
19
  }
15
20
 
16
21
  prev() {
17
22
  if (this.indexValue > 0) {
18
23
  this.indexValue--
19
- this.#updateTabstops()
20
- this.#focusCurrentItem()
24
+ this.#update()
21
25
  }
22
26
  }
23
27
 
24
28
  next() {
25
29
  if (this.indexValue < this.#lastIndex) {
26
30
  this.indexValue++
27
- this.#updateTabstops()
28
- this.#focusCurrentItem()
31
+ this.#update()
29
32
  }
30
33
  }
31
34
 
35
+ #reset([ entry ]) {
36
+ if (entry.isIntersecting) {
37
+ this.indexValue = 0
38
+ this.#update()
39
+ }
40
+ }
41
+
42
+ #update() {
43
+ this.#updateTabstops()
44
+ this.#focusCurrentItem()
45
+ }
46
+
32
47
  #updateTabstops() {
33
48
  this.itemTargets.forEach((element, index) => {
34
49
  element.tabIndex = index === this.indexValue ? 0 : -1
@@ -31,7 +31,8 @@ export default class extends Controller {
31
31
 
32
32
  orient() {
33
33
  computePosition(this.buttonTarget, this.menuTarget, this.#options).then(({x, y}) => {
34
- Object.assign(this.menuTarget.style, { insetInlineStart: `${x}px`, insetBlockStart: `${y}px` })
34
+ this.menuTarget.style.insetInlineStart = `${x}px`
35
+ this.menuTarget.style.insetBlockStart = `${y}px`
35
36
  })
36
37
  }
37
38
 
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.85
4
+ version: 0.0.86
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: 2025-01-10 00:00:00.000000000 Z
11
+ date: 2025-01-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lazaronixon@hotmail.com
@@ -96,6 +96,7 @@ files:
96
96
  - lib/generators/css_zero/add/templates/app/javascript/controllers/collapsible_controller.js
97
97
  - lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js
98
98
  - lib/generators/css_zero/add/templates/app/javascript/controllers/command_controller.js
99
+ - lib/generators/css_zero/add/templates/app/javascript/controllers/context_menu_controller.js
99
100
  - lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js
100
101
  - lib/generators/css_zero/add/templates/app/javascript/controllers/datepicker_controller.js
101
102
  - lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js