@anydigital/breakout-css 1.0.0-alpha.5 → 1.0.0-alpha.7
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 +23 -10
- package/dist/breakout.css +5 -6
- package/package.json +3 -7
- package/src/breakout.css +5 -7
package/README.md
CHANGED
|
@@ -36,11 +36,16 @@ Modern CSS utilities to easily break-out / hang / pop-out images, iframes, or ot
|
|
|
36
36
|
|
|
37
37
|
### Supported Elements
|
|
38
38
|
|
|
39
|
-
The breakout effect automatically applies to:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- `
|
|
39
|
+
The breakout effect automatically applies to direct children or elements wrapped in `<p>` tags:
|
|
40
|
+
|
|
41
|
+
**Inline blocks:**
|
|
42
|
+
- `img`, `picture`, `figure`, `canvas`, `audio`
|
|
43
|
+
|
|
44
|
+
**Larger blocks:**
|
|
43
45
|
- `table`, `pre`
|
|
46
|
+
- `iframe`, `object`, `embed`, `video`
|
|
47
|
+
|
|
48
|
+
**Custom utility classes:**
|
|
44
49
|
- Elements with `.breakout-item` or `.breakout-item-max` class
|
|
45
50
|
|
|
46
51
|
### Manual Breakout
|
|
@@ -61,7 +66,7 @@ For elements that don't automatically break out, use the `.breakout-item` class:
|
|
|
61
66
|
|
|
62
67
|
### Force Maximum Width
|
|
63
68
|
|
|
64
|
-
By default, breakout elements
|
|
69
|
+
By default, breakout elements use `width: fit-content` with `max-width: 125%`, allowing them to size between 100% and 125% width based on their content. To force an element to always use the full 125% breakout width, use `.breakout-item-max`:
|
|
65
70
|
|
|
66
71
|
```html
|
|
67
72
|
<div class="breakout">
|
|
@@ -74,15 +79,23 @@ By default, breakout elements auto-size between 100% and 125% width. To force an
|
|
|
74
79
|
</div>
|
|
75
80
|
```
|
|
76
81
|
|
|
82
|
+
Note: `.breakout-item-max` uses `width: 125% !important` to override default sizing.
|
|
83
|
+
|
|
77
84
|
## How It Works
|
|
78
85
|
|
|
79
|
-
The breakout
|
|
86
|
+
The `.breakout` container applies `padding-inline: 10%` to create space for breakout elements.
|
|
87
|
+
|
|
88
|
+
The breakout effect on elements is achieved by:
|
|
89
|
+
|
|
90
|
+
1. Setting `width: fit-content` with `min-width: 100%` and `max-width: 125%` (inline blocks like `img`, `picture`, `figure`, `canvas`, and `audio` use `min-width: auto` instead)
|
|
91
|
+
2. Using `margin-left: 50%` to position from the center of the container
|
|
92
|
+
3. Using `transform: translateX(-50%)` to shift it left by half its width
|
|
93
|
+
|
|
94
|
+
This combination allows elements to extend beyond their parent container (up to 125% width) while remaining visually centered.
|
|
80
95
|
|
|
81
|
-
|
|
82
|
-
2. Using `transform: translateX(-50%)` to shift it left by half its width
|
|
83
|
-
3. Using `margin-left: 50%` to position it from the center of the container
|
|
96
|
+
### Markdown Support
|
|
84
97
|
|
|
85
|
-
|
|
98
|
+
The breakout effect works on direct children of `.breakout`, or elements wrapped in `<p>` tags (for Markdown compatibility where images are often wrapped in paragraphs).
|
|
86
99
|
|
|
87
100
|
## License
|
|
88
101
|
|
package/dist/breakout.css
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
/* Breakout CSS - Framework-agnostic utilities for breaking out images and figures */
|
|
2
2
|
|
|
3
3
|
.breakout {
|
|
4
|
-
padding-
|
|
5
|
-
padding-right: 10%;
|
|
4
|
+
padding-inline: 10%;
|
|
6
5
|
|
|
7
6
|
/* Direct children, or wrapped in <p> for Markdown support */
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
.breakout > img:not(does-not-exist):not(.does-not-exist),.breakout > picture:not(does-not-exist):not(.does-not-exist),.breakout > figure:not(does-not-exist):not(.does-not-exist),.breakout > canvas:not(does-not-exist):not(.does-not-exist),.breakout > audio:not(does-not-exist):not(.does-not-exist),.breakout > table:not(does-not-exist):not(.does-not-exist),.breakout > pre:not(does-not-exist):not(.does-not-exist),.breakout > iframe:not(does-not-exist):not(.does-not-exist),.breakout > object:not(does-not-exist):not(.does-not-exist),.breakout > embed:not(does-not-exist):not(.does-not-exist),.breakout > video:not(does-not-exist):not(.does-not-exist),.breakout > .breakout-item:not(does-not-exist),.breakout > .breakout-item-max:not(does-not-exist),.breakout > p > img:not(.does-not-exist),.breakout > p > picture:not(.does-not-exist),.breakout > p > figure:not(.does-not-exist),.breakout > p > canvas:not(.does-not-exist),.breakout > p > audio:not(.does-not-exist),.breakout > p > table:not(.does-not-exist),.breakout > p > pre:not(.does-not-exist),.breakout > p > iframe:not(.does-not-exist),.breakout > p > object:not(.does-not-exist),.breakout > p > embed:not(.does-not-exist),.breakout > p > video:not(.does-not-exist),.breakout > p > .breakout-item,.breakout > p > .breakout-item-max {
|
|
11
|
-
|
|
12
|
-
width:
|
|
10
|
+
width: -moz-fit-content;
|
|
11
|
+
width: fit-content;
|
|
13
12
|
min-width: 100%;
|
|
14
13
|
max-width: 125%;
|
|
15
|
-
transform: translateX(-50%);
|
|
16
14
|
margin-left: 50%;
|
|
15
|
+
transform: translateX(-50%);
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
/*
|
|
18
|
+
/* Respect inline blocks' min-width */
|
|
20
19
|
|
|
21
20
|
.breakout > img:not(does-not-exist),.breakout > picture:not(does-not-exist),.breakout > figure:not(does-not-exist),.breakout > canvas:not(does-not-exist),.breakout > audio:not(does-not-exist),.breakout > p > img,.breakout > p > picture,.breakout > p > figure,.breakout > p > canvas,.breakout > p > audio {
|
|
22
21
|
min-width: auto;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anydigital/breakout-css",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "Modern CSS utilities to easily break-out / hang / pop-out images, iframes, or other figures from their parent container",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"images",
|
|
9
9
|
"figures",
|
|
10
10
|
"tailwind",
|
|
11
|
-
"tailwind-plugin",
|
|
12
11
|
"utilities"
|
|
13
12
|
],
|
|
14
13
|
"files": [
|
|
@@ -16,12 +15,13 @@
|
|
|
16
15
|
"src",
|
|
17
16
|
"postcss.config.js"
|
|
18
17
|
],
|
|
18
|
+
"style": "./src/breakout.css",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": "./src/breakout.css",
|
|
21
21
|
"./dist": "./dist/breakout.css"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "postcss src/breakout.css -o dist/breakout.css",
|
|
24
|
+
"build": "postcss src/breakout.css --no-map -o dist/breakout.css",
|
|
25
25
|
"prepublishOnly": "npm run build"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
@@ -30,11 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "Anton Staroverov",
|
|
32
32
|
"license": "MIT",
|
|
33
|
-
"peerDependencies": {
|
|
34
|
-
"tailwindcss": "^3.0.0 || ^4.0.0"
|
|
35
|
-
},
|
|
36
33
|
"devDependencies": {
|
|
37
|
-
"fs-extra": "^11.2.0",
|
|
38
34
|
"postcss": "^8.4.0",
|
|
39
35
|
"postcss-cli": "^11.0.0",
|
|
40
36
|
"postcss-preset-env": "^10.6.0"
|
package/src/breakout.css
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Breakout CSS - Framework-agnostic utilities for breaking out images and figures */
|
|
2
2
|
|
|
3
3
|
.breakout {
|
|
4
|
-
padding-
|
|
5
|
-
padding-right: 10%;
|
|
4
|
+
padding-inline: 10%;
|
|
6
5
|
|
|
7
6
|
/* Direct children, or wrapped in <p> for Markdown support */
|
|
8
7
|
& > *,
|
|
@@ -14,19 +13,18 @@
|
|
|
14
13
|
table,
|
|
15
14
|
pre,
|
|
16
15
|
iframe, object, embed, video,
|
|
17
|
-
/* Custom utility
|
|
16
|
+
/* Custom utility classes for other tags that need to be broken out */
|
|
18
17
|
.breakout-item,
|
|
19
18
|
.breakout-item-max
|
|
20
19
|
) {
|
|
21
|
-
|
|
22
|
-
width: auto;
|
|
20
|
+
width: fit-content;
|
|
23
21
|
min-width: 100%;
|
|
24
22
|
max-width: 125%;
|
|
25
|
-
transform: translateX(-50%);
|
|
26
23
|
margin-left: 50%;
|
|
24
|
+
transform: translateX(-50%);
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
/*
|
|
27
|
+
/* Respect inline blocks' min-width */
|
|
30
28
|
&:is(img, picture, figure, canvas, audio) {
|
|
31
29
|
min-width: auto;
|
|
32
30
|
}
|