keystone_ui 0.83.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/lib/keystone_ui/configuration.rb +2 -1
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +16 -5
- data/the_local/agents/keystone_ui-info.md +9 -3
- 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
|
|
@@ -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
|
@@ -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: }, ...]`.
|
|
@@ -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`**.
|
|
@@ -139,8 +140,13 @@ One decision: is keystone_ui set up in the app?
|
|
|
139
140
|
share sit on the same row, a line only the first text has is marked removed
|
|
140
141
|
with a minus, a line only the second has is marked added with a plus, the
|
|
141
142
|
other side shows a blank row beside either one, and each side numbers its own
|
|
142
|
-
lines. On a phone the first text's column sits above the second's. It
|
|
143
|
-
|
|
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.
|
|
144
150
|
- **Semantic colour.** The themed hue is `accent-*` and the themed neutrals are
|
|
145
151
|
`surface-*`, CSS custom properties whose defaults (blue and zinc) come from
|
|
146
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
|