klods-ruby 1.4.0 → 1.5.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: 23dba2589b85888c19d5051400a517437fd767a720be2611cdcd7123cdfc249e
4
- data.tar.gz: 365dd6b471463ab81266e89200aea5f2aa45b7e8cde8a5652e07c0be09d42023
3
+ metadata.gz: fcb611f6ddc17e2a0e583696ec39bbde270cd6bbb4d67c6aa898f43b9b5001d2
4
+ data.tar.gz: 733b3567eab74cfd33b1915624f7dbf0640026b8c531fb1b418d5c44d577ad3e
5
5
  SHA512:
6
- metadata.gz: ab65ea1523078c3752860f4f1a6f2eead5650020f27e8d3a94d62dac60bdc943327ea82d2c5dd8ab02b6d3aaa1fadb809531a9746474f98293ef2f209b4f4a07
7
- data.tar.gz: 7981a98f10fde53e7a3d5684d5676f9d39cfa8e5735ec3e61ae8243c0b1dd93522d0d24164b405f87fc75ac17b5ee202665e57269fcad066adbc0f09794c6fc5
6
+ metadata.gz: bcc2b4e811428f3988d0aa5a42b7158e5442bd8b199ca48fc7bc598812ee2a3d132f6ae363e0891c1105c12650af1ebf39e99f88e04e1133fb73268c17a4573e
7
+ data.tar.gz: b634ffc4cb905b9ea570cb7847f58c6c18c6e9e69c019f683895f39ff0c3f20103a4abe7c37e36d9d7936eba42ce2100b09ff399709015736d78286eb203bd8f
@@ -14,6 +14,7 @@ module Klods
14
14
  include Klods::Components::Details
15
15
  include Klods::Components::Dl
16
16
  include Klods::Components::Form
17
+ include Klods::Components::Link
17
18
  include Klods::Components::List
18
19
  include Klods::Components::Modal
19
20
  include Klods::Components::Nav
@@ -0,0 +1,15 @@
1
+ module Klods
2
+ module Components
3
+ module Link
4
+ def link(a = nil, b = nil, &block)
5
+ props, children = Core.normalize_args(a, b)
6
+ children = klods_capture(&block) if block
7
+ Core.build(
8
+ tag: "a", base: "klods-link",
9
+ modifiers: {plain: "klods-link--plain"},
10
+ props: props, children: children
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -9,6 +9,7 @@ require_relative "components/code"
9
9
  require_relative "components/details"
10
10
  require_relative "components/dl"
11
11
  require_relative "components/form"
12
+ require_relative "components/link"
12
13
  require_relative "components/list"
13
14
  require_relative "components/modal"
14
15
  require_relative "components/nav"
data/lib/klods/node.rb CHANGED
@@ -52,7 +52,16 @@ module Klods
52
52
 
53
53
  def normalize_attrs(attrs)
54
54
  return {} if attrs.nil?
55
- attrs.transform_keys(&:to_s)
55
+ result = {}
56
+ attrs.each do |key, value|
57
+ k = key.to_s
58
+ if (k == "data" || k == "aria") && value.is_a?(Hash)
59
+ value.each { |sub_k, sub_v| result["#{k}-#{sub_k.to_s.tr("_", "-")}"] = sub_v }
60
+ else
61
+ result[k] = value
62
+ end
63
+ end
64
+ result
56
65
  end
57
66
 
58
67
  def flatten_children(children)
data/lib/klods/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Klods
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klods-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drue Wilding
@@ -88,6 +88,7 @@ files:
88
88
  - lib/klods/components/details.rb
89
89
  - lib/klods/components/dl.rb
90
90
  - lib/klods/components/form.rb
91
+ - lib/klods/components/link.rb
91
92
  - lib/klods/components/list.rb
92
93
  - lib/klods/components/modal.rb
93
94
  - lib/klods/components/nav.rb