@spectrum-web-components/base 0.42.1 → 0.42.3
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 +3 -3
- package/src/Base.d.ts +1 -1
- package/src/Base.js +1 -1
- package/src/sizedMixin.d.ts +3 -3
- package/src/streaming-listener.d.ts +2 -2
- package/src/version.js +1 -1
- package/test/base-devmode.test.js +16 -4
- package/test/base-devmode.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.42.
|
|
3
|
+
"version": "0.42.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -109,12 +109,12 @@
|
|
|
109
109
|
"lit-html"
|
|
110
110
|
],
|
|
111
111
|
"dependencies": {
|
|
112
|
-
"lit": "^2.5.0"
|
|
112
|
+
"lit": "^2.5.0 || ^3.1.3"
|
|
113
113
|
},
|
|
114
114
|
"types": "./src/index.d.ts",
|
|
115
115
|
"customElements": "custom-elements.json",
|
|
116
116
|
"sideEffects": [
|
|
117
117
|
"./**/*.dev.js"
|
|
118
118
|
],
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "a03edce4f21f232f1705d8eb222e6e5436cad4c3"
|
|
120
120
|
}
|
package/src/Base.d.ts
CHANGED
package/src/Base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import{LitElement as
|
|
1
|
+
"use strict";import{LitElement as m}from"lit";import{version as u}from"@spectrum-web-components/base/src/version.js";const c=new Set,g=()=>{const s=document.documentElement.dir==="rtl"?document.documentElement.dir:"ltr";c.forEach(o=>{o.setAttribute("dir",s)})},w=new MutationObserver(g);w.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});const p=s=>typeof s.startManagingContentDirection!="undefined"||s.tagName==="SP-THEME";export function SpectrumMixin(s){class o extends s{get isLTR(){return this.dir==="ltr"}hasVisibleFocusInTree(){const n=((r=document)=>{var l;let t=r.activeElement;for(;t!=null&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;const a=t?[t]:[];for(;t;){const i=t.assignedSlot||t.parentElement||((l=t.getRootNode())==null?void 0:l.host);i&&a.push(i),t=i}return a})(this.getRootNode())[0];if(!n)return!1;try{return n.matches(":focus-visible")||n.matches(".focus-visible")}catch(r){return n.matches(".focus-visible")}}connectedCallback(){if(!this.hasAttribute("dir")){let e=this.assignedSlot||this.parentNode;for(;e!==document.documentElement&&!p(e);)e=e.assignedSlot||e.parentNode||e.host;if(this.dir=e.dir==="rtl"?e.dir:this.dir||"ltr",e===document.documentElement)c.add(this);else{const{localName:n}=e;n.search("-")>-1&&!customElements.get(n)?customElements.whenDefined(n).then(()=>{e.startManagingContentDirection(this)}):e.startManagingContentDirection(this)}this._dirParent=e}super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._dirParent&&(this._dirParent===document.documentElement?c.delete(this):this._dirParent.stopManagingContentDirection(this),this.removeAttribute("dir"))}}return o}export class SpectrumElement extends SpectrumMixin(m){}SpectrumElement.VERSION=u;
|
|
2
2
|
//# sourceMappingURL=Base.js.map
|
package/src/sizedMixin.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactiveElement } from 'lit';
|
|
2
|
-
|
|
2
|
+
type Constructor<T = Record<string, unknown>> = {
|
|
3
3
|
new (...args: any[]): T;
|
|
4
4
|
prototype: T;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type ElementSize = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';
|
|
7
7
|
export declare const ElementSizes: Record<string, ElementSize>;
|
|
8
|
-
export
|
|
8
|
+
export type DefaultElementSize = Exclude<ElementSize, 'xxs' | 'xs' | 'xxl'>;
|
|
9
9
|
export interface SizedElementInterface {
|
|
10
10
|
size: ElementSize;
|
|
11
11
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { nothing, Part } from 'lit';
|
|
2
2
|
import { AsyncDirective } from 'lit/async-directive.js';
|
|
3
3
|
import type { DirectiveResult } from 'lit/directive.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type ListenerConfig = [string | string[], (event?: any) => void];
|
|
5
|
+
type ListenerConfigGroup = {
|
|
6
6
|
start: ListenerConfig;
|
|
7
7
|
end: ListenerConfig;
|
|
8
8
|
streamInside?: ListenerConfig;
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '0.42.
|
|
2
|
+
export const version = '0.42.3';
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { expect } from "@open-wc/testing";
|
|
3
3
|
import { stub } from "sinon";
|
|
4
|
-
describe("
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
describe("Dev Mode", () => {
|
|
5
|
+
let consoleWarnStub;
|
|
6
|
+
before(() => {
|
|
7
|
+
window.__swc = {
|
|
8
|
+
...window.__swc,
|
|
9
|
+
verbose: true
|
|
10
|
+
};
|
|
11
|
+
consoleWarnStub = stub(console, "warn");
|
|
12
|
+
});
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
consoleWarnStub.resetHistory();
|
|
15
|
+
});
|
|
16
|
+
after(() => {
|
|
17
|
+
consoleWarnStub.restore();
|
|
18
|
+
});
|
|
19
|
+
it("announces that Dev Mode is on", async function() {
|
|
7
20
|
const { SpectrumElement } = await import("@spectrum-web-components/base");
|
|
8
21
|
expect(SpectrumElement).to.not.be.undefined;
|
|
9
22
|
expect(consoleWarnStub.called).to.be.true;
|
|
@@ -19,7 +32,6 @@ describe("Base", () => {
|
|
|
19
32
|
level: "default"
|
|
20
33
|
}
|
|
21
34
|
});
|
|
22
|
-
consoleWarnStub.restore();
|
|
23
35
|
});
|
|
24
36
|
});
|
|
25
37
|
//# sourceMappingURL=base-devmode.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["base-devmode.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\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 { expect } from '@open-wc/testing';\nimport { stub } from 'sinon';\n\ndescribe('
|
|
5
|
-
"mappings": ";AAUA,SAAS,cAAc;AACvB,SAAS,YAAY;AAErB,SAAS,
|
|
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\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 { expect } from '@open-wc/testing';\nimport { stub } from 'sinon';\n\ndescribe('Dev Mode', () => {\n let consoleWarnStub!: ReturnType<typeof stub>;\n before(() => {\n window.__swc = {\n ...window.__swc,\n verbose: true,\n };\n consoleWarnStub = stub(console, 'warn');\n });\n afterEach(() => {\n consoleWarnStub.resetHistory();\n });\n after(() => {\n consoleWarnStub.restore();\n });\n it('announces that Dev Mode is on', async function () {\n const { SpectrumElement } = await import(\n '@spectrum-web-components/base'\n );\n expect(SpectrumElement).to.not.be.undefined;\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n expect(\n spyCall.args.at(0) as string,\n 'confirm \"dev mode\"-centric message'\n ).to.include('dev mode');\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'base',\n type: 'default',\n level: 'default',\n },\n });\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAUA,SAAS,cAAc;AACvB,SAAS,YAAY;AAErB,SAAS,YAAY,MAAM;AACvB,MAAI;AACJ,SAAO,MAAM;AACT,WAAO,QAAQ;AAAA,MACX,GAAG,OAAO;AAAA,MACV,SAAS;AAAA,IACb;AACA,sBAAkB,KAAK,SAAS,MAAM;AAAA,EAC1C,CAAC;AACD,YAAU,MAAM;AACZ,oBAAgB,aAAa;AAAA,EACjC,CAAC;AACD,QAAM,MAAM;AACR,oBAAgB,QAAQ;AAAA,EAC5B,CAAC;AACD,KAAG,iCAAiC,iBAAkB;AAClD,UAAM,EAAE,gBAAgB,IAAI,MAAM,OAC9B,+BACJ;AACA,WAAO,eAAe,EAAE,GAAG,IAAI,GAAG;AAElC,WAAO,gBAAgB,MAAM,EAAE,GAAG,GAAG;AACrC,UAAM,UAAU,gBAAgB,QAAQ,CAAC;AACzC;AAAA,MACI,QAAQ,KAAK,GAAG,CAAC;AAAA,MACjB;AAAA,IACJ,EAAE,GAAG,QAAQ,UAAU;AACvB,WAAO,QAAQ,KAAK,GAAG,EAAE,GAAG,sBAAsB,EAAE,GAAG,KAAK,MAAM;AAAA,MAC9D,MAAM;AAAA,QACF,WAAW;AAAA,QACX,MAAM;AAAA,QACN,OAAO;AAAA,MACX;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|