keystone_ui 0.93.0 → 0.94.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d9b4e6f41ef819c8ec38c53466d6b07df34c049365d24a5f76386405add852a
4
- data.tar.gz: 966e103db50821bb96a65be8903437e490b102c0159c9fad164a0fbd34a144d5
3
+ metadata.gz: 4947e9dd58a43eddd271d963c9398e29fa2f75f1e3087eb08595bb435d1ac6ca
4
+ data.tar.gz: 0e4cb6faa7d3032195f15650dfbd234c04e88f791bb9c5f118d9f7b175d07c4b
5
5
  SHA512:
6
- metadata.gz: 22dcbeea0616fd58e8e1b928c472d62988a07f23aec2c9f568cc7f90e6a0052a830461d7056af400f606075a426ea34d02d69680af0785dbc1e1941415e8d7ca
7
- data.tar.gz: 01b0b39ecd8881953cef928e658121a5aadf618dc3df79a1f6880d4d09353b6cc62185a7473ae03564501878b14bfd9d1bba04acc1215bc5f2fb42b4eeb22748
6
+ metadata.gz: baa3227236068d2825147f507a553fd00461ae879c29cc73d5a1df10d7692b1da6aa23cda4273f46282cdc41a23a1f17562a0dbf2aaa47f8b17824e4cfc7ed2c
7
+ data.tar.gz: 004fe496f216548caa10e552304c39ae4b2ef8c75596e8c14dcf61895f7ade0d3a0c106aacf3915c0c37d08fa10006590ed8a7d38b79727bdc4e1e934a884cb4
@@ -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
- <div class="<%= Keystone::Ui::TextDiffComponent::COLUMNS_CLASSES %>">
6
- <% Keystone::Ui::TextDiffComponent::SIDES.each do |side| %>
7
- <div class="<%= Keystone::Ui::TextDiffComponent::SIDE_CLASSES %>" data-diff-side="<%= side %>">
8
- <% cells(side).each do |cell| %>
9
- <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>
10
- <% end %>
11
- </div>
12
- <% end %>
13
- </div>
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.93.0"
4
+ VERSION = "0.94.0"
5
5
  end
@@ -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, 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
  ---
@@ -85,7 +85,7 @@ not available in the app yet, that is `keystone_ui-install`'s job.
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.
@@ -740,6 +740,15 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
740
740
  developer whether a screen can be given texts that long, and hand changing
741
741
  the limit to `keystone_ui-install`, since the comparison's work grows with
742
742
  the line count of one text times the other's.
743
+ - `one_column: true` shows both texts in one column in place of side by
744
+ side, the same at every screen width. A shared line appears once with no
745
+ sign, a removed line appears at its place in `before:` with a `-`, and an
746
+ added line appears at its place in `after:` with a `+`, so a changed line
747
+ shows as the removed line followed by the added one. The removed and added
748
+ colour covers the sign and text of the line, the column numbers no lines,
749
+ and a long line scrolls sideways inside the column. Both notices still
750
+ show. When the texts are too long to compare, the column lists every line
751
+ of `before:` and then every line of `after:`, with none marked.
743
752
  - Ask the developer which two versions a screen compares and which is the
744
753
  earlier one.
745
754
  - `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.93.0
4
+ version: 0.94.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider