vident 0.6.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +224 -38
- data/Rakefile +1 -12
- data/lib/tasks/vident_tasks.rake +4 -0
- data/lib/vident/attributes/not_typed.rb +3 -0
- data/lib/vident/base.rb +8 -29
- data/lib/vident/component.rb +0 -2
- data/lib/vident/engine.rb +15 -0
- data/lib/vident/root_component.rb +235 -0
- data/lib/vident/version.rb +1 -1
- data/lib/vident.rb +3 -36
- metadata +11 -28
- data/.standard.yml +0 -3
- data/CHANGELOG.md +0 -69
- data/CODE_OF_CONDUCT.md +0 -84
- data/Gemfile +0 -34
- data/LICENSE.txt +0 -21
- data/examples/ex1.gif +0 -0
- data/lib/tasks/vident.rake +0 -37
- data/lib/vident/attributes/typed.rb +0 -229
- data/lib/vident/attributes/typed_niling_struct.rb +0 -27
- data/lib/vident/attributes/types.rb +0 -16
- data/lib/vident/caching/cache_key.rb +0 -145
- data/lib/vident/railtie.rb +0 -10
- data/lib/vident/root_component/base.rb +0 -237
- data/lib/vident/root_component/using_better_html.rb +0 -41
- data/lib/vident/root_component/using_phlex_html.rb +0 -49
- data/lib/vident/root_component/using_view_component.rb +0 -51
- data/lib/vident/test_case.rb +0 -8
- data/lib/vident/testing/attributes_tester.rb +0 -176
- data/lib/vident/testing/auto_test.rb +0 -70
- data/lib/vident/typed_component.rb +0 -48
- data/sig/vident.rbs +0 -4
@@ -0,0 +1,235 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vident
|
4
|
+
module RootComponent
|
5
|
+
def initialize(
|
6
|
+
controllers: nil,
|
7
|
+
actions: nil,
|
8
|
+
targets: nil,
|
9
|
+
named_classes: nil, # https://stimulus.hotwired.dev/reference/css-classes
|
10
|
+
data_maps: nil,
|
11
|
+
element_tag: nil,
|
12
|
+
id: nil,
|
13
|
+
html_options: nil
|
14
|
+
)
|
15
|
+
@element_tag = element_tag
|
16
|
+
@html_options = html_options
|
17
|
+
@id = id
|
18
|
+
@controllers = Array.wrap(controllers)
|
19
|
+
@actions = actions
|
20
|
+
@targets = targets
|
21
|
+
@named_classes = named_classes
|
22
|
+
@data_map_kvs = {}
|
23
|
+
@data_maps = data_maps
|
24
|
+
end
|
25
|
+
|
26
|
+
# The view component's helpers for setting stimulus data-* attributes on this component.
|
27
|
+
|
28
|
+
# TODO: rename
|
29
|
+
# Create a Stimulus action string, and returns it
|
30
|
+
# examples:
|
31
|
+
# action(:my_thing) => "current_controller#myThing"
|
32
|
+
# action(:click, :my_thing) => "click->current_controller#myThing"
|
33
|
+
# action("click->current_controller#myThing") => "click->current_controller#myThing"
|
34
|
+
# action("path/to/current", :my_thing) => "path--to--current_controller#myThing"
|
35
|
+
# action(:click, "path/to/current", :my_thing) => "click->path--to--current_controller#myThing"
|
36
|
+
def action(*args)
|
37
|
+
part1, part2, part3 = args
|
38
|
+
(args.size == 1) ? parse_action_arg(part1) : parse_multiple_action_args(part1, part2, part3)
|
39
|
+
end
|
40
|
+
|
41
|
+
def action_data_attribute(*actions)
|
42
|
+
{action: parse_actions(actions).join(" ")}
|
43
|
+
end
|
44
|
+
|
45
|
+
# TODO: rename & make stimulus Target class instance and returns it, which can convert to String
|
46
|
+
# Create a Stimulus Target and returns it
|
47
|
+
# examples:
|
48
|
+
# target(:my_target) => {controller: 'current_controller' name: 'myTarget'}
|
49
|
+
# target("path/to/current", :my_target) => {controller: 'path--to--current_controller', name: 'myTarget'}
|
50
|
+
def target(name, part2 = nil)
|
51
|
+
if part2.nil?
|
52
|
+
{controller: implied_controller_name, name: js_name(name)}
|
53
|
+
else
|
54
|
+
{controller: stimulize_path(name), name: js_name(part2)}
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def target_data_attribute(name)
|
59
|
+
build_target_data_attributes([target(name)])
|
60
|
+
end
|
61
|
+
|
62
|
+
# Getter for a named classes list so can be used in view to set initial state on SSR
|
63
|
+
# Returns a String of classes that can be used in a `class` attribute.
|
64
|
+
def named_classes(*names)
|
65
|
+
names.map { |name| convert_classes_list_to_string(@named_classes[name]) }.join(" ")
|
66
|
+
end
|
67
|
+
|
68
|
+
# Helpers for generating the Stimulus data-* attributes directly
|
69
|
+
|
70
|
+
# Return the HTML `data-controller` attribute for the given controllers
|
71
|
+
def with_controllers(*controllers_to_set)
|
72
|
+
"data-controller=\"#{controller_list(controllers_to_set)}\"".html_safe
|
73
|
+
end
|
74
|
+
|
75
|
+
# Return the HTML `data-target` attribute for the given targets
|
76
|
+
def as_targets(*targets)
|
77
|
+
attrs = build_target_data_attributes(parse_targets(targets))
|
78
|
+
attrs.map { |dt, n| "data-#{dt}=\"#{n}\"" }.join(" ").html_safe
|
79
|
+
end
|
80
|
+
alias_method :as_target, :as_targets
|
81
|
+
|
82
|
+
# Return the HTML `data-action` attribute for the given actions
|
83
|
+
def with_actions(*actions_to_set)
|
84
|
+
"data-action='#{parse_actions(actions_to_set).join(" ")}'".html_safe
|
85
|
+
end
|
86
|
+
alias_method :with_action, :with_actions
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
# An implicit Stimulus controller name is built from the implicit controller path
|
91
|
+
def implied_controller_name
|
92
|
+
stimulize_path(implied_controller_path)
|
93
|
+
end
|
94
|
+
|
95
|
+
# When using the DSL if you dont specify, the first controller is implied
|
96
|
+
def implied_controller_path
|
97
|
+
@controllers&.first || raise(StandardError, "No controllers have been specified")
|
98
|
+
end
|
99
|
+
|
100
|
+
# A complete list of Stimulus controllers for this component
|
101
|
+
def controller_list(controllers_to_set)
|
102
|
+
controllers_to_set&.map { |c| stimulize_path(c) }&.join(" ")
|
103
|
+
end
|
104
|
+
|
105
|
+
# Complete list of actions ready to be use in the data-action attribute
|
106
|
+
def action_list(actions_to_parse)
|
107
|
+
return nil unless actions_to_parse&.size&.positive?
|
108
|
+
parse_actions(actions_to_parse).join(" ")
|
109
|
+
end
|
110
|
+
|
111
|
+
# Complete list of targets ready to be use in the data attributes
|
112
|
+
def target_list
|
113
|
+
return {} unless @targets&.size&.positive?
|
114
|
+
build_target_data_attributes(parse_targets(@targets))
|
115
|
+
end
|
116
|
+
|
117
|
+
def named_classes_list
|
118
|
+
return {} unless @named_classes&.size&.positive?
|
119
|
+
build_named_classes_data_attributes(@named_classes)
|
120
|
+
end
|
121
|
+
|
122
|
+
# stimulus "data-*" attributes map for this component
|
123
|
+
def tag_data_attributes
|
124
|
+
{controller: controller_list(@controllers), action: action_list(@actions)}
|
125
|
+
.merge!(target_list)
|
126
|
+
.merge!(named_classes_list)
|
127
|
+
.merge!(data_map_attributes)
|
128
|
+
.compact_blank!
|
129
|
+
end
|
130
|
+
|
131
|
+
# Actions can be specified as a symbol, in which case they imply an action on the primary
|
132
|
+
# controller, or as a string in which case it implies an action that is already fully qualified
|
133
|
+
# stimulus action.
|
134
|
+
# 1 Symbol: :my_action => "my_controller#myAction"
|
135
|
+
# 1 String: "my_controller#myAction"
|
136
|
+
# 2 Symbols: [:click, :my_action] => "click->my_controller#myAction"
|
137
|
+
# 1 String, 1 Symbol: ["path/to/controller", :my_action] => "path--to--controller#myAction"
|
138
|
+
# 1 Symbol, 1 String, 1 Symbol: [:hover, "path/to/controller", :my_action] => "hover->path--to--controller#myAction"
|
139
|
+
|
140
|
+
def parse_action_arg(part1)
|
141
|
+
if part1.is_a?(Symbol)
|
142
|
+
# 1 symbol arg, name of method on this controller
|
143
|
+
"#{implied_controller_name}##{js_name(part1)}"
|
144
|
+
elsif part1.is_a?(String)
|
145
|
+
# 1 string arg, fully qualified action
|
146
|
+
part1
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def parse_multiple_action_args(part1, part2, part3)
|
151
|
+
if part3.nil? && part1.is_a?(Symbol)
|
152
|
+
# 2 symbol args = event + action
|
153
|
+
"#{part1}->#{implied_controller_name}##{js_name(part2)}"
|
154
|
+
elsif part3.nil?
|
155
|
+
# 1 string arg, 1 symbol = controller + action
|
156
|
+
"#{stimulize_path(part1)}##{js_name(part2)}"
|
157
|
+
else
|
158
|
+
# 1 symbol, 1 string, 1 symbol = as above but with event
|
159
|
+
"#{part1}->#{stimulize_path(part2)}##{js_name(part3)}"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Parse actions, targets and attributes that are passed in as symbols or strings
|
164
|
+
|
165
|
+
def parse_targets(targets)
|
166
|
+
targets.map { |n| parse_target(n) }
|
167
|
+
end
|
168
|
+
|
169
|
+
def parse_target(raw_target)
|
170
|
+
return raw_target if raw_target.is_a?(String)
|
171
|
+
return raw_target if raw_target.is_a?(Hash)
|
172
|
+
target(raw_target)
|
173
|
+
end
|
174
|
+
|
175
|
+
def build_target_data_attributes(targets)
|
176
|
+
targets.map { |t| ["#{t[:controller]}-target".to_sym, t[:name]] }.to_h
|
177
|
+
end
|
178
|
+
|
179
|
+
def parse_actions(actions)
|
180
|
+
actions.map! { |a| a.is_a?(String) ? a : action(*a) }
|
181
|
+
end
|
182
|
+
|
183
|
+
def parse_attributes(attrs, controller = nil)
|
184
|
+
attrs.transform_keys { |k| "#{controller || implied_controller_name}-#{k}" }
|
185
|
+
end
|
186
|
+
|
187
|
+
def data_map_attributes
|
188
|
+
return {} unless @data_maps
|
189
|
+
@data_maps.each_with_object({}) do |m, obj|
|
190
|
+
if m.is_a?(Hash)
|
191
|
+
obj.merge!(parse_attributes(m))
|
192
|
+
elsif m.is_a?(Array)
|
193
|
+
controller_path = m.first
|
194
|
+
data = m.last
|
195
|
+
obj.merge!(parse_attributes(data, stimulize_path(controller_path)))
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def parse_named_classes_hash(named_classes)
|
201
|
+
named_classes.map do |name, classes|
|
202
|
+
logical_name = name.to_s.dasherize
|
203
|
+
classes_str = convert_classes_list_to_string(classes)
|
204
|
+
if classes.is_a?(Hash)
|
205
|
+
{controller: stimulize_path(classes[:controller_path]), name: logical_name, classes: classes_str}
|
206
|
+
else
|
207
|
+
{controller: implied_controller_name, name: logical_name, classes: classes_str}
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def build_named_classes_data_attributes(named_classes)
|
213
|
+
parse_named_classes_hash(named_classes)
|
214
|
+
.map { |c| ["#{c[:controller]}-#{c[:name]}-class", c[:classes]] }
|
215
|
+
.to_h
|
216
|
+
end
|
217
|
+
|
218
|
+
def convert_classes_list_to_string(classes)
|
219
|
+
return "" if classes.nil?
|
220
|
+
return classes if classes.is_a?(String)
|
221
|
+
return classes.join(" ") if classes.is_a?(Array)
|
222
|
+
classes[:classes].is_a?(Array) ? classes[:classes].join(" ") : classes[:classes]
|
223
|
+
end
|
224
|
+
|
225
|
+
# Convert a file path to a stimulus controller name
|
226
|
+
def stimulize_path(path)
|
227
|
+
path.split("/").map { |p| p.to_s.dasherize }.join("--")
|
228
|
+
end
|
229
|
+
|
230
|
+
# Convert a Ruby 'snake case' string to a JavaScript camel case strings
|
231
|
+
def js_name(name)
|
232
|
+
name.to_s.camelize(:lower)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
data/lib/vident/version.rb
CHANGED
data/lib/vident.rb
CHANGED
@@ -1,41 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require "vident/version"
|
4
|
+
require "vident/engine"
|
5
5
|
|
6
6
|
module Vident
|
7
|
-
|
8
|
-
def configuration
|
9
|
-
@configuration ||= Configuration.new
|
10
|
-
end
|
11
|
-
|
12
|
-
def configure
|
13
|
-
yield(configuration) if block_given?
|
14
|
-
configuration
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class Configuration
|
19
|
-
attr_accessor :include_i18n_helpers
|
20
|
-
|
21
|
-
def initialize
|
22
|
-
@include_i18n_helpers = true
|
23
|
-
end
|
24
|
-
end
|
7
|
+
# Your code goes here...
|
25
8
|
end
|
26
|
-
|
27
|
-
require_relative "vident/stable_id"
|
28
|
-
require_relative "vident/root_component/base"
|
29
|
-
require_relative "vident/root_component/using_better_html"
|
30
|
-
require_relative "vident/root_component/using_phlex_html"
|
31
|
-
require_relative "vident/root_component/using_view_component"
|
32
|
-
require_relative "vident/base"
|
33
|
-
require_relative "vident/component"
|
34
|
-
require_relative "vident/typed_component"
|
35
|
-
require_relative "vident/caching/cache_key"
|
36
|
-
|
37
|
-
require_relative "vident/testing/attributes_tester"
|
38
|
-
require_relative "vident/testing/auto_test"
|
39
|
-
|
40
|
-
# TODO: what if not using view_component?
|
41
|
-
require_relative "vident/test_case"
|
metadata
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vident
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Ierodiaconou
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '8'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '7'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '8'
|
@@ -40,41 +40,24 @@ executables: []
|
|
40
40
|
extensions: []
|
41
41
|
extra_rdoc_files: []
|
42
42
|
files:
|
43
|
-
- ".standard.yml"
|
44
|
-
- CHANGELOG.md
|
45
|
-
- CODE_OF_CONDUCT.md
|
46
|
-
- Gemfile
|
47
|
-
- LICENSE.txt
|
48
43
|
- README.md
|
49
44
|
- Rakefile
|
50
|
-
-
|
51
|
-
- lib/tasks/vident.rake
|
45
|
+
- lib/tasks/vident_tasks.rake
|
52
46
|
- lib/vident.rb
|
53
47
|
- lib/vident/attributes/not_typed.rb
|
54
|
-
- lib/vident/attributes/typed.rb
|
55
|
-
- lib/vident/attributes/typed_niling_struct.rb
|
56
|
-
- lib/vident/attributes/types.rb
|
57
48
|
- lib/vident/base.rb
|
58
|
-
- lib/vident/caching/cache_key.rb
|
59
49
|
- lib/vident/component.rb
|
60
|
-
- lib/vident/
|
61
|
-
- lib/vident/root_component
|
62
|
-
- lib/vident/root_component/using_better_html.rb
|
63
|
-
- lib/vident/root_component/using_phlex_html.rb
|
64
|
-
- lib/vident/root_component/using_view_component.rb
|
50
|
+
- lib/vident/engine.rb
|
51
|
+
- lib/vident/root_component.rb
|
65
52
|
- lib/vident/stable_id.rb
|
66
|
-
- lib/vident/test_case.rb
|
67
|
-
- lib/vident/testing/attributes_tester.rb
|
68
|
-
- lib/vident/testing/auto_test.rb
|
69
|
-
- lib/vident/typed_component.rb
|
70
53
|
- lib/vident/version.rb
|
71
|
-
- sig/vident.rbs
|
72
54
|
homepage: https://github.com/stevegeek/vident
|
73
55
|
licenses:
|
74
56
|
- MIT
|
75
57
|
metadata:
|
76
58
|
homepage_uri: https://github.com/stevegeek/vident
|
77
59
|
source_code_uri: https://github.com/stevegeek/vident
|
60
|
+
changelog_uri: https://github.com/stevegeek/vident/blob/main/CHANGELOG.md
|
78
61
|
post_install_message:
|
79
62
|
rdoc_options: []
|
80
63
|
require_paths:
|
@@ -90,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
73
|
- !ruby/object:Gem::Version
|
91
74
|
version: '0'
|
92
75
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
76
|
+
rubygems_version: 3.4.6
|
94
77
|
signing_key:
|
95
78
|
specification_version: 4
|
96
79
|
summary: Vident is the base of your design system implementation, which provides helpers
|
data/.standard.yml
DELETED
data/CHANGELOG.md
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
|
2
|
-
# Change Log
|
3
|
-
All notable changes to this project will be documented in this file.
|
4
|
-
|
5
|
-
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
|
-
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
|
-
|
8
|
-
## [Unreleased]
|
9
|
-
|
10
|
-
### Added
|
11
|
-
|
12
|
-
### Changed
|
13
|
-
|
14
|
-
### Fixed
|
15
|
-
|
16
|
-
## [0.6.3] - 2023-03-03
|
17
|
-
|
18
|
-
### Fixed
|
19
|
-
|
20
|
-
- Fix for changes to HTML tag collection in Phlex
|
21
|
-
|
22
|
-
|
23
|
-
## [0.6.2] - 2023-02-23
|
24
|
-
|
25
|
-
### Fixed
|
26
|
-
|
27
|
-
- Element tag options are not set when no ID is provided
|
28
|
-
|
29
|
-
|
30
|
-
## [0.6.1] - 2023-02-20
|
31
|
-
|
32
|
-
### Fixed
|
33
|
-
|
34
|
-
- `better_html` support fix for aliased dsl methods
|
35
|
-
|
36
|
-
|
37
|
-
## [0.6.0] - 2023-02-20
|
38
|
-
|
39
|
-
### Added
|
40
|
-
|
41
|
-
- Experimental support for `better_html` in the root components (the stimulus attributes are generated with `html_attributes`)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
## [0.5.1] - 2023-02-17
|
46
|
-
|
47
|
-
### Added
|
48
|
-
|
49
|
-
- N/A
|
50
|
-
|
51
|
-
### Changed
|
52
|
-
|
53
|
-
- N/A
|
54
|
-
|
55
|
-
### Fixed
|
56
|
-
|
57
|
-
- Typed attributes was not always using custom coercion methods if they were defined
|
58
|
-
|
59
|
-
### Removed
|
60
|
-
|
61
|
-
- N/A
|
62
|
-
|
63
|
-
### Deprecated
|
64
|
-
|
65
|
-
- N/A
|
66
|
-
|
67
|
-
### Security
|
68
|
-
|
69
|
-
- N/A
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
-
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
-
|
9
|
-
## Our Standards
|
10
|
-
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
-
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
-
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
-
|
19
|
-
Examples of unacceptable behavior include:
|
20
|
-
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or
|
22
|
-
advances of any kind
|
23
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
-
* Public or private harassment
|
25
|
-
* Publishing others' private information, such as a physical or email
|
26
|
-
address, without their explicit permission
|
27
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
-
professional setting
|
29
|
-
|
30
|
-
## Enforcement Responsibilities
|
31
|
-
|
32
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
-
|
34
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
-
|
36
|
-
## Scope
|
37
|
-
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
-
|
40
|
-
## Enforcement
|
41
|
-
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at stevegeek@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
-
|
44
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
-
|
46
|
-
## Enforcement Guidelines
|
47
|
-
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
-
|
50
|
-
### 1. Correction
|
51
|
-
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
-
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
-
|
56
|
-
### 2. Warning
|
57
|
-
|
58
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
-
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
-
|
62
|
-
### 3. Temporary Ban
|
63
|
-
|
64
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
-
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
-
|
68
|
-
### 4. Permanent Ban
|
69
|
-
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
-
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
-
|
74
|
-
## Attribution
|
75
|
-
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
-
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
-
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
-
|
81
|
-
[homepage]: https://www.contributor-covenant.org
|
82
|
-
|
83
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in vident.gemspec
|
6
|
-
gemspec
|
7
|
-
|
8
|
-
gem "puma"
|
9
|
-
|
10
|
-
gem "rails", ">= 7"
|
11
|
-
# TODO: move examples to another app?
|
12
|
-
gem "sprockets-rails"
|
13
|
-
gem "tailwindcss-rails"
|
14
|
-
gem "turbo-rails"
|
15
|
-
gem "importmap-rails"
|
16
|
-
gem "stimulus-rails"
|
17
|
-
|
18
|
-
gem "dry-struct"
|
19
|
-
|
20
|
-
gem "phlex-rails"
|
21
|
-
gem "better_html"
|
22
|
-
|
23
|
-
# FIXME: versions greater than 2.74 cause issues: https://github.com/ViewComponent/view_component/pull/1571
|
24
|
-
gem "view_component", "2.74.1"
|
25
|
-
|
26
|
-
gem "sqlite3"
|
27
|
-
|
28
|
-
gem "rake", "~> 13.0"
|
29
|
-
|
30
|
-
gem "minitest", "~> 5.0"
|
31
|
-
gem "minitest-hooks"
|
32
|
-
gem "faker"
|
33
|
-
|
34
|
-
gem "standard", "~> 1.3"
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2022 Stephen Ierodiaconou
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/examples/ex1.gif
DELETED
Binary file
|
data/lib/tasks/vident.rake
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require "stimulus/manifest"
|
2
|
-
|
3
|
-
namespace :vident do
|
4
|
-
task :stimulus_controller_imports do
|
5
|
-
paths = {
|
6
|
-
"app/components" => "../../../app/components",
|
7
|
-
"app/views" => "../../../app/views",
|
8
|
-
"app/javascript/controllers" => "."
|
9
|
-
}
|
10
|
-
manifests = []
|
11
|
-
paths.each do |controllers_path, import_path|
|
12
|
-
vc_controllers_path = Rails.root.join(controllers_path)
|
13
|
-
manifests << Stimulus::Manifest.extract_controllers_from(vc_controllers_path).collect do |controller_path|
|
14
|
-
controller_path = controller_path.relative_path_from(vc_controllers_path).to_s
|
15
|
-
module_path = controller_path.split(".").first
|
16
|
-
controller_class_name = module_path.camelize.gsub(/::/, "__")
|
17
|
-
tag_name = module_path.remove(/_controller/).tr("_", "-").gsub(/\//, "--")
|
18
|
-
|
19
|
-
<<~JS
|
20
|
-
import #{controller_class_name} from "#{import_path}/#{controller_path.gsub(".ts", "")}"
|
21
|
-
application.register("#{tag_name}", #{controller_class_name});
|
22
|
-
JS
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
File.open(Rails.root.join("app/javascript/controllers/index.js"), "w+") do |index|
|
27
|
-
index.puts "// This file is auto-generated by ./bin/rails stimulus_controller_imports"
|
28
|
-
index.puts "// Run that command whenever you add a new controller or create them with"
|
29
|
-
index.puts "// ./bin/rails generate stimulus controllerName"
|
30
|
-
index.puts
|
31
|
-
index.puts %(import { application } from "./application")
|
32
|
-
manifests.each do |manifest|
|
33
|
-
index.puts manifest
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|