css-zero 0.0.84 → 0.0.86

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d6d7165606f68bfeaf5ea3257f89a0930e1e4ff4f1e98fab0a02f832cf0fb0a
4
- data.tar.gz: cef16687bf6571c5e7af1454519bfb69a72cf66cfc48ca0b5ea90e809d8138e1
3
+ metadata.gz: 9db39d993375c71281634dcc6d4cf952d063cc91fa06a5dac1d570ed73970b4c
4
+ data.tar.gz: b317d56e8be1be45f5eb781c8db8a776acd43f8cf6c49058758bc65ed5573fdb
5
5
  SHA512:
6
- metadata.gz: f3f726e4812aea10b251fc6dd3d3532d7ddb67899f99dfe8677742a7c7e82876273274b03cf53d6ba859e6ee1cfdfdf65123b5e2f0f99b1cd3ce02ee4c7b8add
7
- data.tar.gz: 4a269b0b7868152d856552a537f09753bf6297a3cf9cbd4bb1cc9ec4d92bd5fd3cf5c5185b1f0ffb8cb8691a0aa8d2b20176cc31e67041ec822c060611f6d6f4
6
+ metadata.gz: 80cd9c9f10bd5dc571ebb119606cfc3c2555243157a85d1175054f3ebbed55524f5ee22d9a84e54de02eccc7d6e1855a6cf77e481f2f7ebd228259180b02b3a9
7
+ data.tar.gz: 97792e3a516b4eab80d530fa5f01e4f7e429c4f5201b61636ca85b4033bd6946f4109a79620620723a6760dd01d0666da44ba4fd2eee65a480dcfe3ec34ebee6
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.84"
2
+ VERSION = "0.0.86"
3
3
  end
@@ -35,8 +35,7 @@ combobox:
35
35
  - app/assets/images/select-arrow.svg
36
36
  command:
37
37
  - app/assets/stylesheets/command.css
38
- - app/javascript/controllers/filter_controller.js
39
- - app/javascript/controllers/listbox_controller.js
38
+ - app/javascript/controllers/command_controller.js
40
39
  - app/assets/images/search.svg
41
40
  collapsible:
42
41
  - app/javascript/controllers/collapsible_controller.js
@@ -53,6 +52,7 @@ dropdown:
53
52
  - app/javascript/controllers/popover_controller.js
54
53
  - app/assets/stylesheets/menu.css
55
54
  - app/javascript/controllers/menu_controller.js
55
+ - app/javascript/controllers/context_menu_controller.js
56
56
  flash:
57
57
  - app/assets/stylesheets/flash.css
58
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
- }
@@ -1,14 +1,31 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
  import { debounce } from "https://cdn.skypack.dev/lodash-es@4.17.21?min"
3
+ import Combobox from "https://cdn.skypack.dev/@github/combobox-nav@3.0.1?min"
3
4
 
4
5
  export default class extends Controller {
5
- static targets = [ "list" ]
6
+ static targets = [ "input", "list" ]
6
7
  static classes = [ "active", "selected" ]
7
8
 
8
9
  initialize() {
9
10
  this.filter = debounce(this.filter.bind(this), 300)
10
11
  }
11
12
 
13
+ connect() {
14
+ this.combobox = new Combobox(this.inputTarget, this.listTarget)
15
+ }
16
+
17
+ disconnect() {
18
+ this.combobox.destroy()
19
+ }
20
+
21
+ start() {
22
+ this.combobox.start()
23
+ }
24
+
25
+ stop() {
26
+ this.combobox.stop()
27
+ }
28
+
12
29
  filter({ target }) {
13
30
  this.#reset()
14
31
 
@@ -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.84
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-09 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
@@ -95,17 +95,17 @@ files:
95
95
  - lib/generators/css_zero/add/templates/app/javascript/controllers/clearable_input_controller.js
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
+ - 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
98
100
  - lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js
99
101
  - lib/generators/css_zero/add/templates/app/javascript/controllers/datepicker_controller.js
100
102
  - lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js
101
103
  - lib/generators/css_zero/add/templates/app/javascript/controllers/element_removal_controller.js
102
- - lib/generators/css_zero/add/templates/app/javascript/controllers/filter_controller.js
103
104
  - lib/generators/css_zero/add/templates/app/javascript/controllers/form_controller.js
104
105
  - lib/generators/css_zero/add/templates/app/javascript/controllers/fullscreen_controller.js
105
106
  - lib/generators/css_zero/add/templates/app/javascript/controllers/hotkey_controller.js
106
107
  - lib/generators/css_zero/add/templates/app/javascript/controllers/inputmask_controller.js
107
108
  - lib/generators/css_zero/add/templates/app/javascript/controllers/lightbox_controller.js
108
- - lib/generators/css_zero/add/templates/app/javascript/controllers/listbox_controller.js
109
109
  - lib/generators/css_zero/add/templates/app/javascript/controllers/local_time_controller.js
110
110
  - lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js
111
111
  - lib/generators/css_zero/add/templates/app/javascript/controllers/navigation_controller.js
@@ -1,22 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
- import Listbox from "https://cdn.skypack.dev/@github/combobox-nav@3.0.1?min"
3
-
4
- export default class extends Controller {
5
- static targets = [ "input", "list" ]
6
-
7
- connect() {
8
- this.listbox = new Listbox(this.inputTarget, this.listTarget)
9
- }
10
-
11
- disconnect() {
12
- this.listbox.destroy()
13
- }
14
-
15
- start() {
16
- this.listbox.start()
17
- }
18
-
19
- stop() {
20
- this.listbox.stop()
21
- }
22
- }