Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.4
3.3.6
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ group :development do
gem "puma"
gem "rspec"
gem "rspec-rails"
gem "ruby-lsp"
gem "ruby-lsp", ">= 0.23"
gem "sprockets-rails"

# gem 'better_errors'
Expand Down
33 changes: 17 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PATH
remote: .
specs:
phlex_storybook (0.4.2)
phlex_storybook (1.0.0)
importmap-rails
phlex-icons (~> 0.11.0)
phlex-rails (~> 1.2)
phlex-icons (>= 2)
phlex-rails (~> 2.0.0.rc1)
rails (>= 7, < 8)
rouge (~> 4.3.0)
stimulus-rails
Expand Down Expand Up @@ -158,7 +158,7 @@ GEM
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
language_server-protocol (3.17.0.3)
language_server-protocol (3.17.0.4)
logger (1.6.0)
loofah (2.22.0)
crass (~> 1.0.2)
Expand Down Expand Up @@ -201,17 +201,18 @@ GEM
faraday (>= 1, < 3)
sawyer (~> 0.9)
overmind (2.5.1)
overmind (2.5.1-aarch64-linux)
overmind (2.5.1-arm-linux)
overmind (2.5.1-arm64-darwin)
overmind (2.5.1-x86-linux)
overmind (2.5.1-x86_64-darwin)
phlex (1.10.3)
phlex-icons (0.11.0)
phlex (~> 1.10)
phlex-rails (1.2.1)
phlex (~> 1.10.0)
railties (>= 6.1, < 8)
prism (1.0.0)
phlex (2.0.0.rc1)
phlex-icons (2.8.0)
phlex (>= 1.11)
phlex-rails (2.0.0.rc1)
phlex (= 2.0.0.rc1)
railties (>= 6.1, < 9)
prism (1.3.0)
protocol-hpack (1.5.0)
protocol-http (0.33.0)
protocol-http1 (0.22.0)
Expand Down Expand Up @@ -264,7 +265,7 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rbs (3.5.3)
rbs (3.8.1)
logger
rdoc (6.7.0)
psych (>= 4.0.0)
Expand Down Expand Up @@ -292,16 +293,16 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
ruby-lsp (0.17.17)
ruby-lsp (0.23.8)
language_server-protocol (~> 3.17.0)
prism (~> 1.0)
prism (>= 1.2, < 2.0)
rbs (>= 3, < 4)
sorbet-runtime (>= 0.5.10782)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
securerandom (0.3.1)
sorbet-runtime (0.5.11558)
sorbet-runtime (0.5.11805)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand Down Expand Up @@ -363,7 +364,7 @@ DEPENDENCIES
puma
rspec
rspec-rails
ruby-lsp
ruby-lsp (>= 0.23)
sprockets-rails
web-console

Expand Down
2 changes: 1 addition & 1 deletion lib/phlex_storybook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "fileutils"
require "importmap-rails"
require "phlex_icons"
require "phlex-icons"
require "phlex-rails"
require "phlex"
require "rouge"
Expand Down
4 changes: 2 additions & 2 deletions lib/phlex_storybook/components/icon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def initialize(icon_class, inactive_class = nil, active: false, size: nil, class
end

def view_template
render Phlex::Icons::Lucide.const_get(@icon_class).new(
classes: [icon_color, SIZES[@size], "inline", *@classes].compact.uniq.join(" "),
render PhlexIcons::Lucide.const_get(@icon_class).new(
class: [icon_color, SIZES[@size], "inline", *@classes].compact.uniq.join(" "),
)
end

Expand Down
6 changes: 3 additions & 3 deletions lib/phlex_storybook/components/stories/component_display.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def render_story_header
class: "bg-slate-700 group px-2 py-1 rounded",
) do
span(class: 'clipboard') do
render Phlex::Icons::Lucide::Copy.new(
classes: "group-enabled:stroke-slate-100 group-disabled:stroke-slate-500 size-5",
render PhlexIcons::Lucide::Copy.new(
class: "group-enabled:stroke-slate-100 group-disabled:stroke-slate-500 size-5",
)
end
span(class: 'check hidden') do
render Phlex::Icons::Lucide::CopyCheck.new(classes: "stroke-green-400 size-5")
render PhlexIcons::Lucide::CopyCheck.new(class: "stroke-green-400 size-5")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/phlex_storybook/components/stories/component_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def render_ruby_code(id, source)
pre(class: "hidden", data: { copy_target: "source" }) { source }
formatter = Rouge::Formatters::HTMLLineTable.new(Rouge::Formatters::HTML.new)
lexer = Rouge::Lexers::Ruby.new
unsafe_raw formatter.format(lexer.lex(source))
raw safe formatter.format(lexer.lex(source))
end
style do
unsafe_raw Rouge::Themes::Molokai.render(scope: "##{id}")
raw safe Rouge::Themes::Molokai.render(scope: "##{id}")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/phlex_storybook/tasks/sample_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class SampleComponent < Phlex::HTML
def view_template(&)
script(type: "module") { unsafe_raw js }
style { unsafe_raw css }
script(type: "module") { raw safe js }
style { raw safe css }
div(data: { controller: "test" }) do
h1 { "Hello World" }
# render MyComponent.new
Expand Down
4 changes: 2 additions & 2 deletions lib/phlex_storybook/tasks/sample_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def view_template(&)
csp_meta_tag
end
body do
script(type: "module") { unsafe_raw js }
style { unsafe_raw css }
script(type: "module") { raw safe js }
style { raw safe css }
div(data: { controller: "test" }) do
h1 { "Hello World" }
# render MyComponent.new
Expand Down
2 changes: 1 addition & 1 deletion lib/phlex_storybook/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module PhlexStorybook
VERSION = "0.4.2"
VERSION = "1.0.0"
end
4 changes: 2 additions & 2 deletions phlex_storybook.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ Gem::Specification.new do |spec|
end

spec.add_dependency "importmap-rails"
spec.add_dependency "phlex-rails", "~> 1.2"
spec.add_dependency "phlex-rails", "~> 2.0.0.rc1"
spec.add_dependency "rails", ">= 7", "< 8"
spec.add_dependency "stimulus-rails"
spec.add_dependency "tailwindcss-rails", "~> 2.7"
spec.add_dependency "turbo-rails"
spec.add_dependency "turbo_power", "~> 0.6.2"
spec.add_dependency "phlex-icons", "~> 0.11.0"
spec.add_dependency "phlex-icons", ">= 2"
spec.add_dependency "rouge", "~> 4.3.0"
end
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ def view_template
div(class: 'rendered-results-preview') do
h1 { 'Rendered Results Preview' }
hr
unsafe_raw @html
raw safe @html
hr
end

div(class: 'rendered-results-preview raw-html') do
h1(style: "font-family: Karla, sans-serif") { 'Raw HTML' }
div(class: 'highlight') { unsafe_raw @formatter.format(@lexer.lex(@html)) if @html }
div(class: 'highlight') { raw safe @formatter.format(@lexer.lex(@html)) if @html }
end
end

Expand Down
Loading