katalyst-kpop 3.0.0 → 3.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: a962b5da6d47aaad35256ab66cb90fcb20cf42fee35e566f19393d9a6a02ec63
4
- data.tar.gz: d50849e4da9a51e547c46c861c844375f4aef5ee4c6df75e52e557cf553dac9f
3
+ metadata.gz: 56bf54429bfb238e72687e0672f8ec6b677c092d1940a593100c3f1afe3676dd
4
+ data.tar.gz: b64fbdc1cd8e6b5798db53ff13808022dbae2cfa0cd8a682d199efb895934638
5
5
  SHA512:
6
- metadata.gz: 4ff935cebd1a45f2ac6018eea1d180662eb1e53e517a42dfa94b843fde883846c499834ccafd417ec0e1386a4bf5fd37e2b8b04e0689e746b045d046bc17a312
7
- data.tar.gz: e572c8b98ed9325592ec15f5780ff024e3a0623f3e20620d06045b4b9223953467451ebe94a7f36223c517061efad67e792b729817abd82c0c1fdd2a882165ec
6
+ metadata.gz: bd797cb4d09e3f8539962e2acd3b4bbb928d9613f3b43b16ef0f457b2318ba345fe087e5af562898025bf744d6a5bd10698ffcf57debca463cbf05702bede267
7
+ data.tar.gz: 3a6a920b59893419b34ba6bdeff80fc0e976dbb5f91c5bcd3f7f601d31e09b1e04b732cccbe4c41199aed4f0cb439101a530b0ff86c881e3dbfcb96f6bcb04a1
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Kpop
4
4
  class FrameComponent < ViewComponent::Base
5
- include HasHtmlAttributes
5
+ include Katalyst::HtmlAttributes
6
6
  include Turbo::FramesHelper
7
7
 
8
8
  attr_reader :id
@@ -3,7 +3,7 @@
3
3
  module Kpop
4
4
  module Modal
5
5
  class FooterComponent < ViewComponent::Base
6
- include HasHtmlAttributes
6
+ include Katalyst::HtmlAttributes
7
7
 
8
8
  def call
9
9
  tag.div(content, **html_attributes)
@@ -3,7 +3,7 @@
3
3
  module Kpop
4
4
  module Modal
5
5
  class HeaderComponent < ViewComponent::Base
6
- include HasHtmlAttributes
6
+ include Katalyst::HtmlAttributes
7
7
 
8
8
  def call
9
9
  tag.div(content, **html_attributes)
@@ -3,7 +3,7 @@
3
3
  module Kpop
4
4
  module Modal
5
5
  class TitleComponent < ViewComponent::Base
6
- include HasHtmlAttributes
6
+ include Katalyst::HtmlAttributes
7
7
 
8
8
  def initialize(title: nil, captive: false, **)
9
9
  super
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Kpop
4
4
  class ModalComponent < ViewComponent::Base
5
- include HasHtmlAttributes
5
+ include Katalyst::HtmlAttributes
6
6
 
7
7
  renders_one :title, "Kpop::Modal::TitleComponent"
8
8
  renders_one :header, "Kpop::Modal::HeaderComponent"
data/lib/katalyst/kpop.rb CHANGED
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "html_attributes_utils"
3
+ require "katalyst/html_attributes"
4
4
  require "view_component"
5
5
 
6
6
  require "katalyst/kpop/engine"
7
7
  require "katalyst/kpop/turbo"
8
- require "katalyst/kpop/version"
9
8
 
10
9
  module Katalyst
11
10
  module Kpop
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-kpop
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-02 00:00:00.000000000 Z
11
+ date: 2023-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: html-attributes-utils
14
+ name: katalyst-html-attributes
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -72,7 +72,6 @@ files:
72
72
  - app/assets/stylesheets/katalyst/kpop/_scrim.scss
73
73
  - app/assets/stylesheets/katalyst/kpop/_side_panel.scss
74
74
  - app/assets/stylesheets/katalyst/kpop/_variables.scss
75
- - app/components/concerns/kpop/has_html_attributes.rb
76
75
  - app/components/kpop/frame_component.html.erb
77
76
  - app/components/kpop/frame_component.rb
78
77
  - app/components/kpop/modal/footer_component.rb
@@ -112,7 +111,6 @@ files:
112
111
  - lib/katalyst/kpop/matchers/title_finder.rb
113
112
  - lib/katalyst/kpop/matchers/title_matcher.rb
114
113
  - lib/katalyst/kpop/turbo.rb
115
- - lib/katalyst/kpop/version.rb
116
114
  homepage: https://github.com/katalyst/kpop
117
115
  licenses:
118
116
  - MIT
@@ -1,78 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "html_attributes_utils"
4
-
5
- module Kpop
6
- # Adds HTML attributes to a component.
7
- # Accepts HTML attributes from the constructor or via `html_attributes=`.
8
- # These are merged with the default attributes defined in the component.
9
- # Adds support for custom html attributes for other tags, e.g.:
10
- # define_html_attribute_methods :table_attributes, default: {}
11
- # tag.table(**table_attributes)
12
- module HasHtmlAttributes
13
- extend ActiveSupport::Concern
14
-
15
- using HTMLAttributesUtils
16
-
17
- MERGEABLE_ATTRIBUTES = [
18
- *HTMLAttributesUtils::DEFAULT_MERGEABLE_ATTRIBUTES,
19
- %i[data controller],
20
- %i[data action],
21
- ].freeze
22
-
23
- FLATTENABLE_ATTRIBUTES = [
24
- %i[data controller],
25
- %i[data action],
26
- ].freeze
27
-
28
- refine NilClass do
29
- def flatten_html(*)
30
- self
31
- end
32
- end
33
-
34
- refine Hash do
35
- def merge_html(attributes)
36
- result = deep_merge_html_attributes(attributes, mergeable_attributes: MERGEABLE_ATTRIBUTES)
37
- FLATTENABLE_ATTRIBUTES.each_with_object(result) do |path, flattened|
38
- flattened.flatten_html(*path)
39
- end
40
- end
41
-
42
- def flatten_html(key, *path)
43
- if path.empty?
44
- self[key] = self[key].join(" ") if self[key].is_a?(Array)
45
- else
46
- self[key].flatten_html(*path)
47
- end
48
- end
49
- end
50
-
51
- class_methods do
52
- using HasHtmlAttributes
53
-
54
- def define_html_attribute_methods(name, default: {})
55
- define_method("default_#{name}") { default }
56
- private("default_#{name}")
57
-
58
- define_method(name) do
59
- send("default_#{name}").merge_html(instance_variable_get("@#{name}") || {})
60
- end
61
-
62
- define_method("#{name}=") do |options|
63
- instance_variable_set("@#{name}", options.slice(:id, :aria, :class, :data).merge(options.fetch(:html, {})))
64
- end
65
- end
66
- end
67
-
68
- included do
69
- define_html_attribute_methods :html_attributes, default: {}
70
- end
71
-
72
- def initialize(**options)
73
- super(**options.except(:id, :aria, :class, :data, :html))
74
-
75
- self.html_attributes = options
76
- end
77
- end
78
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Katalyst
4
- module Kpop
5
- VERSION = "3.0.0"
6
- end
7
- end