Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Jun 18, 2024
1 parent 837a0ee commit 1863dd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/runtime/initialize-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const initializeComponent = async (
/**
* this component has styles but we haven't registered them yet
*/
let style: string | undefined
let style: string | undefined;

if (typeof Cstr.style === 'string') {
/**
Expand All @@ -128,7 +128,7 @@ export const initializeComponent = async (
* })
* ```
*/
style = Cstr.style
style = Cstr.style;
} else if (BUILD.mode && typeof style !== 'string') {
/**
* in case the component has a `styleUrl` object defined, e.g.
Expand Down
10 changes: 7 additions & 3 deletions src/runtime/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export const registerStyle = (scopeId: string, cssText: string, allowCS: boolean
* @param mode an optional current mode
* @returns the scope ID for the component of interest
*/
export const addStyle = (styleContainerNode: Element | Document | ShadowRoot, cmpMeta: d.ComponentRuntimeMeta, mode?: string) => {
export const addStyle = (
styleContainerNode: Element | Document | ShadowRoot,
cmpMeta: d.ComponentRuntimeMeta,
mode?: string,
) => {
const styleContainerDocument = styleContainerNode as Document;
const styleContainerShadowRoot = styleContainerNode as ShadowRoot;
const scopeId = getScopeId(cmpMeta, mode);
Expand All @@ -62,7 +66,7 @@ export const addStyle = (styleContainerNode: Element | Document | ShadowRoot, cm

if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerDocument.head || styleContainerNode as HTMLElement;
styleContainerNode = styleContainerDocument.head || (styleContainerNode as HTMLElement);
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
let styleElm;
if (!appliedStyles) {
Expand Down Expand Up @@ -121,7 +125,7 @@ export const attachStyles = (hostRef: d.HostRef) => {
const flags = cmpMeta.$flags$;
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
const scopeId = addStyle(
BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode() as ShadowRoot,
BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : (elm.getRootNode() as ShadowRoot),
cmpMeta,
hostRef.$modeName$,
);
Expand Down

0 comments on commit 1863dd3

Please sign in to comment.