basecoat 1.1.1 → 2.0.1

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: 3273d016589877e63365f54753ec24490331270a14f2870024cf2c17e643d432
4
- data.tar.gz: 48df591a8457651c29693b4a7430973146ca90b805307d99517da7525fdb9741
3
+ metadata.gz: 1211adbec8da355fa5ec5c1794561f8637b1a0cc08441ad67c560fe550f12b1e
4
+ data.tar.gz: 9e7569725fcfd26c137868fa764d6302b29c1011bda90d00a39e253f857a2474
5
5
  SHA512:
6
- metadata.gz: 38950b35cb6a9e208f26876d42333ee6c48f08b2feb04f87af01696092b3ba414bf0a350ad55068ee93d42412e6cebc866c59cf5fe4428bc829a28159863187a
7
- data.tar.gz: 5578532de781f2fc679a7742d407f0982eaa58f649b5d896b6bce361e19351173673bf889c1eef78790643d3a5ef2bb01f69d2e6fbd4bf5a6d0367502cd4cf7e
6
+ metadata.gz: 0037adf9df5619c1402db0216bb281f340b5008b954a2cb0c1f278165909d5306037183dd93f839a18b09126a5edec914efab7380c339e928ff0144e3d5145d7
7
+ data.tar.gz: b0ebf8d1841064e080c81a4a3ad57cacff757fa78b6e3f1d9534f200e68702d5f4376645ba12aad92509acfea0a0aa28514e54f71370b432a0405209bf924873
data/README.md CHANGED
@@ -5,12 +5,10 @@ It is especially powerful for admin applications with a lot of CRUD actions.
5
5
 
6
6
  Beautiful responsive, dark & light mode Rails scaffolds, pages for authentication and Devise, and pagy styling.
7
7
 
8
- Login:
8
+
9
9
  ![Basecoat Login](basecoat-login.png)
10
- Index:
11
- ![Basecoat Index](basecoat-index.png)
12
- Form, mobile dark mode:
13
- ![Basecoat Dark Form](basecoat-dark-form.png)
10
+
11
+ ![Basecoat Index](basecoat-new.png)
14
12
 
15
13
  ## Why?
16
14
 
data/basecoat-new.png ADDED
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Basecoat
4
- VERSION = "1.1.1"
4
+ VERSION = "2.0.1"
5
5
  end
@@ -7,7 +7,7 @@
7
7
  </div>
8
8
  <div class="grid flex-1 text-left text-sm leading-tight">
9
9
  <span class="truncate font-medium">Basecoat</span>
10
- <span class="truncate text-xs">v0.0.1</span>
10
+ <span class="truncate text-xs">v0.3.3</span>
11
11
  </div>
12
12
  </a>
13
13
  </header>
@@ -1,4 +1,4 @@
1
- <button type="button" aria-label="Toggle dark mode" data-tooltip="Toggle dark mode" data-side="left" data-action="click->theme#toggle" class="btn-icon-outline size-8">
1
+ <button type="button" aria-label="Toggle dark mode" data-tooltip="Toggle dark mode" data-side="left" data-action="click->theme#toggle" class="btn-ghost size-8">
2
2
  <span class="hidden dark:block"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="m4.93 4.93 1.41 1.41"></path><path d="m17.66 17.66 1.41 1.41"></path><path d="M2 12h2"></path><path d="M20 12h2"></path><path d="m6.34 17.66-1.41 1.41"></path><path d="m19.07 4.93-1.41 1.41"></path></svg></span>
3
3
  <span class="block dark:hidden"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg></span>
4
4
  </button>
@@ -6,7 +6,7 @@
6
6
  <p>Sign in to your account to continue.</p>
7
7
  </header>
8
8
  <section class="space-y-4">
9
- <%= form_with url: session_url, html: { class: "grid gap-6" } do |form| %>
9
+ <%= form_with url: session_url, html: { data: { turbo: false }, class: "grid gap-6" } do |form| %>
10
10
  <div class="grid gap-3">
11
11
  <%= form.label :email_address, "Email", class: "label" %>
12
12
  <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", value: params[:email_address], class: "input" %>
@@ -0,0 +1,16 @@
1
+ <div class="flex mt-10 flex-1 flex-col items-center justify-center gap-6">
2
+ <header class="flex max-w-sm flex-col items-center gap-2 text-center">
3
+ <div class="mb-2 bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg">
4
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 10.5 8 13l2 2.5" /><path d="m14 10.5 2 2.5-2 2.5" /><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z" /></svg>
5
+ </div>
6
+ <h3 class="text-lg font-medium tracking-tight">No <%= resource_name %> yet</h3>
7
+ <p class="text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4">
8
+ Get started by creating your first <%= resource_name.singularize %>.
9
+ </p>
10
+ </header>
11
+ <section class="flex w-full max-w-sm flex-col items-center gap-4 text-sm text-balance">
12
+ <div class="flex gap-2">
13
+ <%= link_to "New #{resource_name.singularize}", new_path, class: "btn", data: { turbo_action: "advance" } %>
14
+ </div>
15
+ </section>
16
+ </div>
@@ -32,7 +32,7 @@ namespace :basecoat do
32
32
 
33
33
  unless importmap_content.include?("basecoat-css")
34
34
  File.open(importmap_path, "a") do |f|
35
- f.puts "\npin \"basecoat-css/all\", to: \"https://cdn.jsdelivr.net/npm/basecoat-css@0.3.2/dist/js/all.js\""
35
+ f.puts "\npin \"basecoat-css/all\", to: \"https://cdn.jsdelivr.net/npm/basecoat-css@0.3.3/dist/js/all.js\""
36
36
  end
37
37
  puts " Added: basecoat-css to config/importmap.rb"
38
38
  end
@@ -58,16 +58,10 @@ namespace :basecoat do
58
58
  puts " Added: basecoat-css import to app/javascript/application.js"
59
59
  end
60
60
 
61
- # Add basecoat helper JavaScript directly to application.js
61
+ # Add cool view transition to application.js
62
62
  js_content = File.read(js_path)
63
63
  unless js_content.include?("Re-initialize basecoat-css components")
64
64
  basecoat_js = <<~JS
65
-
66
- // Re-initialize basecoat-css components after Turbo navigation
67
- document.addEventListener('turbo:load', () => {
68
- document.dispatchEvent(new Event('DOMContentLoaded', { bubbles: true, cancelable: false }))
69
- })
70
-
71
65
  // View transitions for turbo frame navigation
72
66
  addEventListener("turbo:before-frame-render", (event) => {
73
67
  if (document.startViewTransition) {
@@ -80,7 +74,7 @@ namespace :basecoat do
80
74
  })
81
75
  JS
82
76
  File.open(js_path, "a") { |f| f.write(basecoat_js) }
83
- puts " Added: Basecoat helper JavaScript to app/javascript/application.js"
77
+ puts " Added: cool view transition to app/javascript/application.js"
84
78
  end
85
79
 
86
80
  # Copy theme_controller.js
@@ -179,6 +173,17 @@ namespace :basecoat do
179
173
  puts " Created: app/views/layouts/#{filename}"
180
174
  end
181
175
 
176
+ # Copy shared partials
177
+ shared_source = File.expand_path("../generators/basecoat/templates/shared", __dir__)
178
+ shared_destination = Rails.root.join("app/views/shared")
179
+
180
+ FileUtils.mkdir_p(shared_destination)
181
+ Dir.glob("#{shared_source}/*").each do |file|
182
+ filename = File.basename(file)
183
+ FileUtils.cp(file, shared_destination.join(filename))
184
+ puts " Created: app/views/shared/#{filename}"
185
+ end
186
+
182
187
  # Copy scaffold hook initializer
183
188
  initializer_source = File.expand_path("../generators/basecoat/templates/scaffold_hook.rb", __dir__)
184
189
  initializer_destination = Rails.root.join("config/initializers/scaffold_hook.rb")
@@ -220,8 +225,8 @@ namespace :basecoat do
220
225
 
221
226
  <% if defined?(user_signed_in?) && user_signed_in? %>
222
227
  <div id="dropdown-user" class="dropdown-menu">
223
- <button type="button" id="dropdown-user-trigger" aria-haspopup="menu" aria-controls="dropdown-user-menu" aria-expanded="false" class="btn-icon-ghost rounded-full size-8">
224
- <img alt="<%= current_user.email %>" src="https://github.com/lafeber.png" class="size-8 shrink-0 rounded-full">
228
+ <button type="button" id="dropdown-user-trigger" aria-haspopup="menu" aria-controls="dropdown-user-menu" aria-expanded="false" class="btn-ghost size-8">
229
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-user-icon lucide-circle-user"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="10" r="3"/><path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662"/></svg>
225
230
  </button>
226
231
  <div id="dropdown-user-popover" data-popover="" aria-hidden="true" data-align="end">
227
232
  <div role="menu" id="dropdown-user-menu" aria-labelledby="dropdown-user-trigger">
@@ -326,8 +331,8 @@ namespace :basecoat do
326
331
 
327
332
  <% if defined?(Current) && defined?(Current.user) && Current.user %>
328
333
  <div id="dropdown-user" class="dropdown-menu">
329
- <button type="button" id="dropdown-user-trigger" aria-haspopup="menu" aria-controls="dropdown-user-menu" aria-expanded="false" class="btn-icon-ghost rounded-full size-8">
330
- <img alt="<%= Current.user.email_address %>" src="https://github.com/lafeber.png" class="size-8 shrink-0 rounded-full">
334
+ <button type="button" id="dropdown-user-trigger" aria-haspopup="menu" aria-controls="dropdown-user-menu" aria-expanded="false" class="btn-ghost size-8">
335
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-user-icon lucide-circle-user"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="10" r="3"/><path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662"/></svg>
331
336
  </button>
332
337
  <div id="dropdown-user-popover" data-popover="" aria-hidden="true" data-align="end">
333
338
  <div role="menu" id="dropdown-user-menu" aria-labelledby="dropdown-user-trigger">
@@ -1,15 +1,15 @@
1
- <%%= form_with(model: <%= model_resource_name %>, class: "space-y-6") do |form| %>
1
+ <%%= form_with(model: <%= model_resource_name %>, class: "space-y-4") do |form| %>
2
2
  <%%= render "/layouts/form_errors", object: <%= singular_table_name %> if <%= singular_table_name %>.errors.any? %>
3
3
 
4
4
  <% attributes.each do |attribute| -%>
5
5
  <% required = attribute.to_s.include?('{null}') -%>
6
- <div class="grid gap-3">
6
+ <div class="field">
7
7
  <% if attribute.password_digest? -%>
8
8
  <%%= form.label :password, class: "label" %>
9
9
  <%%= form.password_field :password, class: "input", required: true %>
10
10
  </div>
11
11
 
12
- <div class="grid gap-3">
12
+ <div class="field">
13
13
  <%%= form.label :password_confirmation, class: "label" %>
14
14
  <%%= form.password_field :password_confirmation, class: "input", required: true %>
15
15
  <% elsif attribute.attachments? -%>
@@ -45,15 +45,6 @@
45
45
  </div>
46
46
 
47
47
  <%% if @<%= plural_table_name %>.empty? %>
48
- <div class="text-center py-12">
49
- <div class="mb-4">
50
- <svg class="mx-auto h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
51
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2M4 13h2m13-8V4a1 1 0 00-1-1H7a1 1 0 00-1 1v1h10z" />
52
- </svg>
53
- </div>
54
- <h3 class="text-lg font-medium mb-2">No <%= human_name.pluralize.downcase %> yet</h3>
55
- <p class="mb-6">Get started by creating your first <%= human_name.downcase %>.</p>
56
- <%%= link_to "New <%= human_name.downcase %>", <%= new_helper(type: :path) %>, class: "btn", data: { turbo_action: "advance" } %>
57
- </div>
48
+ <%%= render "shared/empty", resource_name: "<%= human_name.pluralize.downcase %>", new_path: <%= new_helper(type: :path) %> %>
58
49
  <%% end %>
59
50
  <%% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basecoat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martijn Lafeber
@@ -40,9 +40,8 @@ files:
40
40
  - LICENSE.txt
41
41
  - README.md
42
42
  - Rakefile
43
- - basecoat-dark-form.png
44
- - basecoat-index.png
45
43
  - basecoat-login.png
44
+ - basecoat-new.png
46
45
  - lib/basecoat.rb
47
46
  - lib/basecoat/railtie.rb
48
47
  - lib/basecoat/version.rb
@@ -75,6 +74,7 @@ files:
75
74
  - lib/generators/basecoat/templates/scaffold_hook.rb
76
75
  - lib/generators/basecoat/templates/sessions.html.erb
77
76
  - lib/generators/basecoat/templates/sessions/new.html.erb
77
+ - lib/generators/basecoat/templates/shared/_empty.html.erb
78
78
  - lib/generators/basecoat/templates/theme_controller.js
79
79
  - lib/tasks/basecoat.rake
80
80
  - lib/templates/erb/scaffold/_form.html.erb.tt
Binary file
data/basecoat-index.png DELETED
Binary file