ariadne_view_components 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +28 -0
- data/README.md +5 -1
- data/exe/tailwindcss +21 -0
- data/lib/ariadne/view_components/commands.rb +90 -0
- data/lib/ariadne/view_components/engine.rb +8 -137
- data/lib/ariadne/view_components/upstream.rb +20 -0
- data/lib/ariadne/view_components/version.rb +1 -1
- data/lib/ariadne/view_components.rb +1 -0
- data/lib/tasks/ariadne_view_components.rake +2 -1
- data/lib/tasks/build.rake +30 -0
- data/tailwind.config.js +65 -0
- metadata +11 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2784e40f38456ba75ebc2beca6c9cfc4b0affceabc204b7a34d8f6859adbc36e
|
4
|
+
data.tar.gz: aa37a547c572f7fb33218d7fc8e0ec9330364660374e562c5e692adbcf368429
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7397e543b7acef6d9db30a3f995ab5e2824b0f7fb253124d3c3a5829b073c3c90ab9acc0017d5f14c966089ff165029780eefe4d588b50727041df6422a22802
|
7
|
+
data.tar.gz: f92fb375e938162076069219e2479a052613c4f25643d6c358fd897ce708f29ef39ecb4767a1bba374f0f7bdc466ff1b2a9cb8a941b2254ead4e3b67ee85a654
|
data/LICENSE.txt
CHANGED
@@ -19,3 +19,31 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
THE SOFTWARE.
|
22
|
+
|
23
|
+
ariadne_view_components may redistribute executables from the https://github.com/tailwindlabs/tailwindcss project
|
24
|
+
|
25
|
+
The license for that software can be found at https://github.com/tailwindlabs/tailwindcss/blob/master/LICENSE
|
26
|
+
and is reproduced here for your convenience:
|
27
|
+
|
28
|
+
MIT License
|
29
|
+
|
30
|
+
Copyright (c) Adam Wathan <adam.wathan@gmail.com>
|
31
|
+
Copyright (c) Jonathan Reinink <jonathan@reinink.ca>
|
32
|
+
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
34
|
+
of this software and associated documentation files (the "Software"), to deal
|
35
|
+
in the Software without restriction, including without limitation the rights
|
36
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
37
|
+
copies of the Software, and to permit persons to whom the Software is
|
38
|
+
furnished to do so, subject to the following conditions:
|
39
|
+
|
40
|
+
The above copyright notice and this permission notice shall be included in all
|
41
|
+
copies or substantial portions of the Software.
|
42
|
+
|
43
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
44
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
45
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
46
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
47
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
48
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
49
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -9,6 +9,10 @@ This repository contains the Ruby view components for the Ariadne design system.
|
|
9
9
|
|
10
10
|
This project is basically a fork and rewrite of [Primer's ViewComponents](https://primer.style/view-components/), except instead of Primer, it uses an open source stack we've found useful. **Our eternal gratitude to GitHub's design team for open sourcing that repo.**
|
11
11
|
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Like [tailwindcss-rails](https://github.com/rails/tailwindcss-rails), this gem also wraps [the standalone executable version](https://tailwindcss.com/blog/standalone-cli) of the Tailwind CSS v3 framework. These executables are platform specific, so there are actually separate underlying gems per platform, but the correct gem will automatically be picked for your platform. Supported platforms are Linux x64, macOS arm64, macOS x64, and Windows x64. (Note that due to this setup, you must install the actual gems – you can't pin your gem to the GitHub repo.)
|
15
|
+
|
12
16
|
## Using the gem
|
13
17
|
|
14
18
|
todo, lol
|
@@ -36,7 +40,7 @@ This gem comes with some standard linters to keep your code fresh and consistent
|
|
36
40
|
|
37
41
|
## Getting started with development
|
38
42
|
|
39
|
-
So, you just cloned the repo, huh? Great. In addition to Ruby
|
43
|
+
So, you just cloned the repo, huh? Great. In addition to Ruby 3.x, install [Overmind](https://github.com/DarthSim/overmind) and Node/NPM. Then, run the following script to set up your local environment:
|
40
44
|
|
41
45
|
```
|
42
46
|
script/setup
|
data/exe/tailwindcss
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# because rubygems shims assume a gem's executables are Ruby
|
5
|
+
|
6
|
+
require "ariadne/view_components/commands"
|
7
|
+
|
8
|
+
begin
|
9
|
+
command = [Ariadne::ViewComponents::Commands.executable, *ARGV]
|
10
|
+
puts command.inspect
|
11
|
+
if Gem.win_platform?
|
12
|
+
# use system rather than exec as exec inexplicably fails to find the executable on Windows
|
13
|
+
# see related https://github.com/rubys/sprockets-esbuild/pull/4
|
14
|
+
system(*command, exception: true)
|
15
|
+
else
|
16
|
+
exec(*command)
|
17
|
+
end
|
18
|
+
rescue Ariadne::ViewComponents::Commands::UnsupportedPlatformException, Ariadne::ViewComponents::Commands::ExecutableNotFoundException => e
|
19
|
+
$stderr.puts("ERROR: " + e.message)
|
20
|
+
exit(1)
|
21
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "upstream"
|
4
|
+
|
5
|
+
module Ariadne
|
6
|
+
module ViewComponents
|
7
|
+
# commands related to the upstream Tailwindcss project
|
8
|
+
module Commands
|
9
|
+
# raised when the host platform is not supported by upstream tailwindcss's binary releases
|
10
|
+
class UnsupportedPlatformException < StandardError
|
11
|
+
end
|
12
|
+
|
13
|
+
# raised when the tailwindcss executable could not be found where we expected it to be
|
14
|
+
class ExecutableNotFoundException < StandardError
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def platform
|
19
|
+
[:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
|
20
|
+
end
|
21
|
+
|
22
|
+
def executable(
|
23
|
+
exe_path: File.expand_path(File.join(__dir__, "..", "..", "exe"))
|
24
|
+
)
|
25
|
+
if Ariadne::ViewComponents::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match(p) }
|
26
|
+
raise UnsupportedPlatformException, <<~MESSAGE
|
27
|
+
ariadne_view_components does not support the #{platform} platform
|
28
|
+
Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
|
29
|
+
MESSAGE
|
30
|
+
end
|
31
|
+
|
32
|
+
exe_path = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
|
33
|
+
Gem::Platform.match(File.basename(File.dirname(f)))
|
34
|
+
end
|
35
|
+
|
36
|
+
if exe_path.nil?
|
37
|
+
raise ExecutableNotFoundException, <<~MESSAGE
|
38
|
+
Cannot find the tailwindcss executable for #{platform} in #{exe_path}
|
39
|
+
|
40
|
+
If you're using bundler, please make sure you're on the latest bundler version:
|
41
|
+
|
42
|
+
gem install bundler
|
43
|
+
bundle update --bundler
|
44
|
+
|
45
|
+
Then make sure your lock file includes this platform by running:
|
46
|
+
|
47
|
+
bundle lock --add-platform #{platform}
|
48
|
+
bundle install
|
49
|
+
|
50
|
+
See `bundle lock --help` output for details.
|
51
|
+
|
52
|
+
If you're still seeing this message after taking those steps, try running
|
53
|
+
`bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
|
54
|
+
https://github.com/rails/tailwindcss-rails#check-bundle_force_ruby_platform
|
55
|
+
for more details.
|
56
|
+
MESSAGE
|
57
|
+
end
|
58
|
+
|
59
|
+
exe_path
|
60
|
+
end
|
61
|
+
|
62
|
+
def compile_command(debug: false, **kwargs)
|
63
|
+
[
|
64
|
+
executable(**kwargs),
|
65
|
+
"-i", relative_path("app/assets/stylesheets/ariadne_view_components.css"),
|
66
|
+
"-o", relative_path("app/assets/builds/ariadne_view_components.css"),
|
67
|
+
"-c", relative_path("tailwind.config.js"),
|
68
|
+
].tap do |command|
|
69
|
+
command << "--minify" unless debug
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def watch_command(poll: false, **kwargs)
|
74
|
+
compile_command(**kwargs).tap do |command|
|
75
|
+
command << "-w"
|
76
|
+
command << "-p" if poll
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def relative_path(path)
|
81
|
+
if defined?(Rails)
|
82
|
+
Rails.root.join(path).to_s
|
83
|
+
else
|
84
|
+
path
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -5,7 +5,6 @@ require "rails/engine"
|
|
5
5
|
require "view_component"
|
6
6
|
|
7
7
|
require "tailwind_merge"
|
8
|
-
require "simple_form"
|
9
8
|
|
10
9
|
module Ariadne
|
11
10
|
# The Ariadne gem is a collection of ViewComponents that can be used to build
|
@@ -16,7 +15,9 @@ module Ariadne
|
|
16
15
|
# :nodoc:
|
17
16
|
class Engine < ::Rails::Engine
|
18
17
|
isolate_namespace Ariadne::ViewComponents
|
19
|
-
|
18
|
+
|
19
|
+
config.autoload_paths = ["#{root}/lib"]
|
20
|
+
config.eager_load_paths = ["#{root}/app/components", "#{root}/app/helpers", "#{root}/app/lib"]
|
20
21
|
|
21
22
|
config.ariadne_view_components = ActiveSupport::OrderedOptions.new
|
22
23
|
|
@@ -36,141 +37,11 @@ module Ariadne
|
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
|
-
initializer "ariadne_view_components.
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# Define the default class of the input wrapper of the boolean input.
|
46
|
-
config.boolean_label_class = ""
|
47
|
-
|
48
|
-
# How the label text should be generated altogether with the required text.
|
49
|
-
config.label_text = lambda { |label, required, _explicit_label| "#{label} #{required}" }
|
50
|
-
|
51
|
-
# Define the way to render check boxes / radio buttons with labels.
|
52
|
-
config.boolean_style = :inline
|
53
|
-
|
54
|
-
# You can wrap each item in a collection of radio/check boxes with a tag
|
55
|
-
config.item_wrapper_tag = :div
|
56
|
-
|
57
|
-
# Defines if the default input wrapper class should be included in radio
|
58
|
-
# collection wrappers.
|
59
|
-
config.include_default_input_wrapper_class = false
|
60
|
-
|
61
|
-
# CSS class to add for error notification helper.
|
62
|
-
config.error_notification_class = "text-white px-6 py-4 border-0 rounded relative mb-4 bg-red-400"
|
63
|
-
|
64
|
-
# Method used to tidy up errors. Specify any Rails Array method.
|
65
|
-
# :first lists the first message for each field.
|
66
|
-
# :to_sentence to list all errors for each field.
|
67
|
-
config.error_method = :to_sentence
|
68
|
-
|
69
|
-
# add validation classes to `input_field`
|
70
|
-
config.input_field_error_class = "border-red-500"
|
71
|
-
config.input_field_valid_class = "border-green-400"
|
72
|
-
config.label_class = "text-sm font-medium text-gray-600"
|
73
|
-
|
74
|
-
# vertical forms
|
75
|
-
#
|
76
|
-
# vertical default_wrapper
|
77
|
-
config.wrappers(:vertical_form, tag: "div", class: "mb-4") do |b|
|
78
|
-
b.use(:html5)
|
79
|
-
b.use(:placeholder)
|
80
|
-
b.optional(:maxlength)
|
81
|
-
b.optional(:minlength)
|
82
|
-
b.optional(:pattern)
|
83
|
-
b.optional(:min_max)
|
84
|
-
b.optional(:readonly)
|
85
|
-
b.use(:label, class: "block", error_class: "text-red-500")
|
86
|
-
b.use(:input, class: "shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out", error_class: "border-red-500", valid_class: "border-green-400")
|
87
|
-
b.use(:full_error, wrap_with: { tag: "p", class: "mt-2 text-red-500 text-xs italic" })
|
88
|
-
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
89
|
-
end
|
90
|
-
|
91
|
-
# vertical input for boolean (aka checkboxes)
|
92
|
-
config.wrappers(:vertical_boolean, tag: "div", class: "mb-4 flex items-start", error_class: "") do |b|
|
93
|
-
b.use(:html5)
|
94
|
-
b.optional(:readonly)
|
95
|
-
b.wrapper(tag: "div", class: "flex items-center h-5") do |ba|
|
96
|
-
ba.use(:input, class: "focus:ring-2 focus:ring-indigo-500:focus ring-offset-2 h-4 w-4 text-indigo-600 border-gray-300 rounded")
|
97
|
-
end
|
98
|
-
b.wrapper(tag: "div", class: "ml-3 text-sm") do |bb|
|
99
|
-
bb.use(:label, class: "block", error_class: "text-red-500")
|
100
|
-
bb.use(:hint, wrap_with: { tag: "p", class: "block text-grey-700 text-xs italic" })
|
101
|
-
bb.use(:full_error, wrap_with: { tag: "p", class: "block text-red-500 text-xs italic" })
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
# vertical input for radio buttons and check boxes
|
106
|
-
config.wrappers(:vertical_collection, item_wrapper_class: "flex items-center", item_label_class: "my-1 ml-3 block text-sm font-medium text-gray-400", tag: "div", class: "my-4") do |b|
|
107
|
-
b.use(:html5)
|
108
|
-
b.optional(:readonly)
|
109
|
-
b.wrapper(:legend_tag, tag: "legend", class: "text-sm font-medium text-gray-600", error_class: "text-red-500") do |ba|
|
110
|
-
ba.use(:label_text)
|
111
|
-
end
|
112
|
-
b.use(:input, class: "focus:ring-2 focus:ring-indigo-500 ring-offset-2 h-4 w-4 text-indigo-600 border-gray-300 rounded", error_class: "text-red-500", valid_class: "text-green-400")
|
113
|
-
b.use(:full_error, wrap_with: { tag: "p", class: "block mt-2 text-red-500 text-xs italic" })
|
114
|
-
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
115
|
-
end
|
116
|
-
|
117
|
-
# vertical file input
|
118
|
-
config.wrappers(:vertical_file, tag: "div", class: "") do |b|
|
119
|
-
b.use(:html5)
|
120
|
-
b.use(:placeholder)
|
121
|
-
b.optional(:maxlength)
|
122
|
-
b.optional(:minlength)
|
123
|
-
b.optional(:readonly)
|
124
|
-
b.use(:label, class: "text-sm font-medium text-gray-600 block", error_class: "text-red-500")
|
125
|
-
b.use(:input, class: "w-full text-gray-500 px-3 py-2 border rounded", error_class: "text-red-500 border-red-500", valid_class: "text-green-400")
|
126
|
-
b.use(:full_error, wrap_with: { tag: "p", class: "mt-2 text-red-500 text-xs italic" })
|
127
|
-
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
128
|
-
end
|
129
|
-
|
130
|
-
# vertical multi select
|
131
|
-
config.wrappers(:vertical_multi_select, tag: "div", class: "my-4", error_class: "f", valid_class: "") do |b|
|
132
|
-
b.use(:html5)
|
133
|
-
b.optional(:readonly)
|
134
|
-
b.wrapper(:legend_tag, tag: "legend", class: "text-sm font-medium text-gray-600", error_class: "text-red-500") do |ba|
|
135
|
-
ba.use(:label_text)
|
136
|
-
end
|
137
|
-
b.wrapper(tag: "div", class: "inline-flex space-x-1") do |ba|
|
138
|
-
# ba.use :input, class: 'flex w-auto w-auto text-gray-500 text-sm border-gray-300 rounded p-2', error_class: 'text-red-500', valid_class: 'text-green-400'
|
139
|
-
ba.use(:input, class: "flex w-auto w-auto shadow appearance-none border border-gray-300 rounded w-full p-2 bg-white focus:outline-none focus:border-blue-500 text-gray-400 leading-4 transition-colors duration-200 ease-in-out")
|
140
|
-
end
|
141
|
-
b.use(:full_error, wrap_with: { tag: "p", class: "mt-2 text-red-500 text-xs italic" })
|
142
|
-
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
143
|
-
end
|
144
|
-
|
145
|
-
# vertical range input
|
146
|
-
config.wrappers(:vertical_range, tag: "div", class: "my-4", error_class: "text-red-500", valid_class: "text-green-400") do |b|
|
147
|
-
b.use(:html5)
|
148
|
-
b.use(:placeholder)
|
149
|
-
b.optional(:readonly)
|
150
|
-
b.optional(:step)
|
151
|
-
b.use(:label, class: "text-sm font-medium text-gray-600 block", error_class: "text-red-500")
|
152
|
-
b.wrapper(tag: "div", class: "flex items-center h-5") do |ba|
|
153
|
-
ba.use(:input, class: "rounded-lg overflow-hidden appearance-none bg-gray-400 h-3 w-full text-gray-300", error_class: "text-red-500", valid_class: "text-green-400")
|
154
|
-
end
|
155
|
-
b.use(:full_error, wrap_with: { tag: "p", class: "mt-2 text-red-500 text-xs italic" })
|
156
|
-
b.use(:hint, wrap_with: { tag: "p", class: "mt-2 text-grey-700 text-xs italic" })
|
157
|
-
end
|
158
|
-
|
159
|
-
# The default wrapper to be used by the FormBuilder.
|
160
|
-
config.default_wrapper = :vertical_form
|
161
|
-
|
162
|
-
# Custom wrappers for input types. This should be a hash containing an input
|
163
|
-
# type as key and the wrapper that will be used for all inputs with specified type.
|
164
|
-
config.wrapper_mappings = {
|
165
|
-
boolean: :vertical_boolean,
|
166
|
-
check_boxes: :vertical_collection,
|
167
|
-
date: :vertical_multi_select,
|
168
|
-
datetime: :vertical_multi_select,
|
169
|
-
file: :vertical_file,
|
170
|
-
radio_buttons: :vertical_collection,
|
171
|
-
range: :vertical_range,
|
172
|
-
time: :vertical_multi_select,
|
173
|
-
}
|
40
|
+
initializer "ariadne_view_components.zeitwerk_ignore" do
|
41
|
+
Rails.autoloaders.each do |autoloader|
|
42
|
+
autoloader.ignore(Engine.root.join("lib", "ariadne", "view_components", "linters.rb"))
|
43
|
+
autoloader.ignore(Engine.root.join("lib", "ariadne", "view_components", "linters", "**", "*.rb"))
|
44
|
+
autoloader.ignore(Engine.root.join("lib", "ariadne", "view_components", "statuses.rb"))
|
174
45
|
end
|
175
46
|
end
|
176
47
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ariadne
|
4
|
+
module ViewComponents
|
5
|
+
# constants describing the upstream tailwindcss project
|
6
|
+
module Upstream
|
7
|
+
VERSION = "v3.1.8"
|
8
|
+
|
9
|
+
# rubygems platform name => upstream release filename
|
10
|
+
NATIVE_PLATFORMS = {
|
11
|
+
"arm64-darwin" => "tailwindcss-macos-arm64",
|
12
|
+
"x64-mingw32" => "tailwindcss-windows-x64.exe",
|
13
|
+
"x64-mingw-ucrt" => "tailwindcss-windows-x64.exe",
|
14
|
+
"x86_64-darwin" => "tailwindcss-macos-x64",
|
15
|
+
"x86_64-linux" => "tailwindcss-linux-x64",
|
16
|
+
"aarch64-linux" => "tailwindcss-linux-arm64",
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
ERB_GLOB = "**/*.html{+*,}.erb"
|
4
4
|
RB_GLOB = "**/*.rb"
|
5
|
-
|
5
|
+
# copied from Rails: action_view/template/handlers/erb/erubi.rb
|
6
|
+
BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/
|
6
7
|
|
7
8
|
namespace :ariadne_view_components do
|
8
9
|
desc "Report arguments used in each component"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ariadne/view_components/commands"
|
4
|
+
|
5
|
+
namespace :ariadne_view_components do
|
6
|
+
desc "Build Ariadne View Components CSS"
|
7
|
+
task :build do |_, args|
|
8
|
+
debug = args.extras.include?("debug")
|
9
|
+
command = Ariadne::ViewComponents::Commands.compile_command(debug: debug)
|
10
|
+
puts command.inspect
|
11
|
+
system(*command, exception: true)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Watch and build Ariadne View Components CSS on file changes"
|
15
|
+
task :watch do |_, args|
|
16
|
+
debug = args.extras.include?("debug")
|
17
|
+
poll = args.extras.include?("poll")
|
18
|
+
command = Ariadne::ViewComponents::Commands.watch_command(debug: debug, poll: poll)
|
19
|
+
puts command.inspect
|
20
|
+
system(*command)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Rake::Task["assets:precompile"].enhance(["ariadne_view_components:build"]) if Rake::Task.task_defined?("assets:precompile")
|
25
|
+
|
26
|
+
if Rake::Task.task_defined?("test:prepare")
|
27
|
+
Rake::Task["test:prepare"].enhance(["ariadne_view_components:build"])
|
28
|
+
elsif Rake::Task.task_defined?("db:test:prepare")
|
29
|
+
Rake::Task["db:test:prepare"].enhance(["ariadne_view_components:build"])
|
30
|
+
end
|
data/tailwind.config.js
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
const defaultTheme = require('tailwindcss/defaultTheme')
|
2
|
+
const colors = require('tailwindcss/colors')
|
3
|
+
|
4
|
+
const CLASS_YML_REGEX = /^- "\.([\S-]+)"$/
|
5
|
+
|
6
|
+
// for classes in hashes
|
7
|
+
const CLASS_MAPPINGS = '(?:\\S+|:\\"[\\S-]+\\"): \\"([\\S -]+)\\"'
|
8
|
+
// for classes in constants
|
9
|
+
const CLASS_CONSTANT = '[A-Z_]+ = \\"([\\S -]+)\\"'
|
10
|
+
const CLASS_RB_REGEX = new RegExp(`(?:${CLASS_MAPPINGS}|${CLASS_CONSTANT})'`, 'g')
|
11
|
+
|
12
|
+
module.exports = {
|
13
|
+
prefix: 'ariadne-',
|
14
|
+
content: {
|
15
|
+
files: [
|
16
|
+
'./public/*.html',
|
17
|
+
'./app/assets/javascripts/**/*.js',
|
18
|
+
'./app/components/**/*.erb',
|
19
|
+
'./app/components/**/*.rb',
|
20
|
+
'./app/lib/ariadne',
|
21
|
+
'./static/classes.yml'
|
22
|
+
],
|
23
|
+
extract: {
|
24
|
+
yml: content => {
|
25
|
+
const matches = content.match(CLASS_YML_REGEX)
|
26
|
+
return matches ? matches[1].split(/\s+/) : []
|
27
|
+
},
|
28
|
+
rb: content => {
|
29
|
+
const matches = content.match(CLASS_RB_REGEX)
|
30
|
+
return matches ? matches[1].split(/\s+/) : []
|
31
|
+
}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
theme: {
|
35
|
+
extend: {
|
36
|
+
colors: {
|
37
|
+
'billy-purple': '#a700a0',
|
38
|
+
|
39
|
+
'state-closed': '#da1e28',
|
40
|
+
'state-open': '#198038',
|
41
|
+
|
42
|
+
'list-hover': colors.indigo['50'],
|
43
|
+
'filter-panel': colors.amber['100'],
|
44
|
+
|
45
|
+
'button-text-color': colors.indigo['700'],
|
46
|
+
'button-bg-color': colors.indigo['100'],
|
47
|
+
'button-hover-color': colors.indigo['200'],
|
48
|
+
|
49
|
+
'internal-message': colors.amber['100']
|
50
|
+
},
|
51
|
+
fontFamily: {
|
52
|
+
sans: ['Inter var', ...defaultTheme.fontFamily.sans]
|
53
|
+
},
|
54
|
+
zIndex: {
|
55
|
+
max: '9999'
|
56
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
plugins: [
|
60
|
+
require('@tailwindcss/aspect-ratio'),
|
61
|
+
require('@tailwindcss/line-clamp'),
|
62
|
+
require('@tailwindcss/forms'),
|
63
|
+
require('@tailwindcss/typography')
|
64
|
+
]
|
65
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ariadne_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen J. Torikian
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tailwind_merge
|
@@ -78,20 +78,6 @@ dependencies:
|
|
78
78
|
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0.6'
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: simple_form
|
83
|
-
requirement: !ruby/object:Gem::Requirement
|
84
|
-
requirements:
|
85
|
-
- - "~>"
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '5.1'
|
88
|
-
type: :runtime
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
requirements:
|
92
|
-
- - "~>"
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: '5.1'
|
95
81
|
- !ruby/object:Gem::Dependency
|
96
82
|
name: view_component
|
97
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,7 +101,8 @@ dependencies:
|
|
115
101
|
description:
|
116
102
|
email:
|
117
103
|
- gjtorikian@yettoapp.com
|
118
|
-
executables:
|
104
|
+
executables:
|
105
|
+
- tailwindcss
|
119
106
|
extensions: []
|
120
107
|
extra_rdoc_files: []
|
121
108
|
files:
|
@@ -214,17 +201,21 @@ files:
|
|
214
201
|
- app/lib/ariadne/test_selector_helper.rb
|
215
202
|
- app/lib/ariadne/underline_nav_helper.rb
|
216
203
|
- app/lib/ariadne/view_helper.rb
|
204
|
+
- exe/tailwindcss
|
217
205
|
- lib/ariadne/view_components.rb
|
206
|
+
- lib/ariadne/view_components/commands.rb
|
218
207
|
- lib/ariadne/view_components/constants.rb
|
219
208
|
- lib/ariadne/view_components/engine.rb
|
220
209
|
- lib/ariadne/view_components/linters.rb
|
221
210
|
- lib/ariadne/view_components/statuses.rb
|
211
|
+
- lib/ariadne/view_components/upstream.rb
|
222
212
|
- lib/ariadne/view_components/version.rb
|
223
213
|
- lib/rubocop/config/default.yml
|
224
214
|
- lib/rubocop/cop/ariadne.rb
|
225
215
|
- lib/rubocop/cop/ariadne/base_cop.rb
|
226
216
|
- lib/rubocop/cop/ariadne/no_tag_memoize.rb
|
227
217
|
- lib/tasks/ariadne_view_components.rake
|
218
|
+
- lib/tasks/build.rake
|
228
219
|
- lib/tasks/coverage.rake
|
229
220
|
- lib/tasks/custom_utilities.yml
|
230
221
|
- lib/tasks/docs.rake
|
@@ -241,6 +232,7 @@ files:
|
|
241
232
|
- static/constants.json
|
242
233
|
- static/statuses.json
|
243
234
|
- static/tailwindcss.yml
|
235
|
+
- tailwind.config.js
|
244
236
|
homepage: https://github.com/yettoapp/ariadne/view_components
|
245
237
|
licenses:
|
246
238
|
- MIT
|
@@ -254,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
254
246
|
requirements:
|
255
247
|
- - ">="
|
256
248
|
- !ruby/object:Gem::Version
|
257
|
-
version: '
|
249
|
+
version: '3.0'
|
258
250
|
- - "<"
|
259
251
|
- !ruby/object:Gem::Version
|
260
252
|
version: '4.0'
|