showcase-rails 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29e0e0059cf53cd0d451d1f5018bee11ee70957dbe6c01bd286cfc38647922c1
4
- data.tar.gz: fa52f4fb277dd3236fa8f831d6ab124094206dbcc5b7b88b84f5717ec82dd349
3
+ metadata.gz: 2adc4a47c5a8ed232806aa549ba9f06ed31dbfdce4f5ddcc0b3870c5b98238b1
4
+ data.tar.gz: 0b020029eb9033a4bf4301d89ab8e126a830863db386f4b53379a1a3cc20c28d
5
5
  SHA512:
6
- metadata.gz: f6c4dea89446707034687d3677bf9960fccb8aacec4ddec9a7827ee1e7979fe6c48b987cb7e82858ca7ec32b03cb2194c5aba6d68603f271fd44efe204a91cd8
7
- data.tar.gz: b14391d1b133b50b11c396cdc076041dd0a8791141191233736c475db2d617701504a37e85dd5799da77bd5a960ecd2ae6706fe8578f7bdac8976030a5fe21df
6
+ metadata.gz: 5441474266e6a2316ff5756c49bcf3c4933fc805f7f55ff24884ac68fb2696e4365bb0ca1db89237006c3e51d916e11d685862b5dab0177eca6a18fb616e5211
7
+ data.tar.gz: 1b7c20bdc9e88829e5fbfe8aedaffa31af65010d9d8460c5fffb58dae6f42d48eb6f04c9a58edc7a84a43574fd90710ffa831ecbfbc6c7f4c7196dc6566300ed
data/README.md CHANGED
@@ -175,7 +175,7 @@ Add these lines to your application's Gemfile. See next section for why Showcase
175
175
  ```ruby
176
176
  group :development, :test do
177
177
  gem "showcase-rails"
178
- gem "rouge" # Optional. For out-of-the-box syntax highlighting.
178
+ gem "rouge", require: false # Syntax highlighting, `require: false` lets Showcase handle loading and saves boot time.
179
179
  end
180
180
  ```
181
181
 
@@ -228,7 +228,7 @@ end
228
228
 
229
229
  ### Syntax Highlighting
230
230
 
231
- Add `gem "rouge"` to your Gemfile and Showcase will set syntax highlighting up for you. Any denoted syntaxes in your samples are then highlighted, e.g.:
231
+ Add `gem "rouge", require: false` to your Gemfile and Showcase will set syntax highlighting up for you. Any denoted syntaxes in your samples are then highlighted, e.g.:
232
232
 
233
233
  ```erb
234
234
  # app/views/showcase/previews/_plain_ruby.ruby
@@ -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
  }
@@ -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,6 +1,10 @@
1
1
  <main class="sc-flex sc-flex-wrap dark:sc-bg-neutral-900 dark:sc-text-white" aria-labelledby="showcase_main_title">
2
2
  <section class="sc-grid sc-grid-cols-12 sc-w-full">
3
- <nav class="sc-col-span-3 xl:sc-col-span-2 sc-h-full sc-border-0 sc-border-r sc-border-solid sc-border-gray-200">
3
+ <nav
4
+ id="showcase-nav"
5
+ data-turbo-permanent
6
+ class="sc-col-span-3 xl:sc-col-span-2 sc-h-full sc-border-0 sc-border-r sc-border-solid sc-border-gray-200"
7
+ >
4
8
  <h1 id="showcase_main_title" class="sc-font-black sc-text-2xl sc-m-0">
5
9
  <%= link_to "Showcase", root_url, class: "sc-link sc-block sc-pt-5 sc-pb-2 sc-pl-4" %>
6
10
  </h1>
@@ -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.2"
2
+ VERSION = "0.4.4"
3
3
  end
data/lib/showcase.rb CHANGED
@@ -1,12 +1,5 @@
1
1
  require_relative "showcase/version"
2
2
 
3
- # Activate the app-bundled Rouge gem to setup default syntax highlighting.
4
- begin
5
- gem "rouge"
6
- require "rouge"
7
- rescue LoadError
8
- end
9
-
10
3
  module Showcase
11
4
  autoload :PreviewsTest, "showcase/previews_test"
12
5
  autoload :RouteHelper, "showcase/route_helper"
@@ -19,16 +12,22 @@ module Showcase
19
12
  end
20
13
  self.tree_opens = true # All open by default
21
14
 
22
- singleton_class.attr_accessor :sample_renderer
23
- @sample_renderer = proc { _1 }
24
-
25
- if defined?(Rouge)
26
- Formatter = Rouge::Formatters::HTML.new
27
-
28
- @sample_renderer = ->(source, syntax) do
29
- lexed = Rouge::Lexer.find(syntax).lex(source)
30
- Showcase::Formatter.format(lexed).html_safe
31
- end
15
+ singleton_class.attr_writer :sample_renderer
16
+
17
+ def self.sample_renderer
18
+ @sample_renderer ||=
19
+ begin
20
+ gem "rouge" # Activate the app-bundled Rouge gem to setup default syntax highlighting.
21
+ require "rouge"
22
+
23
+ formatter = Rouge::Formatters::HTML.new
24
+ @sample_renderer = ->(source, syntax) do
25
+ lexed = Rouge::Lexer.find(syntax).lex(source)
26
+ formatter.format(lexed).html_safe
27
+ end
28
+ rescue LoadError
29
+ proc { _1 }
30
+ end
32
31
  end
33
32
 
34
33
  def self.previews
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.2
4
+ version: 0.4.4
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-27 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