atomic_view 0.2.0 → 0.2.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd4eda901113f75bade919c83f2f6e45bc8e01727ca22aed9b6c4ab85ef55693
|
|
4
|
+
data.tar.gz: 566969e9ac8ba89e384e85b427f836a15226bf27834524caae0355efef80b39f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76933653def4779402ce08951a2dc75642d4e1e5a6e350127944f2a598216b1d09ef929021e204780f2a3957ed7394cdeae40a09819be4c9ddf464c6de9f9711
|
|
7
|
+
data.tar.gz: e05db9862990d64563fe7310828681d194f08c3ed6c33b9cb5b365c8fd944e121b76e001adeed404b54783b51ae85a4b2ac59f348571df5f039b8aca8bc598f6
|
|
@@ -16,16 +16,23 @@ module AtomicView
|
|
|
16
16
|
# (aging into a full date over time) client-side once the host app
|
|
17
17
|
# loads local_time's JS -- see `config/importmap.rb`'s "local-time"
|
|
18
18
|
# pin comment for that setup.
|
|
19
|
+
#
|
|
20
|
+
# Any other keyword argument (`id:`, `data:`, `class:`, ...) passes
|
|
21
|
+
# through to the row's outer wrapper `<div>` in
|
|
22
|
+
# `TimelineComponent`'s template, so a caller can address a whole
|
|
23
|
+
# row -- marker, meta line, and content -- for e.g. a Turbo Stream
|
|
24
|
+
# `remove`/`replace`, or wire up a Stimulus target on the row itself.
|
|
19
25
|
class ItemComponent < AtomicView::Component
|
|
20
|
-
attr_reader :icon_name, :avatar, :actor, :description, :time
|
|
26
|
+
attr_reader :icon_name, :avatar, :actor, :description, :time, :html_options
|
|
21
27
|
|
|
22
|
-
def initialize(description:, icon: nil, avatar: nil, actor: nil, time: nil)
|
|
28
|
+
def initialize(description:, icon: nil, avatar: nil, actor: nil, time: nil, **html_options)
|
|
23
29
|
super()
|
|
24
30
|
@icon_name = icon
|
|
25
31
|
@avatar = avatar
|
|
26
32
|
@actor = actor
|
|
27
33
|
@description = description
|
|
28
34
|
@time = time
|
|
35
|
+
@html_options = html_options
|
|
29
36
|
end
|
|
30
37
|
|
|
31
38
|
def marker
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<%= tag.div(**@options.except(:class), class: container_class) do %>
|
|
2
2
|
<% items.each_with_index do |item, index| %>
|
|
3
|
-
|
|
3
|
+
<%= tag.div(**item.html_options.except(:class), class: item_wrapper_class(index, item)) do %>
|
|
4
4
|
<% if render_line?(index) %>
|
|
5
5
|
<div class="absolute left-[13px] top-7 -bottom-6 w-px bg-border"></div>
|
|
6
6
|
<% end %>
|
|
7
7
|
<%= item %>
|
|
8
|
-
|
|
8
|
+
<% end %>
|
|
9
9
|
<% end %>
|
|
10
10
|
<% end %>
|
|
@@ -34,8 +34,9 @@ module AtomicView
|
|
|
34
34
|
class TimelineComponent < AtomicView::Component
|
|
35
35
|
renders_many :items, "ItemComponent"
|
|
36
36
|
|
|
37
|
-
def initialize(**options)
|
|
37
|
+
def initialize(continues: false, **options)
|
|
38
38
|
super()
|
|
39
|
+
@continues = continues
|
|
39
40
|
@options = options
|
|
40
41
|
end
|
|
41
42
|
|
|
@@ -43,12 +44,15 @@ module AtomicView
|
|
|
43
44
|
class_names("flex flex-col", @options[:class])
|
|
44
45
|
end
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
# `continues:` says this render is one page of a longer feed -- the connector
|
|
48
|
+
# keeps going past the last item, into whatever the next turbo frame appends
|
|
49
|
+
# or the stream prepends above.
|
|
50
|
+
def item_wrapper_class(index, item)
|
|
51
|
+
class_names("relative flex gap-3.5", {"pb-6" => !last?(index) || @continues}, item.html_options[:class])
|
|
48
52
|
end
|
|
49
53
|
|
|
50
54
|
def render_line?(index)
|
|
51
|
-
!last?(index)
|
|
55
|
+
!last?(index) || @continues
|
|
52
56
|
end
|
|
53
57
|
|
|
54
58
|
private
|
data/lib/atomic_view/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: atomic_view
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joel Warrington
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: zeitwerk
|