Skip to content

Commit

Permalink
chore: remove onQueryTheme from sp-theme (#4749)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencarvalho authored Sep 17, 2024
1 parent 47b2d61 commit f5f09b3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
20 changes: 0 additions & 20 deletions tools/theme/src/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
ShadowRootWithAdoptedStyleSheets,
SYSTEM_VARIANT_VALUES,
SystemVariant,
ThemeData,
ThemeFragmentMap,
ThemeKindProvider,
} from './theme-interfaces';
Expand Down Expand Up @@ -298,10 +297,6 @@ export class Theme extends HTMLElement implements ThemeKindProvider {
const node = document.importNode(Theme.template.content, true);
this.shadowRoot.appendChild(node);
this.shouldAdoptStyles();
this.addEventListener(
'sp-query-theme',
this.onQueryTheme as EventListener
);
this.addEventListener(
'sp-language-context',
this._handleContextPresence as EventListener
Expand All @@ -317,21 +312,6 @@ export class Theme extends HTMLElement implements ThemeKindProvider {
this.__resolve = resolve;
});
}
/* c8 ignore next 12 */
private onQueryTheme(event: CustomEvent<ThemeData>): void {
if (event.defaultPrevented) {
return;
}
event.preventDefault();
const { detail: theme } = event;
theme.color = this.color || undefined;
theme.scale = this.scale || undefined;
theme.lang =
this.lang || document.documentElement.lang || navigator.language;
// `theme` is deprecated in favor of `system` but maintaining `theme` as a deprecated path.
theme.theme = this.system || undefined;
theme.system = this.system || undefined;
}

protected connectedCallback(): void {
// Note, first update/render handles styleElement so we only call this if
Expand Down
8 changes: 0 additions & 8 deletions tools/theme/src/theme-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ export type Color = (typeof COLOR_VALUES)[number];

export type FragmentName = Color | Scale | SystemVariant | 'core' | 'app';

export interface ThemeData {
color?: Color;
scale?: Scale;
lang?: string;
theme?: SystemVariant;
system?: SystemVariant;
}

export type ThemeKindProvider = {
[P in SettableFragmentTypes]: SystemVariant | Color | Scale | '';
};
Expand Down

0 comments on commit f5f09b3

Please sign in to comment.