Skip to content

Commit 09f54e6

Browse files
Limit tailwind preflight to scoped containers
egraphs-good/egglog#426 (comment)
1 parent 3deff46 commit 09f54e6

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>E-Graph Visualizer</title>
77
</head>
8-
<body class="h-full">
8+
<body class="h-full twp">
99
<div class="h-full" id="root"></div>
1010
<script type="module" src="/src/main.tsx"></script>
1111
</body>

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egraph-visualizer",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/egraphs-good/egraph-visualizer.git"
@@ -45,6 +45,7 @@
4545
"globals": "^15.11.0",
4646
"postcss": "8.4.47",
4747
"tailwindcss": "3.4.13",
48+
"tailwindcss-scoped-preflight": "^3.4.5",
4849
"typescript": "^5.6.3",
4950
"typescript-eslint": "^8.8.1",
5051
"vite": "^5.4.8"

src/Visualizer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ export function Visualizer({ egraphs, height = null, resize = false }: { egraphs
462462
);
463463

464464
return (
465-
<div className={`w-full relative ${resize ? "resize-y" : ""}`} style={{ height: height || "100%" }} ref={setRootElem}>
465+
<div className={`twp w-full relative ${resize ? "resize-y" : ""}`} style={{ height: height || "100%" }} ref={setRootElem}>
466466
{/* Hidden node to measure text size */}
467467
<div className="invisible absolute">
468468
<ENode outerRef={setOuterElem} innerRef={setInnerElem} />

tailwind.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import { scopedPreflightStyles, isolateInsideOfContainer } from 'tailwindcss-scoped-preflight';
2+
13
// https://github.com/zaichaopan/react-aria-components-tailwind-starter/blob/c15f630866480e00d7a39258db0f61b39704e00e/tailwind.config.js
4+
25
const defaultTheme = require('tailwindcss/defaultTheme');
6+
37
/** @type {import('tailwindcss').Config} */
48
export default {
59
content: [
@@ -25,6 +29,9 @@ export default {
2529
require('tailwindcss-react-aria-components'),
2630
require('tailwindcss-animate'),
2731
require('@tailwindcss/container-queries'),
32+
scopedPreflightStyles({
33+
isolationStrategy: isolateInsideOfContainer('.twp', {}),
34+
}),
2835
],
2936
important: true,
3037
}

yarn.lock

+11
Original file line numberDiff line numberDiff line change
@@ -3411,6 +3411,7 @@ __metadata:
34113411
tailwindcss: "npm:3.4.13"
34123412
tailwindcss-animate: "npm:1.0.7"
34133413
tailwindcss-react-aria-components: "npm:1.1.6"
3414+
tailwindcss-scoped-preflight: "npm:^3.4.5"
34143415
typescript: "npm:^5.6.3"
34153416
typescript-eslint: "npm:^8.8.1"
34163417
vega-scale: "npm:7.4.1"
@@ -5336,6 +5337,16 @@ __metadata:
53365337
languageName: node
53375338
linkType: hard
53385339

5340+
"tailwindcss-scoped-preflight@npm:^3.4.5":
5341+
version: 3.4.5
5342+
resolution: "tailwindcss-scoped-preflight@npm:3.4.5"
5343+
peerDependencies:
5344+
postcss: ^8
5345+
tailwindcss: ^3
5346+
checksum: 10c0/d61f85deba587affb70eb430ca2722ce798fc2b62f9230a7d2d2dd35765e7d83d99d8e46e0fc6ff197ad2c47bd66bc9b5b77d200b3d885644a14996ef309eaef
5347+
languageName: node
5348+
linkType: hard
5349+
53395350
"tailwindcss@npm:3.4.13":
53405351
version: 3.4.13
53415352
resolution: "tailwindcss@npm:3.4.13"

0 commit comments

Comments
 (0)