Skip to content

Commit

Permalink
Add standardrb and apply standardization to lib/*
Browse files Browse the repository at this point in the history
  • Loading branch information
coderberry committed Jan 3, 2024
1 parent f24761a commit 47ec075
Show file tree
Hide file tree
Showing 130 changed files with 2,323 additions and 2,174 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/standardrb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: StandardRB

on:
pull_request:
branches:
- "*"
push:
branches:
- main

jobs:
standard:
name: StandardRB Check Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec standardrb --format progress
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.2
2 changes: 2 additions & 0 deletions .standardrb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
parallel: true
ruby_version: 3.2
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

source "https://rubygems.org"
gemspec

gem "standard", "~> 1.0"
93 changes: 93 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
PATH
remote: .
specs:
phlex_ui (0.1.4)
phlex (~> 1.7)
rouge (~> 4.2.0)
ruby-next (~> 1.0)
zeitwerk (~> 2.6)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
cgi (0.4.1)
concurrent-ruby (1.2.2)
diff-lcs (1.5.0)
erb (4.0.3)
cgi (>= 0.3.3)
json (2.7.1)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
paco (0.2.3)
parallel (1.24.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
phlex (1.9.0)
concurrent-ruby (~> 1.2)
erb (>= 4)
zeitwerk (~> 2.6)
racc (1.7.3)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.8.3)
require-hooks (0.2.2)
rexml (3.2.6)
rouge (4.2.0)
rubocop (1.59.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-performance (1.20.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-next (1.0.0)
paco (~> 0.2)
require-hooks (~> 0.2)
ruby-next-core (= 1.0.0)
ruby-next-parser (>= 3.2.2.0)
unparser (~> 0.6.0)
ruby-next-core (1.0.0)
ruby-next-parser (3.2.2.0)
parser (>= 3.0.3.1)
ruby-progressbar (1.13.0)
standard (1.33.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.59.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.3)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.3.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.20.1)
unicode-display_width (2.5.0)
unparser (0.6.10)
diff-lcs (~> 1.3)
parser (>= 3.2.2.4)
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin-23
ruby

DEPENDENCIES
phlex_ui!
rake
ruby-next (~> 1.0)
standard (~> 1.0)

BUNDLED WITH
2.5.3
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# PhlexUI

A UI component library, crafted precisely for Ruby devs who want to stay organized and build modern apps, fast.

Visit [phlexui.com](https://phlexui.com) for more information.
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "standard/rake"
13 changes: 9 additions & 4 deletions lib/phlex_ui.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
require 'phlex'
require 'zeitwerk'
require "ruby-next"

require "ruby-next/language/setup"
RubyNext::Language.setup_gem_load_path(transpile: true)

require "phlex"
require "zeitwerk"

loader = Zeitwerk::Loader.for_gem
loader.inflector.inflect(
"phlex_ui" => "PhlexUI",
"phlex_ui" => "PhlexUI"
)
loader.setup # ready!

module PhlexUI
end

loader.eager_load
loader.eager_load
20 changes: 10 additions & 10 deletions lib/phlex_ui/accordion.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# frozen_string_literal: true

module PhlexUI
class Accordion < Base
def template(&)
div(**attrs, &)
end
class Accordion < Base
def template(&)
div(**attrs, &)
end

private
private

def default_attrs
{
class: 'w-full'
}
end
def default_attrs
{
class: "w-full"
}
end
end
end
30 changes: 15 additions & 15 deletions lib/phlex_ui/accordion/builder.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# frozen_string_literal: true

module PhlexUI
class Accordion::Builder < Base
def template(&block)
render PhlexUI::Accordion.new(**attrs) do
block.call
end
end
class Accordion::Builder < Base
def template(&block)
render PhlexUI::Accordion.new(**attrs) do
block.call
end
end

def add_item(title, content, open: false)
render Accordion::Item.new(open: open) do
render PhlexUI::Accordion::Trigger.new do
render PhlexUI::Accordion::DefaultTrigger.new { title }
end
render PhlexUI::Accordion::Content.new do
render PhlexUI::Accordion::DefaultContent.new { content }
end
end
def add_item(title, content, open: false)
render Accordion::Item.new(open: open) do
render PhlexUI::Accordion::Trigger.new do
render PhlexUI::Accordion::DefaultTrigger.new { title }
end
render PhlexUI::Accordion::Content.new do
render PhlexUI::Accordion::DefaultContent.new { content }
end
end
end
end
end
30 changes: 15 additions & 15 deletions lib/phlex_ui/accordion/content.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# frozen_string_literal: true

module PhlexUI
class Accordion::Content < Base
def template(&)
div(**attrs, &)
end
class Accordion::Content < Base
def template(&)
div(**attrs, &)
end

private
private

def default_attrs
{
data: {
accordion_target: "content"
},
class: 'overflow-y-hidden',
style: 'height: 0px;'
}
end
def default_attrs
{
data: {
accordion_target: "content"
},
class: "overflow-y-hidden",
style: "height: 0px;"
}
end
end
end
end
22 changes: 11 additions & 11 deletions lib/phlex_ui/accordion/default_content.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# frozen_string_literal: true

module PhlexUI
class Accordion::DefaultContent < Base
def template(&)
div(**attrs, &)
end
class Accordion::DefaultContent < Base
def template(&)
div(**attrs, &)
end

private
private

def default_attrs
{
class: 'pb-4 pt-0 text-sm'
}
end
def default_attrs
{
class: "pb-4 pt-0 text-sm"
}
end
end
end
end
28 changes: 14 additions & 14 deletions lib/phlex_ui/accordion/default_trigger.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# frozen_string_literal: true

module PhlexUI
class Accordion::DefaultTrigger < Base
def template(&)
div(class: "flex items-center justify-between w-full") do
p(&)
render ::PhlexUI::Accordion::Icon.new
end
end
class Accordion::DefaultTrigger < Base
def template(&)
div(class: "flex items-center justify-between w-full") do
p(&)
render ::PhlexUI::Accordion::Icon.new
end
end

def default_attrs
{
data: { action: "click->accordion#toggle" },
class: 'w-full flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline'
}
end
def default_attrs
{
data: {action: "click->accordion#toggle"},
class: "w-full flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline"
}
end
end
end
end
Loading

0 comments on commit 47ec075

Please sign in to comment.