showcase-rails 0.4.1 → 0.4.3

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: 0c5d33100bd6414501e65b9739978d060032490a480bcf17cac74b689c556605
4
- data.tar.gz: ac2cf1b91db211cce86ad10ac4b9acc9dbfd5c19a7d4fdda17e853b3e81ebade
3
+ metadata.gz: 62a983038704732db89c5b41327a4787c562920c8ad849809e400a09990bc5b1
4
+ data.tar.gz: 02d378f6e837f91d623d09547469b4bce8c7b07ffc47d394c1d8df0621c28257
5
5
  SHA512:
6
- metadata.gz: 754d2bfcd10de161792834a56b470dc88652ac393429295d794e05b6c97b8da6a309af9aad284456742f34fde3faa6f7de50583f43f341178e2a0f22f13e314d
7
- data.tar.gz: 2bb6891dd5236ce84728bb6c86db146de9724152f471b5e7f71fd1149941866572e9e2d5fd23e575e87019db5c62eb4597ef3807e28b3c20c33265cc896c479d
6
+ metadata.gz: ede2f638590dd154fc5e45d0ab186ff25bea725033655361a286ea2677cf3406fd042dd459e82b00a8b0dcf266ea128ec02df3bbd352ba602e889254dfdc1181
7
+ data.tar.gz: 4f0a46f8364fa27e8066c20313e3c6a10abf3e7dbfa893f656e439367d444438c34c667e713374aa3ea124e86eb205bd7d14f01b34675c23831fd6aabe108ff9
@@ -40,6 +40,9 @@ pre {
40
40
  --tw-pan-y: ;
41
41
  --tw-pinch-zoom: ;
42
42
  --tw-scroll-snap-strictness: proximity;
43
+ --tw-gradient-from-position: ;
44
+ --tw-gradient-via-position: ;
45
+ --tw-gradient-to-position: ;
43
46
  --tw-ordinal: ;
44
47
  --tw-slashed-zero: ;
45
48
  --tw-numeric-figure: ;
@@ -87,6 +90,9 @@ pre {
87
90
  --tw-pan-y: ;
88
91
  --tw-pinch-zoom: ;
89
92
  --tw-scroll-snap-strictness: proximity;
93
+ --tw-gradient-from-position: ;
94
+ --tw-gradient-via-position: ;
95
+ --tw-gradient-to-position: ;
90
96
  --tw-ordinal: ;
91
97
  --tw-slashed-zero: ;
92
98
  --tw-numeric-figure: ;
@@ -278,6 +284,10 @@ pre {
278
284
  white-space: nowrap;
279
285
  }
280
286
 
287
+ .sc-whitespace-normal {
288
+ white-space: normal;
289
+ }
290
+
281
291
  .sc-rounded-full {
282
292
  border-radius: 9999px;
283
293
  }
@@ -17,6 +17,10 @@ class Showcase::Path
17
17
  Showcase.tree_opens.call(self)
18
18
  end
19
19
 
20
+ def active?(id)
21
+ children.any? { _1.active?(id) }
22
+ end
23
+
20
24
  def ordered_children
21
25
  children.partition { !_1.is_a?(Tree) }.flatten
22
26
  end
@@ -62,6 +66,10 @@ class Showcase::Path
62
66
  cached_partial_path = "showcase/engine/path/path"
63
67
  define_method(:to_partial_path) { cached_partial_path }
64
68
 
69
+ def active?(id)
70
+ self.id == id
71
+ end
72
+
65
73
  def preview_for(view_context)
66
74
  Showcase::Preview.new(view_context, id: id, title: basename.titleize).tap(&:render_associated_partial)
67
75
  end
@@ -43,7 +43,7 @@ class Showcase::Preview
43
43
  # <%= showcase.link_to id: "extra-large" %>
44
44
  # # => <a href="components/button#extra-large"><showcase components/button#extra-large></a>
45
45
  def link_to(preview_id = id, id: nil)
46
- @view_context.link_to @view_context.preview_path(preview_id, anchor: id), class: "sc-link sc-font-mono sc-text-sm" do
46
+ @view_context.link_to Showcase::Engine.routes.url_helpers.preview_path(preview_id, anchor: id), class: "sc-link sc-font-mono sc-text-sm" do
47
47
  "<showcase #{[preview_id, id].compact.join("#").squish}>"
48
48
  end
49
49
  end
@@ -16,10 +16,10 @@
16
16
  <% option.each do |key, value| %>
17
17
  <% if key == :required %>
18
18
  <td class="sc-p-4">
19
- <%= tag.input type: :checkbox, checked: value, disabled: true if value%>
19
+ <%= tag.input type: :checkbox, checked: value, disabled: true if value %>
20
20
  </td>
21
21
  <% else %>
22
- <td class="sc-p-4"><%= tag.pre value %></td>
22
+ <td class="sc-p-4"><%= tag.pre value, class: "sc-whitespace-normal" %></td>
23
23
  <% end %>
24
24
  <% end %>
25
25
  </tr>
@@ -1,3 +1,3 @@
1
- <article class="hover:sc-bg-indigo-50 dark:hover:sc-bg-neutral-700/50 <%= "sc-bg-indigo-50 dark:sc-bg-neutral-700/50" if path.id == params[:id] %>">
1
+ <article class="hover:sc-bg-indigo-50 dark:hover:sc-bg-neutral-700/50 <%= "sc-bg-indigo-50 dark:sc-bg-neutral-700/50" if path.active? params[:id] %>">
2
2
  <%= link_to path.basename.titleize, preview_path(path.id), class: "sc-inline-block sc-py-2 sc-px-8 sc-w-full !sc-text-inherit !sc-no-underline" %>
3
3
  </article>
@@ -1,4 +1,4 @@
1
- <%= tag.details open: tree.open?, class: ["sc-flex sc-flex-col", "sc-pl-4" => !tree.root?] do %>
1
+ <%= tag.details open: tree.active?(params[:id]) || tree.open?, class: ["sc-flex sc-flex-col", "sc-pl-4" => !tree.root?] do %>
2
2
  <%= tag.summary tree.name.titleize, class: "sc-list-item hover:sc-bg-indigo-50 dark:hover:sc-bg-neutral-700/50 sc-font-medium sc-text-base sc-py-2 sc-pl-4 sc-cursor-pointer" %>
3
3
  <%= render tree.ordered_children %>
4
4
  <% end %>
@@ -1,6 +1,5 @@
1
1
  class Showcase::PreviewsTest < ActionView::TestCase
2
- extensions = [ Showcase::EngineController._helpers, Showcase::Engine.routes.url_helpers ]
3
- setup { view.extend *extensions }
2
+ setup { view.extend Showcase::EngineController._helpers }
4
3
 
5
4
  def self.inherited(test_class)
6
5
  super
@@ -1,3 +1,3 @@
1
1
  module Showcase
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.3"
3
3
  end
data/lib/showcase.rb CHANGED
@@ -12,16 +12,12 @@ module Showcase
12
12
  autoload :RouteHelper, "showcase/route_helper"
13
13
  autoload :Options, "showcase/options"
14
14
 
15
- class << self
16
- attr_reader :tree_opens
15
+ singleton_class.attr_reader :tree_opens
17
16
 
18
- def tree_opens=(opens)
19
- @tree_opens = opens.respond_to?(:call) ? opens : proc { opens }
20
- end
17
+ def self.tree_opens=(opens)
18
+ @tree_opens = opens.respond_to?(:call) ? opens : proc { opens }
21
19
  end
22
20
  self.tree_opens = true # All open by default
23
- # self.tree_opens = false # All closed by default
24
- # self.tree_opens = ->(tree) { tree.root? } # Just keep the root-level trees open.
25
21
 
26
22
  singleton_class.attr_accessor :sample_renderer
27
23
  @sample_renderer = proc { _1 }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showcase-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Pence
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-29 00:00:00.000000000 Z
12
+ date: 2023-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.4.8
106
+ rubygems_version: 3.4.10
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Showcase helps you show off and document your partials, components, view