keystone_ui 0.82.0 → 0.84.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/app/components/keystone/ui/text_diff_component.html.erb +3 -0
- data/app/components/keystone/ui/text_diff_component.rb +20 -1
- data/app/components/keystone/ui/timeline_component.html.erb +25 -18
- data/app/components/keystone/ui/timeline_component.rb +29 -4
- data/lib/keystone_ui/configuration.rb +2 -1
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +37 -12
- data/the_local/agents/keystone_ui-info.md +15 -4
- data/the_local/agents/keystone_ui-install.md +12 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d6aca33ab4bb957d295ce1adc465f61381cac1d772d3e885be8d52c4046dfe4
|
|
4
|
+
data.tar.gz: 7e0e253257eacc75d574b4ae11f471e1340af12a446024e8b4c4063e42f8cd66
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 929aa35425b706b9fc32da6ce3ed248ebead30afa1c3b1bce0abc68ab81e6a77ac00602ca29a93969e5413a622724fce2f2ed0523c9f95161ba32749e1f43d8f
|
|
7
|
+
data.tar.gz: cdefad1999050ec571db3ab9d304801f3cccd493dd7ca11b98f2eb99648511d1a65aec869201fa262c81beb45deaf64c98322e0bff00d7df1092f193eaceae38
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
<div class="<%= Keystone::Ui::TextDiffComponent::WRAPPER_CLASSES %>">
|
|
2
|
+
<% if notice %>
|
|
3
|
+
<div class="<%= Keystone::Ui::TextDiffComponent::NOTICE_CLASSES %>" data-diff-notice><%= notice %></div>
|
|
4
|
+
<% end %>
|
|
2
5
|
<div class="<%= Keystone::Ui::TextDiffComponent::COLUMNS_CLASSES %>">
|
|
3
6
|
<% Keystone::Ui::TextDiffComponent::SIDES.each do |side| %>
|
|
4
7
|
<div class="<%= Keystone::Ui::TextDiffComponent::SIDE_CLASSES %>" data-diff-side="<%= side %>">
|
|
@@ -11,12 +11,25 @@ module Keystone
|
|
|
11
11
|
NUMBER_CLASSES = "w-8 shrink-0 select-none text-right"
|
|
12
12
|
SIGN_CLASSES = "w-6 shrink-0 select-none text-center"
|
|
13
13
|
TEXT_CLASSES = "whitespace-pre"
|
|
14
|
+
NOTICE_CLASSES = "ks-code-caption text-xs"
|
|
14
15
|
|
|
15
16
|
def initialize(before:, after:)
|
|
16
17
|
@before = before.to_s.lines(chomp: true)
|
|
17
18
|
@after = after.to_s.lines(chomp: true)
|
|
18
19
|
end
|
|
19
20
|
|
|
21
|
+
def notice
|
|
22
|
+
if @before == @after
|
|
23
|
+
"These texts are the same."
|
|
24
|
+
elsif too_long?
|
|
25
|
+
"These texts are too long to compare."
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def too_long?
|
|
30
|
+
@before.size + @after.size > KeystoneUi.configuration.text_diff_line_limit
|
|
31
|
+
end
|
|
32
|
+
|
|
20
33
|
def cells(side)
|
|
21
34
|
rows.map { |row| row[SIDES.index(side)] }
|
|
22
35
|
end
|
|
@@ -24,7 +37,13 @@ module Keystone
|
|
|
24
37
|
private
|
|
25
38
|
|
|
26
39
|
def rows
|
|
27
|
-
@rows ||= compare
|
|
40
|
+
@rows ||= too_long? ? side_by_side : compare
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def side_by_side
|
|
44
|
+
Array.new([ @before.size, @after.size ].max) do |index|
|
|
45
|
+
[ @before, @after ].map { |version| { text: version[index], number: index + 1 } if index < version.size }
|
|
46
|
+
end
|
|
28
47
|
end
|
|
29
48
|
|
|
30
49
|
def compare
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
1
|
+
<% if entries.empty? %>
|
|
2
|
+
<%= render Keystone::Ui::EmptyStateComponent.new(title: "No steps") %>
|
|
3
|
+
<% else %>
|
|
4
|
+
<div class="flex flex-col gap-3">
|
|
5
|
+
<% rows.each do |row| %>
|
|
6
|
+
<div data-timeline-row<% if selected?(row) %> class="<%= SELECTED_ROW_CLASSES %>" aria-current="true"<% end %>>
|
|
7
|
+
<div class="<%= ROW_TEXT_CLASSES %>">
|
|
8
|
+
<%= content_tag(row_href(row) ? :a : :span, row[:label], data: { timeline_label: "" }, href: row_href(row)) %>
|
|
9
|
+
<span class="<%= ROW_STATUS_CLASSES %>">
|
|
10
|
+
<% if running?(row) %><%= render Keystone::Ui::StatusDotComponent.new(state: :info, label: "Running") %><% end %>
|
|
11
|
+
<span data-timeline-duration><%= duration(row) %></span>
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="<%= TRACK_CLASSES %>">
|
|
15
|
+
<% row[:tries].each do |entry| %>
|
|
16
|
+
<% if entry[:queued_at] %>
|
|
17
|
+
<div class="<%= QUEUED_CLASSES %>" data-timeline-queued style="<%= queued_style(entry) %>"></div>
|
|
18
|
+
<% end %>
|
|
19
|
+
<%= content_tag(bar_tag(entry), class: bar_classes(entry), data: { timeline_bar: "" }, style: bar_style(entry), href: entry[:href]) do %><% if entry[:href] %><span class="<%= SCREEN_READER_CLASSES %>"><%= entry[:label] %></span> <% end %><% if entry[:failed] %><span class="<%= SCREEN_READER_CLASSES %>">Failed</span><% end %><% end %>
|
|
12
20
|
<% end %>
|
|
13
|
-
|
|
14
|
-
<% end %>
|
|
21
|
+
</div>
|
|
15
22
|
</div>
|
|
23
|
+
<% end %>
|
|
24
|
+
<div class="<%= AXIS_CLASSES %>">
|
|
25
|
+
<span data-timeline-axis-start><%= axis_start_label %></span>
|
|
26
|
+
<span data-timeline-axis-end><%= total_duration %></span>
|
|
16
27
|
</div>
|
|
17
|
-
<% end %>
|
|
18
|
-
<div class="<%= AXIS_CLASSES %>">
|
|
19
|
-
<span data-timeline-axis-start><%= axis_start_label %></span>
|
|
20
|
-
<span data-timeline-axis-end><%= total_duration %></span>
|
|
21
28
|
</div>
|
|
22
|
-
|
|
29
|
+
<% end %>
|
|
@@ -11,15 +11,18 @@ module Keystone
|
|
|
11
11
|
SELECTED_ROW_CLASSES = "ks-table-row-current"
|
|
12
12
|
ROW_TEXT_CLASSES = "ks-meter-label flex justify-between text-sm"
|
|
13
13
|
AXIS_CLASSES = "ks-meter-label flex justify-between text-xs"
|
|
14
|
+
ROW_STATUS_CLASSES = "flex items-center ks-grid-gap-sm"
|
|
15
|
+
MINIMUM_BAR_PERCENT = 2
|
|
14
16
|
|
|
15
17
|
attr_reader :entries
|
|
16
18
|
|
|
17
19
|
def initialize(entries:)
|
|
20
|
+
entries.each { |entry| check_times(entry) }
|
|
18
21
|
@entries = entries
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
def bar_style(entry)
|
|
22
|
-
"left: #{percent(entry[:started_at] - axis_start)}%; width: #{
|
|
25
|
+
"left: #{percent(entry[:started_at] - axis_start)}%; width: #{bar_width(entry)}%"
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
def rows
|
|
@@ -34,6 +37,10 @@ module Keystone
|
|
|
34
37
|
row[:tries].any? { |entry| entry[:selected] }
|
|
35
38
|
end
|
|
36
39
|
|
|
40
|
+
def running?(row)
|
|
41
|
+
row[:tries].any? { |entry| entry[:ended_at].nil? }
|
|
42
|
+
end
|
|
43
|
+
|
|
37
44
|
def queued_style(entry)
|
|
38
45
|
"left: #{percent(entry[:queued_at] - axis_start)}%; width: #{percent(entry[:started_at] - entry[:queued_at])}%"
|
|
39
46
|
end
|
|
@@ -47,7 +54,7 @@ module Keystone
|
|
|
47
54
|
end
|
|
48
55
|
|
|
49
56
|
def duration(row)
|
|
50
|
-
written_duration(row[:tries].last
|
|
57
|
+
written_duration(ended_at(row[:tries].last) - row[:tries].first[:started_at])
|
|
51
58
|
end
|
|
52
59
|
|
|
53
60
|
def total_duration
|
|
@@ -60,6 +67,11 @@ module Keystone
|
|
|
60
67
|
|
|
61
68
|
private
|
|
62
69
|
|
|
70
|
+
def check_times(entry)
|
|
71
|
+
raise ArgumentError, "Timeline entry #{entry[:label].inspect} has no started_at" unless entry[:started_at]
|
|
72
|
+
raise ArgumentError, "Timeline entry #{entry[:label].inspect} ends before it starts" if entry[:ended_at] && entry[:ended_at] < entry[:started_at]
|
|
73
|
+
end
|
|
74
|
+
|
|
63
75
|
def written_duration(seconds)
|
|
64
76
|
hours, rest = seconds.round.divmod(3600)
|
|
65
77
|
minutes, seconds = rest.divmod(60)
|
|
@@ -73,11 +85,24 @@ module Keystone
|
|
|
73
85
|
end
|
|
74
86
|
|
|
75
87
|
def axis_end
|
|
76
|
-
@axis_end ||= entries.map { |entry| entry[:ended_at] }.max
|
|
88
|
+
@axis_end ||= entries.map { |entry| entry[:ended_at] || entry[:started_at] }.max
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def ended_at(entry)
|
|
92
|
+
entry[:ended_at] || axis_end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def bar_width(entry)
|
|
96
|
+
format("%g", [ share(ended_at(entry) - entry[:started_at]), MINIMUM_BAR_PERCENT ].max)
|
|
77
97
|
end
|
|
78
98
|
|
|
79
99
|
def percent(seconds)
|
|
80
|
-
format("%g", (seconds
|
|
100
|
+
format("%g", share(seconds))
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def share(seconds)
|
|
104
|
+
span = axis_end - axis_start
|
|
105
|
+
span.zero? ? 0 : (seconds / span * 100).round(2)
|
|
81
106
|
end
|
|
82
107
|
end
|
|
83
108
|
end
|
|
@@ -4,12 +4,13 @@ require "keystone_ui/navigation_group"
|
|
|
4
4
|
|
|
5
5
|
module KeystoneUi
|
|
6
6
|
class Configuration
|
|
7
|
-
attr_accessor :accent, :surface, :theme_mode_supplier, :look_supplier, :trail_supplier, :preference_supplier, :current_tab_supplier
|
|
7
|
+
attr_accessor :accent, :surface, :theme_mode_supplier, :look_supplier, :trail_supplier, :preference_supplier, :current_tab_supplier, :text_diff_line_limit
|
|
8
8
|
attr_reader :tailwind_imports, :tailwind_sources, :looks, :default_look, :navigation_groups
|
|
9
9
|
|
|
10
10
|
def initialize
|
|
11
11
|
@accent = :blue
|
|
12
12
|
@surface = :zinc
|
|
13
|
+
@text_diff_line_limit = 2000
|
|
13
14
|
@tailwind_imports = []
|
|
14
15
|
@tailwind_sources = []
|
|
15
16
|
@looks = {}
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: keystone_ui-develop
|
|
3
|
-
description: Use PROACTIVELY for building or editing screens in a Rails app that has keystone_ui — page shells with Back links and breadcrumbs, forms and fields, a search field that picks a record or enters a new one, data tables with saved columns, desktop navigation, sidebars and bottom tabs, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a question asked before a button or main action goes ahead, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps with retries, queued time, failed tries, links to each try and the current step marked, amounts shown in green or red as a gain or loss, status dots coloured by state, pictures held to half the screen, two versions of a text compared line by line side by side, info buttons and breakdowns, marketing sections, a light/dark theme switch — MUST BE USED instead of hand-writing ERB and Tailwind for UI.
|
|
3
|
+
description: Use PROACTIVELY for building or editing screens in a Rails app that has keystone_ui — page shells with Back links and breadcrumbs, forms and fields, a search field that picks a record or enters a new one, data tables with saved columns, desktop navigation, sidebars and bottom tabs, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a question asked before a button or main action goes ahead, action menus for a record's Edit and Delete, dashboards with stat cards, charts, funnels, goal buckets and timelines of timed steps with retries, queued time, failed tries, steps still running, links to each try and the current step marked, amounts shown in green or red as a gain or loss, status dots coloured by state, pictures held to half the screen, two versions of a text compared line by line side by side, info buttons and breakdowns, marketing sections, a light/dark theme switch — MUST BE USED instead of hand-writing ERB and Tailwind for UI.
|
|
4
4
|
tools: Bash, Read, Write, Edit, Grep
|
|
5
5
|
scope: UI — pages, forms, tables, navigation, dashboards
|
|
6
6
|
---
|
|
@@ -98,7 +98,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
98
98
|
- `ui_funnel` — a conversion funnel drawn as bars or one joined shape.
|
|
99
99
|
- `ui_bucket` — an upright container filled toward a goal.
|
|
100
100
|
- `ui_bucket_series` — a wrapping row of buckets.
|
|
101
|
-
- `ui_timeline` — rows of timed steps on one shared time axis, each try of a step a bar on its row, with optional queued time
|
|
101
|
+
- `ui_timeline` — rows of timed steps on one shared time axis, each try of a step a bar on its row, with optional queued time, failed tries and tries still running marked, bars and row labels that open an address, the current row marked, and a "No steps" message when there are no entries.
|
|
102
102
|
- `ui_pipeline` — a staged flow diagram with buttons and breakable links that post to the app.
|
|
103
103
|
- `ui_hero` — a marketing hero with title, call-to-action buttons and an aside.
|
|
104
104
|
- `ui_cta_banner` — a marketing banner holding call-to-action buttons.
|
|
@@ -660,11 +660,22 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
660
660
|
blank row opposite, so a changed line shows as a removed row followed by
|
|
661
661
|
an added row. Each column numbers its own lines, and a long line scrolls
|
|
662
662
|
sideways inside its column. Lines must match exactly, spaces included, to
|
|
663
|
-
count as shared
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
663
|
+
count as shared, apart from their line endings, so a line ending in a
|
|
664
|
+
Windows line break matches the same line ending in a Unix one. A `nil`
|
|
665
|
+
text is treated as empty, and both are shown as plain text.
|
|
666
|
+
- When the two texts hold the same lines, including two empty texts, a
|
|
667
|
+
notice above the columns reads "These texts are the same." and no row is
|
|
668
|
+
marked.
|
|
669
|
+
- When the two texts together hold more lines than the app's line limit,
|
|
670
|
+
2,000 unless the app's keystone_ui configuration sets another, it does not
|
|
671
|
+
compare them. It shows "These texts are too long to compare." above the
|
|
672
|
+
columns and draws line 1 beside line 1, line 2 beside line 2 and so on,
|
|
673
|
+
with no row marked and no `-` or `+`. The notice wording is fixed. Ask the
|
|
674
|
+
developer whether a screen can be given texts that long, and hand changing
|
|
675
|
+
the limit to `keystone_ui-install`, since the comparison's work grows with
|
|
676
|
+
the line count of one text times the other's.
|
|
677
|
+
- Ask the developer which two versions a screen compares and which is the
|
|
678
|
+
earlier one.
|
|
668
679
|
- `ui_disclosure(open: false)` takes a block yielding the component. Fill
|
|
669
680
|
its `summary` slot with the header, and the rest of the block is the body.
|
|
670
681
|
- `ui_accordion(items: [])` — `items:` is `[{ question:, answer: }, ...]`.
|
|
@@ -753,7 +764,7 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
753
764
|
- `ui_bucket_series(buckets:)` takes an array of hashes with the keywords
|
|
754
765
|
of `ui_bucket`, such as `[{ goal: 10, actual: 7, label: "Mon" }, ...]`.
|
|
755
766
|
- `ui_timeline(entries:)` takes no block. `entries:` is
|
|
756
|
-
`[{ label:, started_at:, ended_at
|
|
767
|
+
`[{ label:, started_at:, ended_at: nil, queued_at: nil, failed: false, href: nil, selected: false }, ...]`,
|
|
757
768
|
with every time a `Time` value.
|
|
758
769
|
- It draws one row per label, in the order each label first appears.
|
|
759
770
|
Entries that share a label, such as the tries of one step, share that
|
|
@@ -761,7 +772,15 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
761
772
|
in the order they ran.
|
|
762
773
|
- Every bar is placed by its entry's `started_at` and `ended_at` on one
|
|
763
774
|
axis shared by all rows. The axis runs from the earliest `queued_at` or
|
|
764
|
-
`started_at` of any entry to the latest `ended_at
|
|
775
|
+
`started_at` of any entry to the latest `ended_at`, or to the latest
|
|
776
|
+
`started_at` when that is later.
|
|
777
|
+
- An entry with no `ended_at:`, or `ended_at: nil`, is a try still
|
|
778
|
+
running. Its bar runs to the end of the axis, and its row shows an
|
|
779
|
+
`:info` status dot beside its duration that screen readers read as
|
|
780
|
+
"Running". Leave `ended_at:` out only for a try that has not finished.
|
|
781
|
+
- Every bar is drawn at least 2% of the track wide, so a try that took no
|
|
782
|
+
time still shows. When every entry starts and ends at one moment, every
|
|
783
|
+
bar is drawn at that width at the left edge of the track.
|
|
765
784
|
- An entry given `queued_at:` also draws the time from `queued_at` to
|
|
766
785
|
`started_at` before its bar, in the queued colour. Leave it out when the
|
|
767
786
|
wait is not known.
|
|
@@ -780,12 +799,18 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
780
799
|
and on one entry at most.
|
|
781
800
|
- Each row shows its label and its duration on one line, then its track.
|
|
782
801
|
The row's duration runs from its first entry's `started_at` to its last
|
|
783
|
-
entry's `ended_at`,
|
|
802
|
+
entry's `ended_at`, or to the end of the axis when that last entry is
|
|
803
|
+
still running, so queued time before the first try is not counted.
|
|
784
804
|
- Under the rows the axis reads `0s` on the left and the whole span on the
|
|
785
805
|
right. Durations are written as `1h 0m 5s`, leaving out leading zero
|
|
786
806
|
units, and a zero duration is `0s`.
|
|
787
|
-
-
|
|
788
|
-
|
|
807
|
+
- An entry with no `started_at:` raises `ArgumentError` naming its label,
|
|
808
|
+
and so does an entry whose `ended_at:` is before its `started_at:`. Check
|
|
809
|
+
the times before rendering rather than rescuing the error.
|
|
810
|
+
- An empty `entries:` draws a centred "No steps" message in place of the
|
|
811
|
+
timeline, so it can be rendered for a list that may be empty. The
|
|
812
|
+
wording is fixed, so ask the developer whether it fits, and when it does
|
|
813
|
+
not, check for no entries and call `ui_empty_state` instead.
|
|
789
814
|
- `ui_pipeline(title:, boxes:, links:, subtitle: nil)` — `boxes:` is
|
|
790
815
|
`[{ label:, count:, accent:, action: }, ...]`, with `accent:` one of
|
|
791
816
|
`:amber` `:emerald` `:danger` `:muted`, and `action:` is
|
|
@@ -31,7 +31,8 @@ This local declares no commands. The working surfaces belong to the other two:
|
|
|
31
31
|
|
|
32
32
|
- **Getting the gem into a host app** — the install generator, the
|
|
33
33
|
configuration block, the theme and look attributes on the layout, the palette,
|
|
34
|
-
registered looks, the navigation groups,
|
|
34
|
+
registered looks, the navigation groups, the text diff's line limit, and the
|
|
35
|
+
suppliers for trails, themes,
|
|
35
36
|
looks, the current tab and saved preferences → **`keystone_ui-install`**.
|
|
36
37
|
- **Building screens with it** — which helper renders what, the keywords each
|
|
37
38
|
takes, and how they nest → **`keystone_ui-develop`**.
|
|
@@ -71,7 +72,12 @@ One decision: is keystone_ui set up in the app?
|
|
|
71
72
|
try's end. Queued time is drawn as its own segment before the bar, and a
|
|
72
73
|
failed try is marked failed both in colour and for screen readers. The axis
|
|
73
74
|
runs from the earliest queued or start time of any entry to the latest end
|
|
74
|
-
time. An entry
|
|
75
|
+
or start time. An entry with no end time is still running: its bar runs to
|
|
76
|
+
the end of the axis, and its row shows a status dot that screen readers read
|
|
77
|
+
as "Running". Every bar is drawn at least a small visible width, so a try
|
|
78
|
+
that took no time still shows. An entry with no start time, or one that ends
|
|
79
|
+
before it starts, raises `ArgumentError` naming its label. A timeline with no
|
|
80
|
+
entries shows a message saying there are no steps. An entry can carry an address, and then its bar is a link to it whose
|
|
75
81
|
name screen readers announce is the entry's label, and the row's label links
|
|
76
82
|
to the address of the last entry in that row that has one. An entry can be
|
|
77
83
|
marked selected, and the row holding it is drawn in the same tint as a data
|
|
@@ -134,8 +140,13 @@ One decision: is keystone_ui set up in the app?
|
|
|
134
140
|
share sit on the same row, a line only the first text has is marked removed
|
|
135
141
|
with a minus, a line only the second has is marked added with a plus, the
|
|
136
142
|
other side shows a blank row beside either one, and each side numbers its own
|
|
137
|
-
lines. On a phone the first text's column sits above the second's. It
|
|
138
|
-
|
|
143
|
+
lines. On a phone the first text's column sits above the second's. It
|
|
144
|
+
compares whole lines, so a line with one word changed shows as one line
|
|
145
|
+
removed and one added. Windows and Unix line endings compare as equal. Two
|
|
146
|
+
identical texts show a notice saying they are the same above the columns.
|
|
147
|
+
When the two texts together hold more lines than the host's line limit, 2,000
|
|
148
|
+
by default, it does not compare them: it lines them up by position with no
|
|
149
|
+
marks or signs, and the notice says they are too long to compare.
|
|
139
150
|
- **Semantic colour.** The themed hue is `accent-*` and the themed neutrals are
|
|
140
151
|
`surface-*`, CSS custom properties whose defaults (blue and zinc) come from
|
|
141
152
|
the keystone_ui-styles gem. Retheming changes those values, not the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: keystone_ui-install
|
|
3
|
-
description: Use to hook Keystone UI into a project — adding the gem, running the install generator to wire Tailwind, the Stimulus controllers and the layout's theme attributes, and configuring the palette, the theme mode supplier, registered looks, the breadcrumb trail supplier, the saved table layout supplier, the navigation groups and current tab supplier, and extra Tailwind imports and sources.
|
|
3
|
+
description: Use to hook Keystone UI into a project — adding the gem, running the install generator to wire Tailwind, the Stimulus controllers and the layout's theme attributes, and configuring the palette, the theme mode supplier, registered looks, the breadcrumb trail supplier, the saved table layout supplier, the navigation groups and current tab supplier, the text diff's line limit, and extra Tailwind imports and sources.
|
|
4
4
|
tools: Bash, Read, Edit
|
|
5
5
|
scope: UI — pages, forms, tables, navigation, dashboards
|
|
6
6
|
---
|
|
@@ -36,6 +36,8 @@ built on ViewComponent; hook it in before building any screen with those helpers
|
|
|
36
36
|
`current_tab_supplier` (a callable that supplies the key of the declared tab
|
|
37
37
|
the current page belongs to, so the navigation marks it and its group
|
|
38
38
|
active),
|
|
39
|
+
`text_diff_line_limit` (the most lines a text diff's two texts may hold
|
|
40
|
+
together before it stops comparing them, 2,000 unless set),
|
|
39
41
|
and the `tailwind_imports` and `tailwind_sources` lists (extra CSS files and
|
|
40
42
|
scan paths added to the Tailwind build).
|
|
41
43
|
- `keystone_theme_attributes` — a layout helper placed inside the `<html>` tag.
|
|
@@ -196,6 +198,7 @@ built on ViewComponent; hook it in before building any screen with those helpers
|
|
|
196
198
|
group.tab :quotes, label: "Quotes", href: ->(view) { view.quotes_path }, permitted: ->(view) { view.policy(Quote).index? }
|
|
197
199
|
end
|
|
198
200
|
config.current_tab_supplier = ->(view) { view.controller.try(:navigation_tab) }
|
|
201
|
+
config.text_diff_line_limit = 5000
|
|
199
202
|
config.tailwind_imports << "/absolute/path/to/extra.css"
|
|
200
203
|
config.tailwind_sources << "/absolute/path/to/components/**/*.{erb,rb}"
|
|
201
204
|
end
|
|
@@ -347,6 +350,14 @@ built on ViewComponent; hook it in before building any screen with those helpers
|
|
|
347
350
|
callable must answer for every page the layout draws, so a page with no
|
|
348
351
|
tab returns `nil` rather than raising. Ask the developer how a page names
|
|
349
352
|
its tab, such as a method on each controller, before writing the callable.
|
|
353
|
+
- `text_diff_line_limit` — an integer, 2,000 unless set. When the two texts
|
|
354
|
+
given to a text diff hold more lines together than this, the diff does not
|
|
355
|
+
compare them. It shows the lines side by side, paired by position, with no
|
|
356
|
+
added or removed marks, under the notice
|
|
357
|
+
`These texts are too long to compare.` The time and memory a comparison
|
|
358
|
+
takes grow with the line count of one text times the line count of the
|
|
359
|
+
other, so a higher limit makes each long diff slower to render. Leave it
|
|
360
|
+
unset unless the developer asks for a different limit.
|
|
350
361
|
- `tailwind_imports` and `tailwind_sources` — lists to append to, never
|
|
351
362
|
assign. Each import becomes an `@import` line and each source becomes an
|
|
352
363
|
`@source` line in `keystone_source.css` on the next boot. They are for
|