@anydigital/bricks 0.24.2 → 0.26.0-alpha

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
@@ -1,30 +1,36 @@
1
- # *Any*bricks
1
+ # `bricks[.css]` <sup><sub>by *Any*digital</sub></sup>
2
2
 
3
- Framework-agnostic CSS utilities and single-file Liquid 'bricks' for modern web development.
3
+ Framework-agnostic, Tailwind-compatible CSS utilities and single-file `bricks` for modern web development.
4
4
 
5
- ## Installation
5
+ <!--section:css-h2-->
6
6
 
7
- ### Via CDN
7
+ ## CSS 'Bricks' <br><sub>from https://github.com/anydigital/bricks</sub> <a id="bricks"></a>
8
+
9
+ ### Install CSS
10
+
11
+ Via CDN:
8
12
 
9
13
  ```html
10
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@anydigital/bricks@1/dist/bricks.css" />
14
+ <link href="https://cdn.jsdelivr.net/npm/@anydigital/bricks@0/dist/bricks.min.css" rel="stylesheet" />
11
15
  ```
12
16
 
13
- ### Via npm
17
+ Or import source styles via npm:
14
18
 
15
19
  ```sh
16
20
  npm install @anydigital/bricks
17
21
  ```
18
22
 
19
- Then import in your CSS:
20
-
21
- ```css
23
+ ```css {data-caption=.css}
22
24
  @import "@anydigital/bricks";
23
25
  ```
24
26
 
25
- ## Features
27
+ <details><summary>
28
+
29
+ ### `_base.css` styles
30
+
31
+ </summary>
26
32
 
27
- ### Overflow Control
33
+ #### Overflow Control
28
34
 
29
35
  Prevents horizontal overflow and scrolling on the entire page:
30
36
 
@@ -37,7 +43,7 @@ body {
37
43
 
38
44
  This is automatically applied when you include the stylesheet.
39
45
 
40
- ### Full Viewport Height
46
+ #### Full Viewport Height
41
47
 
42
48
  Ensures the body element takes at least the full height of the viewport using dynamic viewport height for better mobile support:
43
49
 
@@ -49,7 +55,26 @@ body {
49
55
 
50
56
  This is automatically applied when you include the stylesheet.
51
57
 
52
- ### Typography Enhancements
58
+ #### Flexbox Layout
59
+
60
+ Sets up a flexible column layout structure:
61
+
62
+ ```css
63
+ body {
64
+ display: flex;
65
+ flex-direction: column;
66
+ }
67
+
68
+ body > main {
69
+ flex-grow: 1;
70
+ }
71
+ ```
72
+
73
+ The body becomes a flex container with column direction, and `main` elements automatically grow to fill available space. This is useful for creating sticky footers and full-height layouts.
74
+
75
+ This is automatically applied when you include the stylesheet.
76
+
77
+ #### Typography Enhancements
53
78
 
54
79
  Improves text rendering and readability:
55
80
 
@@ -67,7 +92,13 @@ body {
67
92
 
68
93
  This is automatically applied when you include the stylesheet.
69
94
 
70
- ### Prose Styling
95
+ </details>
96
+
97
+ <details><summary>
98
+
99
+ ### `_prose.css` Tailwind Typography enhancements
100
+
101
+ </summary>
71
102
 
72
103
  The `.prose` class provides enhanced typography for article content and long-form text with container-like behavior:
73
104
 
@@ -110,7 +141,9 @@ The `.prose` class provides enhanced typography for article content and long-for
110
141
 
111
142
  - Code blocks with `data-caption` attribute display the caption above the code block (styled with 50% opacity, italic, and `1.5em` bottom margin)
112
143
 
113
- ### Code Highlighting
144
+ </details>
145
+
146
+ ### `_prism.css` enhancements
114
147
 
115
148
  Includes specialized styling for Prism.js, specifically focusing on treeview components:
116
149
 
@@ -120,7 +153,11 @@ Includes specialized styling for Prism.js, specifically focusing on treeview com
120
153
  - Last-child entry names have no `::before` pseudo-element
121
154
  - Supports complex file tree visualizations out of the box
122
155
 
123
- ### Utilities
156
+ <details><summary>
157
+
158
+ ### `_util.css` helpers
159
+
160
+ </summary>
124
161
 
125
162
  #### Scrollbar Inversion
126
163
 
@@ -157,26 +194,9 @@ This ensures the icon and the text stay together on the same line. If you need n
157
194
 
158
195
  This is automatically included when you import the stylesheet.
159
196
 
160
- ### Flexbox Layout
161
-
162
- Sets up a flexible column layout structure:
163
-
164
- ```css
165
- body {
166
- display: flex;
167
- flex-direction: column;
168
- }
169
-
170
- body > main {
171
- flex-grow: 1;
172
- }
173
- ```
174
-
175
- The body becomes a flex container with column direction, and `main` elements automatically grow to fill available space. This is useful for creating sticky footers and full-height layouts.
176
-
177
- This is automatically applied when you include the stylesheet.
197
+ </details>
178
198
 
179
- ### Breakout CSS
199
+ ### `breakout-css` included
180
200
 
181
201
  Includes [breakout-css](https://github.com/anydigital/breakout-css) utilities for breaking out images and figures beyond their container width. Use the `.breakout` class to allow elements to extend beyond their parent container:
182
202
 
@@ -188,13 +208,45 @@ Includes [breakout-css](https://github.com/anydigital/breakout-css) utilities fo
188
208
 
189
209
  The breakout container has `10%` inline padding and a max-width of `calc(10% + 65ch + 10%)`. The breakout utilities support images, pictures, figures, canvas, audio, video, tables, pre, iframe, and other media elements. Tables inside `.breakout` are specifically enhanced for horizontal scrolling and full-bleed mobile display. This is automatically included when you import the stylesheet.
190
210
 
191
- ## Bricks (Template Components)
211
+ <!--section:njk-liquid-h2-->
212
+
213
+ ## Universal Template 'Bricks' <small>(`.njk` & `.liquid`)</small> <br><sub>from https://github.com/anydigital/bricks</sub>
214
+
215
+ The package includes reusable templates in the `./src/bricks/` directory. These are useful for common web development patterns.
216
+
217
+ ### Install Templates
218
+
219
+ ```sh
220
+ npm install @anydigital/bricks
221
+ cd ./src/_includes
222
+ ln -s ../../node_modules/@anydigital/bricks/src/bricks
223
+ ```
224
+
225
+ ### Base HTML Template <small>(`__html.*`)</small>
226
+
227
+ A unified base HTML template `bricks/__html.{njk|liquid}` that provides the essential document structure with built-in support for modern web best practices.
228
+
229
+ **Usage:**
192
230
 
193
- The package includes reusable Liquid templates in the `bricks/` directory. These are useful for common web development patterns.
231
+ ```jinja2 {data-caption="in .njk layout:"}
232
+ {% extends 'bricks/__html.njk' %}
194
233
 
195
- ### Base HTML Template (`__html.liquid`)
234
+ {% block body %}
235
+ <!-- YOUR page content -->
236
+ {% endblock %}
237
+ ```
196
238
 
197
- A unified base HTML template that provides the essential document structure with built-in support for modern web best practices.
239
+ Example: https://github.com/anydigital/sveleven/blob/main/src/_theme/__layout.njk
240
+
241
+ ```liquid {data-caption="in .liquid layout:"}
242
+ {% capture body %}
243
+ <!-- YOUR page content -->
244
+ {% endcapture %}
245
+
246
+ {% include 'bricks/__html' %}
247
+ ```
248
+
249
+ Example: https://github.com/anydigital/sveleven/blob/main/src/_theme/__layout.liquid
198
250
 
199
251
  **Features:**
200
252
 
@@ -207,19 +259,7 @@ A unified base HTML template that provides the essential document structure with
207
259
  - Automatic script loading from `site.scripts` array (with `defer` attribute)
208
260
  - Inline module scripts from `site.inline_scripts` array (joined with newlines in a `<script type="module">` tag)
209
261
  - Custom header content via `content_for_header`
210
- - Google Tag Manager integration (automatically rendered via `_gtm.liquid` template for both `<head>` and `<body>`)
211
-
212
- **Usage:**
213
-
214
- ```liquid
215
- {% capture page_content %}
216
- <!-- Your page content -->
217
- {% endcapture %}
218
-
219
- {% render 'bricks/__html', site: site, title: title, content_for_header: content_for_header, body: page_content %}
220
- ```
221
-
222
- Note: Google Tag Manager is automatically included in both `<head>` and `<body>` (via the `_gtm.liquid` template) when `site.prod` and `site.gtm_id` are set.
262
+ - Google Tag Manager integration (automatically rendered via `_gtm.{njk|liquid}` template for both `<head>` and `<body>` when `site.prod` and `site.gtm_id` are set)
223
263
 
224
264
  **Variables:**
225
265
 
@@ -235,26 +275,20 @@ Note: Google Tag Manager is automatically included in both `<head>` and `<body>`
235
275
  - `site.gtm_id` - Google Tag Manager ID (optional)
236
276
  - `site.prod` - Boolean flag for production environment (optional)
237
277
 
238
- ### Navigation (`_nav.liquid`)
278
+ ### Navigation <small>(`_nav.*`)</small>
239
279
 
240
- A navigation template that renders a list of navigation links with proper accessibility attributes.
280
+ A navigation template `bricks/_nav.{njk|liquid}` that renders a list of navigation links with proper accessibility attributes.
241
281
 
242
282
  **Parameters:**
243
283
 
244
284
  - `nav_pages` - Array of navigation page objects with `url` and `title` properties
245
285
  - `current_url` - The URL of the current page (used to set `aria-current="page"`)
246
286
 
247
- **Usage:**
287
+ **Usage example with [Eleventy Navigation plugin](https://www.11ty.dev/docs/plugins/navigation/#bring-your-own-html-render-the-menu-items-manually):**
248
288
 
249
- ```liquid
250
- {% render 'bricks/_nav', nav_pages: navPages, current_url: page.url %}
251
- ```
252
-
253
- **Example:**
254
-
255
- ```liquid
256
- {% assign navPages = site.pages | where: "nav", true %}
257
- {% render 'bricks/_nav', nav_pages: navPages, current_url: page.url %}
289
+ ```liquid {data-caption="in .liquid:"}
290
+ {% assign nav_pages = collections.all | eleventyNavigation %}
291
+ {% render 'bricks/_nav', nav_pages: nav_pages, current_url: page.url %}
258
292
  ```
259
293
 
260
294
  **Output:**
@@ -267,11 +301,13 @@ A navigation template that renders a list of navigation links with proper access
267
301
  </nav>
268
302
  ```
269
303
 
270
- **Compatibility:** Compatible with [Eleventy Navigation plugin](https://www.11ty.dev/docs/plugins/navigation/#bring-your-own-html-render-the-menu-items-manually).
304
+ <details><summary>
305
+
306
+ ### Google Tag Manager <small>(`_gtm.*`)</small>
271
307
 
272
- ### Google Tag Manager (`_gtm.liquid`)
308
+ </summary>
273
309
 
274
- A template for embedding Google Tag Manager scripts in your pages.
310
+ A template `bricks/_gtm.{njk|liquid}` for embedding Google Tag Manager scripts in your pages.
275
311
 
276
312
  **Parameters:**
277
313
 
@@ -279,39 +315,9 @@ A template for embedding Google Tag Manager scripts in your pages.
279
315
  - `site.prod` - Boolean flag to enable GTM only in production
280
316
  - `for_body` - Boolean flag (default: `false`). When `false`, renders the script tag for the `<head>`. When `true`, renders the noscript fallback for the `<body>`.
281
317
 
282
- **Note:** This template is automatically included when using `__html.liquid`. You only need to manually render it if you're not using that base template.
283
-
284
- **Manual Usage:**
285
-
286
- In your base template's `<head>`:
287
-
288
- ```liquid
289
- {% render 'bricks/_gtm', site: site %}
290
- ```
291
-
292
- In your base template's `<body>` (right after the opening tag):
293
-
294
- ```liquid
295
- {% render 'bricks/_gtm', site: site, for_body: true %}
296
- ```
297
-
298
- **Example (Manual Integration):**
299
-
300
- ```liquid
301
- <!DOCTYPE html>
302
- <html>
303
- <head>
304
- {% render 'bricks/_gtm', site: site %}
305
- </head>
306
- <body>
307
- {% render 'bricks/_gtm', site: site, for_body: true %}
308
- <!-- Your content -->
309
- </body>
310
- </html>
311
- ```
312
-
313
- **Rendering Logic:** The GTM script is only rendered when both `site.prod` is `true` and `site.gtm_id` is set. The template uses a capture block to strip whitespace from the output.
318
+ **Note:** This template is automatically included when using `__html.liquid`. You only need to manually render it if you're not using that base template, see examples:
314
319
 
315
- ## License
320
+ - https://github.com/anydigital/bricks/blob/main/bricks/__html.njk
321
+ - https://github.com/anydigital/bricks/blob/main/bricks/__html.liquid
316
322
 
317
- MIT
323
+ </details>
package/_config.yml ADDED
@@ -0,0 +1,4 @@
1
+ exclude:
2
+ - "**/*"
3
+ include:
4
+ - "*.md"
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
6
6
  <title>
7
- {{- title | strip_html | append: ' | ' | if: title -}}
7
+ {%- if title %}{{ title | strip_html | append: ' | ' }}{% endif -%}
8
8
  {{- site.title -}}
9
9
  </title>
10
10
  <link rel="icon" href="/favicon.ico">
@@ -12,24 +12,24 @@
12
12
  {%- for href in site.styles %}
13
13
  <link rel="stylesheet" href="{{ href }}">
14
14
  {%- endfor %}
15
- {% # prettier-ignore %}
16
- <style>{{ site.inline_styles | join: '\n' }}</style>
17
- {% # %}
15
+ <style>
16
+ {{ site.inline_styles | join: '\n' }}
17
+ </style>
18
18
 
19
19
  {%- for src in site.scripts %}
20
20
  <script src="{{ src }}" defer></script>
21
21
  {%- endfor %}
22
- {% # prettier-ignore %}
23
- <script type="module">{{ site.inline_scripts | join: '\n' }}</script>
24
- {% # %}
22
+ <script type="module">
23
+ {{ site.inline_scripts | join: '\n' }}
24
+ </script>
25
25
 
26
26
  {{ content_for_header }}
27
- {% render './_gtm', site: site %}
27
+ {% include bricks/gtm.liquid %}
28
28
  </head>
29
29
 
30
30
  <body>
31
- {% render './_gtm', site: site, for_body: true %}
31
+ {% include bricks/gtm.liquid for_body=true %}
32
+
32
33
  {{ body }}
33
- {% # %}
34
34
  </body>
35
35
  </html>
@@ -12,23 +12,23 @@
12
12
  {%- for href in site.styles %}
13
13
  <link rel="stylesheet" href="{{ href }}" />
14
14
  {%- endfor %}
15
- {# prettier-ignore-start #}
16
- <style>{{ site.inline_styles | d([]) | join('\n') }}</style>
17
- {# prettier-ignore-end #}
15
+ {# prettier-ignore-start #}<style>
16
+ {{ site.inline_styles | d([]) | join('\n') }}
17
+ </style>{# prettier-ignore-end #}
18
18
 
19
19
  {%- for src in site.scripts %}
20
20
  <script src="{{ src }}" defer></script>
21
21
  {%- endfor %}
22
- {# prettier-ignore-start #}
23
- <script type="module">{{ site.inline_scripts | d([]) | join('\n') }}</script>
24
- {# prettier-ignore-end #}
22
+ {# prettier-ignore-start #}<script type="module">
23
+ {{ site.inline_scripts | d([]) | join('\n') }}
24
+ </script>{# prettier-ignore-end #}
25
25
 
26
26
  {{ content_for_header }}
27
- {% include 'bricks/_gtm.njk' %}
27
+ {% include 'bricks/gtm.njk' %}
28
28
  </head>
29
29
 
30
30
  <body>
31
- {% set for_body = true %}{% include 'bricks/_gtm.njk' %}
31
+ {% set for_body = true %}{% include 'bricks/gtm.njk' %}
32
32
  {% block body %}
33
33
  {% endblock %}
34
34
  </body>
package/bricks.gemspec ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "bricks"
5
+ spec.version = "0.25.0"
6
+ spec.authors = ["Anton Staroverov"]
7
+
8
+ spec.summary = "Framework-agnostic CSS utilities and single-file Liquid 'bricks' for modern web development."
9
+ spec.homepage = "https://github.com/anydigital/bricks"
10
+ spec.license = "MIT"
11
+
12
+ spec.files = Dir.glob("{_includes}/**/*")
13
+ # puts "spec.files: #{spec.files.inspect}"
14
+
15
+ spec.add_runtime_dependency "jekyll", ">= 3.5", "< 5.0"
16
+ end
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@anydigital/bricks",
3
- "version": "0.24.2",
3
+ "version": "0.26.0-alpha",
4
4
  "description": "Framework-agnostic CSS utilities and single-file Liquid 'bricks' for modern web development.",
5
- "style": "./bricks/bricks.css",
5
+ "style": "./src/bricks.css",
6
6
  "exports": {
7
- ".": "./bricks/bricks.css",
7
+ ".": "./src/bricks.css",
8
8
  "./dist": "./dist/bricks.css"
9
9
  },
10
10
  "scripts": {
11
- "postcss": "postcss bricks/bricks.css -o dist/bricks.css",
11
+ "postcss": "postcss src/bricks.css -o dist/bricks.css",
12
12
  "build": "npm run postcss -- --no-map",
13
13
  "start": "npm run postcss -- --watch",
14
14
  "prepublishOnly": "npm run build"
@@ -3,7 +3,7 @@
3
3
  * Framework-agnostic CSS utility helpers
4
4
  */
5
5
 
6
- @import "./__html";
6
+ @import "./_base";
7
7
  @import "./_prose";
8
8
  @import "@anydigital/breakout-css"; /* after prose to override it */
9
9
  @import "./_prism";
File without changes
File without changes
File without changes
File without changes
File without changes