@spectrum-web-components/thumbnail
Advanced tools
Comparing version 1.0.0-rc.0 to 1.0.0-rc.1
{ | ||
"name": "@spectrum-web-components/thumbnail", | ||
"version": "1.0.0-rc.0", | ||
"version": "1.0.0-rc.1", | ||
"publishConfig": { | ||
@@ -61,4 +61,4 @@ "access": "public" | ||
"dependencies": { | ||
"@spectrum-web-components/base": "^1.0.0-rc.0", | ||
"@spectrum-web-components/opacity-checkerboard": "^1.0.0-rc.0" | ||
"@spectrum-web-components/base": "^1.0.0-rc.1", | ||
"@spectrum-web-components/opacity-checkerboard": "^1.0.0-rc.1" | ||
}, | ||
@@ -74,3 +74,3 @@ "devDependencies": { | ||
], | ||
"gitHead": "24a3e0d1d0ead33c41454223b290a258b75d3111" | ||
"gitHead": "9f2638a0500c33adc8e06079a87a55b7d5695966" | ||
} |
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base'; | ||
declare const validSizes: string[]; | ||
export type ThumbnailSize = typeof validSizes[number]; | ||
export type ThumbnailSize = (typeof validSizes)[number]; | ||
/** | ||
@@ -5,0 +5,0 @@ * @element sp-thumbnail |
@@ -48,25 +48,2 @@ "use strict"; | ||
set size(value) { | ||
const deprecatedSizes = ["xxs", "xs", "s", "m", "l"]; | ||
const managedSizes = { | ||
xxs: "100", | ||
xs: "300", | ||
s: "500", | ||
m: "700", | ||
l: "900" | ||
}; | ||
const usesDeprecatedSize = deprecatedSizes.includes(value); | ||
if (usesDeprecatedSize) { | ||
if (true) { | ||
window.__swc.warn( | ||
this, | ||
`The "size" attribute/property for <${this.localName}> no longer supports the value "${value}". Use one of the following values, instead:`, | ||
"https://opensource.adobe.com/spectrum-web-components/components/thumbnail/#sizes", | ||
{ | ||
level: "deprecation", | ||
issues: validSizes | ||
} | ||
); | ||
} | ||
value = managedSizes[value]; | ||
} | ||
const size = validSizes.includes(value) ? value : defaultSize; | ||
@@ -73,0 +50,0 @@ if (size) { |
@@ -1,2 +0,2 @@ | ||
"use strict";var z=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var o=(c,r,e,i)=>{for(var t=i>1?void 0:i?m(r,e):r,a=c.length-1,s;a>=0;a--)(s=c[a])&&(t=(i?s(r,e,t):s(t))||t);return i&&t&&z(r,e,t),t};import{html as p,SpectrumElement as h}from"@spectrum-web-components/base";import{property as l}from"@spectrum-web-components/base/src/decorators.js";import b from"@spectrum-web-components/opacity-checkerboard/src/opacity-checkerboard.css.js";import y from"./thumbnail.css.js";const n=["50","75","100","200","300","400","500","600","700","800","900","1000"],u=n[6];export class Thumbnail extends h{constructor(){super(...arguments);this.cover=!1;this.layer=!1;this._size=u}static get styles(){return[b,y]}get size(){return this._size}set size(e){const i=["xxs","xs","s","m","l"],t={xxs:"100",xs:"300",s:"500",m:"700",l:"900"};i.includes(e)&&(e=t[e]);const s=n.includes(e)?e:u;if(s&&this.setAttribute("size",`${s}`),this._size===s)return;const d=this._size;this._size=s,this.requestUpdate("size",d)}update(e){this.hasAttribute("size")||this.setAttribute("size",this.size),super.update(e)}render(){return this.background?p` | ||
"use strict";var n=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var s=(o,i,r,e)=>{for(var t=e>1?void 0:e?y(i,r):i,a=o.length-1,c;a>=0;a--)(c=o[a])&&(t=(e?c(i,r,t):c(t))||t);return e&&t&&n(i,r,t),t};import{html as p,SpectrumElement as z}from"@spectrum-web-components/base";import{property as l}from"@spectrum-web-components/base/src/decorators.js";import b from"@spectrum-web-components/opacity-checkerboard/src/opacity-checkerboard.css.js";import h from"./thumbnail.css.js";const u=["50","75","100","200","300","400","500","600","700","800","900","1000"],d=u[6];export class Thumbnail extends z{constructor(){super(...arguments);this.cover=!1;this.layer=!1;this._size=d}static get styles(){return[b,h]}get size(){return this._size}set size(r){const e=u.includes(r)?r:d;if(e&&this.setAttribute("size",`${e}`),this._size===e)return;const t=this._size;this._size=e,this.requestUpdate("size",t)}update(r){this.hasAttribute("size")||this.setAttribute("size",this.size),super.update(r)}render(){return this.background?p` | ||
<div | ||
@@ -18,3 +18,3 @@ class="opacity-checkerboard background" | ||
</div> | ||
`}}o([l({type:String,reflect:!0})],Thumbnail.prototype,"background",2),o([l({type:Boolean,reflect:!0})],Thumbnail.prototype,"cover",2),o([l({type:Boolean,reflect:!0})],Thumbnail.prototype,"layer",2),o([l({type:String,reflect:!0})],Thumbnail.prototype,"size",1); | ||
`}}s([l({type:String,reflect:!0})],Thumbnail.prototype,"background",2),s([l({type:Boolean,reflect:!0})],Thumbnail.prototype,"cover",2),s([l({type:Boolean,reflect:!0})],Thumbnail.prototype,"layer",2),s([l({type:String,reflect:!0})],Thumbnail.prototype,"size",1); | ||
//# sourceMappingURL=Thumbnail.js.map |
@@ -71,27 +71,4 @@ "use strict"; | ||
}); | ||
it("warns in devMode when white/black variant is provided", async () => { | ||
const el = await fixture(html` | ||
<sp-thumbnail background="blue" size="xxs"> | ||
<img src=${thumbnail} alt="Woman crouching" /> | ||
</sp-thumbnail> | ||
`); | ||
await elementUpdated(el); | ||
expect(consoleWarnStub.called).to.be.true; | ||
const spyCall = consoleWarnStub.getCall(0); | ||
expect( | ||
spyCall.args.at(0).includes( | ||
"no longer supports the value" | ||
), | ||
"confirm deprecated size warning" | ||
).to.be.true; | ||
expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({ | ||
data: { | ||
localName: "sp-thumbnail", | ||
type: "api", | ||
level: "deprecation" | ||
} | ||
}); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=thumbnail.test.js.map |
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
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
931768
2156