Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade phlex to v2 beta #154

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
22 changes: 9 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,17 @@ jobs:
name: StandardRB Check Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec standardrb --format progress
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec standardrb --format progress
tests:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
ruby-version:
- "3.2"
- "3.3"
- "head"
fail-fast: false
matrix:
os: ["ubuntu-latest"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SethHorsley , you don't want to test with ruby 3.2, 3.3 and head?


name: Running minitest
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ruby 3.3.5

8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: .
specs:
rbui (1.0.0.pre.alpha.3)
phlex (~> 1.10)
rbui (1.0.0.pre.alpha.4)
phlex (>= 1.10)
rouge (~> 4.2.0)
tailwind_merge (>= 0.12)

Expand All @@ -19,7 +19,7 @@ GEM
parser (3.3.3.0)
ast (~> 2.4.1)
racc
phlex (1.11.0)
phlex (2.0.0.beta2)
racc (1.8.0)
rainbow (3.1.1)
rake (13.2.1)
Expand Down Expand Up @@ -57,7 +57,7 @@ GEM
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
strscan (3.1.0)
tailwind_merge (0.13.0)
tailwind_merge (0.13.1)
lru_redux (~> 1.1)
unicode-display_width (2.5.0)

Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/alert/alert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def colors
def default_attrs
base_classes = "backdrop-blur relative w-full ring-1 ring-inset rounded-lg px-4 py-4 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-8"
{
class: tokens(base_classes, colors)
class: [base_classes, colors]
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/alert_dialog/alert_dialog_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RBUI
class AlertDialogContent < Base
def view_template(&block)
template_tag(**attrs) do
template(**attrs) do
div(data: {controller: "rbui--alert-dialog"}) do
background
container(&block)
Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/avatar/avatar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def view_template(&)

def default_attrs
{
class: tokens("relative flex shrink-0 overflow-hidden rounded-full", @size_classes)
class: ["relative flex shrink-0 overflow-hidden rounded-full", @size_classes]
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/badge/badge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def view_template(&)

def default_attrs
{
class: tokens("inline-flex items-center rounded-md font-medium ring-1 ring-inset", SIZES[@size], COLORS[@variant])
class: ["inline-flex items-center rounded-md font-medium ring-1 ring-inset", SIZES[@size], COLORS[@variant]]
}
end
end
Expand Down
24 changes: 12 additions & 12 deletions lib/rbui/button/button.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,45 +35,45 @@ def size_classes
end

def primary_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90",
size_classes
)
]
end

def link_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 text-primary underline-offset-4 hover:underline",
size_classes
)
]
end

def secondary_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-secondary text-secondary-foreground hover:bg-opacity-80",
size_classes
)
]
end

def destructive_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
size_classes
)
]
end

def outline_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
size_classes
)
]
end

def ghost_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground",
size_classes
)
]
end

def default_classes
Expand Down
18 changes: 9 additions & 9 deletions lib/rbui/calendar/calendar_days.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def render_selected_date_template
data_action: "click->rbui--calendar#selectDay",
name: "day",
class:
tokens(
[
BASE_CLASS,
"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground"
),
],
role: "gridcell",
tabindex: "0",
type: "button",
Expand All @@ -39,10 +39,10 @@ def render_today_date_template
data_action: "click->rbui--calendar#selectDay",
name: "day",
class:
tokens(
[
BASE_CLASS,
"bg-accent text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
),
],
role: "gridcell",
tabindex: "-1",
type: "button"
Expand All @@ -57,10 +57,10 @@ def render_current_month_date_template
data_action: "click->rbui--calendar#selectDay",
name: "day",
class:
tokens(
[
BASE_CLASS,
"bg-background text-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
),
],
role: "gridcell",
tabindex: "-1",
type: "button"
Expand All @@ -75,10 +75,10 @@ def render_other_month_date_template
data_action: " click->rbui--calendar#selectDay",
name: "day",
class:
tokens(
[
BASE_CLASS,
"bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
),
],
role: "gridcell",
tabindex: "-1",
type: "button"
Expand All @@ -87,7 +87,7 @@ def render_other_month_date_template
end

def date_template(target, &block)
template_tag(data: {rbui__calendar_target: target}) do
template(data: {rbui__calendar_target: target}) do
td(
class:
"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected])]:rounded-md",
Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/calendar/calendar_weekdays.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class CalendarWeekdays < Base
DAYS = %w[Monday Tuesday Wednesday Thursday Friday Saturday Sunday].freeze

def view_template
template_tag(data: {rbui__calendar_target: "weekdaysTemplate"}) do
template(data: {rbui__calendar_target: "weekdaysTemplate"}) do
thead(**attrs) do
tr(class: "flex") do
DAYS.each do |day|
Expand Down
4 changes: 1 addition & 3 deletions lib/rbui/codeblock/codeblock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ def codeblock
div(**attrs) do
div(class: "after:content-none") do
pre do
unsafe_raw FORMATTER.format(
lexer.lex(@code)
)
raw(safe(FORMATTER.format(lexer.lex(@code))))
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/rbui/command/command_dialog_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(size: :md, **attrs)
end

def view_template(&block)
template_tag(data: {rbui__command_target: "content"}) do
template(data: {rbui__command_target: "content"}) do
div(data: {controller: "rbui--command"}) do
backdrop
div(**attrs, &block)
Expand All @@ -30,10 +30,10 @@ def view_template(&block)
def default_attrs
{
data_state: "open",
class: tokens(
class: [
"fixed pointer-events-auto left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
SIZES[@size]
)
]
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/command/command_dialog_trigger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def view_template(&)
def default_attrs
{
data: {
action: tokens("click->rbui--command#open", @keybindings.join(" "))
action: ["click->rbui--command#open", @keybindings.join(" ")]
}
}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/context_menu/context_menu_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RBUI
class ContextMenuContent < Base
def view_template(&block)
template_tag(data: {rbui__context_menu_target: "content"}) do
template(data: {rbui__context_menu_target: "content"}) do
div(**attrs, &block)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/context_menu/context_menu_label.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def inset? = @inset

def default_attrs
{
class: tokens("px-2 py-1.5 text-sm font-semibold text-foreground", inset?: "pl-8")
class: ["px-2 py-1.5 text-sm font-semibold text-foreground", inset?: "pl-8"]
}
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/rbui/dialog/dialog_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(size: :md, **attrs)
end

def view_template
template_tag(data: {rbui__dialog_target: "content"}) do
template(data: {rbui__dialog_target: "content"}) do
div(data_controller: "rbui--dialog") do
backdrop
div(**attrs) do
Expand All @@ -33,10 +33,10 @@ def view_template
def default_attrs
{
data_state: "open",
class: tokens(
class: [
"fixed pointer-events-auto left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
SIZES[@size]
)
]
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rbui/hover_card/hover_card_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RBUI
class HoverCardContent < Base
def view_template(&block)
template_tag(data: {rbui__hover_card_target: "content"}) do
template(data: {rbui__hover_card_target: "content"}) do
div(**attrs, &block)
end
end
Expand Down
24 changes: 12 additions & 12 deletions lib/rbui/link/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,45 +35,45 @@ def size_classes
end

def primary_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90",
size_classes
)
]
end

def link_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 text-primary underline-offset-4 hover:underline",
size_classes
)
]
end

def secondary_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-secondary text-secondary-foreground hover:bg-opacity-80",
size_classes
)
]
end

def destructive_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
size_classes
)
]
end

def outline_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
size_classes
)
]
end

def ghost_classes
tokens(
[
"whitespace-nowrap inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground",
size_classes
)
]
end

def default_classes
Expand Down
4 changes: 2 additions & 2 deletions lib/rbui/pagination/pagination_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def view_template(&block)
def default_attrs
{
aria: {current: @active ? "page" : nil},
class: tokens(
class: [
RBUI::Button.new(variant: @active ? :outline : :ghost).attrs[:class]
)
]
}
end
end
Expand Down
Loading