vident 1.0.2 → 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 +4 -4
- data/CHANGELOG.md +50 -0
- data/README.md +45 -17
- data/lib/vident/caching.rb +4 -110
- data/lib/vident/capabilities/caching.rb +98 -0
- data/lib/vident/capabilities/child_element_rendering.rb +92 -0
- data/lib/vident/capabilities/class_list_building.rb +23 -0
- data/lib/vident/capabilities/declarable.rb +39 -0
- data/lib/vident/capabilities/identifiable.rb +54 -0
- data/lib/vident/capabilities/inspectable.rb +17 -0
- data/lib/vident/capabilities/root_element_rendering.rb +31 -0
- data/lib/vident/capabilities/stimulus_data_emitting.rb +98 -0
- data/lib/vident/capabilities/stimulus_declaring.rb +79 -0
- data/lib/vident/capabilities/stimulus_draft.rb +51 -0
- data/lib/vident/capabilities/stimulus_mutation.rb +60 -0
- data/lib/vident/capabilities/stimulus_parsing.rb +144 -0
- data/lib/vident/capabilities/tailwind.rb +18 -0
- data/lib/vident/component.rb +14 -76
- data/lib/vident/engine.rb +6 -5
- data/lib/vident/error.rb +16 -0
- data/lib/{vident2 → vident}/internals/action_builder.rb +18 -22
- data/lib/vident/internals/attribute_writer.rb +17 -0
- data/lib/{vident2 → vident}/internals/class_list_builder.rb +5 -22
- data/lib/vident/internals/declaration.rb +13 -0
- data/lib/{vident2 → vident}/internals/declarations.rb +6 -18
- data/lib/{vident2 → vident}/internals/draft.rb +3 -16
- data/lib/{vident2 → vident}/internals/dsl.rb +6 -32
- data/lib/vident/internals/plan.rb +9 -0
- data/lib/vident/internals/registry.rb +37 -0
- data/lib/{vident2 → vident}/internals/resolver.rb +101 -91
- data/lib/{vident2 → vident}/internals/target_builder.rb +1 -7
- data/lib/vident/stable_id.rb +3 -3
- data/lib/{vident2 → vident}/stimulus/action.rb +11 -24
- data/lib/vident/stimulus/base.rb +26 -0
- data/lib/{vident2 → vident}/stimulus/class_map.rb +6 -18
- data/lib/{vident2 → vident}/stimulus/collection.rb +6 -8
- data/lib/vident/stimulus/combinable.rb +30 -0
- data/lib/vident/stimulus/controller.rb +45 -0
- data/lib/vident/stimulus/naming.rb +9 -9
- data/lib/vident/stimulus/null.rb +7 -0
- data/lib/{vident2 → vident}/stimulus/outlet.rb +12 -32
- data/lib/{vident2 → vident}/stimulus/param.rb +5 -11
- data/lib/{vident2 → vident}/stimulus/target.rb +5 -14
- data/lib/vident/stimulus/value.rb +57 -0
- data/lib/vident/stimulus_null.rb +4 -8
- data/lib/vident/tailwind.rb +4 -17
- data/lib/vident/types.rb +28 -0
- data/lib/vident/version.rb +1 -6
- data/lib/vident.rb +46 -36
- data/skills/vident/SKILL.md +122 -19
- data/skills/vident/api-reference.md +259 -115
- data/skills/vident/examples.md +23 -10
- metadata +38 -60
- data/lib/vident/child_element_helper.rb +0 -64
- data/lib/vident/class_list_builder.rb +0 -112
- data/lib/vident/component_attribute_resolver.rb +0 -106
- data/lib/vident/component_class_lists.rb +0 -37
- data/lib/vident/stimulus/primitive.rb +0 -38
- data/lib/vident/stimulus.rb +0 -31
- data/lib/vident/stimulus_action.rb +0 -133
- data/lib/vident/stimulus_action_collection.rb +0 -11
- data/lib/vident/stimulus_attribute_base.rb +0 -67
- data/lib/vident/stimulus_attributes.rb +0 -129
- data/lib/vident/stimulus_builder.rb +0 -136
- data/lib/vident/stimulus_class.rb +0 -59
- data/lib/vident/stimulus_class_collection.rb +0 -11
- data/lib/vident/stimulus_collection_base.rb +0 -51
- data/lib/vident/stimulus_component.rb +0 -75
- data/lib/vident/stimulus_controller.rb +0 -41
- data/lib/vident/stimulus_controller_collection.rb +0 -14
- data/lib/vident/stimulus_data_attribute_builder.rb +0 -32
- data/lib/vident/stimulus_helper.rb +0 -66
- data/lib/vident/stimulus_outlet.rb +0 -90
- data/lib/vident/stimulus_outlet_collection.rb +0 -11
- data/lib/vident/stimulus_param.rb +0 -42
- data/lib/vident/stimulus_param_collection.rb +0 -11
- data/lib/vident/stimulus_target.rb +0 -47
- data/lib/vident/stimulus_target_collection.rb +0 -18
- data/lib/vident/stimulus_value.rb +0 -39
- data/lib/vident/stimulus_value_collection.rb +0 -11
- data/lib/vident2/caching.rb +0 -93
- data/lib/vident2/component.rb +0 -538
- data/lib/vident2/engine.rb +0 -18
- data/lib/vident2/error.rb +0 -30
- data/lib/vident2/internals/attribute_writer.rb +0 -22
- data/lib/vident2/internals/declaration.rb +0 -17
- data/lib/vident2/internals/plan.rb +0 -12
- data/lib/vident2/internals/registry.rb +0 -41
- data/lib/vident2/phlex/html.rb +0 -84
- data/lib/vident2/phlex.rb +0 -9
- data/lib/vident2/stimulus/controller.rb +0 -59
- data/lib/vident2/stimulus/naming.rb +0 -26
- data/lib/vident2/stimulus/null.rb +0 -16
- data/lib/vident2/stimulus/value.rb +0 -77
- data/lib/vident2/tailwind.rb +0 -19
- data/lib/vident2/version.rb +0 -5
- data/lib/vident2/view_component/base.rb +0 -124
- data/lib/vident2/view_component.rb +0 -9
- data/lib/vident2.rb +0 -50
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "literal"
|
|
4
|
+
require_relative "naming"
|
|
5
|
+
require_relative "base"
|
|
6
|
+
|
|
7
|
+
module Vident
|
|
8
|
+
module Stimulus
|
|
9
|
+
# `data-controller` fragment.
|
|
10
|
+
class Controller < Base
|
|
11
|
+
prop :path, String
|
|
12
|
+
prop :name, String
|
|
13
|
+
prop :alias_name, _Nilable(Symbol), default: nil
|
|
14
|
+
|
|
15
|
+
def self.parse(*args, implied:, as: nil, component_id: nil)
|
|
16
|
+
case args.size
|
|
17
|
+
when 0
|
|
18
|
+
new(path: implied.path, name: implied.name, alias_name: as)
|
|
19
|
+
when 1
|
|
20
|
+
raw = args[0]
|
|
21
|
+
path = raw.to_s
|
|
22
|
+
new(path: path, name: Naming.stimulize_path(path), alias_name: as)
|
|
23
|
+
else
|
|
24
|
+
raise ::Vident::ParseError, "Controller.parse: expected 0 or 1 positional args, got #{args.size}"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def identifier = name
|
|
29
|
+
|
|
30
|
+
def to_s = name
|
|
31
|
+
|
|
32
|
+
def to_data_pair = [:controller, name]
|
|
33
|
+
|
|
34
|
+
def to_h = {controller: name}
|
|
35
|
+
alias_method :to_hash, :to_h
|
|
36
|
+
|
|
37
|
+
def self.to_data_hash(controllers)
|
|
38
|
+
return {} if controllers.empty?
|
|
39
|
+
joined = controllers.map(&:name).reject(&:empty?).join(" ")
|
|
40
|
+
return {} if joined.empty?
|
|
41
|
+
{controller: joined}
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "active_support/core_ext/string/inflections"
|
|
4
|
+
|
|
3
5
|
module Vident
|
|
4
6
|
module Stimulus
|
|
5
|
-
# Vident's internal naming conventions for per-primitive wiring — the
|
|
6
|
-
# `add_stimulus_<plural>` mutator method, the `@stimulus_<plural>` prop
|
|
7
|
-
# ivar, and the `@stimulus_<plural>_collection` parsed-collection ivar.
|
|
8
|
-
# Mixed in by the consumers that need these helpers. Kept off `Primitive`
|
|
9
|
-
# so the primitive stays a clean domain value object and doesn't carry
|
|
10
|
-
# the implementation details of its consumers.
|
|
11
7
|
module Naming
|
|
12
|
-
|
|
8
|
+
module_function
|
|
13
9
|
|
|
14
|
-
def
|
|
10
|
+
def stimulize_path(path)
|
|
11
|
+
path.to_s.split("/").map(&:dasherize).join("--")
|
|
12
|
+
end
|
|
15
13
|
|
|
16
|
-
def
|
|
14
|
+
def js_name(name)
|
|
15
|
+
name.to_s.camelize(:lower)
|
|
16
|
+
end
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -2,28 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
require "literal"
|
|
4
4
|
require_relative "naming"
|
|
5
|
+
require_relative "base"
|
|
5
6
|
require_relative "controller"
|
|
6
7
|
|
|
7
|
-
module
|
|
8
|
+
module Vident
|
|
8
9
|
module Stimulus
|
|
9
10
|
# `data-<ctrl>-<name>-outlet` fragment. `selector` is the CSS selector
|
|
10
11
|
# the Stimulus runtime uses to resolve the outlet on the page.
|
|
11
|
-
|
|
12
|
-
# Auto-selector: `"#<component_id> [data-controller~=<outlet>]"`. If
|
|
13
|
-
# `component_id` is nil (host id not yet known) the `#<id>` prefix is
|
|
14
|
-
# omitted — caller must backfill if needed.
|
|
15
|
-
class Outlet < ::Literal::Data
|
|
12
|
+
class Outlet < Base
|
|
16
13
|
prop :controller, Controller
|
|
17
14
|
prop :name, String
|
|
18
15
|
prop :selector, String
|
|
19
16
|
|
|
20
|
-
# `.parse(*args, implied:, component_id:)` grammar mirrors v1:
|
|
21
|
-
# (Symbol) -> outlet name on implied, auto-selector
|
|
22
|
-
# (String) -> outlet identifier, auto-selector
|
|
23
|
-
# (Array[name, sel]) -> explicit [name, selector] pair
|
|
24
|
-
# (Symbol|String, String) -> (name, explicit selector)
|
|
25
|
-
# (String, Symbol, String) -> (ctrl_path, name, selector)
|
|
26
|
-
# (<component instance>) -> grab stimulus_identifier and build auto-selector
|
|
27
17
|
def self.parse(*args, implied:, component_id: nil)
|
|
28
18
|
case args
|
|
29
19
|
in [Symbol => sym]
|
|
@@ -38,7 +28,7 @@ module Vident2
|
|
|
38
28
|
new(
|
|
39
29
|
controller: implied,
|
|
40
30
|
name: name,
|
|
41
|
-
selector: auto_selector(
|
|
31
|
+
selector: auto_selector(name, component_id: component_id)
|
|
42
32
|
)
|
|
43
33
|
in [[identifier, selector]]
|
|
44
34
|
new(
|
|
@@ -64,18 +54,15 @@ module Vident2
|
|
|
64
54
|
name: sym.to_s.dasherize,
|
|
65
55
|
selector: sel
|
|
66
56
|
)
|
|
57
|
+
in [obj] if obj.respond_to?(:stimulus_identifier)
|
|
58
|
+
ident = obj.stimulus_identifier
|
|
59
|
+
new(
|
|
60
|
+
controller: implied,
|
|
61
|
+
name: ident,
|
|
62
|
+
selector: auto_selector(ident, component_id: component_id)
|
|
63
|
+
)
|
|
67
64
|
else
|
|
68
|
-
|
|
69
|
-
if component_like && component_like.respond_to?(:stimulus_identifier)
|
|
70
|
-
ident = component_like.stimulus_identifier
|
|
71
|
-
new(
|
|
72
|
-
controller: implied,
|
|
73
|
-
name: ident,
|
|
74
|
-
selector: auto_selector(ident, component_id: component_id)
|
|
75
|
-
)
|
|
76
|
-
else
|
|
77
|
-
raise ::Vident2::ParseError, "Outlet.parse: invalid arguments #{args.inspect}"
|
|
78
|
-
end
|
|
65
|
+
raise ::Vident::ParseError, "Outlet.parse: invalid arguments #{args.inspect}"
|
|
79
66
|
end
|
|
80
67
|
end
|
|
81
68
|
|
|
@@ -101,13 +88,6 @@ module Vident2
|
|
|
101
88
|
|
|
102
89
|
def to_h = {data_attribute_key => selector}
|
|
103
90
|
alias_method :to_hash, :to_h
|
|
104
|
-
|
|
105
|
-
def self.to_data_hash(outlets)
|
|
106
|
-
outlets.each_with_object({}) do |o, acc|
|
|
107
|
-
key, sel = o.to_data_pair
|
|
108
|
-
acc[key] = sel
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
91
|
end
|
|
112
92
|
end
|
|
113
93
|
end
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
require "json"
|
|
4
4
|
require "literal"
|
|
5
5
|
require_relative "naming"
|
|
6
|
+
require_relative "base"
|
|
6
7
|
require_relative "null"
|
|
7
8
|
require_relative "controller"
|
|
8
9
|
|
|
9
|
-
module
|
|
10
|
+
module Vident
|
|
10
11
|
module Stimulus
|
|
11
12
|
# `data-<ctrl>-<name>-param` fragment — same shape as Value, distinct
|
|
12
13
|
# semantics on the JS side (read via `event.params.<camel>`).
|
|
13
|
-
class Param <
|
|
14
|
+
class Param < Base
|
|
14
15
|
prop :controller, Controller
|
|
15
16
|
prop :name, String
|
|
16
17
|
prop :serialized, String
|
|
@@ -30,12 +31,12 @@ module Vident2
|
|
|
30
31
|
serialized: serialize(raw)
|
|
31
32
|
)
|
|
32
33
|
else
|
|
33
|
-
raise ::
|
|
34
|
+
raise ::Vident::ParseError, "Param.parse: invalid arguments #{args.inspect}"
|
|
34
35
|
end
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def self.serialize(raw)
|
|
38
|
-
raise ::
|
|
39
|
+
raise ::Vident::ParseError, "Param.serialize: nil is not serializable — filter nil upstream" if raw.nil?
|
|
39
40
|
case raw
|
|
40
41
|
when Array, Hash then raw.to_json
|
|
41
42
|
else raw.to_s
|
|
@@ -50,13 +51,6 @@ module Vident2
|
|
|
50
51
|
|
|
51
52
|
def to_h = {data_attribute_key => serialized}
|
|
52
53
|
alias_method :to_hash, :to_h
|
|
53
|
-
|
|
54
|
-
def self.to_data_hash(params)
|
|
55
|
-
params.each_with_object({}) do |p, acc|
|
|
56
|
-
key, str = p.to_data_pair
|
|
57
|
-
acc[key] = str
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
54
|
end
|
|
61
55
|
end
|
|
62
56
|
end
|
|
@@ -2,20 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
require "literal"
|
|
4
4
|
require_relative "naming"
|
|
5
|
+
require_relative "base"
|
|
5
6
|
require_relative "controller"
|
|
6
7
|
|
|
7
|
-
module
|
|
8
|
+
module Vident
|
|
8
9
|
module Stimulus
|
|
9
|
-
# `data-<ctrl>-target` fragment.
|
|
10
|
-
|
|
11
|
-
class Target < ::Literal::Data
|
|
10
|
+
# `data-<ctrl>-target` fragment.
|
|
11
|
+
class Target < Base
|
|
12
12
|
prop :controller, Controller
|
|
13
13
|
prop :name, String
|
|
14
14
|
|
|
15
|
-
# `.parse(*args, implied:)`:
|
|
16
|
-
# (Symbol) -> target `:name` on implied controller
|
|
17
|
-
# (String) -> target name as-is on implied (already js-cased)
|
|
18
|
-
# (String, Symbol) -> explicit (controller_path, target_name)
|
|
19
15
|
def self.parse(*args, implied:, component_id: nil)
|
|
20
16
|
case args
|
|
21
17
|
in [Symbol => sym]
|
|
@@ -28,7 +24,7 @@ module Vident2
|
|
|
28
24
|
name: Naming.js_name(sym)
|
|
29
25
|
)
|
|
30
26
|
else
|
|
31
|
-
raise ::
|
|
27
|
+
raise ::Vident::ParseError, "Target.parse: invalid arguments #{args.inspect}"
|
|
32
28
|
end
|
|
33
29
|
end
|
|
34
30
|
|
|
@@ -38,14 +34,9 @@ module Vident2
|
|
|
38
34
|
|
|
39
35
|
def to_data_pair = [data_attribute_key, name]
|
|
40
36
|
|
|
41
|
-
# Splat target for inline `data: {**target.to_h}` usage.
|
|
42
37
|
def to_h = {data_attribute_key => name}
|
|
43
38
|
alias_method :to_hash, :to_h
|
|
44
39
|
|
|
45
|
-
# Same-key concat with space. Example:
|
|
46
|
-
# Target(row) -> "foo-target" => "row"
|
|
47
|
-
# Target(row) + Target(cell) -> "foo-target" => "row cell"
|
|
48
|
-
# Target(row) + Target(x, on: bar) -> {"foo-target"=>"row", "bar-target"=>"x"}
|
|
49
40
|
def self.to_data_hash(targets)
|
|
50
41
|
targets.each_with_object({}) do |t, acc|
|
|
51
42
|
key, value = t.to_data_pair
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require "literal"
|
|
5
|
+
require_relative "naming"
|
|
6
|
+
require_relative "base"
|
|
7
|
+
require_relative "controller"
|
|
8
|
+
require_relative "null"
|
|
9
|
+
|
|
10
|
+
module Vident
|
|
11
|
+
module Stimulus
|
|
12
|
+
# `data-<ctrl>-<name>-value` fragment. Holds the serialised form
|
|
13
|
+
# (always a String). Only `nil` is rejected — `false`, blank strings,
|
|
14
|
+
# and empty collections emit their serialised form.
|
|
15
|
+
class Value < Base
|
|
16
|
+
prop :controller, Controller
|
|
17
|
+
prop :name, String
|
|
18
|
+
prop :serialized, String
|
|
19
|
+
|
|
20
|
+
def self.parse(*args, implied:, component_id: nil)
|
|
21
|
+
case args
|
|
22
|
+
in [Symbol => name_sym, raw]
|
|
23
|
+
new(
|
|
24
|
+
controller: implied,
|
|
25
|
+
name: name_sym.to_s.dasherize,
|
|
26
|
+
serialized: serialize(raw)
|
|
27
|
+
)
|
|
28
|
+
in [String => ctrl_path, Symbol => name_sym, raw]
|
|
29
|
+
new(
|
|
30
|
+
controller: Controller.parse(ctrl_path, implied: implied),
|
|
31
|
+
name: name_sym.to_s.dasherize,
|
|
32
|
+
serialized: serialize(raw)
|
|
33
|
+
)
|
|
34
|
+
else
|
|
35
|
+
raise ::Vident::ParseError, "Value.parse: invalid arguments #{args.inspect}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.serialize(raw)
|
|
40
|
+
raise ::Vident::ParseError, "Value.serialize: nil is not serializable — filter nil upstream" if raw.nil?
|
|
41
|
+
case raw
|
|
42
|
+
when Array, Hash then raw.to_json
|
|
43
|
+
else raw.to_s
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def to_s = serialized
|
|
48
|
+
|
|
49
|
+
def data_attribute_key = :"#{controller.name}-#{name}-value"
|
|
50
|
+
|
|
51
|
+
def to_data_pair = [data_attribute_key, serialized]
|
|
52
|
+
|
|
53
|
+
def to_h = {data_attribute_key => serialized}
|
|
54
|
+
alias_method :to_hash, :to_h
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/vident/stimulus_null.rb
CHANGED
|
@@ -9,13 +9,9 @@ module Vident
|
|
|
9
9
|
# A bare `nil` (static or returned from a proc) omits the attribute entirely so
|
|
10
10
|
# Stimulus uses its per-type default. Reach for this sentinel only when you need
|
|
11
11
|
# an explicit JS `null`.
|
|
12
|
-
StimulusNull = Object.new
|
|
13
|
-
|
|
14
|
-
"Vident::StimulusNull"
|
|
15
|
-
end
|
|
12
|
+
StimulusNull = Object.new.tap do |s|
|
|
13
|
+
def s.inspect = "Vident::StimulusNull"
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
-
StimulusNull.freeze
|
|
15
|
+
def s.to_s = "null"
|
|
16
|
+
end.freeze
|
|
21
17
|
end
|
data/lib/vident/tailwind.rb
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
# Adds Tailwind CSS class merging functionality to components
|
|
5
|
-
# This module provides methods to create and manage TailwindMerge::Merger instances
|
|
6
|
-
module Tailwind
|
|
7
|
-
# Get or create a thread-safe Tailwind merger instance
|
|
8
|
-
def tailwind_merger
|
|
9
|
-
return unless tailwind_merge_available?
|
|
10
|
-
|
|
11
|
-
return @tailwind_merger if defined?(@tailwind_merger)
|
|
3
|
+
require_relative "capabilities/tailwind"
|
|
12
4
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# Check if TailwindMerge gem is available
|
|
17
|
-
def tailwind_merge_available?
|
|
18
|
-
defined?(::TailwindMerge::Merger) && ::TailwindMerge::Merger.respond_to?(:new)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
5
|
+
module Vident
|
|
6
|
+
# Top-level alias for the mixin at `Vident::Capabilities::Tailwind`.
|
|
7
|
+
Tailwind = Capabilities::Tailwind
|
|
21
8
|
end
|
data/lib/vident/types.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "literal"
|
|
4
|
+
require_relative "stimulus/controller"
|
|
5
|
+
require_relative "stimulus/action"
|
|
6
|
+
require_relative "stimulus/target"
|
|
7
|
+
require_relative "stimulus/outlet"
|
|
8
|
+
require_relative "stimulus/value"
|
|
9
|
+
require_relative "stimulus/param"
|
|
10
|
+
require_relative "stimulus/class_map"
|
|
11
|
+
|
|
12
|
+
module Vident
|
|
13
|
+
# Canonical Literal type unions for the seven `stimulus_*:` props.
|
|
14
|
+
# The same objects are used internally by `Vident::Capabilities::Declarable`
|
|
15
|
+
# for the built-in props; exposed here so user components can reference
|
|
16
|
+
# them when adding matching props of their own.
|
|
17
|
+
module Types
|
|
18
|
+
extend Literal::Types
|
|
19
|
+
|
|
20
|
+
StimulusControllers = _Array(_Union(String, Symbol, ::Vident::Stimulus::Controller))
|
|
21
|
+
StimulusActions = _Array(_Union(String, Symbol, Array, Hash, ::Vident::Stimulus::Action))
|
|
22
|
+
StimulusTargets = _Array(_Union(String, Symbol, Array, ::Vident::Stimulus::Target))
|
|
23
|
+
StimulusOutlets = _Array(_Union(String, Symbol, Array, ::Vident::Stimulus::Outlet))
|
|
24
|
+
StimulusValues = _Union(_Hash(Symbol, _Any), Array, ::Vident::Stimulus::Value)
|
|
25
|
+
StimulusParams = _Union(_Hash(Symbol, _Any), Array, ::Vident::Stimulus::Param)
|
|
26
|
+
StimulusClasses = _Union(_Hash(Symbol, _Any), Array, ::Vident::Stimulus::ClassMap)
|
|
27
|
+
end
|
|
28
|
+
end
|
data/lib/vident/version.rb
CHANGED
data/lib/vident.rb
CHANGED
|
@@ -5,46 +5,56 @@ require "active_support/concern"
|
|
|
5
5
|
require "literal"
|
|
6
6
|
|
|
7
7
|
require "vident/version"
|
|
8
|
-
require "vident/tailwind"
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
require "vident/stimulus_controller"
|
|
13
|
-
require "vident/stimulus_action"
|
|
14
|
-
require "vident/stimulus_target"
|
|
15
|
-
require "vident/stimulus_outlet"
|
|
16
|
-
require "vident/stimulus_value"
|
|
17
|
-
require "vident/stimulus_param"
|
|
18
|
-
require "vident/stimulus_class"
|
|
19
|
-
|
|
20
|
-
require "vident/stimulus_collection_base"
|
|
21
|
-
require "vident/stimulus_controller_collection"
|
|
22
|
-
require "vident/stimulus_action_collection"
|
|
23
|
-
require "vident/stimulus_target_collection"
|
|
24
|
-
require "vident/stimulus_outlet_collection"
|
|
25
|
-
require "vident/stimulus_value_collection"
|
|
26
|
-
require "vident/stimulus_param_collection"
|
|
27
|
-
require "vident/stimulus_class_collection"
|
|
28
|
-
|
|
29
|
-
require "vident/stimulus/primitive"
|
|
30
|
-
require "vident/stimulus/naming"
|
|
31
|
-
require "vident/stimulus"
|
|
9
|
+
module Vident
|
|
10
|
+
end
|
|
32
11
|
|
|
33
|
-
require "vident/
|
|
34
|
-
require "vident/
|
|
35
|
-
|
|
36
|
-
require "vident/child_element_helper"
|
|
12
|
+
require "vident/engine" if defined?(Rails::Engine)
|
|
13
|
+
require "vident/error"
|
|
37
14
|
require "vident/stable_id"
|
|
38
|
-
require "vident/
|
|
15
|
+
require "vident/stimulus_null"
|
|
39
16
|
|
|
40
|
-
require "vident/
|
|
41
|
-
require "vident/
|
|
42
|
-
require "vident/
|
|
43
|
-
require "vident/
|
|
44
|
-
require "vident/
|
|
17
|
+
require "vident/stimulus/naming"
|
|
18
|
+
require "vident/stimulus/null"
|
|
19
|
+
require "vident/stimulus/controller"
|
|
20
|
+
require "vident/stimulus/action"
|
|
21
|
+
require "vident/stimulus/target"
|
|
22
|
+
require "vident/stimulus/outlet"
|
|
23
|
+
require "vident/stimulus/value"
|
|
24
|
+
require "vident/stimulus/param"
|
|
25
|
+
require "vident/stimulus/class_map"
|
|
26
|
+
require "vident/stimulus/collection"
|
|
27
|
+
require "vident/types"
|
|
28
|
+
require "vident/internals/registry"
|
|
29
|
+
require "vident/internals/declaration"
|
|
30
|
+
require "vident/internals/declarations"
|
|
31
|
+
require "vident/internals/dsl"
|
|
32
|
+
require "vident/internals/draft"
|
|
33
|
+
require "vident/internals/plan"
|
|
34
|
+
require "vident/internals/resolver"
|
|
35
|
+
require "vident/internals/attribute_writer"
|
|
36
|
+
require "vident/internals/class_list_builder"
|
|
37
|
+
|
|
38
|
+
require "vident/capabilities/tailwind"
|
|
39
|
+
require "vident/capabilities/caching"
|
|
40
|
+
require "vident/capabilities/declarable"
|
|
41
|
+
require "vident/capabilities/identifiable"
|
|
42
|
+
require "vident/capabilities/stimulus_declaring"
|
|
43
|
+
require "vident/capabilities/stimulus_parsing"
|
|
44
|
+
require "vident/capabilities/stimulus_mutation"
|
|
45
|
+
require "vident/capabilities/stimulus_draft"
|
|
46
|
+
require "vident/capabilities/stimulus_data_emitting"
|
|
47
|
+
require "vident/capabilities/class_list_building"
|
|
48
|
+
require "vident/capabilities/root_element_rendering"
|
|
49
|
+
require "vident/capabilities/child_element_rendering"
|
|
50
|
+
require "vident/capabilities/inspectable"
|
|
45
51
|
|
|
46
|
-
require "vident/
|
|
52
|
+
require "vident/tailwind"
|
|
53
|
+
require "vident/caching"
|
|
47
54
|
|
|
48
|
-
require "vident/
|
|
55
|
+
require "vident/component"
|
|
49
56
|
|
|
50
|
-
|
|
57
|
+
# Adapter modules (`vident/phlex`, `vident/view_component`) ship in their own
|
|
58
|
+
# gems and are loaded by their own entry points (`lib/vident-phlex.rb`,
|
|
59
|
+
# `lib/vident-view_component.rb`). Do not require them unconditionally here —
|
|
60
|
+
# they only exist when the corresponding adapter gem is installed.
|