@spectrum-web-components/theme
Advanced tools
Comparing version 0.8.8 to 0.8.9-alpha.1
{ | ||
"name": "@spectrum-web-components/theme", | ||
"version": "0.8.8", | ||
"version": "0.8.9-alpha.1+ed84dff79", | ||
"publishConfig": { | ||
@@ -58,4 +58,4 @@ "access": "public" | ||
"dependencies": { | ||
"@spectrum-web-components/base": "^0.4.3", | ||
"@spectrum-web-components/styles": "^0.9.7", | ||
"@spectrum-web-components/base": "^0.4.4-alpha.135+ed84dff79", | ||
"@spectrum-web-components/styles": "^0.9.8-alpha.1+ed84dff79", | ||
"tslib": "^2.0.0" | ||
@@ -75,3 +75,3 @@ }, | ||
], | ||
"gitHead": "b425768aaf694ab19ddad4fcab9939c29a2a503b" | ||
"gitHead": "ed84dff79fd23708ed6c63a8114290217d9c17ad" | ||
} |
@@ -1,2 +0,2 @@ | ||
declare const styles: import("@spectrum-web-components/base").CSSResult; | ||
declare const styles: import("@spectrum-web-components/base").CSSResultGroup; | ||
export default styles; |
@@ -1,2 +0,2 @@ | ||
declare const styles: import("@spectrum-web-components/base").CSSResult; | ||
declare const styles: import("@spectrum-web-components/base").CSSResultGroup; | ||
export default styles; |
@@ -1,2 +0,2 @@ | ||
declare const styles: import("@spectrum-web-components/base").CSSResult; | ||
declare const styles: import("@spectrum-web-components/base").CSSResultGroup; | ||
export default styles; |
@@ -1,2 +0,2 @@ | ||
declare const styles: import("@spectrum-web-components/base").CSSResult; | ||
declare const styles: import("@spectrum-web-components/base").CSSResultGroup; | ||
export default styles; |
@@ -1,2 +0,2 @@ | ||
declare const styles: import("@spectrum-web-components/base").CSSResult; | ||
declare const styles: import("@spectrum-web-components/base").CSSResultGroup; | ||
export default styles; |
@@ -1,2 +0,2 @@ | ||
declare const styles: import("@spectrum-web-components/base").CSSResult; | ||
declare const styles: import("@spectrum-web-components/base").CSSResultGroup; | ||
export default styles; |
@@ -1,2 +0,2 @@ | ||
declare const styles: import("@spectrum-web-components/base").CSSResult; | ||
declare const styles: import("@spectrum-web-components/base").CSSResultGroup; | ||
export default styles; |
@@ -1,2 +0,2 @@ | ||
import { CSSResult } from '@spectrum-web-components/base'; | ||
import { CSSResultGroup } from '@spectrum-web-components/base'; | ||
declare global { | ||
@@ -21,3 +21,3 @@ interface Window { | ||
name: string; | ||
styles: CSSResult; | ||
styles: CSSResultGroup; | ||
}>; | ||
@@ -65,4 +65,4 @@ export declare type ThemeFragmentMap = Map<FragmentType, FragmentMap>; | ||
protected adoptStyles(): void; | ||
static registerThemeFragment(name: FragmentName, kind: FragmentType, styles: CSSResult): void; | ||
static registerThemeFragment(name: FragmentName, kind: FragmentType, styles: CSSResultGroup): void; | ||
} | ||
export {}; |
@@ -14,2 +14,4 @@ /* | ||
import { | ||
CSSResultGroup, | ||
CSSResultArray, | ||
CSSResult, | ||
@@ -46,3 +48,3 @@ supportsAdoptingStyleSheets, | ||
type SettableFragmentTypes = 'color' | 'scale'; | ||
type FragmentMap = Map<string, { name: string; styles: CSSResult }>; | ||
type FragmentMap = Map<string, { name: string; styles: CSSResultGroup }>; | ||
export type ThemeFragmentMap = Map<FragmentType, FragmentMap>; | ||
@@ -157,3 +159,3 @@ export type Color = 'light' | 'lightest' | 'dark' | 'darkest'; | ||
private get styles(): CSSResult[] { | ||
private get styles(): CSSResultGroup { | ||
const themeKinds: FragmentType[] = [ | ||
@@ -172,3 +174,3 @@ ...Theme.themeFragmentsByKind.keys(), | ||
return acc; | ||
}, [] as CSSResult[]); | ||
}, [] as CSSResultArray); | ||
return [...styles]; | ||
@@ -238,3 +240,3 @@ } | ||
dirParent = ((dirParent as HTMLElement).assignedSlot || // step into the shadow DOM of the parent of a slotted node | ||
dirParent.parentNode || // DOM Element detected | ||
dirParent.parentNode || // DOM Element detected | ||
(dirParent as ShadowRoot).host) as | ||
@@ -281,3 +283,3 @@ | HTMLElement | ||
protected adoptStyles(): void { | ||
const styles = this.styles; // No test coverage on Edge | ||
const styles = this.styles as CSSResultArray; // No test coverage on Edge | ||
if (styles.length < this.expectedFragments) return; | ||
@@ -303,3 +305,3 @@ | ||
if (name === 'default') continue; | ||
let cssText = styles.cssText; | ||
let cssText = (styles as CSSResult).cssText; | ||
if (!Theme.defaultFragments.has(name as FragmentName)) { | ||
@@ -322,3 +324,5 @@ cssText = cssText.replace( | ||
for (const style of styles) { | ||
styleSheets.push(style.styleSheet as CSSStyleSheet); | ||
styleSheets.push( | ||
(style as CSSResult).styleSheet as CSSStyleSheet | ||
); | ||
} | ||
@@ -331,3 +335,3 @@ this.shadowRoot.adoptedStyleSheets = styleSheets; | ||
const style = document.createElement('style'); | ||
style.textContent = s.cssText; | ||
style.textContent = (s as CSSResult).cssText; | ||
this.shadowRoot.appendChild(style); | ||
@@ -342,3 +346,3 @@ }); | ||
kind: FragmentType, | ||
styles: CSSResult | ||
styles: CSSResultGroup | ||
): void { | ||
@@ -345,0 +349,0 @@ const fragmentMap = Theme.themeFragmentsByKind.get(kind) || new Map(); |
@@ -1,2 +0,2 @@ | ||
declare const styles: import("@spectrum-web-components/base").CSSResult; | ||
declare const styles: import("@spectrum-web-components/base").CSSResultGroup; | ||
export default styles; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1475344
4881
1