Skip to content

Commit

Permalink
Fix styles in sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeckem committed Nov 24, 2024
1 parent 2dca263 commit 3dae510
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ packages:
- src/packages/core
- src/packages/chakra-integration
- src/packages/test-utils
- src/samples/chakra-sample/**
# TODO:
# - src/**
- "!**/test-data/**"
Expand All @@ -30,6 +31,7 @@ catalog:
react-dom: *react_version
react-json-view: ^1.21.3
react-use: ^17.5.1
react-icons: ^5.3.0
react: *react_version

# Devtools
Expand Down
2 changes: 1 addition & 1 deletion src/packages/chakra-integration/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const system = createSystem(
defaultConfig,
defineConfig({
preflight: {
scope: ":host"
scope: ".pioneer-root"
},
cssVarsRoot: ":host",
conditions: redirectLightCondition(defaultConfig.conditions),
Expand Down
5 changes: 4 additions & 1 deletion src/packages/runtime/CustomElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,10 @@ class ApplicationInstance {
private initStyles() {
// Prevent inheritance of certain css values and normalize to display: block by default.
// See https://open-wc.org/guides/knowledge/styling/styles-piercing-shadow-dom/
const builtinStyles = ":host { all: initial; display: block; }";
// NOTE: layer base comes from chakra (used for css resets etc).
// TODO: Merge with global styles in chakra integration package
// TODO: Perhaps even move the chakra-provider in this package
const builtinStyles = "@layer base { :host { all: initial; display: block; } }";
const builtinStylesNode = document.createElement("style");
applyStyles(builtinStylesNode, { value: builtinStyles });

Expand Down
4 changes: 4 additions & 0 deletions src/samples/chakra-sample/chakra-app/SampleUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import {
Button,
Container,
Portal,
Spinner,
Stack,
Text
Expand All @@ -22,6 +23,9 @@ export function SampleUI() {

<Text>I am Text</Text>

{/* TODO: Portal appears at the wrong location (direct child of shadow root instead of .pioneer-root */}
<Portal><Button>Hello World</Button></Portal>

<AccordionDemo />
<Spinner />
</Container>
Expand Down

0 comments on commit 3dae510

Please sign in to comment.