@anydigital/breakout-css 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Anton Staroverov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # breakout-css
2
+
3
+ Modern CSS utilities to easily break-out / hang / pop-out images, iframes, or other "figures" from their parent container.
4
+
5
+ ## Installation
6
+
7
+ ### From CDN
8
+
9
+ ```html
10
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@anydigital/breakout-css@1/dist/breakout.min.css">
11
+ ```
12
+
13
+ ### Precompiled CSS
14
+
15
+ ```bash
16
+ npm install @anydigital/breakout-css
17
+ ```
18
+
19
+ Import the compiled CSS file directly into your project:
20
+
21
+ ```css
22
+ @import '@anydigital/breakout-css/dist/breakout.css';
23
+ ```
24
+
25
+ ### With Tailwind v4
26
+
27
+ Tailwind v4 supports native CSS nesting, so you can import the source file directly:
28
+
29
+ ```css
30
+ @import '@anydigital/breakout-css/src/breakout.css';
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ### Basic Usage
36
+
37
+ ```html
38
+ <div class="breakout">
39
+ <h1>Article Title</h1>
40
+ <p>Lorem ipsum dolor sit amet...</p>
41
+
42
+ <!-- This image will automatically break out -->
43
+ <img src="hero.jpg" alt="Hero image">
44
+
45
+ <p>More content here...</p>
46
+ </div>
47
+ ```
48
+
49
+ ### Supported Elements
50
+
51
+ The breakout effect automatically applies to:
52
+ - `img`, `figure`, `picture`
53
+ - `video`, `audio`
54
+ - `iframe`, `object`, `embed`, `canvas`
55
+ - Elements with `.breakout-figure` class
56
+
57
+ ### Manual Breakout
58
+
59
+ ```html
60
+ <div class="breakout">
61
+ <p>Regular content...</p>
62
+
63
+ <div class="breakout-figure">
64
+ <iframe src="https://example.com/embed"></iframe>
65
+ </div>
66
+
67
+ <p>More content...</p>
68
+ </div>
69
+ ```
70
+
71
+ ## How It Works
72
+
73
+ The breakout effect is achieved by:
74
+
75
+ 1. Setting the element's width to 125% of its container
76
+ 2. Using `transform: translateX(-50%)` to shift it left by half its width
77
+ 3. Using `margin-left: 50%` to position it from the center of the container
78
+
79
+ This combination allows elements to extend beyond their parent container while remaining visually centered.
80
+
81
+ ## License
82
+
83
+ MIT
@@ -0,0 +1,25 @@
1
+ /* Breakout CSS - Framework-agnostic utilities for breaking out images and figures */
2
+
3
+ .breakout {
4
+ padding-left: 10%;
5
+ padding-right: 10%;
6
+
7
+ /* Direct children, potentially wrapped in <p> for Markdown support */
8
+
9
+ }
10
+
11
+ /* All the supported "figure" elements and custom utility class for other tags that need to be broken out */
12
+
13
+ .breakout > img:not(does-not-exist):not(.does-not-exist),.breakout > figure:not(does-not-exist):not(.does-not-exist),.breakout > picture:not(does-not-exist):not(.does-not-exist),.breakout > video:not(does-not-exist):not(.does-not-exist),.breakout > audio: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 > canvas:not(does-not-exist):not(.does-not-exist),.breakout > .breakout-figure:not(does-not-exist),.breakout > p > img:not(.does-not-exist),.breakout > p > figure:not(.does-not-exist),.breakout > p > picture:not(.does-not-exist),.breakout > p > video:not(.does-not-exist),.breakout > p > audio: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 > canvas:not(.does-not-exist),.breakout > p > .breakout-figure {
14
+ width: auto; /* Support small images */
15
+ max-width: 125%;
16
+ transform: translateX(-50%);
17
+ margin-left: 50%;
18
+
19
+ }
20
+
21
+ .breakout > .breakout-figure:not(does-not-exist),.breakout > p > .breakout-figure {
22
+ width: 125% !important;
23
+ }
24
+
25
+ /* @TODO: Allow non-direct children. */
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@anydigital/breakout-css",
3
+ "version": "1.0.0-alpha",
4
+ "description": "Modern CSS utilities to easily break-out / hang / pop-out images, iframes, or other figures from their parent container",
5
+ "keywords": [
6
+ "css",
7
+ "breakout",
8
+ "images",
9
+ "figures",
10
+ "tailwind",
11
+ "tailwind-plugin",
12
+ "utilities"
13
+ ],
14
+ "main": "dist/breakout.css",
15
+ "style": "dist/breakout.css",
16
+ "files": [
17
+ "dist",
18
+ "src"
19
+ ],
20
+ "exports": {
21
+ ".": "./dist/breakout.css",
22
+ "./css": "./dist/breakout.css",
23
+ "./src": "./src/breakout.css"
24
+ },
25
+ "scripts": {
26
+ "build": "node scripts/build.js",
27
+ "prepublishOnly": "npm run build"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/anydigital/breakout-css.git"
32
+ },
33
+ "author": "Anton Staroverov",
34
+ "license": "MIT",
35
+ "peerDependencies": {
36
+ "tailwindcss": "^3.0.0 || ^4.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "fs-extra": "^11.2.0",
40
+ "postcss": "^8.4.0",
41
+ "postcss-nesting": "^12.0.0",
42
+ "postcss-preset-env": "^10.6.0"
43
+ }
44
+ }
@@ -0,0 +1,25 @@
1
+ /* Breakout CSS - Framework-agnostic utilities for breaking out images and figures */
2
+
3
+ .breakout {
4
+ padding-left: 10%;
5
+ padding-right: 10%;
6
+
7
+ /* Direct children, potentially wrapped in <p> for Markdown support */
8
+ & > *,
9
+ & > p > * {
10
+ /* All the supported "figure" elements and custom utility class for other tags that need to be broken out */
11
+ &:is(img, figure, picture, video, audio, iframe, object, embed, canvas, .breakout-figure) {
12
+ width: auto; /* Support small images */
13
+ max-width: 125%;
14
+ transform: translateX(-50%);
15
+ margin-left: 50%;
16
+
17
+ }
18
+ &:is(.breakout-figure) {
19
+ width: 125% !important;
20
+ }
21
+ }
22
+
23
+ }
24
+
25
+ /* @TODO: Allow non-direct children. */