@robert.tools/atom-text 1.0.1 → 1.0.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robert.tools/atom-text",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A component to provide text elements.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/index.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 🏷️ typing module
3
- * @version 1.0.1
3
+ * @version 1.0.3
4
4
  * @date 2026-11-29
5
5
  * @license MIT
6
6
  * @author Robert Willemelis <github.com/willi84>
package/src/index.njk CHANGED
@@ -1,21 +1,31 @@
1
+ {# defaults #}
2
+ {% set component = "atom.text" %}
1
3
  {% set tag = params.tag or "span" %}
4
+ {% set text = (params.prefix or "") ~ params.text ~ (params.suffix or "") %}
5
+
6
+ {# css #}
2
7
  {% set css_base = params.css or "text--standard" %}
3
8
  {% set css_modifier = params.css_modifier or "" %}
4
- {% set css = (css_base ~ " " ~ css_modifier) | trim %}
5
9
 
6
- {% set text = (params.prefix or "") ~ params.text ~ (params.suffix or "") %}
10
+ {# attributes #}
11
+ {% set id = params.id | addAttribute('id') %}
12
+ {% set css = (css_base ~ " " ~ css_modifier) | trim | addAttribute('class') %}
13
+ {% set atomic = component | addAttribute('data-component') %}
14
+
15
+ {% set attrs = id ~ " " ~ css ~ " " ~ atomic %}
7
16
 
17
+ {# MAIN CONTENT #}
8
18
  {% if params.text is defined %}
9
19
  {% if tag == 'span' %}
10
- <span class="{{css}}" data-component="text.atom">{{ text }}</span>
20
+ <span {{attrs | safe }}>{{ text }}</span>
11
21
  {% elif tag == 'h1' %}
12
- <h1 class="{{css}}" data-component="text.atom">{{ text }}</h1>
22
+ <h1 {{attrs | safe }}>{{ text }}</h1>
13
23
  {% elif tag == 'h2' %}
14
- <h2 class="{{css}}" data-component="text.atom">{{ text }}</h2>
24
+ <h2 {{attrs | safe }}>{{ text }}</h2>
15
25
  {% elif tag == 'h3' %}
16
- <h3 class="{{css}}" data-component="text.atom">{{ text }}</h3>
26
+ <h3 {{attrs | safe }}>{{ text }}</h3>
17
27
  {% elif tag == 'p' %}
18
- <p class="{{css}}" data-component="text.atom">{{ text }}</p>
28
+ <p {{attrs | safe }}>{{ text }}</p>
19
29
  {% else %}
20
30
  {{ text }}
21
31
  {% endif %}