H-5780: Remove petrinaut-old and fix Petrinaut CSS scoping for HASH embedding#8369
Draft
H-5780: Remove petrinaut-old and fix Petrinaut CSS scoping for HASH embedding#8369
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
The migration to @hashintel/petrinaut is complete — nothing depends on the old package anymore. Remove it entirely and clean up the changeset ignore list. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Switch panels from `position: fixed` to `position: absolute` so they
stay contained within petrinaut-root when embedded in Hash. Add
`position: relative` to `.petrinaut-root` as the positioning anchor.
Enable `base: "./"` and add a `generateBundle` plugin to simplify
Vite's worker URL output from `"" + new URL(...).href` to a clean
`new URL("assets/...", import.meta.url)`.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Override light/dark conditions so color tokens land on .petrinaut-root instead of :where(:root,...). Enable CSS @layer polyfill so utilities are not overridden by HASH's unlayered global reset (* { padding: 0 }). Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add CSS resets (fontWeight, textAlign, textTransform, letterSpacing) to tooltip content so it doesn't inherit styles from ancestor elements like section titles and field labels. Co-Authored-By: Claude Opus 4.6 <[email protected]>
The last MUI usage (tooltip) was replaced with Ark UI and native SVG, so the dependency and its ESLint import restriction are no longer needed. Co-Authored-By: Claude Opus 4.6 <[email protected]>
d36dfc7 to
ddb3b65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🌟 What is the purpose of this PR?
Remove the legacy
@hashintel/petrinaut-oldpackage from the monorepo and fix CSS scoping issues when embedding the new@hashintel/petrinautlibrary inside Hash frontend.🔗 Related links
🚫 Blocked by
Nothing
🔍 What does this change?
1. Remove
@hashintel/petrinaut-oldlibs/@hashintel/petrinaut-old/directory (the legacy Petrinaut implementation)yarn.lock2. Integrate new Petrinaut into Hash frontend
apps/hash-frontendto import@hashintel/petrinautinstead ofpetrinaut-oldconvert-net-formats.tsfor data format conversion between Hash entities and Petrinaut's SDCPN formatuse-process-save-and-load.tsxto work with the new Petrinaut APInode-noop.ts,os.ts) for browser compatibility in the lib build3. Fix Petrinaut panel positioning and worker URL
position: fixed→position: absolute)4. Fix CSS scoping for HASH embedding (⚠️ important)
Two PandaCSS scoping issues were fixed in
panda.config.ts:Problem A — Color tokens not on
.petrinaut-root:The
@hashintel/ds-themepreset defineslight/darkconditions as:root &, .light &, .... PandaCSS generated color tokens on:where(:root,.light,[data-theme=light])instead of.petrinaut-root, so color CSS variables were undefined when embedded in Hash.Fix: Override conditions to scope to
.petrinaut-root:Problem B — CSS
@layervs unlayered global reset:Hash applies an unlayered global CSS reset (
* { padding: 0; margin: 0; box-sizing: border-box; }) via MUI CssBaseline andglobals.scss. PandaCSS wraps all its output in CSS@layerblocks (e.g.@layer utilities { .p_4 { padding: ... } }).Per the CSS cascade specification, unlayered CSS always beats layered CSS, regardless of selector specificity. This means Hash's
* { padding: 0 }overrides Petrinaut's.p_4 { padding: var(--spacing-4) }even though a class selector normally beats the universal selector.Fix: Enable PandaCSS's
polyfill: trueoption. This uses@csstools/postcss-cascade-layersto transform@layerwrappers into specificity-based equivalents (:not(#\#)chains), making the output unlayered. Normal CSS specificity then applies, and.p_4:not(#\#):not(#\#):not(#\#)(specificity 3,1,0) correctly beats*(specificity 0,0,0).Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
@layerpolyfill is a workaround for Hash's unlayered global reset overriding Petrinaut's layered utilities. A cleaner long-term solution would be to wrap Hash's global CSS in a layer, but that is a broader change.:not(#\#)specificity boosts add ~14 kB to the uncompressed CSS (~0.6 kB gzipped).🐾 Next steps
@layerso embedded components using@layerwork correctly without polyfills🛡 What tests cover this?
dist/main.csscontains all CSS variables on.petrinaut-rootand utilities are not wrapped in@layerblocks❓ How to test this?
turbo run build --filter '@hashintel/petrinaut' --forcelibs/@hashintel/petrinaut/dist/main.css:--colors-gray-10, etc.) should be on.petrinaut-root, NOT on:where(:root,...):not(#\#)specificity boosts (e.g..p_4:not(#\#):not(#\#):not(#\#))@layer utilities { ... }blocks should remain (only the empty declaration@layer reset,base,tokens,recipes,utilities;)yarn dev) and navigate to a process page — Petrinaut should render with correct padding, margins, and colors📹 Demo
N/A — CSS scoping fix, no visual change from standalone Petrinaut (it now looks correct when embedded)