keystone_ui 0.93.0 → 0.95.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/link_list_component.html.erb +10 -2
- data/app/components/keystone/ui/link_list_component.rb +14 -2
- data/app/components/keystone/ui/text_diff_component.html.erb +17 -9
- data/app/components/keystone/ui/text_diff_component.rb +14 -1
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +22 -5
- data/the_local/agents/keystone_ui-info.md +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04c11d9c46c1a257a56b70a575ce82d1b42f6173be503bf450aae5f455d58084
|
|
4
|
+
data.tar.gz: a5b020f2a8eb2634626b6a7b3a6dcf891660fbcc8494e2c7f924a7ad4cea1672
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b096a567e0f8760c19208f9e185ba149006fab0e04c436d935fb3af5a80b92db18b0676f31d9469d85a5f3341254ddee2ec6ba848dc55b1578dd7e4e289d984
|
|
7
|
+
data.tar.gz: badc61c1eec2c324c027882f36f57cc66d1ee6f891648e9a575131a022dec3ddb9a735cb8d2405ac47d644af309b3a6f19f474721805d5ee6e471937a245f463
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
<div class="ks-value-list">
|
|
2
2
|
<% rows.each do |row| %>
|
|
3
|
-
<%= link_to row.fetch(:href),
|
|
3
|
+
<%= link_to row.fetch(:href), **row_options(row) do %>
|
|
4
4
|
<span class="<%= STACK_CLASSES %>">
|
|
5
5
|
<span class="<%= TEXT_CLASSES %>">
|
|
6
|
+
<% if row[:top_line] %>
|
|
7
|
+
<span class="<%= TOP_LINE_CLASSES %>">
|
|
8
|
+
<%= render top_line_badge(row) %>
|
|
9
|
+
<span class="<%= TOP_LINE_TEXT_CLASSES %>"><%= row[:top_line][:text] %></span>
|
|
10
|
+
</span>
|
|
11
|
+
<% end %>
|
|
6
12
|
<span class="<%= LABEL_CLASSES %>"><%= row.fetch(:label) %></span>
|
|
7
13
|
<% if row[:subtitle] %>
|
|
8
14
|
<span class="<%= SUBTITLE_CLASSES %>"><%= row[:subtitle] %></span>
|
|
@@ -15,7 +21,9 @@
|
|
|
15
21
|
<% if row[:value] %>
|
|
16
22
|
<span class="<%= VALUE_CLASSES %>"><%= row[:value] %></span>
|
|
17
23
|
<% end %>
|
|
18
|
-
|
|
24
|
+
<% if chevron %>
|
|
25
|
+
<%= Keystone::Ui::SettingsLinkComponent::CHEVRON_ICON.html_safe %>
|
|
26
|
+
<% end %>
|
|
19
27
|
<% end %>
|
|
20
28
|
<% end %>
|
|
21
29
|
</div>
|
|
@@ -4,22 +4,34 @@ module Keystone
|
|
|
4
4
|
module Ui
|
|
5
5
|
class LinkListComponent < ViewComponent::Base
|
|
6
6
|
ROW_CLASSES = "ks-value-list-row items-center no-underline"
|
|
7
|
+
CURRENT_ROW_CLASSES = "ks-value-list-row-current"
|
|
7
8
|
STACK_CLASSES = "flex min-w-0 flex-1 flex-col-reverse ks-grid-gap-sm sm:contents"
|
|
8
9
|
BADGE_CLASSES = "max-sm:self-start"
|
|
9
10
|
TEXT_CLASSES = "min-w-0 flex-1"
|
|
11
|
+
TOP_LINE_CLASSES = "flex items-center justify-between ks-grid-gap-sm whitespace-nowrap"
|
|
12
|
+
TOP_LINE_TEXT_CLASSES = "ks-value-list-note min-w-0 truncate"
|
|
10
13
|
LABEL_CLASSES = "ks-paragraph ks-settings-link-label block"
|
|
11
14
|
SUBTITLE_CLASSES = "ks-value-list-note"
|
|
12
15
|
VALUE_CLASSES = "ks-value-list-value shrink-0"
|
|
13
16
|
|
|
14
|
-
attr_reader :rows
|
|
17
|
+
attr_reader :rows, :chevron
|
|
15
18
|
|
|
16
|
-
def initialize(rows:)
|
|
19
|
+
def initialize(rows:, chevron: true)
|
|
17
20
|
@rows = rows
|
|
21
|
+
@chevron = chevron
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def row_options(row)
|
|
25
|
+
{ class: [ ROW_CLASSES, (CURRENT_ROW_CLASSES if row[:current]) ].compact.join(" "), aria: { current: ("true" if row[:current]) } }
|
|
18
26
|
end
|
|
19
27
|
|
|
20
28
|
def badge(row)
|
|
21
29
|
BadgeComponent.new(**row[:badge], class: BADGE_CLASSES)
|
|
22
30
|
end
|
|
31
|
+
|
|
32
|
+
def top_line_badge(row)
|
|
33
|
+
BadgeComponent.new(**row[:top_line][:badge])
|
|
34
|
+
end
|
|
23
35
|
end
|
|
24
36
|
end
|
|
25
37
|
end
|
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
<% if notice %>
|
|
3
3
|
<div class="<%= Keystone::Ui::TextDiffComponent::NOTICE_CLASSES %>" data-diff-notice><%= notice %></div>
|
|
4
4
|
<% end %>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
<% if one_column? %>
|
|
6
|
+
<div class="<%= Keystone::Ui::TextDiffComponent::SIDE_CLASSES %>" data-diff-column>
|
|
7
|
+
<% lines.each do |line| %>
|
|
8
|
+
<div class="<%= Keystone::Ui::TextDiffComponent::LINE_CLASSES %>" data-diff-row><span class="<%= line[:mark] %>"><span class="<%= Keystone::Ui::TextDiffComponent::LINE_SIGN_CLASSES %>" data-diff-sign><%= line[:sign] %></span><span data-diff-text><%= line[:text] %></span></span></div>
|
|
9
|
+
<% end %>
|
|
10
|
+
</div>
|
|
11
|
+
<% else %>
|
|
12
|
+
<div class="<%= Keystone::Ui::TextDiffComponent::COLUMNS_CLASSES %>">
|
|
13
|
+
<% Keystone::Ui::TextDiffComponent::SIDES.each do |side| %>
|
|
14
|
+
<div class="<%= Keystone::Ui::TextDiffComponent::SIDE_CLASSES %>" data-diff-side="<%= side %>">
|
|
15
|
+
<% cells(side).each do |cell| %>
|
|
16
|
+
<div class="<%= [ Keystone::Ui::TextDiffComponent::ROW_CLASSES, cell&.dig(:mark) ].compact.join(" ") %>" data-diff-row><span class="<%= Keystone::Ui::TextDiffComponent::NUMBER_CLASSES %>" data-diff-number><%= cell&.dig(:number) %></span><span class="<%= Keystone::Ui::TextDiffComponent::SIGN_CLASSES %>" data-diff-sign><%= cell&.dig(:sign) %></span><span class="<%= Keystone::Ui::TextDiffComponent::TEXT_CLASSES %>" data-diff-text><%= cell&.dig(:text) %></span></div>
|
|
17
|
+
<% end %>
|
|
18
|
+
</div>
|
|
19
|
+
<% end %>
|
|
20
|
+
</div>
|
|
21
|
+
<% end %>
|
|
14
22
|
</div>
|
|
@@ -11,11 +11,18 @@ 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
|
+
LINE_CLASSES = "h-[1lh] whitespace-pre"
|
|
15
|
+
LINE_SIGN_CLASSES = "inline-block w-[2ch] select-none"
|
|
14
16
|
NOTICE_CLASSES = "ks-code-caption text-xs"
|
|
15
17
|
|
|
16
|
-
def initialize(before:, after:)
|
|
18
|
+
def initialize(before:, after:, one_column: false)
|
|
17
19
|
@before = before.to_s.lines(chomp: true)
|
|
18
20
|
@after = after.to_s.lines(chomp: true)
|
|
21
|
+
@one_column = one_column
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def one_column?
|
|
25
|
+
@one_column
|
|
19
26
|
end
|
|
20
27
|
|
|
21
28
|
def notice
|
|
@@ -34,6 +41,12 @@ module Keystone
|
|
|
34
41
|
rows.map { |row| row[SIDES.index(side)] }
|
|
35
42
|
end
|
|
36
43
|
|
|
44
|
+
def lines
|
|
45
|
+
return (@before + @after).map { |text| { text: text } } if too_long?
|
|
46
|
+
|
|
47
|
+
rows.map { |row| row.compact.first }
|
|
48
|
+
end
|
|
49
|
+
|
|
37
50
|
private
|
|
38
51
|
|
|
39
52
|
def rows
|
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 phone header with a line above its title and a badge at its right end, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a decision bar of a note field and several buttons sent as one form and fixed to the bottom of a phone 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, drawn one line per step with a marked time axis if wanted, with retries and their count, queued time, failed tries, steps still running, steps waiting on approval, 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, a short note or badge at the right of a section's title, a record's details as labelled values in rows or in two columns, 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 phone header with a line above its title and a badge at its right end, a page's main action as a phone top-bar icon or a button fixed to the bottom of the screen, a decision bar of a note field and several buttons sent as one form and fixed to the bottom of a phone 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, drawn one line per step with a marked time axis if wanted, with retries and their count, queued time, failed tries, steps still running, steps waiting on approval, 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, a short note or badge at the right of a section's title, a record's details as labelled values in rows or in two columns, a queue of links with a type and time above each title and the open one marked, two versions of a text compared line by line side by side or in one column, 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
|
---
|
|
@@ -79,13 +79,13 @@ not available in the app yet, that is `keystone_ui-install`'s job.
|
|
|
79
79
|
- `ui_paragraph` — a paragraph of running text.
|
|
80
80
|
- `ui_value_list` — labelled values, as rows of a label beside its value, such as a ledger or a byline, or as columns of a label above its value.
|
|
81
81
|
- `ui_alert` — a banner message, optionally dismissible.
|
|
82
|
-
- `ui_link_list` — a list of links, each row with a label, an optional subtitle, badge and
|
|
82
|
+
- `ui_link_list` — a list of links, each row with a label, an optional subtitle, badge, value and top line, an optional current-row mark, and a chevron that can be left off.
|
|
83
83
|
- `ui_empty_state` — what a list or section shows when it has nothing in it, with an optional message and action.
|
|
84
84
|
- `ui_progress` — a labelled progress bar.
|
|
85
85
|
- `ui_stat_card` — a single metric tile with optional change, link and info button.
|
|
86
86
|
- `ui_copy_button` — a button that copies text to the clipboard.
|
|
87
87
|
- `ui_code` — a block of code with an optional caption.
|
|
88
|
-
- `ui_text_diff` — two versions of a text side by side, with removed and added lines marked.
|
|
88
|
+
- `ui_text_diff` — two versions of a text side by side, or in one column, with removed and added lines marked.
|
|
89
89
|
- `ui_disclosure` — a native expandable section with a clickable summary.
|
|
90
90
|
- `ui_calculation` — the steps behind a figure, closed under a summary row.
|
|
91
91
|
- `ui_info` — an inline info button showing a summary, and optional detail, in floating panels.
|
|
@@ -703,9 +703,17 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
703
703
|
- `ui_alert(message:, type: :info, title: nil, dismissible: false, class: nil)`
|
|
704
704
|
— `type:` is `:info` `:success` `:warning` `:error`, and `dismissible: true`
|
|
705
705
|
adds a close button.
|
|
706
|
-
- `ui_link_list(rows:)` — each row is `{ label:, href:,
|
|
707
|
-
badge: nil, value: nil
|
|
706
|
+
- `ui_link_list(rows:, chevron: true)` — each row is `{ label:, href:,
|
|
707
|
+
subtitle: nil, badge: nil, value: nil, top_line: nil, current: false }`,
|
|
708
|
+
and `badge:` takes `ui_badge`'s `{ label:, variant: }`.
|
|
708
709
|
A row's badge sits above its label below `sm` and beside it from `sm` up.
|
|
710
|
+
`top_line:` is `{ badge:, text: }`, a line above the label with its own
|
|
711
|
+
badge at the left, apart from the row's `badge:`, and short text at the
|
|
712
|
+
right, such as a type and the time left. It stays on one line and cuts off
|
|
713
|
+
long text, while the label and subtitle wrap. `current: true` marks the
|
|
714
|
+
row the person has open with `aria-current` and a tint and accent bar.
|
|
715
|
+
`chevron: false` leaves off every row's chevron, as in a queue beside the
|
|
716
|
+
open item. Ask the developer which row is current on each page.
|
|
709
717
|
Use it for a list of records that each open their own page, in place of a
|
|
710
718
|
hand-written `<ul>` of links.
|
|
711
719
|
- `ui_empty_state(title:, message: nil, action: nil)` — `action:` is
|
|
@@ -740,6 +748,15 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
|
|
|
740
748
|
developer whether a screen can be given texts that long, and hand changing
|
|
741
749
|
the limit to `keystone_ui-install`, since the comparison's work grows with
|
|
742
750
|
the line count of one text times the other's.
|
|
751
|
+
- `one_column: true` shows both texts in one column in place of side by
|
|
752
|
+
side, the same at every screen width. A shared line appears once with no
|
|
753
|
+
sign, a removed line appears at its place in `before:` with a `-`, and an
|
|
754
|
+
added line appears at its place in `after:` with a `+`, so a changed line
|
|
755
|
+
shows as the removed line followed by the added one. The removed and added
|
|
756
|
+
colour covers the sign and text of the line, the column numbers no lines,
|
|
757
|
+
and a long line scrolls sideways inside the column. Both notices still
|
|
758
|
+
show. When the texts are too long to compare, the column lists every line
|
|
759
|
+
of `before:` and then every line of `after:`, with none marked.
|
|
743
760
|
- Ask the developer which two versions a screen compares and which is the
|
|
744
761
|
earlier one.
|
|
745
762
|
- `ui_disclosure(open: false)` takes a block yielding the component. Fill
|
|
@@ -203,6 +203,11 @@ One decision: is keystone_ui set up in the app?
|
|
|
203
203
|
When the two texts together hold more lines than the host's line limit, 2,000
|
|
204
204
|
by default, it does not compare them: it lines them up by position with no
|
|
205
205
|
marks or signs, and the notice says they are too long to compare.
|
|
206
|
+
With its one-column option it shows both texts in one column instead, the
|
|
207
|
+
same at every screen width: a shared line once, a removed line at its place
|
|
208
|
+
in the first text and an added line at its place in the second, each marked
|
|
209
|
+
and signed, with no line numbers. Too long to compare, that column lists the
|
|
210
|
+
first text and then the second, unmarked.
|
|
206
211
|
- **Semantic colour.** The themed hue is `accent-*` and the themed neutrals are
|
|
207
212
|
`surface-*`, CSS custom properties whose defaults (blue and zinc) come from
|
|
208
213
|
the keystone_ui-styles gem. Retheming changes those values, not the
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keystone_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.95.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.36.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.36.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: view_component
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|