lit-element
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -12,2 +12,4 @@ # Change Log | ||
--> | ||
<!-- ## Unreleased --> | ||
<!-- ### Added --> | ||
@@ -18,4 +20,7 @@ <!-- ### Changed --> | ||
## Unreleased | ||
## [2.2.0] - 2019-06-11 | ||
### Added | ||
* css tagged template literals now allow numbers to be used in expressions ([#488](https://github.com/Polymer/lit-element/issues/488)). | ||
## [2.1.0] - 2019-03-21 | ||
@@ -22,0 +27,0 @@ ### Changed |
@@ -33,3 +33,3 @@ /** | ||
*/ | ||
export declare const css: (strings: TemplateStringsArray, ...values: CSSResult[]) => CSSResult; | ||
export declare const css: (strings: TemplateStringsArray, ...values: (number | CSSResult)[]) => CSSResult; | ||
//# sourceMappingURL=css-tag.d.ts.map |
@@ -55,2 +55,5 @@ /** | ||
} | ||
else if (typeof value === 'number') { | ||
return value; | ||
} | ||
else { | ||
@@ -57,0 +60,0 @@ throw new Error(`Value passed to 'css' function must be a 'css' function result: ${value}. Use 'unsafeCSS' to pass non-literal values, but |
@@ -71,3 +71,2 @@ /** | ||
// ], | ||
// tslint:disable-next-line:no-any decorator | ||
initializer() { | ||
@@ -74,0 +73,0 @@ if (typeof element.initializer === 'function') { |
@@ -156,5 +156,3 @@ /** | ||
set(value) { | ||
// tslint:disable-next-line:no-any no symbol in index | ||
const oldValue = this[name]; | ||
// tslint:disable-next-line:no-any no symbol in index | ||
this[key] = value; | ||
@@ -265,3 +263,4 @@ this._requestUpdate(name, oldValue); | ||
this._saveInstanceProperties(); | ||
// ensures first update will be caught by an early access of `updateComplete` | ||
// ensures first update will be caught by an early access of | ||
// `updateComplete` | ||
this._requestUpdate(); | ||
@@ -308,6 +307,6 @@ } | ||
this._updateState = this._updateState | STATE_HAS_CONNECTED; | ||
// Ensure first connection completes an update. Updates cannot complete before | ||
// connection and if one is pending connection the `_hasConnectionResolver` | ||
// will exist. If so, resolve it to complete the update, otherwise | ||
// requestUpdate. | ||
// Ensure first connection completes an update. Updates cannot complete | ||
// before connection and if one is pending connection the | ||
// `_hasConnectionResolver` will exist. If so, resolve it to complete the | ||
// update, otherwise requestUpdate. | ||
if (this._hasConnectedResolver) { | ||
@@ -314,0 +313,0 @@ this._hasConnectedResolver(); |
@@ -42,3 +42,3 @@ /** | ||
*/ | ||
static render: (result: TemplateResult, container: Element | DocumentFragment, options: import("lit-html/lib/shady-render").ShadyRenderOptions) => void; | ||
static render: (result: TemplateResult, container: Element | DocumentFragment | ShadowRoot, options: import("lit-html/lib/shady-render").ShadyRenderOptions) => void; | ||
/** | ||
@@ -45,0 +45,0 @@ * Array of styles to apply to the element. The styles should be defined |
@@ -26,3 +26,3 @@ /** | ||
(window['litElementVersions'] || (window['litElementVersions'] = [])) | ||
.push('2.0.1'); | ||
.push('2.2.0'); | ||
/** | ||
@@ -29,0 +29,0 @@ * Minimal implementation of Array.prototype.flat |
{ | ||
"name": "lit-element", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "A simple base class for creating fast, lightweight web components", | ||
"license": "BSD-3-Clause", | ||
"homepage": "https://lit-element.polymer-project.org/", | ||
"repository": "Polymer/lit-element", | ||
@@ -30,6 +31,7 @@ "main": "lit-element.js", | ||
"lint": "tslint --project ./", | ||
"prepublishOnly": "npm run build", | ||
"prepublishOnly": "node check-version-tracker.js && npm run lint && npm test", | ||
"prepare": "npm run build", | ||
"regen-package-lock": "rm -rf node_modules package-lock.json; npm install", | ||
"publish-dev": "npm test && VERSION=${npm_package_version%-*}-dev.`git rev-parse --short HEAD` && npm version --no-git-tag-version $VERSION && npm publish --tag dev" | ||
"publish-dev": "npm test && VERSION=${npm_package_version%-*}-dev.`git rev-parse --short HEAD` && npm version --no-git-tag-version $VERSION && npm publish --tag dev", | ||
"release": "np --any-branch --yolo" | ||
}, | ||
@@ -47,3 +49,5 @@ "author": "The Polymer Authors", | ||
"chai": "^4.0.2", | ||
"lit-element-benchmarks": "^0.1.0", | ||
"mocha": "^5.0.5", | ||
"np": "^4.0.2", | ||
"rollup": "^0.64.1", | ||
@@ -53,5 +57,6 @@ "rollup-plugin-filesize": "^4.0.1", | ||
"rollup-plugin-terser": "^1.0.1", | ||
"tachometer": "^0.4.4", | ||
"tslint": "^5.12.0", | ||
"typedoc": "^0.8.0", | ||
"typescript": "^3.2.2", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.4.1", | ||
"uglify-es": "^3.3.9", | ||
@@ -58,0 +63,0 @@ "wct-mocha": "^1.0.0", |
@@ -63,5 +63,7 @@ /** | ||
const textFromCSSResult = (value: CSSResult) => { | ||
const textFromCSSResult = (value: CSSResult|number) => { | ||
if (value instanceof CSSResult) { | ||
return value.cssText; | ||
} else if (typeof value === 'number') { | ||
return value; | ||
} else { | ||
@@ -81,7 +83,8 @@ throw new Error( | ||
*/ | ||
export const css = (strings: TemplateStringsArray, ...values: CSSResult[]) => { | ||
const cssText = values.reduce( | ||
(acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], | ||
strings[0]); | ||
return new CSSResult(cssText, constructionToken); | ||
}; | ||
export const css = | ||
(strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => { | ||
const cssText = values.reduce( | ||
(acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], | ||
strings[0]); | ||
return new CSSResult(cssText, constructionToken); | ||
}; |
@@ -108,6 +108,5 @@ /** | ||
// ], | ||
// tslint:disable-next-line:no-any decorator | ||
initializer(this: any) { | ||
initializer(this: {[key: string]: unknown}) { | ||
if (typeof element.initializer === 'function') { | ||
this[element.key] = element.initializer.call(this); | ||
this[element.key as string] = element.initializer.call(this); | ||
} | ||
@@ -114,0 +113,0 @@ }, |
@@ -299,10 +299,9 @@ /** | ||
get(): any { | ||
return this[key]; | ||
return (this as {[key: string]: unknown})[key as string]; | ||
}, | ||
set(this: UpdatingElement, value: unknown) { | ||
// tslint:disable-next-line:no-any no symbol in index | ||
const oldValue = (this as any)[name]; | ||
// tslint:disable-next-line:no-any no symbol in index | ||
(this as any)[key] = value; | ||
this._requestUpdate(name, oldValue); | ||
const oldValue = | ||
(this as {} as {[key: string]: unknown})[name as string]; | ||
(this as {} as {[key: string]: unknown})[key as string] = value; | ||
(this as unknown as UpdatingElement)._requestUpdate(name, oldValue); | ||
}, | ||
@@ -445,3 +444,4 @@ configurable: true, | ||
this._saveInstanceProperties(); | ||
// ensures first update will be caught by an early access of `updateComplete` | ||
// ensures first update will be caught by an early access of | ||
// `updateComplete` | ||
this._requestUpdate(); | ||
@@ -491,6 +491,6 @@ } | ||
this._updateState = this._updateState | STATE_HAS_CONNECTED; | ||
// Ensure first connection completes an update. Updates cannot complete before | ||
// connection and if one is pending connection the `_hasConnectionResolver` | ||
// will exist. If so, resolve it to complete the update, otherwise | ||
// requestUpdate. | ||
// Ensure first connection completes an update. Updates cannot complete | ||
// before connection and if one is pending connection the | ||
// `_hasConnectionResolver` will exist. If so, resolve it to complete the | ||
// update, otherwise requestUpdate. | ||
if (this._hasConnectedResolver) { | ||
@@ -497,0 +497,0 @@ this._hasConnectedResolver(); |
@@ -35,3 +35,3 @@ /** | ||
(window['litElementVersions'] || (window['litElementVersions'] = [])) | ||
.push('2.0.1'); | ||
.push('2.2.0'); | ||
@@ -38,0 +38,0 @@ export interface CSSResultArray extends Array<CSSResult|CSSResultArray> {} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
215967
2908
0
23
1