css-zero 0.0.48 → 0.0.49

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: 2c2fa4f9172129b3e90a0a4cdcb7870f5467d8cbee3fd8d9d621eebd65212912
4
- data.tar.gz: 0ddf2089702a14920122e9ce9d421dc8017e6a2c3fe9aa42284b83700b83a357
3
+ metadata.gz: 20f634891b019d8f1daeb601e8c4f095ad0bc4a0e17e4dc8af56a265a8d578d3
4
+ data.tar.gz: 1be7e6e2f94347c1419523f814f60f11bac915072c171a3d657d50cf576b8ab0
5
5
  SHA512:
6
- metadata.gz: a98928f94335f61b029d53858d524919c940f14012bdaa9af96b22c924f03d6bff5b79c1aa774caebb4d7b494de2a9392f4e6315dc7445c9734244f09e88313f
7
- data.tar.gz: d682b0a2a721c13c04e250ca332eaf1bd531b173b96552b60fd1f93f8cb94813a139b4926fdb718c423412d9151be3b18242235d0e51cc21886411ad28ab2a93
6
+ metadata.gz: e49c19d5180e28cbfce2db4d3f7c21205de6708d8ef4cd340622846b52a4d089a7a32f829859e41577d68251e9d4f64cbaad629bf0d114ea9ad86087cdbe55d4
7
+ data.tar.gz: d2855e45ea3959712e2736746fdc1da91e0266da4bff2c0db1629317e5cff53eb4b32392841ef93b3b42e218ed369dc375bdc8249776c30e62a3cb6a8e640f2d
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.48"
2
+ VERSION = "0.0.49"
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 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 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
6
6
 
7
7
  Example:
8
8
  bin/rails generate css_zero:add [components...]
@@ -40,6 +40,8 @@ dropdown:
40
40
  flash:
41
41
  - app/assets/stylesheets/flash.css
42
42
  - app/javascript/controllers/element_removal_controller.js
43
+ form:
44
+ - app/javascript/controllers/form_controller.js
43
45
  fullscreen:
44
46
  - app/javascript/controllers/fullscreen_controller.js
45
47
  hotkey:
@@ -88,7 +90,6 @@ skeleton:
88
90
  - app/assets/stylesheets/skeleton.css
89
91
  switch:
90
92
  - app/assets/stylesheets/switch.css
91
- - app/javascript/controllers/form_controller.js
92
93
  table:
93
94
  - app/assets/stylesheets/table.css
94
95
  tabs:
@@ -10,4 +10,8 @@ export default class extends Controller {
10
10
  cancel() {
11
11
  this.cancelTarget?.click()
12
12
  }
13
+
14
+ preventAttachment(event) {
15
+ event.preventDefault()
16
+ }
13
17
  }
@@ -4,6 +4,20 @@ 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.#resetOnVisible.bind(this))
11
+ }
12
+
13
+ connect() {
14
+ this.#observer.observe(this.element)
15
+ }
16
+
17
+ disconnect() {
18
+ this.#observer.disconnect()
19
+ }
20
+
7
21
  indexValueChanged(index, previousIndex) {
8
22
  this.#updateTabstops(previousIndex !== undefined)
9
23
  }
@@ -16,8 +30,8 @@ export default class extends Controller {
16
30
  this.indexValue < this.itemTargets.length -1 && this.indexValue++
17
31
  }
18
32
 
19
- reset() {
20
- this.indexValue = 0
33
+ #resetOnVisible([ entry ]) {
34
+ if (entry.isIntersecting) this.indexValue = 0
21
35
  }
22
36
 
23
37
  #updateTabstops(shouldFocus) {
@@ -16,6 +16,16 @@ class CssZero::InstallGenerator < Rails::Generators::Base
16
16
  append_to_file "config/importmap.rb", %(pin_all_from "app/javascript/helpers", under: "helpers"\n)
17
17
  end
18
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
+
19
29
  private
20
30
  def install_with_importmap?
21
31
  Rails.root.join("config/importmap.rb").exist?
@@ -0,0 +1,2 @@
1
+ // import "initializers/current"
2
+ // import "initializers/time_zone_cookie"
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.48
4
+ version: 0.0.49
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-15 00:00:00.000000000 Z
11
+ date: 2024-10-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: lazaronixon@hotmail.com
@@ -105,6 +105,7 @@ files:
105
105
  - lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css
106
106
  - lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js
107
107
  - lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js
108
+ - lib/generators/css_zero/install/templates/app/javascript/initializers/index.js
108
109
  homepage: https://github.com/lazaronixon/css-zero
109
110
  licenses:
110
111
  - MIT