@spectrum-web-components/base 0.40.0 → 0.40.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/directives.d.ts +2 -0
- package/src/directives.dev.js +2 -0
- package/src/directives.dev.js.map +2 -2
- package/src/directives.js +1 -1
- package/src/directives.js.map +2 -2
- package/src/sizedMixin.dev.js +1 -1
- package/src/sizedMixin.dev.js.map +2 -2
- package/src/sizedMixin.js +1 -1
- package/src/sizedMixin.js.map +2 -2
- package/src/version.js +1 -1
- package/test/define-element.test.js +3 -1
- package/test/define-element.test.js.map +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/base",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"sideEffects": [
|
|
117
117
|
"./**/*.dev.js"
|
|
118
118
|
],
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "e5fd35c7a98569150ca695ec0e0e7411c9c64c28"
|
|
120
120
|
}
|
package/src/directives.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export type { StyleInfo } from 'lit/directives/style-map.js';
|
|
|
6
6
|
export { until } from 'lit/directives/until.js';
|
|
7
7
|
export { live } from 'lit/directives/live.js';
|
|
8
8
|
export { when } from 'lit/directives/when.js';
|
|
9
|
+
export { join } from 'lit/directives/join.js';
|
|
10
|
+
export { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
package/src/directives.dev.js
CHANGED
|
@@ -6,4 +6,6 @@ export { styleMap } from "lit/directives/style-map.js";
|
|
|
6
6
|
export { until } from "lit/directives/until.js";
|
|
7
7
|
export { live } from "lit/directives/live.js";
|
|
8
8
|
export { when } from "lit/directives/when.js";
|
|
9
|
+
export { join } from "lit/directives/join.js";
|
|
10
|
+
export { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
9
11
|
//# sourceMappingURL=directives.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["directives.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport { ifDefined } from 'lit/directives/if-defined.js';\nexport { repeat } from 'lit/directives/repeat.js';\nexport { classMap } from 'lit/directives/class-map.js';\nexport { styleMap } from 'lit/directives/style-map.js';\nexport type { StyleInfo } from 'lit/directives/style-map.js';\nexport { until } from 'lit/directives/until.js';\nexport { live } from 'lit/directives/live.js';\nexport { when } from 'lit/directives/when.js';\n"],
|
|
5
|
-
"mappings": ";AAYA,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAEzB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,YAAY;",
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport { ifDefined } from 'lit/directives/if-defined.js';\nexport { repeat } from 'lit/directives/repeat.js';\nexport { classMap } from 'lit/directives/class-map.js';\nexport { styleMap } from 'lit/directives/style-map.js';\nexport type { StyleInfo } from 'lit/directives/style-map.js';\nexport { until } from 'lit/directives/until.js';\nexport { live } from 'lit/directives/live.js';\nexport { when } from 'lit/directives/when.js';\nexport { join } from 'lit/directives/join.js';\nexport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAEzB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,kBAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/directives.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";export{ifDefined}from"lit/directives/if-defined.js";export{repeat}from"lit/directives/repeat.js";export{classMap}from"lit/directives/class-map.js";export{styleMap}from"lit/directives/style-map.js";export{until}from"lit/directives/until.js";export{live}from"lit/directives/live.js";export{when}from"lit/directives/when.js";
|
|
1
|
+
"use strict";export{ifDefined}from"lit/directives/if-defined.js";export{repeat}from"lit/directives/repeat.js";export{classMap}from"lit/directives/class-map.js";export{styleMap}from"lit/directives/style-map.js";export{until}from"lit/directives/until.js";export{live}from"lit/directives/live.js";export{when}from"lit/directives/when.js";export{join}from"lit/directives/join.js";export{unsafeHTML}from"lit/directives/unsafe-html.js";
|
|
2
2
|
//# sourceMappingURL=directives.js.map
|
package/src/directives.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["directives.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport { ifDefined } from 'lit/directives/if-defined.js';\nexport { repeat } from 'lit/directives/repeat.js';\nexport { classMap } from 'lit/directives/class-map.js';\nexport { styleMap } from 'lit/directives/style-map.js';\nexport type { StyleInfo } from 'lit/directives/style-map.js';\nexport { until } from 'lit/directives/until.js';\nexport { live } from 'lit/directives/live.js';\nexport { when } from 'lit/directives/when.js';\n"],
|
|
5
|
-
"mappings": "aAYA,OAAS,cAAiB,+BAC1B,OAAS,WAAc,2BACvB,OAAS,aAAgB,8BACzB,OAAS,aAAgB,8BAEzB,OAAS,UAAa,0BACtB,OAAS,SAAY,yBACrB,OAAS,SAAY",
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport { ifDefined } from 'lit/directives/if-defined.js';\nexport { repeat } from 'lit/directives/repeat.js';\nexport { classMap } from 'lit/directives/class-map.js';\nexport { styleMap } from 'lit/directives/style-map.js';\nexport type { StyleInfo } from 'lit/directives/style-map.js';\nexport { until } from 'lit/directives/until.js';\nexport { live } from 'lit/directives/live.js';\nexport { when } from 'lit/directives/when.js';\nexport { join } from 'lit/directives/join.js';\nexport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n"],
|
|
5
|
+
"mappings": "aAYA,OAAS,cAAiB,+BAC1B,OAAS,WAAc,2BACvB,OAAS,aAAgB,8BACzB,OAAS,aAAgB,8BAEzB,OAAS,UAAa,0BACtB,OAAS,SAAY,yBACrB,OAAS,SAAY,yBACrB,OAAS,SAAY,yBACrB,OAAS,eAAkB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/sizedMixin.dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sizedMixin.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { PropertyValues, ReactiveElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport type ElementSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\nexport const ElementSizes: Record<string, ElementSize> = {\n xxs: 'xxs',\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'l',\n xl: 'xl',\n xxl: 'xxl',\n};\nexport type DefaultElementSize = Exclude<ElementSize, 'xxs' | 'xs' | 'xxl'>;\n\nexport interface SizedElementInterface {\n size: ElementSize;\n}\n\nexport function SizedMixin<T extends Constructor<ReactiveElement>>(\n constructor: T,\n {\n validSizes = ['s', 'm', 'l', 'xl'],\n noDefaultSize,\n defaultSize = 'm',\n }: {\n validSizes?: ElementSize[];\n noDefaultSize?: boolean;\n defaultSize?: ElementSize;\n } = {}\n): T & Constructor<SizedElementInterface> {\n class SizedElement extends constructor {\n @property({ type: String
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAYA,SAAS,gBAAgB;AASlB,aAAM,eAA4C;AAAA,EACrD,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AACT;AAOO,gBAAS,WACZ,aACA;AAAA,EACI,aAAa,CAAC,KAAK,KAAK,KAAK,IAAI;AAAA,EACjC;AAAA,EACA,cAAc;AAClB,IAII,CAAC,GACiC;AAAA,EACtC,MAAM,qBAAqB,YAAY;AAAA,IAAvC;AAAA;AAyBI,WAAQ,QAA4B;AAAA;AAAA,IAvBpC,IAAW,OAAoB;AAC3B,aAAO,KAAK,SAAS;AAAA,IACzB;AAAA,IAEA,IAAW,KAAK,OAAoB;AAChC,YAAM,eAAe,gBAAgB,OAAO;AAC5C,YAAM,OACF,QAAQ,MAAM,kBAAkB,IAAI;AAExC,YAAM,YACF,WAAW,SAAS,IAAI,IAAI,OAAO;AAEvC,UAAI,WAAW;AACX,aAAK,aAAa,QAAQ,SAAS;AAAA,MACvC;AACA,UAAI,KAAK,UAAU,WAAW;AAC1B;AAAA,MACJ;AACA,YAAM,UAAU,KAAK;AACrB,WAAK,QAAQ;AACb,WAAK,cAAc,QAAQ,OAAO;AAAA,IACtC;AAAA,IAImB,OAAO,SAA+B;AACrD,UAAI,CAAC,KAAK,aAAa,MAAM,KAAK,CAAC,eAAe;AAC9C,aAAK,aAAa,QAAQ,KAAK,IAAI;AAAA,MACvC;AACA,YAAM,OAAO,OAAO;AAAA,IACxB;AAAA,EACJ;AA/Be;AAAA,IADV,SAAS,EAAE,MAAM,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { PropertyValues, ReactiveElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport type ElementSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\nexport const ElementSizes: Record<string, ElementSize> = {\n xxs: 'xxs',\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'l',\n xl: 'xl',\n xxl: 'xxl',\n};\nexport type DefaultElementSize = Exclude<ElementSize, 'xxs' | 'xs' | 'xxl'>;\n\nexport interface SizedElementInterface {\n size: ElementSize;\n}\n\nexport function SizedMixin<T extends Constructor<ReactiveElement>>(\n constructor: T,\n {\n validSizes = ['s', 'm', 'l', 'xl'],\n noDefaultSize,\n defaultSize = 'm',\n }: {\n validSizes?: ElementSize[];\n noDefaultSize?: boolean;\n defaultSize?: ElementSize;\n } = {}\n): T & Constructor<SizedElementInterface> {\n class SizedElement extends constructor {\n @property({ type: String })\n public get size(): ElementSize {\n return this._size || defaultSize;\n }\n\n public set size(value: ElementSize) {\n const fallbackSize = noDefaultSize ? null : defaultSize;\n const size = (\n value ? value.toLocaleLowerCase() : value\n ) as ElementSize;\n const validSize = (\n validSizes.includes(size) ? size : fallbackSize\n ) as ElementSize;\n if (validSize) {\n this.setAttribute('size', validSize);\n }\n if (this._size === validSize) {\n return;\n }\n const oldSize = this._size;\n this._size = validSize;\n this.requestUpdate('size', oldSize);\n }\n\n private _size: ElementSize | null = defaultSize;\n\n protected override update(changes: PropertyValues): void {\n if (!this.hasAttribute('size') && !noDefaultSize) {\n this.setAttribute('size', this.size);\n }\n super.update(changes);\n }\n }\n return SizedElement;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAYA,SAAS,gBAAgB;AASlB,aAAM,eAA4C;AAAA,EACrD,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AACT;AAOO,gBAAS,WACZ,aACA;AAAA,EACI,aAAa,CAAC,KAAK,KAAK,KAAK,IAAI;AAAA,EACjC;AAAA,EACA,cAAc;AAClB,IAII,CAAC,GACiC;AAAA,EACtC,MAAM,qBAAqB,YAAY;AAAA,IAAvC;AAAA;AAyBI,WAAQ,QAA4B;AAAA;AAAA,IAvBpC,IAAW,OAAoB;AAC3B,aAAO,KAAK,SAAS;AAAA,IACzB;AAAA,IAEA,IAAW,KAAK,OAAoB;AAChC,YAAM,eAAe,gBAAgB,OAAO;AAC5C,YAAM,OACF,QAAQ,MAAM,kBAAkB,IAAI;AAExC,YAAM,YACF,WAAW,SAAS,IAAI,IAAI,OAAO;AAEvC,UAAI,WAAW;AACX,aAAK,aAAa,QAAQ,SAAS;AAAA,MACvC;AACA,UAAI,KAAK,UAAU,WAAW;AAC1B;AAAA,MACJ;AACA,YAAM,UAAU,KAAK;AACrB,WAAK,QAAQ;AACb,WAAK,cAAc,QAAQ,OAAO;AAAA,IACtC;AAAA,IAImB,OAAO,SAA+B;AACrD,UAAI,CAAC,KAAK,aAAa,MAAM,KAAK,CAAC,eAAe;AAC9C,aAAK,aAAa,QAAQ,KAAK,IAAI;AAAA,MACvC;AACA,YAAM,OAAO,OAAO;AAAA,IACxB;AAAA,EACJ;AA/Be;AAAA,IADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,KADxB,aAES;AAgCf,SAAO;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/sizedMixin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=(
|
|
1
|
+
"use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=(r,i,s,t)=>{for(var e=t>1?void 0:t?u(i,s):i,l=r.length-1,o;l>=0;l--)(o=r[l])&&(e=(t?o(i,s,e):o(e))||e);return t&&e&&a(i,s,e),e};import{property as S}from"lit/decorators.js";export const ElementSizes={xxs:"xxs",xs:"xs",s:"s",m:"m",l:"l",xl:"xl",xxl:"xxl"};export function SizedMixin(r,{validSizes:i=["s","m","l","xl"],noDefaultSize:s,defaultSize:t="m"}={}){class e extends r{constructor(){super(...arguments);this._size=t}get size(){return this._size||t}set size(n){const p=s?null:t,z=n&&n.toLocaleLowerCase(),x=i.includes(z)?z:p;if(x&&this.setAttribute("size",x),this._size===x)return;const c=this._size;this._size=x,this.requestUpdate("size",c)}update(n){!this.hasAttribute("size")&&!s&&this.setAttribute("size",this.size),super.update(n)}}return m([S({type:String})],e.prototype,"size",1),e}
|
|
2
2
|
//# sourceMappingURL=sizedMixin.js.map
|
package/src/sizedMixin.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sizedMixin.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { PropertyValues, ReactiveElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport type ElementSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\nexport const ElementSizes: Record<string, ElementSize> = {\n xxs: 'xxs',\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'l',\n xl: 'xl',\n xxl: 'xxl',\n};\nexport type DefaultElementSize = Exclude<ElementSize, 'xxs' | 'xs' | 'xxl'>;\n\nexport interface SizedElementInterface {\n size: ElementSize;\n}\n\nexport function SizedMixin<T extends Constructor<ReactiveElement>>(\n constructor: T,\n {\n validSizes = ['s', 'm', 'l', 'xl'],\n noDefaultSize,\n defaultSize = 'm',\n }: {\n validSizes?: ElementSize[];\n noDefaultSize?: boolean;\n defaultSize?: ElementSize;\n } = {}\n): T & Constructor<SizedElementInterface> {\n class SizedElement extends constructor {\n @property({ type: String
|
|
5
|
-
"mappings": "qNAYA,OAAS,YAAAA,MAAgB,oBASlB,aAAM,aAA4C,CACrD,IAAK,MACL,GAAI,KACJ,EAAG,IACH,EAAG,IACH,EAAG,IACH,GAAI,KACJ,IAAK,KACT,EAOO,gBAAS,WACZC,EACA,CACI,WAAAC,EAAa,CAAC,IAAK,IAAK,IAAK,IAAI,EACjC,cAAAC,EACA,YAAAC,EAAc,GAClB,EAII,CAAC,EACiC,CACtC,MAAMC,UAAqBJ,CAAY,CAAvC,kCAyBI,KAAQ,MAA4BG,EAvBpC,IAAW,MAAoB,CAC3B,OAAO,KAAK,OAASA,CACzB,CAEA,IAAW,KAAKE,EAAoB,CAChC,MAAMC,EAAeJ,EAAgB,KAAOC,EACtCI,EACFF,GAAQA,EAAM,kBAAkB,EAE9BG,EACFP,EAAW,SAASM,CAAI,EAAIA,EAAOD,EAKvC,GAHIE,GACA,KAAK,aAAa,OAAQA,CAAS,EAEnC,KAAK,QAAUA,EACf,OAEJ,MAAMC,EAAU,KAAK,MACrB,KAAK,MAAQD,EACb,KAAK,cAAc,OAAQC,CAAO,CACtC,CAImB,OAAOC,EAA+B,CACjD,CAAC,KAAK,aAAa,MAAM,GAAK,CAACR,GAC/B,KAAK,aAAa,OAAQ,KAAK,IAAI,EAEvC,MAAM,OAAOQ,CAAO,CACxB,CACJ,CA/Be,OAAAC,EAAA,CADVZ,EAAS,CAAE,KAAM,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { PropertyValues, ReactiveElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport type ElementSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\nexport const ElementSizes: Record<string, ElementSize> = {\n xxs: 'xxs',\n xs: 'xs',\n s: 's',\n m: 'm',\n l: 'l',\n xl: 'xl',\n xxl: 'xxl',\n};\nexport type DefaultElementSize = Exclude<ElementSize, 'xxs' | 'xs' | 'xxl'>;\n\nexport interface SizedElementInterface {\n size: ElementSize;\n}\n\nexport function SizedMixin<T extends Constructor<ReactiveElement>>(\n constructor: T,\n {\n validSizes = ['s', 'm', 'l', 'xl'],\n noDefaultSize,\n defaultSize = 'm',\n }: {\n validSizes?: ElementSize[];\n noDefaultSize?: boolean;\n defaultSize?: ElementSize;\n } = {}\n): T & Constructor<SizedElementInterface> {\n class SizedElement extends constructor {\n @property({ type: String })\n public get size(): ElementSize {\n return this._size || defaultSize;\n }\n\n public set size(value: ElementSize) {\n const fallbackSize = noDefaultSize ? null : defaultSize;\n const size = (\n value ? value.toLocaleLowerCase() : value\n ) as ElementSize;\n const validSize = (\n validSizes.includes(size) ? size : fallbackSize\n ) as ElementSize;\n if (validSize) {\n this.setAttribute('size', validSize);\n }\n if (this._size === validSize) {\n return;\n }\n const oldSize = this._size;\n this._size = validSize;\n this.requestUpdate('size', oldSize);\n }\n\n private _size: ElementSize | null = defaultSize;\n\n protected override update(changes: PropertyValues): void {\n if (!this.hasAttribute('size') && !noDefaultSize) {\n this.setAttribute('size', this.size);\n }\n super.update(changes);\n }\n }\n return SizedElement;\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAAS,YAAAA,MAAgB,oBASlB,aAAM,aAA4C,CACrD,IAAK,MACL,GAAI,KACJ,EAAG,IACH,EAAG,IACH,EAAG,IACH,GAAI,KACJ,IAAK,KACT,EAOO,gBAAS,WACZC,EACA,CACI,WAAAC,EAAa,CAAC,IAAK,IAAK,IAAK,IAAI,EACjC,cAAAC,EACA,YAAAC,EAAc,GAClB,EAII,CAAC,EACiC,CACtC,MAAMC,UAAqBJ,CAAY,CAAvC,kCAyBI,KAAQ,MAA4BG,EAvBpC,IAAW,MAAoB,CAC3B,OAAO,KAAK,OAASA,CACzB,CAEA,IAAW,KAAKE,EAAoB,CAChC,MAAMC,EAAeJ,EAAgB,KAAOC,EACtCI,EACFF,GAAQA,EAAM,kBAAkB,EAE9BG,EACFP,EAAW,SAASM,CAAI,EAAIA,EAAOD,EAKvC,GAHIE,GACA,KAAK,aAAa,OAAQA,CAAS,EAEnC,KAAK,QAAUA,EACf,OAEJ,MAAMC,EAAU,KAAK,MACrB,KAAK,MAAQD,EACb,KAAK,cAAc,OAAQC,CAAO,CACtC,CAImB,OAAOC,EAA+B,CACjD,CAAC,KAAK,aAAa,MAAM,GAAK,CAACR,GAC/B,KAAK,aAAa,OAAQ,KAAK,IAAI,EAEvC,MAAM,OAAOQ,CAAO,CACxB,CACJ,CA/Be,OAAAC,EAAA,CADVZ,EAAS,CAAE,KAAM,MAAO,CAAC,GADxBK,EAES,oBAgCRA,CACX",
|
|
6
6
|
"names": ["property", "constructor", "validSizes", "noDefaultSize", "defaultSize", "SizedElement", "value", "fallbackSize", "size", "validSize", "oldSize", "changes", "__decorateClass"]
|
|
7
7
|
}
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '0.40.
|
|
2
|
+
export const version = '0.40.2';
|
|
@@ -121,7 +121,9 @@ describe("define-element", function() {
|
|
|
121
121
|
const spyCall = this.warn.getCall(0);
|
|
122
122
|
expect(
|
|
123
123
|
spyCall.args.at(0).includes("redefine"),
|
|
124
|
-
|
|
124
|
+
`message should warn about redefining an element, instead got "${spyCall.args.at(
|
|
125
|
+
0
|
|
126
|
+
)}"`
|
|
125
127
|
).to.be.true;
|
|
126
128
|
})
|
|
127
129
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["define-element.test.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { expect } from '@open-wc/testing';\nimport { stub } from 'sinon';\nimport {\n isFirefox,\n isWebKit,\n} from '@spectrum-web-components/shared/src/platform.js';\n\n// for window.__swc\nimport '@spectrum-web-components/base';\n\n// mostly alphabetical,\n// but reordered to put dependents above dependencies,\n// in order to avoid transitive dependency conflicts (eg card -> asset)\nconst elements = {\n 'sp-accordion-item': () =>\n import('@spectrum-web-components/accordion/sp-accordion-item.js'),\n 'sp-accordion': () =>\n import('@spectrum-web-components/accordion/sp-accordion.js'),\n 'sp-action-bar': () =>\n import('@spectrum-web-components/action-bar/sp-action-bar.js'),\n 'sp-action-menu': () =>\n import('@spectrum-web-components/action-menu/sp-action-menu.js'),\n 'sp-action-button': () =>\n import('@spectrum-web-components/action-button/sp-action-button.js'),\n 'sp-action-group': () =>\n import('@spectrum-web-components/action-group/sp-action-group.js'),\n 'sp-card': () => import('@spectrum-web-components/card/sp-card.js'),\n 'sp-asset': () => import('@spectrum-web-components/asset/sp-asset.js'),\n 'sp-avatar': () => import('@spectrum-web-components/avatar/sp-avatar.js'),\n 'sp-badge': () => import('@spectrum-web-components/badge/sp-badge.js'),\n 'sp-banner': () => import('@spectrum-web-components/banner/sp-banner.js'),\n 'sp-dialog-wrapper': () =>\n import('@spectrum-web-components/dialog/sp-dialog-wrapper.js'),\n 'sp-dialog': () => import('@spectrum-web-components/dialog/sp-dialog.js'),\n 'sp-dialog-base': () =>\n import('@spectrum-web-components/dialog/sp-dialog-base.js'),\n 'sp-button': () => import('@spectrum-web-components/button/sp-button.js'),\n 'sp-button-group': () =>\n import('@spectrum-web-components/button-group/sp-button-group.js'),\n 'sp-checkbox': () =>\n import('@spectrum-web-components/checkbox/sp-checkbox.js'),\n 'sp-coachmark': () =>\n import('@spectrum-web-components/coachmark/sp-coachmark.js'),\n 'sp-color-area': () =>\n import('@spectrum-web-components/color-area/sp-color-area.js'),\n 'sp-color-handle': () =>\n import('@spectrum-web-components/color-handle/sp-color-handle.js'),\n 'sp-color-loupe': () =>\n import('@spectrum-web-components/color-loupe/sp-color-loupe.js'),\n 'sp-color-slider': () =>\n import('@spectrum-web-components/color-slider/sp-color-slider.js'),\n 'sp-color-wheel': () =>\n import('@spectrum-web-components/color-wheel/sp-color-wheel.js'),\n 'sp-divider': () =>\n import('@spectrum-web-components/divider/sp-divider.js'),\n 'sp-dropzone': () =>\n import('@spectrum-web-components/dropzone/sp-dropzone.js'),\n 'sp-meter': () => import('@spectrum-web-components/meter/sp-meter.js'),\n 'sp-field-group': () =>\n import('@spectrum-web-components/field-group/sp-field-group.js'),\n 'sp-field-label': () =>\n import('@spectrum-web-components/field-label/sp-field-label.js'),\n 'sp-help-text': () =>\n import('@spectrum-web-components/help-text/sp-help-text.js'),\n 'sp-icon': () => import('@spectrum-web-components/icon/sp-icon.js'),\n 'sp-icons-medium': () =>\n import('@spectrum-web-components/icons/sp-icons-medium.js'),\n 'sp-icons-large': () =>\n import('@spectrum-web-components/icons/sp-icons-large.js'),\n 'sp-illustrated-message': () =>\n import(\n '@spectrum-web-components/illustrated-message/sp-illustrated-message.js'\n ),\n 'sp-link': () => import('@spectrum-web-components/link/sp-link.js'),\n 'sp-menu-group': () =>\n import('@spectrum-web-components/menu/sp-menu-group.js'),\n 'sp-menu-item': () =>\n import('@spectrum-web-components/menu/sp-menu-item.js'),\n 'sp-menu': () => import('@spectrum-web-components/menu/sp-menu.js'),\n 'overlay-trigger': () =>\n import('@spectrum-web-components/overlay/overlay-trigger.js'),\n 'sp-overlay': () =>\n import('@spectrum-web-components/overlay/sp-overlay.js'),\n 'sp-picker': () => import('@spectrum-web-components/picker/sp-picker.js'),\n 'sp-picker-button': () =>\n import('@spectrum-web-components/picker-button/sp-picker-button.js'),\n 'sp-popover': () =>\n import('@spectrum-web-components/popover/sp-popover.js'),\n 'sp-progress-bar': () =>\n import('@spectrum-web-components/progress-bar/sp-progress-bar.js'),\n 'sp-progress-circle': () =>\n import(\n '@spectrum-web-components/progress-circle/sp-progress-circle.js'\n ),\n 'sp-quick-actions': () =>\n import('@spectrum-web-components/quick-actions/sp-quick-actions.js'),\n 'sp-radio-group': () =>\n import('@spectrum-web-components/radio/sp-radio-group.js'),\n 'sp-radio': () => import('@spectrum-web-components/radio/sp-radio.js'),\n 'sp-search': () => import('@spectrum-web-components/search/sp-search.js'),\n 'sp-sidenav-item': () =>\n import('@spectrum-web-components/sidenav/sp-sidenav-item.js'),\n 'sp-sidenav': () =>\n import('@spectrum-web-components/sidenav/sp-sidenav.js'),\n 'sp-slider': () => import('@spectrum-web-components/slider/sp-slider.js'),\n 'sp-slider-handle': () =>\n import('@spectrum-web-components/slider/sp-slider-handle.js'),\n 'sp-split-button': () =>\n import('@spectrum-web-components/split-button/sp-split-button.js'),\n 'sp-split-view': () =>\n import('@spectrum-web-components/split-view/sp-split-view.js'),\n 'sp-status-light': () =>\n import('@spectrum-web-components/status-light/sp-status-light.js'),\n 'sp-swatch-group': () =>\n import('@spectrum-web-components/swatch/sp-swatch-group.js'),\n 'sp-swatch': () => import('@spectrum-web-components/swatch/sp-swatch.js'),\n 'sp-switch': () => import('@spectrum-web-components/switch/sp-switch.js'),\n 'sp-table': () => import('@spectrum-web-components/table/sp-table.js'),\n 'sp-table-body': () =>\n import('@spectrum-web-components/table/sp-table-body.js'),\n 'sp-table-cell': () =>\n import('@spectrum-web-components/table/sp-table-cell.js'),\n 'sp-table-head': () =>\n import('@spectrum-web-components/table/sp-table-head.js'),\n 'sp-table-checkbox-cell': () =>\n import('@spectrum-web-components/table/sp-table-checkbox-cell.js'),\n 'sp-table-head-cell': () =>\n import('@spectrum-web-components/table/sp-table-head-cell.js'),\n 'sp-table-row': () =>\n import('@spectrum-web-components/table/sp-table-row.js'),\n 'sp-tab': () => import('@spectrum-web-components/tabs/sp-tab.js'),\n 'sp-tabs': () => import('@spectrum-web-components/tabs/sp-tabs.js'),\n 'sp-tabs-overflow': () =>\n import('@spectrum-web-components/tabs/sp-tabs-overflow.js'),\n 'sp-tag': () => import('@spectrum-web-components/tags/sp-tag.js'),\n 'sp-tags': () => import('@spectrum-web-components/tags/sp-tags.js'),\n 'sp-textfield': () =>\n import('@spectrum-web-components/textfield/sp-textfield.js'),\n 'sp-thumbnail': () =>\n import('@spectrum-web-components/thumbnail/sp-thumbnail.js'),\n 'sp-toast': () => import('@spectrum-web-components/toast/sp-toast.js'),\n 'sp-tooltip': () =>\n import('@spectrum-web-components/tooltip/sp-tooltip.js'),\n 'sp-top-nav': () =>\n import('@spectrum-web-components/top-nav/sp-top-nav.js'),\n 'sp-tray': () => import('@spectrum-web-components/tray/sp-tray.js'),\n 'sp-underlay': () =>\n import('@spectrum-web-components/underlay/sp-underlay.js'),\n};\n\nconst browser: 'webkit' | 'firefox' | 'chromium' = isWebKit()\n ? 'webkit'\n : isFirefox()\n ? 'firefox'\n : 'chromium';\n\ndescribe('define-element', function () {\n // registrations are globally-unique, so retries will always fail\n this.retries(0);\n\n beforeEach(function () {\n window.__swc.verbose = true;\n this.warn = stub(console, 'warn');\n });\n\n afterEach(function () {\n this.warn.resetHistory();\n window.__swc.verbose = false;\n this.warn.restore();\n });\n\n Object.entries(elements).forEach(([name, register]) =>\n it(`'${name}' warns on redefinition`, async function () {\n // classes already-defined via transitive dependencies can't be tested this way\n if (customElements.get(name)) {\n this.skip();\n }\n const error = {\n webkit: 'Cannot define multiple custom elements with the same tag name',\n firefox: `'${name}' has already been defined`,\n chromium: `\"${name}\" has already been used with this registry`,\n }[browser];\n let caughtError: Error | undefined;\n\n customElements.define(name, class extends HTMLElement {});\n try {\n await register();\n } catch (error) {\n caughtError = error as Error;\n }\n\n expect(caughtError?.message ?? '').to.include(error);\n expect(this.warn.called, 'should call console.warn()').to.be.true;\n const spyCall = this.warn.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes('redefine'),\n 'message should warn about redefining an element'\n ).to.be.true;\n })\n );\n});\n"],
|
|
5
|
-
"mappings": ";AAYA,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAGP,OAAO;AAKP,MAAM,WAAW;AAAA,EACb,qBAAqB,MACjB,OAAO,yDAAyD;AAAA,EACpE,gBAAgB,MACZ,OAAO,oDAAoD;AAAA,EAC/D,iBAAiB,MACb,OAAO,sDAAsD;AAAA,EACjE,kBAAkB,MACd,OAAO,wDAAwD;AAAA,EACnE,oBAAoB,MAChB,OAAO,4DAA4D;AAAA,EACvE,mBAAmB,MACf,OAAO,0DAA0D;AAAA,EACrE,WAAW,MAAM,OAAO,0CAA0C;AAAA,EAClE,YAAY,MAAM,OAAO,4CAA4C;AAAA,EACrE,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,YAAY,MAAM,OAAO,4CAA4C;AAAA,EACrE,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,qB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2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { expect } from '@open-wc/testing';\nimport { stub } from 'sinon';\nimport {\n isFirefox,\n isWebKit,\n} from '@spectrum-web-components/shared/src/platform.js';\n\n// for window.__swc\nimport '@spectrum-web-components/base';\n\n// mostly alphabetical,\n// but reordered to put dependents above dependencies,\n// in order to avoid transitive dependency conflicts (eg card -> asset)\nconst elements = {\n 'sp-accordion-item': () =>\n import('@spectrum-web-components/accordion/sp-accordion-item.js'),\n 'sp-accordion': () =>\n import('@spectrum-web-components/accordion/sp-accordion.js'),\n 'sp-action-bar': () =>\n import('@spectrum-web-components/action-bar/sp-action-bar.js'),\n 'sp-action-menu': () =>\n import('@spectrum-web-components/action-menu/sp-action-menu.js'),\n 'sp-action-button': () =>\n import('@spectrum-web-components/action-button/sp-action-button.js'),\n 'sp-action-group': () =>\n import('@spectrum-web-components/action-group/sp-action-group.js'),\n 'sp-card': () => import('@spectrum-web-components/card/sp-card.js'),\n 'sp-asset': () => import('@spectrum-web-components/asset/sp-asset.js'),\n 'sp-avatar': () => import('@spectrum-web-components/avatar/sp-avatar.js'),\n 'sp-badge': () => import('@spectrum-web-components/badge/sp-badge.js'),\n 'sp-banner': () => import('@spectrum-web-components/banner/sp-banner.js'),\n 'sp-dialog-wrapper': () =>\n import('@spectrum-web-components/dialog/sp-dialog-wrapper.js'),\n 'sp-dialog': () => import('@spectrum-web-components/dialog/sp-dialog.js'),\n 'sp-dialog-base': () =>\n import('@spectrum-web-components/dialog/sp-dialog-base.js'),\n 'sp-button': () => import('@spectrum-web-components/button/sp-button.js'),\n 'sp-button-group': () =>\n import('@spectrum-web-components/button-group/sp-button-group.js'),\n 'sp-checkbox': () =>\n import('@spectrum-web-components/checkbox/sp-checkbox.js'),\n 'sp-coachmark': () =>\n import('@spectrum-web-components/coachmark/sp-coachmark.js'),\n 'sp-color-area': () =>\n import('@spectrum-web-components/color-area/sp-color-area.js'),\n 'sp-color-handle': () =>\n import('@spectrum-web-components/color-handle/sp-color-handle.js'),\n 'sp-color-loupe': () =>\n import('@spectrum-web-components/color-loupe/sp-color-loupe.js'),\n 'sp-color-slider': () =>\n import('@spectrum-web-components/color-slider/sp-color-slider.js'),\n 'sp-color-wheel': () =>\n import('@spectrum-web-components/color-wheel/sp-color-wheel.js'),\n 'sp-divider': () =>\n import('@spectrum-web-components/divider/sp-divider.js'),\n 'sp-dropzone': () =>\n import('@spectrum-web-components/dropzone/sp-dropzone.js'),\n 'sp-meter': () => import('@spectrum-web-components/meter/sp-meter.js'),\n 'sp-field-group': () =>\n import('@spectrum-web-components/field-group/sp-field-group.js'),\n 'sp-field-label': () =>\n import('@spectrum-web-components/field-label/sp-field-label.js'),\n 'sp-help-text': () =>\n import('@spectrum-web-components/help-text/sp-help-text.js'),\n 'sp-icon': () => import('@spectrum-web-components/icon/sp-icon.js'),\n 'sp-icons-medium': () =>\n import('@spectrum-web-components/icons/sp-icons-medium.js'),\n 'sp-icons-large': () =>\n import('@spectrum-web-components/icons/sp-icons-large.js'),\n 'sp-illustrated-message': () =>\n import(\n '@spectrum-web-components/illustrated-message/sp-illustrated-message.js'\n ),\n 'sp-link': () => import('@spectrum-web-components/link/sp-link.js'),\n 'sp-menu-group': () =>\n import('@spectrum-web-components/menu/sp-menu-group.js'),\n 'sp-menu-item': () =>\n import('@spectrum-web-components/menu/sp-menu-item.js'),\n 'sp-menu': () => import('@spectrum-web-components/menu/sp-menu.js'),\n 'overlay-trigger': () =>\n import('@spectrum-web-components/overlay/overlay-trigger.js'),\n 'sp-overlay': () =>\n import('@spectrum-web-components/overlay/sp-overlay.js'),\n 'sp-picker': () => import('@spectrum-web-components/picker/sp-picker.js'),\n 'sp-picker-button': () =>\n import('@spectrum-web-components/picker-button/sp-picker-button.js'),\n 'sp-popover': () =>\n import('@spectrum-web-components/popover/sp-popover.js'),\n 'sp-progress-bar': () =>\n import('@spectrum-web-components/progress-bar/sp-progress-bar.js'),\n 'sp-progress-circle': () =>\n import(\n '@spectrum-web-components/progress-circle/sp-progress-circle.js'\n ),\n 'sp-quick-actions': () =>\n import('@spectrum-web-components/quick-actions/sp-quick-actions.js'),\n 'sp-radio-group': () =>\n import('@spectrum-web-components/radio/sp-radio-group.js'),\n 'sp-radio': () => import('@spectrum-web-components/radio/sp-radio.js'),\n 'sp-search': () => import('@spectrum-web-components/search/sp-search.js'),\n 'sp-sidenav-item': () =>\n import('@spectrum-web-components/sidenav/sp-sidenav-item.js'),\n 'sp-sidenav': () =>\n import('@spectrum-web-components/sidenav/sp-sidenav.js'),\n 'sp-slider': () => import('@spectrum-web-components/slider/sp-slider.js'),\n 'sp-slider-handle': () =>\n import('@spectrum-web-components/slider/sp-slider-handle.js'),\n 'sp-split-button': () =>\n import('@spectrum-web-components/split-button/sp-split-button.js'),\n 'sp-split-view': () =>\n import('@spectrum-web-components/split-view/sp-split-view.js'),\n 'sp-status-light': () =>\n import('@spectrum-web-components/status-light/sp-status-light.js'),\n 'sp-swatch-group': () =>\n import('@spectrum-web-components/swatch/sp-swatch-group.js'),\n 'sp-swatch': () => import('@spectrum-web-components/swatch/sp-swatch.js'),\n 'sp-switch': () => import('@spectrum-web-components/switch/sp-switch.js'),\n 'sp-table': () => import('@spectrum-web-components/table/sp-table.js'),\n 'sp-table-body': () =>\n import('@spectrum-web-components/table/sp-table-body.js'),\n 'sp-table-cell': () =>\n import('@spectrum-web-components/table/sp-table-cell.js'),\n 'sp-table-head': () =>\n import('@spectrum-web-components/table/sp-table-head.js'),\n 'sp-table-checkbox-cell': () =>\n import('@spectrum-web-components/table/sp-table-checkbox-cell.js'),\n 'sp-table-head-cell': () =>\n import('@spectrum-web-components/table/sp-table-head-cell.js'),\n 'sp-table-row': () =>\n import('@spectrum-web-components/table/sp-table-row.js'),\n 'sp-tab': () => import('@spectrum-web-components/tabs/sp-tab.js'),\n 'sp-tabs': () => import('@spectrum-web-components/tabs/sp-tabs.js'),\n 'sp-tabs-overflow': () =>\n import('@spectrum-web-components/tabs/sp-tabs-overflow.js'),\n 'sp-tag': () => import('@spectrum-web-components/tags/sp-tag.js'),\n 'sp-tags': () => import('@spectrum-web-components/tags/sp-tags.js'),\n 'sp-textfield': () =>\n import('@spectrum-web-components/textfield/sp-textfield.js'),\n 'sp-thumbnail': () =>\n import('@spectrum-web-components/thumbnail/sp-thumbnail.js'),\n 'sp-toast': () => import('@spectrum-web-components/toast/sp-toast.js'),\n 'sp-tooltip': () =>\n import('@spectrum-web-components/tooltip/sp-tooltip.js'),\n 'sp-top-nav': () =>\n import('@spectrum-web-components/top-nav/sp-top-nav.js'),\n 'sp-tray': () => import('@spectrum-web-components/tray/sp-tray.js'),\n 'sp-underlay': () =>\n import('@spectrum-web-components/underlay/sp-underlay.js'),\n};\n\nconst browser: 'webkit' | 'firefox' | 'chromium' = isWebKit()\n ? 'webkit'\n : isFirefox()\n ? 'firefox'\n : 'chromium';\n\ndescribe('define-element', function () {\n // registrations are globally-unique, so retries will always fail\n this.retries(0);\n\n beforeEach(function () {\n window.__swc.verbose = true;\n this.warn = stub(console, 'warn');\n });\n\n afterEach(function () {\n this.warn.resetHistory();\n window.__swc.verbose = false;\n this.warn.restore();\n });\n\n Object.entries(elements).forEach(([name, register]) =>\n it(`'${name}' warns on redefinition`, async function () {\n // classes already-defined via transitive dependencies can't be tested this way\n if (customElements.get(name)) {\n this.skip();\n }\n const error = {\n webkit: 'Cannot define multiple custom elements with the same tag name',\n firefox: `'${name}' has already been defined`,\n chromium: `\"${name}\" has already been used with this registry`,\n }[browser];\n let caughtError: Error | undefined;\n\n customElements.define(name, class extends HTMLElement {});\n try {\n await register();\n } catch (error) {\n caughtError = error as Error;\n }\n\n expect(caughtError?.message ?? '').to.include(error);\n expect(this.warn.called, 'should call console.warn()').to.be.true;\n const spyCall = this.warn.getCall(0);\n expect(\n (spyCall.args.at(0) as string).includes('redefine'),\n `message should warn about redefining an element, instead got \"${spyCall.args.at(\n 0\n )}\"`\n ).to.be.true;\n })\n );\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAGP,OAAO;AAKP,MAAM,WAAW;AAAA,EACb,qBAAqB,MACjB,OAAO,yDAAyD;AAAA,EACpE,gBAAgB,MACZ,OAAO,oDAAoD;AAAA,EAC/D,iBAAiB,MACb,OAAO,sDAAsD;AAAA,EACjE,kBAAkB,MACd,OAAO,wDAAwD;AAAA,EACnE,oBAAoB,MAChB,OAAO,4DAA4D;AAAA,EACvE,mBAAmB,MACf,OAAO,0DAA0D;AAAA,EACrE,WAAW,MAAM,OAAO,0CAA0C;AAAA,EAClE,YAAY,MAAM,OAAO,4CAA4C;AAAA,EACrE,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,YAAY,MAAM,OAAO,4CAA4C;AAAA,EACrE,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,qBAAqB,MACjB,OAAO,sDAAsD;AAAA,EACjE,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,kBAAkB,MACd,OAAO,mDAAmD;AAAA,EAC9D,aAAa,MAAM,OAAO,8CAA8C;AAAA,EACxE,mBAAmB,MACf,OAAO,0DAA0D;AAAA,EACrE,eAAe,MACX,OAAO,kDAAkD;AAAA,EAC7D,gBAAgB,MACZ,OAAO,oDAAoD;AAAA,EAC/D,iBAAiB,MACb,OAAO,sDAAsD;AAAA,EACjE,mBAAmB,MACf,OAAO,0DAA0D;AAAA,EACrE,kBAAkB,MACd,OAAO,wDAAwD;AAAA,EACnE,mBAAmB,MACf,OAAO,0DAA0D;AAAA,EACrE,kBAAkB,MACd,OAAO,wDAAwD;AAAA,EACnE,cAAc,MACV,OAAO,gDA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