@anydigital/atomic-bricks 1.0.0-alpha.6 → 1.0.0-alpha.8

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/README.md CHANGED
@@ -7,7 +7,7 @@ Framework-agnostic CSS utility helpers for modern web development.
7
7
  ### Via CDN
8
8
 
9
9
  ```html
10
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@anydigital/atomic-bricks@1/dist/atomic-bricks.min.css">
10
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@anydigital/atomic-bricks@1/dist/atomic-bricks.css">
11
11
  ```
12
12
 
13
13
  ### Via npm
@@ -67,27 +67,32 @@ This is automatically applied when you include the stylesheet.
67
67
 
68
68
  ### Prose Styling
69
69
 
70
- The `.prose` class provides enhanced typography for article content and long-form text:
70
+ The `.prose` class provides enhanced typography for article content and long-form text with container-like behavior:
71
+
72
+ **Container:**
73
+ - Full width with `1rem` padding
74
+ - Centered with automatic inline margins
71
75
 
72
76
  **Links:**
73
- - Custom underline offset and thickness (1px default, 2px on hover)
74
- - Special handling for links containing `small`, `sup`, or `sub` elements
77
+ - Custom underline offset (`0.1em`) and thickness (`1px` default, `2px` on hover)
78
+ - Special handling for `small`, `sup`, or `sub` elements: lighter weight (`300`) and displayed as `inline-block` to prevent underline decoration
75
79
 
76
80
  **Headings:**
77
- - `h1` with `small`, `sup`, or `sub` elements get reduced font size (0.5em) and lighter weight
78
- - `h2` headings (without classes) get a full-width decorative bar above them
79
- - `h3` and `h4` headings (without classes) get a decorative gradient bar to the left
81
+ - `h1` with `small`, `sup`, or `sub` elements get reduced font size (`0.5em`) and lighter weight (`300`)
82
+ - `h2` headings (without classes) get a full-width decorative bar above them (`0.4em` height, positioned `1em` above, with `2em` top margin)
83
+ - `h3` headings (without classes) get a decorative gradient bar to the left (`10em` width, `0.3em` height, fading from 10% to 5% to transparent opacity)
84
+ - `h4` headings (without classes) get a similar decorative gradient bar but thinner (`0.2em` height)
80
85
 
81
86
  **Tables:**
82
87
  - Tables are displayed as blocks with horizontal scrolling
83
- - On mobile (max-width: 767px), tables get horizontal padding
84
- - Table cells have consistent vertical padding
85
- - Workaround for widening columns using hidden `hr` elements
86
- - Support for headings in Markdown tables using `big` elements
88
+ - On mobile (max-width: 767px), tables get `1.5em` horizontal padding
89
+ - Table cells have `1em` vertical padding (top and bottom)
90
+ - Workaround for widening columns using hidden `hr` elements (minimum width: `25ch`)
91
+ - Support for headings in Markdown tables using `big` elements (styled as bold italic)
87
92
 
88
93
  **Blockquotes:**
89
- - Lighter font weight (300)
90
- - Adjacent `figcaption` elements are styled with italic text, right alignment, and an em dash prefix
94
+ - Lighter font weight (`300`)
95
+ - Adjacent `figcaption` elements are styled with italic text, right alignment, lighter weight (`300`), negative top margin (`-1em`), and an em dash prefix
91
96
 
92
97
  **Usage:**
93
98
 
@@ -137,13 +142,43 @@ The breakout utilities support images, pictures, figures, canvas, audio, video,
137
142
 
138
143
  The package includes reusable Nunjucks template macros in the `src/bricks/` directory. These are useful for common web development patterns.
139
144
 
145
+ ### Base HTML Template (`__html.njk`)
146
+
147
+ A base HTML template that provides the essential document structure with built-in support for modern web best practices.
148
+
149
+ **Features:**
150
+ - HTML5 DOCTYPE with language attribute
151
+ - UTF-8 charset and comprehensive viewport meta tag with `viewport-fit=cover` for notched devices
152
+ - Dynamic title generation with site title suffix
153
+ - Favicon link
154
+ - CSS dependencies management via `bricksDependencies` filter
155
+ - Google Tag Manager integration (conditional on production environment)
156
+ - Body content block for template extension
157
+
158
+ **Usage:**
159
+
160
+ ```njk
161
+ {% extends site.bricks ~ '__html.njk' %}
162
+
163
+ {% block body %}
164
+ <!-- Your page content -->
165
+ {% endblock %}
166
+ ```
167
+
168
+ **Required Variables:**
169
+ - `title` - Page title (optional, will be stripped of HTML tags)
170
+ - `site.title` - Site title for the title suffix
171
+ - `site.bricks` - Path to the bricks directory
172
+ - `site.gtmId` - Google Tag Manager ID (optional)
173
+ - `site.isProd` - Boolean flag for production environment (optional)
174
+
140
175
  ### Navigation (`_nav.njk`)
141
176
 
142
177
  A navigation macro that renders a list of navigation links with proper accessibility attributes.
143
178
 
144
179
  **Parameters:**
145
180
  - `navPages` - Array of navigation page objects with `url` and `title` properties
146
- - `currentPageUrl` - The URL of the current page (used to set `aria-current="page"`)
181
+ - `curPageUrl` - The URL of the current page (used to set `aria-current="page"`)
147
182
 
148
183
  **Usage:**
149
184
 
@@ -189,15 +224,14 @@ A macro for embedding Google Tag Manager scripts in your pages.
189
224
  In your base template's `<head>`:
190
225
 
191
226
  ```njk
192
- {% from "bricks/_gtm.njk" import render %}
193
- {{ render('GTM-XXXXXXX') }}
227
+ {% import "bricks/_gtm.njk" as gtm %}
228
+ {{ gtm.render(site.gtmId) }}
194
229
  ```
195
230
 
196
231
  In your base template's `<body>` (right after the opening tag):
197
232
 
198
233
  ```njk
199
- {% from "bricks/_gtm.njk" import render %}
200
- {{ render('GTM-XXXXXXX', true) }}
234
+ {{ gtm.render(site.gtmId, bodyFallback=true) }}
201
235
  ```
202
236
 
203
237
  **Example:**
@@ -206,12 +240,11 @@ In your base template's `<body>` (right after the opening tag):
206
240
  <!DOCTYPE html>
207
241
  <html>
208
242
  <head>
209
- {% from "bricks/_gtm.njk" import render %}
210
- {{ render('GTM-XXXXXXX') }}
243
+ {% import "bricks/_gtm.njk" as gtm %}
244
+ {{ gtm.render('GTM-XXXXXXX') }}
211
245
  </head>
212
246
  <body>
213
- {% from "bricks/_gtm.njk" import render %}
214
- {{ render('GTM-XXXXXXX', true) }}
247
+ {{ gtm.render('GTM-XXXXXXX', bodyFallback=true) }}
215
248
  <!-- Your content -->
216
249
  </body>
217
250
  </html>
@@ -31,6 +31,7 @@ body > main {
31
31
 
32
32
  .prose {
33
33
  /* Container-like behavior with padding and auto margins */
34
+ width: 100%;
34
35
  padding: 1rem;
35
36
  margin-inline: auto;
36
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anydigital/atomic-bricks",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.8",
4
4
  "description": "Framework-agnostic CSS utility helpers for modern web development",
5
5
  "main": "dist/atomic-bricks.css",
6
6
  "style": "dist/atomic-bricks.css",
package/src/_prose.css CHANGED
@@ -1,5 +1,6 @@
1
1
  .prose {
2
2
  /* Container-like behavior with padding and auto margins */
3
+ width: 100%;
3
4
  padding: 1rem;
4
5
  margin-inline: auto;
5
6
 
@@ -0,0 +1,21 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
6
+ <title>{{ title | string | striptags }}{{ ' — ' if title }}{{ site.title }}</title>
7
+ <link rel="icon" href="/favicon.ico">
8
+ {# @TODO: add fallback #}
9
+ {% bricksDependencies [
10
+ 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@7/css/all.min.css',
11
+ 'https://cdn.jsdelivr.net/npm/@anydigital/atomic-bricks@^1.0.0-alpha/dist/atomic-bricks.min.css',
12
+ '/styles.css'
13
+ ] %}
14
+ {% import site.bricks ~ '_gtm.njk' as gtm %}
15
+ {{ gtm.render(site.gtmId) if site.isProd }}
16
+ </head>
17
+ <body>
18
+ {{ gtm.render(site.gtmId, bodyFallback=true) if site.isProd }}
19
+ {% block body %}{% endblock %}
20
+ </body>
21
+ </html>
@@ -1,7 +1,7 @@
1
- {% macro render(navPages, currentPageUrl) %}
1
+ {% macro render(navPages, curPageUrl) %}
2
2
  <nav>
3
3
  {%- for entry in navPages %}
4
- <a href="{{ entry.url }}" {{ 'aria-current="page"' | safe if entry.url == currentPageUrl }}>
4
+ <a href="{{ entry.url }}" {{ 'aria-current="page"' | safe if entry.url == curPageUrl }}>
5
5
  {{- entry.title -}}
6
6
  </a>
7
7
  {%- endfor %}