Socket
Socket
Sign inDemoInstall

@spectrum-web-components/theme

Package Overview
Dependencies
Maintainers
5
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spectrum-web-components/theme - npm Package Compare versions

Comparing version 0.3.3-alpha.11 to 0.4.0

lib/typography.css.d.ts

14

CHANGELOG.md

@@ -6,2 +6,16 @@ # Change Log

# [0.4.0](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/theme@0.3.2...@spectrum-web-components/theme@0.4.0) (2020-04-16)
### Bug Fixes
- ensure themes are registered before adopting ([a7ffb84](https://github.com/adobe/spectrum-web-components/commit/a7ffb8420c7fdb045b837ea733694e1f48192578))
### Features
- **rule:** add Spectrum rule pattern and apply to docs ([f4c52ae](https://github.com/adobe/spectrum-web-components/commit/f4c52ae34eeae80f8edb57828ad93f32f33f713e))
### Performance Improvements
- use "sideEffects" listing in package.json ([7271614](https://github.com/adobe/spectrum-web-components/commit/7271614c0ca3ccf3566583bb59467eb15a6199cd))
## [0.3.2](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/theme@0.3.1...@spectrum-web-components/theme@0.3.2) (2020-04-07)

@@ -8,0 +22,0 @@

3

lib/theme.d.ts

@@ -33,2 +33,3 @@ import { CSSResult } from 'lit-element';

private static templateElement?;
private static instances;
static get observedAttributes(): string[];

@@ -46,2 +47,4 @@ get core(): 'core';

protected connectedCallback(): void;
protected disconnectedCallback(): void;
private shouldAdoptStyles;
protected adoptStyles(): void;

@@ -48,0 +51,0 @@ protected attributeChangedCallback(): void;

@@ -86,3 +86,3 @@ /*

}, []);
return [coreStyles, ...styles];
return [...styles];
}

@@ -106,6 +106,3 @@ static get template() {

connectedCallback() {
/* istanbul ignore if */
if (!this.hasAdoptedStyles) {
this.adoptStyles();
}
this.shouldAdoptStyles();
// Note, first update/render handles styleElement so we only call this if

@@ -117,5 +114,21 @@ // connected after first update.

}
// Add `this` to the instances array.
if (!Theme.instances.has(this)) {
Theme.instances.add(this);
}
}
disconnectedCallback() {
// Remove `this` to the instances array.
Theme.instances.delete(this);
}
shouldAdoptStyles() {
/* istanbul ignore if */
if (!this.hasAdoptedStyles) {
this.adoptStyles();
}
}
adoptStyles() {
const styles = this.styles; // No test coverage on Edge
if (styles.length < 3)
return;
// There are three separate cases here based on Shadow DOM support.

@@ -173,2 +186,3 @@ // (1) shadowRoot polyfilled: use ShadyCSS

attributeChangedCallback() {
this.hasAdoptedStyles = false;
if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {

@@ -190,2 +204,3 @@ window.ShadyCSS.styleElement(this);

fragmentMap.set(name, { name, styles });
Theme.instances.forEach((instance) => instance.shouldAdoptStyles());
}

@@ -195,2 +210,3 @@ }

Theme.defaultFragments = new Set(['core']);
Theme.instances = new Set();
Theme.registerThemeFragment('core', 'core', coreStyles);

@@ -197,0 +213,0 @@ /* istanbul ignore else */

10

package.json

@@ -21,3 +21,3 @@ {

],
"version": "0.3.3-alpha.11+e39e02a1",
"version": "0.4.0",
"description": "",

@@ -33,4 +33,4 @@ "main": "lib/index.js",

"sideEffects": [
"./lib/index.js",
"./src/index.ts"
"./lib/*.js",
"./src/*.ts"
],

@@ -47,6 +47,6 @@ "scripts": {

"dependencies": {
"@spectrum-web-components/styles": "^0.5.2-alpha.11+e39e02a1",
"@spectrum-web-components/styles": "^0.5.2",
"tslib": "^1.10.0"
},
"gitHead": "e39e02a1cbe36c4512a18fa8622a8861f2509629"
"gitHead": "c8a769e3b24974f722054bc121f9a896d66e0bf1"
}

@@ -64,2 +64,4 @@ /*

private static instances: Set<Theme> = new Set();
static get observedAttributes(): string[] {

@@ -135,3 +137,3 @@ return ['color', 'scale'];

}, [] as CSSResult[]);
return [coreStyles, ...styles];
return [...styles];
}

@@ -173,6 +175,3 @@

protected connectedCallback(): void {
/* istanbul ignore if */
if (!this.hasAdoptedStyles) {
this.adoptStyles();
}
this.shouldAdoptStyles();
// Note, first update/render handles styleElement so we only call this if

@@ -184,6 +183,23 @@ // connected after first update.

}
// Add `this` to the instances array.
if (!Theme.instances.has(this)) {
Theme.instances.add(this);
}
}
protected disconnectedCallback(): void {
// Remove `this` to the instances array.
Theme.instances.delete(this);
}
private shouldAdoptStyles(): void {
/* istanbul ignore if */
if (!this.hasAdoptedStyles) {
this.adoptStyles();
}
}
protected adoptStyles(): void {
const styles = this.styles; // No test coverage on Edge
if (styles.length < 3) return;

@@ -248,2 +264,3 @@ // There are three separate cases here based on Shadow DOM support.

protected attributeChangedCallback(): void {
this.hasAdoptedStyles = false;
if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {

@@ -269,2 +286,3 @@ window.ShadyCSS.styleElement(this);

fragmentMap.set(name, { name, styles });
Theme.instances.forEach((instance) => instance.shouldAdoptStyles());
}

@@ -271,0 +289,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc