markawesome 0.10.1 → 0.12.0

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: 467018c4fc1fed8b4f16c0fabc30b74b64b0517a07f1221ae1db9a0f4ae4e13a
4
- data.tar.gz: 22f81090651a9db046abf659b8874071e25b2bf2cc436a92a2c7404d98ab5560
3
+ metadata.gz: 561615ddddb39ccde6417037237c2bc490d2ded75aba4b36faf77e1db0eac1cc
4
+ data.tar.gz: 10ce10fcf7a740754303363579558de85881b4a9e101c73525c7d6ce3ca674e4
5
5
  SHA512:
6
- metadata.gz: de23d695ccadd397f71ff18d99c40a6b9cb61012fd40f95cde7bc7bb85227116aa5fff6768e8baf5ed230b7bf0bd4fca2947a6027eb9c466930542acf686e024
7
- data.tar.gz: 58b1ca622184a8879a76249d081e9983e30fc135ceb9fd057d03db371f39381dc0bf7789d31701af32c6ceb4f05d22d310a9f3c7c9714b947b1ee03f3a80f76c
6
+ metadata.gz: 48b713e5d9b0cd1f182ce321923d02c59c85132c42b75ef2f58088dc5ed433101dac9049ea76abd5858f8f03779c7f56a25a7e2a2e21d484839f19bd8fd038f1
7
+ data.tar.gz: 034dda0ddfc5ca7c24d0107e10632dae1312d122170f65608a3b0bc224b3fe34289b829d68c306da39af08b0e62f16e963d92ad9c92d125ca91bebac06e321e9
data/CHANGELOG.md CHANGED
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.12.0] - 2026-06-19
8
+
9
+ ### Added
10
+
11
+ - `ButtonTransformer` link-form buttons now accept `target` (`_blank`, `_self`, `_parent`, `_top`) and a boolean `download` flag. When `target="_blank"` is set, `rel="noopener noreferrer"` is emitted automatically to guard against reverse tabnabbing. These attributes are emitted **only** on link-form buttons (markup wrapping a markdown link, e.g. `%%%brand _blank\n[Text](url)\n%%%`); written on a regular (non-link) button they are parsed but dropped, consistent with the existing unrecognized-token behavior. They are also absent from the plain-markdown degradation path (`render_as_markdown`), since a plain `[text](url)` can't express them. A `download:filename` value form is a possible future enhancement.
12
+
13
+ ## [0.11.0] - 2026-06-16
14
+
15
+ Aligns generated markup with Web Awesome 3.8.0 (latest). See `ROADMAP.md` for the remaining enhancement backlog from the same audit.
16
+
17
+ ### Fixed
18
+
19
+ - `DialogTransformer` footer button now emits `variant='brand'` instead of the non-existent `variant='primary'`. `primary` is a Shoelace-era value with no equivalent in Web Awesome 3.x, so the button silently fell back to the default neutral variant instead of rendering as a brand call-to-action.
20
+ - `DialogTransformer` image-trigger buttons now emit `appearance='plain'` instead of the invalid `variant='text'`. Because `text` is not a valid `variant`, the wrapping button fell back to the default `accent` appearance — rendering image thumbnails inside a filled accent button background. `appearance='plain'` removes the button chrome as intended.
21
+ - `PopoverTransformer` triggers now emit `appearance='plain'` instead of the invalid `variant='text'`, so popover triggers render as plain text rather than filled buttons.
22
+ - `DetailsTransformer` now emits `appearance='filled-outlined'` (hyphenated) instead of `'filled outlined'` (space). The space-separated value is not a valid appearance and silently fell back to `outlined`.
23
+
24
+ ### Added
25
+
26
+ - Web Awesome 3.x size scale (`xs`, `s`, `m`, `l`, `xl`) is now accepted for `button`, `callout`, and `tag` components. The legacy `small`/`medium`/`large` tokens continue to work.
27
+ - Layout utilities now accept the `4xl` and `5xl` gap tokens (`wa-gap-4xl`, `wa-gap-5xl`), added to Web Awesome's spacing scale in 3.4.
28
+
7
29
  ## [0.10.1] - 2026-05-08
8
30
 
9
31
  ### Fixed
@@ -18,6 +18,11 @@ module Markawesome
18
18
  # - loading: loading (loading state)
19
19
  # - disabled: disabled (disabled state)
20
20
  #
21
+ # Link-form only (emitted only when content is a markdown link):
22
+ # - target: _blank, _self, _parent, _top (target="_blank" also emits
23
+ # rel="noopener noreferrer" automatically)
24
+ # - download: download (bare download attribute)
25
+ #
21
26
  # Link buttons: %%%brand\n[Text](url)\n%%%
22
27
  # Regular buttons: %%%brand large pill\nText\n%%%
23
28
  class ButtonTransformer < BaseTransformer
@@ -25,11 +30,13 @@ module Markawesome
25
30
  BUTTON_ATTRIBUTES = {
26
31
  variant: %w[brand success neutral warning danger],
27
32
  appearance: %w[accent filled outlined filled-outlined plain],
28
- size: %w[small medium large],
33
+ size: %w[xs s m l xl small medium large],
29
34
  pill: %w[pill],
30
35
  caret: %w[caret],
31
36
  loading: %w[loading],
32
- disabled: %w[disabled]
37
+ disabled: %w[disabled],
38
+ target: %w[_blank _self _parent _top],
39
+ download: %w[download]
33
40
  }.freeze
34
41
 
35
42
  ICON_SLOTS = { default: 'start', slots: %w[start end] }.freeze
@@ -105,7 +112,9 @@ module Markawesome
105
112
  # Fix whitespace issues like in badges
106
113
  button_html = button_html.gsub(%r{(</\w+>)\s+}, '\1&nbsp;')
107
114
 
108
- "<wa-button#{attrs_string} href=\"#{link_url}\">#{icon_html}#{button_html}</wa-button>"
115
+ link_attrs_string = link_pass_through_attrs(attributes)
116
+
117
+ "<wa-button#{attrs_string} href=\"#{link_url}\"#{link_attrs_string}>#{icon_html}#{button_html}</wa-button>"
109
118
  else
110
119
  # It's a regular button
111
120
  button_html = markdown_to_html(content).strip
@@ -117,6 +126,17 @@ module Markawesome
117
126
  "<wa-button#{attrs_string}>#{icon_html}#{button_html}</wa-button>"
118
127
  end
119
128
  end
129
+
130
+ # Plain anchor pass-throughs, meaningful only on link-form buttons.
131
+ # Auto-emit rel="noopener noreferrer" with target="_blank" to guard
132
+ # against reverse tabnabbing.
133
+ def link_pass_through_attrs(attributes)
134
+ link_attrs = []
135
+ link_attrs << "target=\"#{attributes[:target]}\"" if attributes[:target]
136
+ link_attrs << 'rel="noopener noreferrer"' if attributes[:target] == '_blank'
137
+ link_attrs << 'download' if attributes[:download]
138
+ link_attrs.empty? ? '' : " #{link_attrs.join(' ')}"
139
+ end
120
140
  end
121
141
  end
122
142
  end
@@ -14,7 +14,7 @@ module Markawesome
14
14
  class CalloutTransformer < BaseTransformer
15
15
  VARIANTS = %w[info brand success neutral warning danger].freeze
16
16
  CALLOUT_ATTRIBUTES = {
17
- size: %w[small medium large],
17
+ size: %w[xs s m l xl small medium large],
18
18
  appearance: %w[accent filled outlined plain filled-outlined]
19
19
  }.freeze
20
20
  VARIANT_ALIASES = { 'info' => 'brand' }.freeze
@@ -97,7 +97,7 @@ module Markawesome
97
97
  when 'filled'
98
98
  'filled'
99
99
  when 'filled-outlined'
100
- 'filled outlined'
100
+ 'filled-outlined'
101
101
  when 'plain'
102
102
  'plain'
103
103
  else
@@ -160,15 +160,15 @@ module Markawesome
160
160
  # Only allow HTML for image tags (for image dialog support), escape everything else for security
161
161
  button_content = is_image_button ? button_text : escape_html(button_text)
162
162
  button_id_attr = is_image_button ? " id='#{button_id}'" : ''
163
- button_variant = is_image_button ? " variant='text'" : ''
164
- html << "<wa-button#{button_id_attr}#{button_variant} data-dialog='open #{dialog_id}'>#{button_content}</wa-button>"
163
+ button_appearance = is_image_button ? " appearance='plain'" : ''
164
+ html << "<wa-button#{button_id_attr}#{button_appearance} data-dialog='open #{dialog_id}'>#{button_content}</wa-button>"
165
165
 
166
166
  # Dialog element
167
167
  html << "<wa-dialog #{dialog_attrs.join(' ')}#{style_attr}>"
168
168
  html << content_html
169
169
 
170
170
  # Footer with close button
171
- html << "<wa-button slot='footer' variant='primary' data-dialog='close'>Close</wa-button>"
171
+ html << "<wa-button slot='footer' variant='brand' data-dialog='close'>Close</wa-button>"
172
172
 
173
173
  html << '</wa-dialog>'
174
174
 
@@ -18,7 +18,7 @@ module Markawesome
18
18
  # Flank-specific: start, end modifiers; size:CSS_VALUE, content:PCT
19
19
  # Frame-specific: landscape, portrait, square modifiers; radius:SIZE
20
20
  class LayoutTransformer < BaseTransformer
21
- VALID_GAPS = %w[0 3xs 2xs xs s m l xl 2xl 3xl].freeze
21
+ VALID_GAPS = %w[0 3xs 2xs xs s m l xl 2xl 3xl 4xl 5xl].freeze
22
22
  VALID_ALIGNS = %w[start end center stretch baseline].freeze
23
23
  VALID_JUSTIFIES = %w[start end center space-between space-around space-evenly].freeze
24
24
  VALID_RADII = %w[s m l pill circle square].freeze
@@ -202,7 +202,7 @@ module Markawesome
202
202
  'cursor: pointer; font: inherit;'
203
203
  "<button type='button' id='#{popover_id}' class='ma-popover-trigger' style='#{link_style_attr}'>#{trigger_content}</button>"
204
204
  else
205
- "<wa-button id='#{popover_id}' variant='text'>#{trigger_content}</wa-button>"
205
+ "<wa-button id='#{popover_id}' appearance='plain'>#{trigger_content}</wa-button>"
206
206
  end
207
207
  end
208
208
 
@@ -21,7 +21,7 @@ module Markawesome
21
21
  COMPONENT_ATTRIBUTES = {
22
22
  variant: %w[brand success neutral warning danger],
23
23
  appearance: %w[accent filled outlined filled-outlined],
24
- size: %w[small medium large],
24
+ size: %w[xs s m l xl small medium large],
25
25
  pill: %w[pill],
26
26
  'with-remove': %w[with-remove]
27
27
  }.freeze
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Markawesome
4
- VERSION = '0.10.1'
4
+ VERSION = '0.12.0'
5
5
  end
data/markawesome.gemspec CHANGED
@@ -35,7 +35,6 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_dependency 'kramdown', '~> 2.0'
37
37
 
38
- spec.add_development_dependency 'bundler', '~> 2.0'
39
38
  spec.add_development_dependency 'rake', '~> 13.0'
40
39
  spec.add_development_dependency 'rspec', '~> 3.0'
41
40
  spec.add_development_dependency 'rubocop', '~> 1.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markawesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janne Waren
@@ -23,20 +23,6 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '2.0'
26
- - !ruby/object:Gem::Dependency
27
- name: bundler
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '2.0'
33
- type: :development
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '2.0'
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: rake
42
28
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  requirements: []
140
- rubygems_version: 4.0.3
126
+ rubygems_version: 4.0.10
141
127
  specification_version: 4
142
128
  summary: Framework-agnostic Markdown to Web Awesome component transformer
143
129
  test_files: []