feat(apollo-wind): add shadow DOM CSS injection utilities#855
Closed
david-rios-uipath wants to merge 3 commits into
Closed
feat(apollo-wind): add shadow DOM CSS injection utilities#855david-rios-uipath wants to merge 3 commits into
david-rios-uipath wants to merge 3 commits into
Conversation
- Fix ReDoS: remove capturing group and use [^}]* instead of [^}]+ - Add idempotency test to verify only one style element is injected
…Css utilities Consolidate the shadow DOM CSS injection pattern into reusable exports so consumers don't need to reimplement the inject + @Property registration dance.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Dependency License Review
License distribution
Excluded packages
|
9d18f76 to
074dd34
Compare
Contributor
Author
|
Merged into #830 — single PR now ships the full shadow DOM injection API. |
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.
Summary
Builds on #830 to consolidate the shadow DOM CSS injection pattern into reusable apollo-wind exports. Every shadow DOM consumer of apollo-wind currently reimplements the same three steps: detect existing CSS, inject a
<style>tag, and callregisterCssPropertyRules. This PR extracts that into shared utilities.New exports
injectTailwindIntoShadowRoot(root, css)— injects a<style data-tailwind-inject>into the shadow root, callsregisterCssPropertyRulesinternally. Idempotent; returns the created element (ornullif skipped) so callers can clean up on unmount.hasApolloWindCss(root)— two-level detection: fast-path tag check + computed-style probes (grid/flex/hidden/relative). Deliberately avoids probing custom properties (they inherit across the shadow boundary and would false-positive).TAILWIND_INJECT_ATTR— the sentinel attribute constant (data-tailwind-inject).Backward compatibility
registerCssPropertyRulesis unchanged. The new functions are additive exports only.Test plan
pnpm --filter @uipath/apollo-wind test— 923 tests pass (11 new)pnpm --filter @uipath/apollo-wind build— new exports appear indist/index.d.tsinjectTailwindIntoShadowRootandhasApolloWindCsswith imports from@uipath/apollo-wind🤖 Generated with Claude Code