@spectrum-web-components/base 0.7.0 → 0.7.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/base",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -96,13 +96,12 @@
96
96
  "lit-html"
97
97
  ],
98
98
  "dependencies": {
99
- "lit": "^2.2.0",
100
- "tslib": "^2.0.0"
99
+ "lit": "^2.2.0"
101
100
  },
102
101
  "types": "./src/index.d.ts",
103
102
  "customElements": "custom-elements.json",
104
103
  "sideEffects": [
105
104
  "./**/*.dev.js"
106
105
  ],
107
- "gitHead": "05c81318844160db3f8156144106e643507fef97"
106
+ "gitHead": "8bd87724e91e23df83dbf63a434bbbe10b8daaa6"
108
107
  }
package/src/Base.dev.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __decorateClass = (decorators, target, key, kind) => {
@@ -47,7 +48,9 @@ export function SpectrumMixin(constructor) {
47
48
  connectedCallback() {
48
49
  if (!this.hasAttribute("dir")) {
49
50
  let dirParent = this.assignedSlot || this.parentNode;
50
- while (dirParent !== document.documentElement && !canManageContentDirection(dirParent)) {
51
+ while (dirParent !== document.documentElement && !canManageContentDirection(
52
+ dirParent
53
+ )) {
51
54
  dirParent = dirParent.assignedSlot || dirParent.parentNode || dirParent.host;
52
55
  }
53
56
  const oldDir = this.dir;
@@ -64,7 +67,9 @@ export function SpectrumMixin(constructor) {
64
67
  dirParent.startManagingContentDirection(this);
65
68
  });
66
69
  } else {
67
- dirParent.startManagingContentDirection(this);
70
+ dirParent.startManagingContentDirection(
71
+ this
72
+ );
68
73
  }
69
74
  }
70
75
  this._dirParent = dirParent;
@@ -77,7 +82,9 @@ export function SpectrumMixin(constructor) {
77
82
  if (this._dirParent === document.documentElement) {
78
83
  observedForElements.delete(this);
79
84
  } else {
80
- this._dirParent.stopManagingContentDirection(this);
85
+ this._dirParent.stopManagingContentDirection(
86
+ this
87
+ );
81
88
  }
82
89
  this.removeAttribute("dir");
83
90
  }
@@ -116,7 +123,9 @@ if (true) {
116
123
  const inspectElement = element ? "\nInspect this issue in the follow element:" : "";
117
124
  const displayURL = (element ? "\n\n" : "\n") + url + "\n";
118
125
  const messages = [];
119
- messages.push(intro + message + "\n" + listedIssues + inspectElement);
126
+ messages.push(
127
+ intro + message + "\n" + listedIssues + inspectElement
128
+ );
120
129
  if (element) {
121
130
  messages.push(element);
122
131
  }
@@ -130,6 +139,11 @@ if (true) {
130
139
  console.warn(...messages);
131
140
  }
132
141
  };
133
- window.__swc.warn(void 0, "Spectrum Web Components is in dev mode. Not recommended for production!", "https://opensource.adobe.com/spectrum-web-components/dev-mode/", { type: "default" });
142
+ window.__swc.warn(
143
+ void 0,
144
+ "Spectrum Web Components is in dev mode. Not recommended for production!",
145
+ "https://opensource.adobe.com/spectrum-web-components/dev-mode/",
146
+ { type: "default" }
147
+ );
134
148
  }
135
149
  //# sourceMappingURL=Base.dev.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["Base.ts"],
4
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 { LitElement, ReactiveElement } from 'lit';\nimport { property } from 'lit/decorators.js';\ntype ThemeRoot = HTMLElement & {\n startManagingContentDirection: (el: HTMLElement) => void;\n stopManagingContentDirection: (el: HTMLElement) => void;\n};\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 interface SpectrumInterface {\n shadowRoot: ShadowRoot;\n isLTR: boolean;\n hasVisibleFocusInTree(): boolean;\n dir: 'ltr' | 'rtl';\n}\n\nconst observedForElements: Set<HTMLElement> = new Set();\n\nconst updateRTL = (): void => {\n const dir =\n document.documentElement.dir === 'rtl'\n ? document.documentElement.dir\n : 'ltr';\n observedForElements.forEach((el) => {\n el.setAttribute('dir', dir);\n });\n};\n\nconst rtlObserver = new MutationObserver(updateRTL);\n\nrtlObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir'],\n});\n\ntype ContentDirectionManager = HTMLElement & {\n startManagingContentDirection?(): void;\n};\n\nconst canManageContentDirection = (el: ContentDirectionManager): boolean =>\n typeof el.startManagingContentDirection !== 'undefined' ||\n el.tagName === 'SP-THEME';\n\nexport function SpectrumMixin<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<SpectrumInterface> {\n class SlotTextObservingElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n @property({ reflect: true })\n public override dir: 'ltr' | 'rtl' = 'ltr';\n\n /**\n * @private\n */\n public get isLTR(): boolean {\n return this.dir === 'ltr';\n }\n\n public hasVisibleFocusInTree(): boolean {\n const activeElement = (this.getRootNode() as Document)\n .activeElement as HTMLElement;\n if (!activeElement) {\n return false;\n }\n // Browsers without support for the `:focus-visible`\n // selector will throw on the following test (Safari, older things).\n // Some won't throw, but will be focusing item rather than the menu and\n // will rely on the polyfill to know whether focus is \"visible\" or not.\n try {\n return (\n activeElement.matches(':focus-visible') ||\n activeElement.matches('.focus-visible')\n );\n } catch (error) {\n return activeElement.matches('.focus-visible');\n }\n }\n\n public override connectedCallback(): void {\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement;\n while (\n dirParent !== document.documentElement &&\n !canManageContentDirection(\n dirParent as ContentDirectionManager\n )\n ) {\n dirParent = ((dirParent as HTMLElement).assignedSlot || // step into the shadow DOM of the parent of a slotted node\n dirParent.parentNode || // DOM Element detected\n (dirParent as unknown as ShadowRoot)\n .host) as HTMLElement;\n }\n const oldDir = this.dir;\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (oldDir === this.dir) {\n this.setAttribute('dir', this.dir);\n }\n if (dirParent === document.documentElement) {\n observedForElements.add(this);\n } else {\n const { localName } = dirParent;\n if (\n localName.search('-') > -1 &&\n !customElements.get(localName)\n ) {\n customElements.whenDefined(localName).then(() => {\n (\n dirParent as ThemeRoot\n ).startManagingContentDirection(this);\n });\n } else {\n (dirParent as ThemeRoot).startManagingContentDirection(\n this\n );\n }\n }\n this._dirParent = dirParent as HTMLElement;\n }\n super.connectedCallback();\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._dirParent) {\n if (this._dirParent === document.documentElement) {\n observedForElements.delete(this);\n } else {\n (this._dirParent as ThemeRoot).stopManagingContentDirection(\n this\n );\n }\n this.removeAttribute('dir');\n }\n }\n }\n return SlotTextObservingElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n window.__swc = {\n ...window.__swc,\n issuedWarnings: new Set(),\n warn: (element, message, url, { type = 'api', level = 'default', issues } = {}): void => {\n const { localName = 'base' } = element || {};\n const id = `${localName}:${type}:${level}` as BrandedSWCWarningID;\n if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id))\n return;\n window.__swc.issuedWarnings.add(id);\n if (window.__swc.ignoreWarningLocalNames?.[localName]) return;\n if (window.__swc.ignoreWarningTypes?.[type]) return;\n if (window.__swc.ignoreWarningLevels?.[level]) return;\n let listedIssues = '';\n if (issues && issues.length) {\n issues.unshift('');\n listedIssues = issues.join('\\n - ') + '\\n';\n }\n const intro = level === 'deprecation' ? 'DEPRECATION NOTICE: ' : '';\n const inspectElement = element\n ? '\\nInspect this issue in the follow element:'\n : '';\n const displayURL = (element ? '\\n\\n' : '\\n') + url + '\\n';\n const messages: unknown[] = [];\n messages.push(\n intro + message + '\\n' + listedIssues + inspectElement\n );\n if (element) {\n messages.push(element);\n }\n messages.push(displayURL, {\n data: {\n localName,\n type,\n level,\n }\n });\n console.warn(...messages);\n },\n };\n\n window.__swc.warn(\n undefined,\n 'Spectrum Web Components is in dev mode. Not recommended for production!',\n 'https://opensource.adobe.com/spectrum-web-components/dev-mode/',\n { type: 'default' },\n );\n}\n"],
5
- "mappings": ";;;;;;;;;;;AAYA;AACA;AAmBA,MAAM,sBAAwC,oBAAI,IAAI;AAEtD,MAAM,YAAY,MAAY;AAC1B,QAAM,MACF,SAAS,gBAAgB,QAAQ,QAC3B,SAAS,gBAAgB,MACzB;AACV,sBAAoB,QAAQ,CAAC,OAAO;AAChC,OAAG,aAAa,OAAO,GAAG;AAAA,EAC9B,CAAC;AACL;AAEA,MAAM,cAAc,IAAI,iBAAiB,SAAS;AAElD,YAAY,QAAQ,SAAS,iBAAiB;AAAA,EAC1C,YAAY;AAAA,EACZ,iBAAiB,CAAC,KAAK;AAC3B,CAAC;AAMD,MAAM,4BAA4B,CAAC,OAC/B,OAAO,GAAG,kCAAkC,eAC5C,GAAG,YAAY;AAEZ,8BACH,aACkC;AAClC,QAAM,iCAAiC,YAAY;AAAA,IAAnD;AAAA;AAWoB,iBAAqB;AAAA;AAAA,QAK1B,QAAiB;AACxB,aAAO,KAAK,QAAQ;AAAA,IACxB;AAAA,IAEO,wBAAiC;AACpC,YAAM,gBAAiB,KAAK,YAAY,EACnC;AACL,UAAI,CAAC,eAAe;AAChB,eAAO;AAAA,MACX;AAKA,UAAI;AACA,eACI,cAAc,QAAQ,gBAAgB,KACtC,cAAc,QAAQ,gBAAgB;AAAA,MAE9C,SAAS,OAAP;AACE,eAA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AAO,MAAM,uBAAb,mBAAkC;AAAO;AAC7C,WAAI,YAAO,MAAM,wBAAb,mBAAmC;AAAQ;AAC/C,UAAI,eAAe;AACnB,UAAI,UAAU,OAAO,QAAQ;AACzB,eAAO,QAAQ,EAAE;AACjB,uBAAe,OAAO,KAAK,UAAU,IAAI;AAAA,MAC7C;AACA,YAAM,QAAQ,UAAU,gBAAgB,yBAAyB;AACjE,YAAM,iBAAiB,UACjB,gDACA;AACN,YAAM,cAAc,UAAU,SAAS,QAAQ,MAAM;AACrD,YAAM,WAAsB,CAAC;AAC7B,eAAS;AAAA,QACL,QAAQ,UAAU,OAAO,eAAe;AAAA,MAC5C;AACA,UAAI,SAAS;AACT,iBAAS,KAAK,OAAO;AAAA,MACzB;AACA,eAAS,KAAK,YAAY;AAAA,QACtB,MAAM;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,QACJ;AAAA,MACJ,CAAC;AACD,cAAQ,KAAK,GAAG,QAAQ;AAAA,IAC5B;AAAA,EACJ;AAEA,SAAO,MAAM;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,EAAE,MAAM,UAAU;AAAA,EACtB;AACJ;",
6
6
  "names": []
7
7
  }
package/src/Base.js CHANGED
@@ -1,2 +1,2 @@
1
- var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=(t,s,o,e)=>{for(var n=e>1?void 0:e?d(s,o):s,i=t.length-1,r;i>=0;i--)(r=t[i])&&(n=(e?r(s,o,n):r(n))||n);return e&&n&&c(s,o,n),n};import{LitElement as m}from"lit";import{property as u}from"lit/decorators.js";const a=new Set,p=()=>{const t=document.documentElement.dir==="rtl"?document.documentElement.dir:"ltr";a.forEach(s=>{s.setAttribute("dir",t)})},h=new MutationObserver(p);h.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});const w=t=>typeof t.startManagingContentDirection!="undefined"||t.tagName==="SP-THEME";export function SpectrumMixin(t){class s extends t{constructor(){super(...arguments);this.dir="ltr"}get isLTR(){return this.dir==="ltr"}hasVisibleFocusInTree(){const e=this.getRootNode().activeElement;if(!e)return!1;try{return e.matches(":focus-visible")||e.matches(".focus-visible")}catch(n){return e.matches(".focus-visible")}}connectedCallback(){if(!this.hasAttribute("dir")){let e=this.assignedSlot||this.parentNode;for(;e!==document.documentElement&&!w(e);)e=e.assignedSlot||e.parentNode||e.host;const n=this.dir;if(this.dir=e.dir==="rtl"?e.dir:this.dir||"ltr",n===this.dir&&this.setAttribute("dir",this.dir),e===document.documentElement)a.add(this);else{const{localName:i}=e;i.search("-")>-1&&!customElements.get(i)?customElements.whenDefined(i).then(()=>{e.startManagingContentDirection(this)}):e.startManagingContentDirection(this)}this._dirParent=e}super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._dirParent&&(this._dirParent===document.documentElement?a.delete(this):this._dirParent.stopManagingContentDirection(this),this.removeAttribute("dir"))}}return l([u({reflect:!0})],s.prototype,"dir",2),s}export class SpectrumElement extends SpectrumMixin(m){}
1
+ "use strict";var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=(t,n,r,o)=>{for(var e=o>1?void 0:o?d(n,r):n,i=t.length-1,s;i>=0;i--)(s=t[i])&&(e=(o?s(n,r,e):s(e))||e);return o&&e&&c(n,r,e),e};import{LitElement as m}from"lit";import{property as u}from"lit/decorators.js";const a=new Set,p=()=>{const t=document.documentElement.dir==="rtl"?document.documentElement.dir:"ltr";a.forEach(n=>{n.setAttribute("dir",t)})},h=new MutationObserver(p);h.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});const w=t=>typeof t.startManagingContentDirection!="undefined"||t.tagName==="SP-THEME";export function SpectrumMixin(t){class n extends t{constructor(){super(...arguments);this.dir="ltr"}get isLTR(){return this.dir==="ltr"}hasVisibleFocusInTree(){const e=this.getRootNode().activeElement;if(!e)return!1;try{return e.matches(":focus-visible")||e.matches(".focus-visible")}catch(i){return e.matches(".focus-visible")}}connectedCallback(){if(!this.hasAttribute("dir")){let e=this.assignedSlot||this.parentNode;for(;e!==document.documentElement&&!w(e);)e=e.assignedSlot||e.parentNode||e.host;const i=this.dir;if(this.dir=e.dir==="rtl"?e.dir:this.dir||"ltr",i===this.dir&&this.setAttribute("dir",this.dir),e===document.documentElement)a.add(this);else{const{localName:s}=e;s.search("-")>-1&&!customElements.get(s)?customElements.whenDefined(s).then(()=>{e.startManagingContentDirection(this)}):e.startManagingContentDirection(this)}this._dirParent=e}super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._dirParent&&(this._dirParent===document.documentElement?a.delete(this):this._dirParent.stopManagingContentDirection(this),this.removeAttribute("dir"))}}return l([u({reflect:!0})],n.prototype,"dir",2),n}export class SpectrumElement extends SpectrumMixin(m){}
2
2
  //# sourceMappingURL=Base.js.map
package/src/Base.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["Base.ts"],
4
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 { LitElement, ReactiveElement } from 'lit';\nimport { property } from 'lit/decorators.js';\ntype ThemeRoot = HTMLElement & {\n startManagingContentDirection: (el: HTMLElement) => void;\n stopManagingContentDirection: (el: HTMLElement) => void;\n};\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 interface SpectrumInterface {\n shadowRoot: ShadowRoot;\n isLTR: boolean;\n hasVisibleFocusInTree(): boolean;\n dir: 'ltr' | 'rtl';\n}\n\nconst observedForElements: Set<HTMLElement> = new Set();\n\nconst updateRTL = (): void => {\n const dir =\n document.documentElement.dir === 'rtl'\n ? document.documentElement.dir\n : 'ltr';\n observedForElements.forEach((el) => {\n el.setAttribute('dir', dir);\n });\n};\n\nconst rtlObserver = new MutationObserver(updateRTL);\n\nrtlObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['dir'],\n});\n\ntype ContentDirectionManager = HTMLElement & {\n startManagingContentDirection?(): void;\n};\n\nconst canManageContentDirection = (el: ContentDirectionManager): boolean =>\n typeof el.startManagingContentDirection !== 'undefined' ||\n el.tagName === 'SP-THEME';\n\nexport function SpectrumMixin<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<SpectrumInterface> {\n class SlotTextObservingElement extends constructor {\n /**\n * @private\n */\n public override shadowRoot!: ShadowRoot;\n private _dirParent?: HTMLElement;\n\n /**\n * @private\n */\n @property({ reflect: true })\n public override dir: 'ltr' | 'rtl' = 'ltr';\n\n /**\n * @private\n */\n public get isLTR(): boolean {\n return this.dir === 'ltr';\n }\n\n public hasVisibleFocusInTree(): boolean {\n const activeElement = (this.getRootNode() as Document)\n .activeElement as HTMLElement;\n if (!activeElement) {\n return false;\n }\n // Browsers without support for the `:focus-visible`\n // selector will throw on the following test (Safari, older things).\n // Some won't throw, but will be focusing item rather than the menu and\n // will rely on the polyfill to know whether focus is \"visible\" or not.\n try {\n return (\n activeElement.matches(':focus-visible') ||\n activeElement.matches('.focus-visible')\n );\n } catch (error) {\n return activeElement.matches('.focus-visible');\n }\n }\n\n public override connectedCallback(): void {\n if (!this.hasAttribute('dir')) {\n let dirParent = ((this as HTMLElement).assignedSlot ||\n this.parentNode) as HTMLElement;\n while (\n dirParent !== document.documentElement &&\n !canManageContentDirection(\n dirParent as ContentDirectionManager\n )\n ) {\n dirParent = ((dirParent as HTMLElement).assignedSlot || // step into the shadow DOM of the parent of a slotted node\n dirParent.parentNode || // DOM Element detected\n (dirParent as unknown as ShadowRoot)\n .host) as HTMLElement;\n }\n const oldDir = this.dir;\n this.dir =\n dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';\n if (oldDir === this.dir) {\n this.setAttribute('dir', this.dir);\n }\n if (dirParent === document.documentElement) {\n observedForElements.add(this);\n } else {\n const { localName } = dirParent;\n if (\n localName.search('-') > -1 &&\n !customElements.get(localName)\n ) {\n customElements.whenDefined(localName).then(() => {\n (\n dirParent as ThemeRoot\n ).startManagingContentDirection(this);\n });\n } else {\n (dirParent as ThemeRoot).startManagingContentDirection(\n this\n );\n }\n }\n this._dirParent = dirParent as HTMLElement;\n }\n super.connectedCallback();\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._dirParent) {\n if (this._dirParent === document.documentElement) {\n observedForElements.delete(this);\n } else {\n (this._dirParent as ThemeRoot).stopManagingContentDirection(\n this\n );\n }\n this.removeAttribute('dir');\n }\n }\n }\n return SlotTextObservingElement;\n}\n\nexport class SpectrumElement extends SpectrumMixin(LitElement) {}\n\nif (window.__swc.DEBUG) {\n window.__swc = {\n ...window.__swc,\n issuedWarnings: new Set(),\n warn: (element, message, url, { type = 'api', level = 'default', issues } = {}): void => {\n const { localName = 'base' } = element || {};\n const id = `${localName}:${type}:${level}` as BrandedSWCWarningID;\n if (!window.__swc.verbose && window.__swc.issuedWarnings.has(id))\n return;\n window.__swc.issuedWarnings.add(id);\n if (window.__swc.ignoreWarningLocalNames?.[localName]) return;\n if (window.__swc.ignoreWarningTypes?.[type]) return;\n if (window.__swc.ignoreWarningLevels?.[level]) return;\n let listedIssues = '';\n if (issues && issues.length) {\n issues.unshift('');\n listedIssues = issues.join('\\n - ') + '\\n';\n }\n const intro = level === 'deprecation' ? 'DEPRECATION NOTICE: ' : '';\n const inspectElement = element\n ? '\\nInspect this issue in the follow element:'\n : '';\n const displayURL = (element ? '\\n\\n' : '\\n') + url + '\\n';\n const messages: unknown[] = [];\n messages.push(\n intro + message + '\\n' + listedIssues + inspectElement\n );\n if (element) {\n messages.push(element);\n }\n messages.push(displayURL, {\n data: {\n localName,\n type,\n level,\n }\n });\n console.warn(...messages);\n },\n };\n\n window.__swc.warn(\n undefined,\n 'Spectrum Web Components is in dev mode. Not recommended for production!',\n 'https://opensource.adobe.com/spectrum-web-components/dev-mode/',\n { type: 'default' },\n );\n}\n"],
5
- "mappings": "wMAYA,iCACA,6CAmBA,KAAM,GAAwC,GAAI,KAE5C,EAAY,IAAY,CAC1B,KAAM,GACF,SAAS,gBAAgB,MAAQ,MAC3B,SAAS,gBAAgB,IACzB,MACV,EAAoB,QAAQ,AAAC,GAAO,CAChC,EAAG,aAAa,MAAO,CAAG,CAC9B,CAAC,CACL,EAEM,EAAc,GAAI,kBAAiB,CAAS,EAElD,EAAY,QAAQ,SAAS,gBAAiB,CAC1C,WAAY,GACZ,gBAAiB,CAAC,KAAK,CAC3B,CAAC,EAMD,KAAM,GAA4B,AAAC,GAC/B,MAAO,GAAG,+BAAkC,aAC5C,EAAG,UAAY,WAEZ,8BACH,EACkC,CAClC,MAAM,SAAiC,EAAY,CAAnD,kCAWoB,SAAqB,SAK1B,QAAiB,CACxB,MAAO,MAAK,MAAQ,KACxB,CAEO,uBAAiC,CACpC,KAAM,GAAiB,KAAK,YAAY,EACnC,cACL,GAAI,CAAC,EACD,MAAO,GAMX,GAAI,CACA,MACI,GAAc,QAAQ,gBAAgB,GACtC,EAAc,QAAQ,gBAAgB,CAE9C,OAAS,EAAP,CACE,MAAO,GAAc,QAAQ,gBAAgB,CACjD,CACJ,CAEgB,mBAA0B,CACtC,GAAI,CAAC,KAAK,aAAa,KAAK,EAAG,CAC3B,GAAI,GAAc,KAAqB,cACnC,KAAK,WACT,KACI,IAAc,SAAS,iBACvB,CAAC,EACG,CACJ,GAEA,EAAc,EAA0B,cACpC,EAAU,YACT,EACI,KAEb,KAAM,GAAS,KAAK,IAMpB,GALA,KAAK,IACD,EAAU,MAAQ,MAAQ,EAAU,IAAM,KAAK,KAAO,MACtD,IAAW,KAAK,KAChB,KAAK,aAAa,MAAO,KAAK,GAAG,EAEjC,IAAc,SAAS,gBAC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AAY,EACnC,cACL,GAAI,CAACA,EACD,MAAO,GAMX,GAAI,CACA,OACIA,EAAc,QAAQ,gBAAgB,GACtCA,EAAc,QAAQ,gBAAgB,CAE9C,OAASC,EAAP,CACE,OAAOD,EAAc,QAAQ,gBAAgB,CACjD,CACJ,CAEgB,mBAA0B,CACtC,GAAI,CAAC,KAAK,aAAa,KAAK,EAAG,CAC3B,IAAIE,EAAc,KAAqB,cACnC,KAAK,WACT,KACIA,IAAc,SAAS,iBACvB,CAACL,EACGK,CACJ,GAEAA,EAAcA,EAA0B,cACpCA,EAAU,YACTA,EACI,KAEb,MAAMC,EAAS,KAAK,IAMpB,GALA,KAAK,IACDD,EAAU,MAAQ,MAAQA,EAAU,IAAM,KAAK,KAAO,MACtDC,IAAW,KAAK,KAChB,KAAK,aAAa,MAAO,KAAK,GAAG,EAEjCD,IAAc,SAAS,gBACvBV,EAAoB,IAAI,IAAI,MACzB,CACH,KAAM,CAAE,UAAAY,CAAU,EAAIF,EAElBE,EAAU,OAAO,GAAG,EAAI,IACxB,CAAC,eAAe,IAAIA,CAAS,EAE7B,eAAe,YAAYA,CAAS,EAAE,KAAK,IAAM,CAEzCF,EACF,8BAA8B,IAAI,CACxC,CAAC,EAEAA,EAAwB,8BACrB,IACJ,CAER,CACA,KAAK,WAAaA,CACtB,CACA,MAAM,kBAAkB,CAC5B,CAEgB,sBAA6B,CACzC,MAAM,qBAAqB,EACvB,KAAK,aACD,KAAK,aAAe,SAAS,gBAC7BV,EAAoB,OAAO,IAAI,EAE9B,KAAK,WAAyB,6BAC3B,IACJ,EAEJ,KAAK,gBAAgB,KAAK,EAElC,CACJ,CAvFoB,OAAAa,EAAA,CADfd,EAAS,CAAE,QAAS,EAAK,CAAC,GAVzBQ,EAWc,mBAwFbA,CACX,CAEO,aAAM,wBAAwB,cAAcT,CAAU,CAAE,CAAC",
6
+ "names": ["LitElement", "property", "observedForElements", "updateRTL", "dir", "el", "rtlObserver", "canManageContentDirection", "constructor", "SlotTextObservingElement", "activeElement", "error", "dirParent", "oldDir", "localName", "__decorateClass"]
7
7
  }
@@ -1,7 +1,10 @@
1
+ "use strict";
1
2
  export function conditionAttributeWithoutId(el, attribute, ids) {
2
3
  const ariaDescribedby = el.getAttribute(attribute);
3
4
  let descriptors = ariaDescribedby ? ariaDescribedby.split(/\s+/) : [];
4
- descriptors = descriptors.filter((descriptor) => !ids.find((id) => descriptor === id));
5
+ descriptors = descriptors.filter(
6
+ (descriptor) => !ids.find((id) => descriptor === id)
7
+ );
5
8
  if (descriptors.length) {
6
9
  el.setAttribute(attribute, descriptors.join(" "));
7
10
  } else {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["condition-attribute-with-id.ts"],
4
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 function conditionAttributeWithoutId(\n el: HTMLElement,\n attribute: string,\n ids: string[]\n): void {\n const ariaDescribedby = el.getAttribute(attribute);\n let descriptors = ariaDescribedby ? ariaDescribedby.split(/\\s+/) : [];\n descriptors = descriptors.filter(\n (descriptor) => !ids.find((id) => descriptor === id)\n );\n if (descriptors.length) {\n el.setAttribute(attribute, descriptors.join(' '));\n } else {\n el.removeAttribute(attribute);\n }\n}\n\nexport function conditionAttributeWithId(\n el: HTMLElement,\n attribute: string,\n id: string | string[]\n): () => void {\n const ids = Array.isArray(id) ? id : [id];\n const ariaDescribedby = el.getAttribute(attribute);\n const descriptors = ariaDescribedby ? ariaDescribedby.split(/\\s+/) : [];\n const hadIds = ids.every((id) => descriptors.indexOf(id) > -1);\n if (hadIds)\n return (): void => {\n return;\n };\n descriptors.push(...ids);\n el.setAttribute(attribute, descriptors.join(' '));\n return () => conditionAttributeWithoutId(el, attribute, ids);\n}\n"],
5
- "mappings": "AAYO,4CACH,IACA,WACA,KACI;AACJ,QAAM,kBAAkB,GAAG,aAAa,SAAS;AACjD,MAAI,cAAc,kBAAkB,gBAAgB,MAAM,KAAK,IAAI,CAAC;AACpE,gBAAc,YAAY,OACtB,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,OAAO,eAAe,EAAE,CACvD;AACA,MAAI,YAAY,QAAQ;AACpB,OAAG,aAAa,WAAW,YAAY,KAAK,GAAG,CAAC;AAAA,EACpD,OAAO;AACH,OAAG,gBAAgB,SAAS;AAAA,EAChC;AACJ;AAEO,yCACH,IACA,WACA,IACU;AACV,QAAM,MAAM,MAAM,QAAQ,EAAE,IAAI,KAAK,CAAC,EAAE;AACxC,QAAM,kBAAkB,GAAG,aAAa,SAAS;AACjD,QAAM,cAAc,kBAAkB,gBAAgB,MAAM,KAAK,IAAI,CAAC;AACtE,QAAM,SAAS,IAAI,MAAM,CAAC,QAAO,YAAY,QAAQ,GAAE,IAAI,EAAE;AAC7D,MAAI;AACA,WAAO,MAAY;AACf;AAAA,IACJ;AACJ,cAAY,KAAK,GAAG,GAAG;AACvB,KAAG,aAAa,WAAW,YAAY,KAAK,GAAG,CAAC;AAChD,SAAO,MAAM,4BAA4B,IAAI,WAAW,GAAG;AAC/D;",
6
- "names": []
5
+ "mappings": ";AAYO,gBAAS,4BACZ,IACA,WACA,KACI;AACJ,QAAM,kBAAkB,GAAG,aAAa,SAAS;AACjD,MAAI,cAAc,kBAAkB,gBAAgB,MAAM,KAAK,IAAI,CAAC;AACpE,gBAAc,YAAY;AAAA,IACtB,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,OAAO,eAAe,EAAE;AAAA,EACvD;AACA,MAAI,YAAY,QAAQ;AACpB,OAAG,aAAa,WAAW,YAAY,KAAK,GAAG,CAAC;AAAA,EACpD,OAAO;AACH,OAAG,gBAAgB,SAAS;AAAA,EAChC;AACJ;AAEO,gBAAS,yBACZ,IACA,WACA,IACU;AACV,QAAM,MAAM,MAAM,QAAQ,EAAE,IAAI,KAAK,CAAC,EAAE;AACxC,QAAM,kBAAkB,GAAG,aAAa,SAAS;AACjD,QAAM,cAAc,kBAAkB,gBAAgB,MAAM,KAAK,IAAI,CAAC;AACtE,QAAM,SAAS,IAAI,MAAM,CAACA,QAAO,YAAY,QAAQA,GAAE,IAAI,EAAE;AAC7D,MAAI;AACA,WAAO,MAAY;AACf;AAAA,IACJ;AACJ,cAAY,KAAK,GAAG,GAAG;AACvB,KAAG,aAAa,WAAW,YAAY,KAAK,GAAG,CAAC;AAChD,SAAO,MAAM,4BAA4B,IAAI,WAAW,GAAG;AAC/D;",
6
+ "names": ["id"]
7
7
  }
@@ -1,2 +1,2 @@
1
- export function conditionAttributeWithoutId(t,i,n){const e=t.getAttribute(i);let r=e?e.split(/\s+/):[];r=r.filter(s=>!n.find(o=>s===o)),r.length?t.setAttribute(i,r.join(" ")):t.removeAttribute(i)}export function conditionAttributeWithId(t,i,n){const e=Array.isArray(n)?n:[n],r=t.getAttribute(i),s=r?r.split(/\s+/):[];return e.every(d=>s.indexOf(d)>-1)?()=>{}:(s.push(...e),t.setAttribute(i,s.join(" ")),()=>conditionAttributeWithoutId(t,i,e))}
1
+ "use strict";export function conditionAttributeWithoutId(t,i,n){const e=t.getAttribute(i);let r=e?e.split(/\s+/):[];r=r.filter(s=>!n.find(o=>s===o)),r.length?t.setAttribute(i,r.join(" ")):t.removeAttribute(i)}export function conditionAttributeWithId(t,i,n){const e=Array.isArray(n)?n:[n],r=t.getAttribute(i),s=r?r.split(/\s+/):[];return e.every(d=>s.indexOf(d)>-1)?()=>{}:(s.push(...e),t.setAttribute(i,s.join(" ")),()=>conditionAttributeWithoutId(t,i,e))}
2
2
  //# sourceMappingURL=condition-attribute-with-id.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["condition-attribute-with-id.ts"],
4
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 function conditionAttributeWithoutId(\n el: HTMLElement,\n attribute: string,\n ids: string[]\n): void {\n const ariaDescribedby = el.getAttribute(attribute);\n let descriptors = ariaDescribedby ? ariaDescribedby.split(/\\s+/) : [];\n descriptors = descriptors.filter(\n (descriptor) => !ids.find((id) => descriptor === id)\n );\n if (descriptors.length) {\n el.setAttribute(attribute, descriptors.join(' '));\n } else {\n el.removeAttribute(attribute);\n }\n}\n\nexport function conditionAttributeWithId(\n el: HTMLElement,\n attribute: string,\n id: string | string[]\n): () => void {\n const ids = Array.isArray(id) ? id : [id];\n const ariaDescribedby = el.getAttribute(attribute);\n const descriptors = ariaDescribedby ? ariaDescribedby.split(/\\s+/) : [];\n const hadIds = ids.every((id) => descriptors.indexOf(id) > -1);\n if (hadIds)\n return (): void => {\n return;\n };\n descriptors.push(...ids);\n el.setAttribute(attribute, descriptors.join(' '));\n return () => conditionAttributeWithoutId(el, attribute, ids);\n}\n"],
5
- "mappings": "AAYO,4CACH,EACA,EACA,EACI,CACJ,KAAM,GAAkB,EAAG,aAAa,CAAS,EACjD,GAAI,GAAc,EAAkB,EAAgB,MAAM,KAAK,EAAI,CAAC,EACpE,EAAc,EAAY,OACtB,AAAC,GAAe,CAAC,EAAI,KAAK,AAAC,GAAO,IAAe,CAAE,CACvD,EACA,AAAI,EAAY,OACZ,EAAG,aAAa,EAAW,EAAY,KAAK,GAAG,CAAC,EAEhD,EAAG,gBAAgB,CAAS,CAEpC,CAEO,yCACH,EACA,EACA,EACU,CACV,KAAM,GAAM,MAAM,QAAQ,CAAE,EAAI,EAAK,CAAC,CAAE,EAClC,EAAkB,EAAG,aAAa,CAAS,EAC3C,EAAc,EAAkB,EAAgB,MAAM,KAAK,EAAI,CAAC,EAEtE,MADe,GAAI,MAAM,AAAC,GAAO,EAAY,QAAQ,CAAE,EAAI,EAAE,EAElD,IAAY,CAEnB,EACJ,GAAY,KAAK,GAAG,CAAG,EACvB,EAAG,aAAa,EAAW,EAAY,KAAK,GAAG,CAAC,EACzC,IAAM,4BAA4B,EAAI,EAAW,CAAG,EAC/D",
6
- "names": []
5
+ "mappings": "aAYO,gBAAS,4BACZA,EACAC,EACAC,EACI,CACJ,MAAMC,EAAkBH,EAAG,aAAaC,CAAS,EACjD,IAAIG,EAAcD,EAAkBA,EAAgB,MAAM,KAAK,EAAI,CAAC,EACpEC,EAAcA,EAAY,OACrBC,GAAe,CAACH,EAAI,KAAMI,GAAOD,IAAeC,CAAE,CACvD,EACIF,EAAY,OACZJ,EAAG,aAAaC,EAAWG,EAAY,KAAK,GAAG,CAAC,EAEhDJ,EAAG,gBAAgBC,CAAS,CAEpC,CAEO,gBAAS,yBACZD,EACAC,EACAK,EACU,CACV,MAAMJ,EAAM,MAAM,QAAQI,CAAE,EAAIA,EAAK,CAACA,CAAE,EAClCH,EAAkBH,EAAG,aAAaC,CAAS,EAC3CG,EAAcD,EAAkBA,EAAgB,MAAM,KAAK,EAAI,CAAC,EAEtE,OADeD,EAAI,MAAOI,GAAOF,EAAY,QAAQE,CAAE,EAAI,EAAE,EAElD,IAAY,CAEnB,GACJF,EAAY,KAAK,GAAGF,CAAG,EACvBF,EAAG,aAAaC,EAAWG,EAAY,KAAK,GAAG,CAAC,EACzC,IAAM,4BAA4BJ,EAAIC,EAAWC,CAAG,EAC/D",
6
+ "names": ["el", "attribute", "ids", "ariaDescribedby", "descriptors", "descriptor", "id"]
7
7
  }
@@ -1,2 +1,3 @@
1
+ "use strict";
1
2
  export * from "lit/decorators.js";
2
3
  //# sourceMappingURL=decorators.dev.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["decorators.ts"],
4
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 * from 'lit/decorators.js';\n"],
5
- "mappings": "AAYA;",
5
+ "mappings": ";AAYA,cAAc;",
6
6
  "names": []
7
7
  }
package/src/decorators.js CHANGED
@@ -1,2 +1,2 @@
1
- export*from"lit/decorators.js";
1
+ "use strict";export*from"lit/decorators.js";
2
2
  //# sourceMappingURL=decorators.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["decorators.ts"],
4
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 * from 'lit/decorators.js';\n"],
5
- "mappings": "AAYA",
5
+ "mappings": "aAYA,WAAc",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  export { ifDefined } from "lit/directives/if-defined.js";
2
3
  export { repeat } from "lit/directives/repeat.js";
3
4
  export { classMap } from "lit/directives/class-map.js";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["directives.ts"],
4
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;AACA;AACA;AACA;AAEA;AACA;AACA;",
5
+ "mappings": ";AAYA,0BAA0B;AAC1B,uBAAuB;AACvB,yBAAyB;AACzB,yBAAyB;AAEzB,sBAAsB;AACtB,qBAAqB;AACrB,qBAAqB;",
6
6
  "names": []
7
7
  }
package/src/directives.js CHANGED
@@ -1,2 +1,2 @@
1
- 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";
2
2
  //# sourceMappingURL=directives.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["directives.ts"],
4
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,oDACA,6CACA,kDACA,kDAEA,2CACA,yCACA",
5
+ "mappings": "aAYA,qBAA0B,+BAC1B,kBAAuB,2BACvB,oBAAyB,8BACzB,oBAAyB,8BAEzB,iBAAsB,0BACtB,gBAAqB,yBACrB,gBAAqB",
6
6
  "names": []
7
7
  }
package/src/html.dev.js CHANGED
@@ -1,2 +1,3 @@
1
+ "use strict";
1
2
  export { nothing, render } from "lit/html.js";
2
3
  //# sourceMappingURL=html.dev.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["html.ts"],
4
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 { nothing, render } from 'lit/html.js';\n"],
5
- "mappings": "AAYA;",
5
+ "mappings": ";AAYA,gCAAgC;",
6
6
  "names": []
7
7
  }
package/src/html.js CHANGED
@@ -1,2 +1,2 @@
1
- export{nothing,render}from"lit/html.js";
1
+ "use strict";export{nothing,render}from"lit/html.js";
2
2
  //# sourceMappingURL=html.js.map
package/src/html.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["html.ts"],
4
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 { nothing, render } from 'lit/html.js';\n"],
5
- "mappings": "AAYA",
5
+ "mappings": "aAYA,0BAAgC",
6
6
  "names": []
7
7
  }
package/src/index.dev.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  export * from "./Base.dev.js";
2
3
  export * from "./sizedMixin.dev.js";
3
4
  export * from "lit";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
4
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 * from './Base.dev.js'\nexport * from './sizedMixin.dev.js'\nexport * from 'lit';\n"],
5
- "mappings": "AAYA;AACA;AACA;",
5
+ "mappings": ";AAYA,cAAc;AACd,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export*from"./Base.js";export*from"./sizedMixin.js";export*from"lit";
1
+ "use strict";export*from"./Base.js";export*from"./sizedMixin.js";export*from"lit";
2
2
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
4
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 * from './Base.js';\nexport * from './sizedMixin.js';\nexport * from 'lit';\n"],
5
- "mappings": "AAYA,uBACA,6BACA",
5
+ "mappings": "aAYA,WAAc,YACd,WAAc,kBACd,WAAc",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __decorateClass = (decorators, target, key, kind) => {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["sizedMixin.ts"],
4
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, reflect: true })\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;AASO,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,2BACH,aACA;AAAA,EACI,aAAa,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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,QAAQ,SAAS,KAAK,CAAC;AAAA,KADvC,aAES;AAgCf,SAAO;AACX;",
6
6
  "names": []
7
7
  }
package/src/sizedMixin.js CHANGED
@@ -1,2 +1,2 @@
1
- var p=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var z=(n,s,r,i)=>{for(var e=i>1?void 0:i?a(s,r):s,l=n.length-1,t;l>=0;l--)(t=n[l])&&(e=(i?t(s,r,e):t(e))||e);return i&&e&&p(s,r,e),e};import{property as u}from"lit/decorators.js";export const ElementSizes={xxs:"xxs",xs:"xs",s:"s",m:"m",l:"l",xl:"xl",xxl:"xxl"};export function SizedMixin(n,{validSizes:s=["s","m","l","xl"],noDefaultSize:r,defaultSize:i="m"}={}){class e extends n{constructor(){super(...arguments);this._size=i}get size(){return this._size||i}set size(t){const m=r?null:i,x=t&&t.toLocaleLowerCase(),o=s.includes(x)?x:m;if(o&&this.setAttribute("size",o),this._size===o)return;const c=this._size;this._size=o,this.requestUpdate("size",c)}update(t){!this.hasAttribute("size")&&!r&&this.setAttribute("size",this.size),super.update(t)}}return z([u({type:String,reflect:!0})],e.prototype,"size",1),e}
1
+ "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=(n,i,s,t)=>{for(var e=t>1?void 0:t?u(i,s):i,l=n.length-1,o;l>=0;l--)(o=n[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(n,{validSizes:i=["s","m","l","xl"],noDefaultSize:s,defaultSize:t="m"}={}){class e extends n{constructor(){super(...arguments);this._size=t}get size(){return this._size||t}set size(r){const c=s?null:t,z=r&&r.toLocaleLowerCase(),x=i.includes(z)?z:c;if(x&&this.setAttribute("size",x),this._size===x)return;const p=this._size;this._size=x,this.requestUpdate("size",p)}update(r){!this.hasAttribute("size")&&!s&&this.setAttribute("size",this.size),super.update(r)}}return m([S({type:String,reflect:!0})],e.prototype,"size",1),e}
2
2
  //# sourceMappingURL=sizedMixin.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["sizedMixin.ts"],
4
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, reflect: true })\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": "wMAYA,6CASO,YAAM,cAA4C,CACrD,IAAK,MACL,GAAI,KACJ,EAAG,IACH,EAAG,IACH,EAAG,IACH,GAAI,KACJ,IAAK,KACT,EAOO,2BACH,EACA,CACI,aAAa,CAAC,IAAK,IAAK,IAAK,IAAI,EACjC,gBACA,cAAc,KAKd,CAAC,EACiC,CACtC,MAAM,SAAqB,EAAY,CAAvC,kCAyBY,WAA4B,KAvBzB,OAAoB,CAC3B,MAAO,MAAK,OAAS,CACzB,IAE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AK,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,OAAQ,QAAS,EAAK,CAAC,GADvCK,EAES,oBAgCRA,CACX",
6
+ "names": ["property", "constructor", "validSizes", "noDefaultSize", "defaultSize", "SizedElement", "value", "fallbackSize", "size", "validSize", "oldSize", "changes", "__decorateClass"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import { nothing } from "lit";
2
3
  import { AsyncDirective, directive } from "lit/async-directive.js";
3
4
  const defaultListener = [
@@ -105,5 +106,7 @@ class StreamingListenerDirective extends AsyncDirective {
105
106
  this.addListeners();
106
107
  }
107
108
  }
108
- export const streamingListener = directive(StreamingListenerDirective);
109
+ export const streamingListener = directive(
110
+ StreamingListenerDirective
111
+ );
109
112
  //# sourceMappingURL=streaming-listener.dev.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["streaming-listener.ts"],
4
4
  "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/*\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 { ElementPart, nothing, Part } from 'lit';\nimport { AsyncDirective, directive } from 'lit/async-directive.js';\nimport type { DirectiveResult } from 'lit/directive.js';\n\ntype ListenerConfig = [string | string[], (event?: any) => void];\ntype ListenerConfigGroup = {\n start: ListenerConfig;\n end: ListenerConfig;\n streamInside?: ListenerConfig;\n streamOutside?: ListenerConfig;\n};\n\n/* c8 ignore next 6 */\nconst defaultListener: ListenerConfig = [\n '',\n (): void => {\n return;\n },\n];\n\n/**\n * Performantly manage listening to event in a series, like:\n * - `input[type=\"range\"]`: input, input, etc. => change\n * - `sp-color-area`: pointerdown => pointermove, pointermove, etc. => pointerup\n * Lazily bind events to the specific part of the series while\n * throttling streamed events to 1/frame.\n */\nclass StreamingListenerDirective extends AsyncDirective {\n host!: EventTarget | Record<string, unknown> | Element;\n element!: Element;\n\n start: ListenerConfig = defaultListener;\n streamInside: ListenerConfig = defaultListener;\n end: ListenerConfig = defaultListener;\n streamOutside: ListenerConfig = defaultListener;\n\n state: 'off' | 'on' = 'off';\n\n /* c8 ignore next 4 */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n render(_configGroup: ListenerConfigGroup): typeof nothing {\n return nothing;\n }\n\n override update(\n part: Part,\n [\n {\n start,\n end,\n streamInside = defaultListener,\n streamOutside = defaultListener,\n },\n ]: Parameters<this['render']>\n ): void {\n if (this.element !== (part as ElementPart).element) {\n this.element = (part as ElementPart).element;\n this.removeListeners();\n }\n this.host =\n (part.options?.host as Record<string, unknown>) || this.element;\n this.start = start;\n this.end = end;\n this.streamInside = streamInside;\n this.streamOutside = streamOutside;\n this.addListeners();\n }\n\n addListeners(state?: 'on' | 'off'): void {\n this.state = state || this.state;\n if (this.state === 'off') {\n this.addListener(this.streamOutside[0], this.handleBetween);\n this.addListener(this.start[0], this.handleStart);\n } else if (this.state === 'on') {\n this.addListener(this.streamInside[0], this.handleStream);\n this.addListener(this.end[0], this.handleEnd);\n }\n }\n\n callHandler(\n value: (event: Event) => void | EventListenerObject,\n event: Event\n ): void {\n if (typeof value === 'function') {\n (value as (event: Event) => void).call(this.host, event);\n } else {\n (value as EventListenerObject).handleEvent(event);\n }\n }\n\n handleStart = (event: Event): void => {\n this.callHandler(this.start[1], event);\n if (event.defaultPrevented) {\n return;\n }\n this.removeListeners();\n this.addListeners('on');\n };\n\n handleStream = (event: Event): void => {\n this.callHandler(this.streamInside[1], event);\n };\n\n handleEnd = (event: Event): void => {\n this.callHandler(this.end[1], event);\n this.removeListeners();\n this.addListeners('off');\n };\n\n handleBetween = (event: Event): void => {\n this.callHandler(this.streamOutside[1], event);\n };\n\n addListener(type: string | string[], fn: (event: Event) => void): void {\n if (Array.isArray(type)) {\n type.map((eventName) => {\n this.element.addEventListener(eventName, fn);\n });\n } else {\n this.element.addEventListener(type, fn);\n }\n }\n\n removeListener(type: string | string[], fn: (event: Event) => void): void {\n if (Array.isArray(type)) {\n type.map((eventName) => {\n this.element.removeEventListener(eventName, fn);\n });\n } else {\n this.element.removeEventListener(type, fn);\n }\n }\n\n removeListeners(): void {\n this.removeListener(this.start[0], this.handleStart);\n this.removeListener(this.streamInside[0], this.handleStream);\n this.removeListener(this.end[0], this.handleEnd);\n this.removeListener(this.streamOutside[0], this.handleBetween);\n }\n\n override disconnected(): void {\n this.removeListeners();\n }\n\n override reconnected(): void {\n this.addListeners();\n }\n}\n\nexport const streamingListener: (\n _configGroup: ListenerConfigGroup\n) => DirectiveResult<typeof StreamingListenerDirective> = directive(\n StreamingListenerDirective\n);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type { StreamingListenerDirective };\n"],
5
- "mappings": "AAYA;AACA;AAYA,MAAM,kBAAkC;AAAA,EACpC;AAAA,EACA,MAAY;AACR;AAAA,EACJ;AACJ;AASA,MAAM,mCAAmC,eAAe;AAAA,EAAxD;AAAA;AAII,iBAAwB;AACxB,wBAA+B;AAC/B,eAAsB;AACtB,yBAAgC;AAEhC,iBAAsB;AAsDtB,uBAAc,CAAC,UAAuB;AAClC,WAAK,YAAY,KAAK,MAAM,IAAI,KAAK;AACrC,UAAI,MAAM,kBAAkB;AACxB;AAAA,MACJ;AACA,WAAK,gBAAgB;AACrB,WAAK,aAAa,IAAI;AAAA,IAC1B;AAEA,wBAAe,CAAC,UAAuB;AACnC,WAAK,YAAY,KAAK,aAAa,IAAI,KAAK;AAAA,IAChD;AAEA,qBA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MAAM,QAAQ,IAAI,GAAG;AACrB,WAAK,IAAI,CAAC,cAAc;AACpB,aAAK,QAAQ,iBAAiB,WAAW,EAAE;AAAA,MAC/C,CAAC;AAAA,IACL,OAAO;AACH,WAAK,QAAQ,iBAAiB,MAAM,EAAE;AAAA,IAC1C;AAAA,EACJ;AAAA,EAEA,eAAe,MAAyB,IAAkC;AACtE,QAAI,MAAM,QAAQ,IAAI,GAAG;AACrB,WAAK,IAAI,CAAC,cAAc;AACpB,aAAK,QAAQ,oBAAoB,WAAW,EAAE;AAAA,MAClD,CAAC;AAAA,IACL,OAAO;AACH,WAAK,QAAQ,oBAAoB,MAAM,EAAE;AAAA,IAC7C;AAAA,EACJ;AAAA,EAEA,kBAAwB;AACpB,SAAK,eAAe,KAAK,MAAM,IAAI,KAAK,WAAW;AACnD,SAAK,eAAe,KAAK,aAAa,IAAI,KAAK,YAAY;AAC3D,SAAK,eAAe,KAAK,IAAI,IAAI,KAAK,SAAS;AAC/C,SAAK,eAAe,KAAK,cAAc,IAAI,KAAK,aAAa;AAAA,EACjE;AAAA,EAES,eAAqB;AAC1B,SAAK,gBAAgB;AAAA,EACzB;AAAA,EAES,cAAoB;AACzB,SAAK,aAAa;AAAA,EACtB;AACJ;AAEO,aAAM,oBAE6C;AAAA,EACtD;AACJ;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- import{nothing as o}from"lit";import{AsyncDirective as a,directive as h}from"lit/async-directive.js";const i=["",()=>{}];class v extends a{constructor(){super(...arguments);this.start=i;this.streamInside=i;this.end=i;this.streamOutside=i;this.state="off";this.handleStart=e=>{this.callHandler(this.start[1],e),!e.defaultPrevented&&(this.removeListeners(),this.addListeners("on"))};this.handleStream=e=>{this.callHandler(this.streamInside[1],e)};this.handleEnd=e=>{this.callHandler(this.end[1],e),this.removeListeners(),this.addListeners("off")};this.handleBetween=e=>{this.callHandler(this.streamOutside[1],e)}}render(e){return o}update(e,[{start:t,end:s,streamInside:r=i,streamOutside:d=i}]){var n;this.element!==e.element&&(this.element=e.element,this.removeListeners()),this.host=((n=e.options)==null?void 0:n.host)||this.element,this.start=t,this.end=s,this.streamInside=r,this.streamOutside=d,this.addListeners()}addListeners(e){this.state=e||this.state,this.state==="off"?(this.addListener(this.streamOutside[0],this.handleBetween),this.addListener(this.start[0],this.handleStart)):this.state==="on"&&(this.addListener(this.streamInside[0],this.handleStream),this.addListener(this.end[0],this.handleEnd))}callHandler(e,t){typeof e=="function"?e.call(this.host,t):e.handleEvent(t)}addListener(e,t){Array.isArray(e)?e.map(s=>{this.element.addEventListener(s,t)}):this.element.addEventListener(e,t)}removeListener(e,t){Array.isArray(e)?e.map(s=>{this.element.removeEventListener(s,t)}):this.element.removeEventListener(e,t)}removeListeners(){this.removeListener(this.start[0],this.handleStart),this.removeListener(this.streamInside[0],this.handleStream),this.removeListener(this.end[0],this.handleEnd),this.removeListener(this.streamOutside[0],this.handleBetween)}disconnected(){this.removeListeners()}reconnected(){this.addListeners()}}export const streamingListener=h(v);
1
+ "use strict";import{nothing as o}from"lit";import{AsyncDirective as a,directive as h}from"lit/async-directive.js";const i=["",()=>{}];class v extends a{constructor(){super(...arguments);this.start=i;this.streamInside=i;this.end=i;this.streamOutside=i;this.state="off";this.handleStart=e=>{this.callHandler(this.start[1],e),!e.defaultPrevented&&(this.removeListeners(),this.addListeners("on"))};this.handleStream=e=>{this.callHandler(this.streamInside[1],e)};this.handleEnd=e=>{this.callHandler(this.end[1],e),this.removeListeners(),this.addListeners("off")};this.handleBetween=e=>{this.callHandler(this.streamOutside[1],e)}}render(e){return o}update(e,[{start:t,end:s,streamInside:r=i,streamOutside:d=i}]){var n;this.element!==e.element&&(this.element=e.element,this.removeListeners()),this.host=((n=e.options)==null?void 0:n.host)||this.element,this.start=t,this.end=s,this.streamInside=r,this.streamOutside=d,this.addListeners()}addListeners(e){this.state=e||this.state,this.state==="off"?(this.addListener(this.streamOutside[0],this.handleBetween),this.addListener(this.start[0],this.handleStart)):this.state==="on"&&(this.addListener(this.streamInside[0],this.handleStream),this.addListener(this.end[0],this.handleEnd))}callHandler(e,t){typeof e=="function"?e.call(this.host,t):e.handleEvent(t)}addListener(e,t){Array.isArray(e)?e.map(s=>{this.element.addEventListener(s,t)}):this.element.addEventListener(e,t)}removeListener(e,t){Array.isArray(e)?e.map(s=>{this.element.removeEventListener(s,t)}):this.element.removeEventListener(e,t)}removeListeners(){this.removeListener(this.start[0],this.handleStart),this.removeListener(this.streamInside[0],this.handleStream),this.removeListener(this.end[0],this.handleEnd),this.removeListener(this.streamOutside[0],this.handleBetween)}disconnected(){this.removeListeners()}reconnected(){this.addListeners()}}export const streamingListener=h(v);
2
2
  //# sourceMappingURL=streaming-listener.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["streaming-listener.ts"],
4
4
  "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/*\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 { ElementPart, nothing, Part } from 'lit';\nimport { AsyncDirective, directive } from 'lit/async-directive.js';\nimport type { DirectiveResult } from 'lit/directive.js';\n\ntype ListenerConfig = [string | string[], (event?: any) => void];\ntype ListenerConfigGroup = {\n start: ListenerConfig;\n end: ListenerConfig;\n streamInside?: ListenerConfig;\n streamOutside?: ListenerConfig;\n};\n\n/* c8 ignore next 6 */\nconst defaultListener: ListenerConfig = [\n '',\n (): void => {\n return;\n },\n];\n\n/**\n * Performantly manage listening to event in a series, like:\n * - `input[type=\"range\"]`: input, input, etc. => change\n * - `sp-color-area`: pointerdown => pointermove, pointermove, etc. => pointerup\n * Lazily bind events to the specific part of the series while\n * throttling streamed events to 1/frame.\n */\nclass StreamingListenerDirective extends AsyncDirective {\n host!: EventTarget | Record<string, unknown> | Element;\n element!: Element;\n\n start: ListenerConfig = defaultListener;\n streamInside: ListenerConfig = defaultListener;\n end: ListenerConfig = defaultListener;\n streamOutside: ListenerConfig = defaultListener;\n\n state: 'off' | 'on' = 'off';\n\n /* c8 ignore next 4 */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n render(_configGroup: ListenerConfigGroup): typeof nothing {\n return nothing;\n }\n\n override update(\n part: Part,\n [\n {\n start,\n end,\n streamInside = defaultListener,\n streamOutside = defaultListener,\n },\n ]: Parameters<this['render']>\n ): void {\n if (this.element !== (part as ElementPart).element) {\n this.element = (part as ElementPart).element;\n this.removeListeners();\n }\n this.host =\n (part.options?.host as Record<string, unknown>) || this.element;\n this.start = start;\n this.end = end;\n this.streamInside = streamInside;\n this.streamOutside = streamOutside;\n this.addListeners();\n }\n\n addListeners(state?: 'on' | 'off'): void {\n this.state = state || this.state;\n if (this.state === 'off') {\n this.addListener(this.streamOutside[0], this.handleBetween);\n this.addListener(this.start[0], this.handleStart);\n } else if (this.state === 'on') {\n this.addListener(this.streamInside[0], this.handleStream);\n this.addListener(this.end[0], this.handleEnd);\n }\n }\n\n callHandler(\n value: (event: Event) => void | EventListenerObject,\n event: Event\n ): void {\n if (typeof value === 'function') {\n (value as (event: Event) => void).call(this.host, event);\n } else {\n (value as EventListenerObject).handleEvent(event);\n }\n }\n\n handleStart = (event: Event): void => {\n this.callHandler(this.start[1], event);\n if (event.defaultPrevented) {\n return;\n }\n this.removeListeners();\n this.addListeners('on');\n };\n\n handleStream = (event: Event): void => {\n this.callHandler(this.streamInside[1], event);\n };\n\n handleEnd = (event: Event): void => {\n this.callHandler(this.end[1], event);\n this.removeListeners();\n this.addListeners('off');\n };\n\n handleBetween = (event: Event): void => {\n this.callHandler(this.streamOutside[1], event);\n };\n\n addListener(type: string | string[], fn: (event: Event) => void): void {\n if (Array.isArray(type)) {\n type.map((eventName) => {\n this.element.addEventListener(eventName, fn);\n });\n } else {\n this.element.addEventListener(type, fn);\n }\n }\n\n removeListener(type: string | string[], fn: (event: Event) => void): void {\n if (Array.isArray(type)) {\n type.map((eventName) => {\n this.element.removeEventListener(eventName, fn);\n });\n } else {\n this.element.removeEventListener(type, fn);\n }\n }\n\n removeListeners(): void {\n this.removeListener(this.start[0], this.handleStart);\n this.removeListener(this.streamInside[0], this.handleStream);\n this.removeListener(this.end[0], this.handleEnd);\n this.removeListener(this.streamOutside[0], this.handleBetween);\n }\n\n override disconnected(): void {\n this.removeListeners();\n }\n\n override reconnected(): void {\n this.addListeners();\n }\n}\n\nexport const streamingListener: (\n _configGroup: ListenerConfigGroup\n) => DirectiveResult<typeof StreamingListenerDirective> = directive(\n StreamingListenerDirective\n);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type { StreamingListenerDirective };\n"],
5
- "mappings": "AAYA,8BACA,uEAYA,KAAM,GAAkC,CACpC,GACA,IAAY,CAEZ,CACJ,EASA,MAAM,SAAmC,EAAe,CAAxD,kCAII,WAAwB,EACxB,kBAA+B,EAC/B,SAAsB,EACtB,mBAAgC,EAEhC,WAAsB,MAsDtB,iBAAc,AAAC,GAAuB,CAElC,AADA,KAAK,YAAY,KAAK,MAAM,GAAI,CAAK,EACjC,GAAM,kBAGV,MAAK,gBAAgB,EACrB,KAAK,aAAa,IAAI,EAC1B,EAEA,kBAAe,AAAC,GAAuB,CACnC,KAAK,YAAY,KAAK,aAAa,GAAI,CAAK,CAChD,EAEA,eAAY,AAAC,GAAuB,CAChC,KAAK,YAAY,KAAK,IAAI,GAAI,CAAK,EACnC,KAAK,gBAAgB,EACrB,KAAK,aAAa,KAAK,CAC3B,EAEA,mBAAgB,AAAC,GAAuB,CACpC,KAAK,YAAY,KAAK,cAAc,GAAI,CAAK,CACjD,EAvEA,OAAO,EAAmD,CACtD,MAAO,EACX,CAES,OACL,EACA,CACI,CACI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AAK,MAAQA,GAAS,KAAK,MACvB,KAAK,QAAU,OACf,KAAK,YAAY,KAAK,cAAc,GAAI,KAAK,aAAa,EAC1D,KAAK,YAAY,KAAK,MAAM,GAAI,KAAK,WAAW,GACzC,KAAK,QAAU,OACtB,KAAK,YAAY,KAAK,aAAa,GAAI,KAAK,YAAY,EACxD,KAAK,YAAY,KAAK,IAAI,GAAI,KAAK,SAAS,EAEpD,CAEA,YACIC,EACAT,EACI,CACA,OAAOS,GAAU,WAChBA,EAAiC,KAAK,KAAK,KAAMT,CAAK,EAEtDS,EAA8B,YAAYT,CAAK,CAExD,CAyBA,YAAYU,EAAyBC,EAAkC,CAC/D,MAAM,QAAQD,CAAI,EAClBA,EAAK,IAAKE,GAAc,CACpB,KAAK,QAAQ,iBAAiBA,EAAWD,CAAE,CAC/C,CAAC,EAED,KAAK,QAAQ,iBAAiBD,EAAMC,CAAE,CAE9C,CAEA,eAAeD,EAAyBC,EAAkC,CAClE,MAAM,QAAQD,CAAI,EAClBA,EAAK,IAAKE,GAAc,CACpB,KAAK,QAAQ,oBAAoBA,EAAWD,CAAE,CAClD,CAAC,EAED,KAAK,QAAQ,oBAAoBD,EAAMC,CAAE,CAEjD,CAEA,iBAAwB,CACpB,KAAK,eAAe,KAAK,MAAM,GAAI,KAAK,WAAW,EACnD,KAAK,eAAe,KAAK,aAAa,GAAI,KAAK,YAAY,EAC3D,KAAK,eAAe,KAAK,IAAI,GAAI,KAAK,SAAS,EAC/C,KAAK,eAAe,KAAK,cAAc,GAAI,KAAK,aAAa,CACjE,CAES,cAAqB,CAC1B,KAAK,gBAAgB,CACzB,CAES,aAAoB,CACzB,KAAK,aAAa,CACtB,CACJ,CAEO,aAAM,kBAE6Cd,EACtDE,CACJ",
6
+ "names": ["nothing", "AsyncDirective", "directive", "defaultListener", "StreamingListenerDirective", "event", "_configGroup", "part", "start", "end", "streamInside", "streamOutside", "_a", "state", "value", "type", "fn", "eventName"]
7
7
  }
@@ -1,2 +1,25 @@
1
- import{expect as e}from"@open-wc/testing";import{stub as n}from"sinon";describe("Base",()=>{it("warns in Dev Mode when no attributes",async()=>{const t=n(console,"warn"),{SpectrumElement:o}=await import("@spectrum-web-components/base");e(o).to.not.be.undefined,e(t.called).to.be.true;const a=t.getCall(0);e(a.args.at(0).includes("dev mode"),'confirm "dev mode"-centric message').to.be.true,e(a.args.at(-1),"confirm `data` shape").to.deep.equal({data:{localName:"base",type:"default",level:"default"}}),t.restore()})});
1
+ "use strict";
2
+ import { expect } from "@open-wc/testing";
3
+ import { stub } from "sinon";
4
+ describe("Base", () => {
5
+ it("warns in Dev Mode when no attributes", async () => {
6
+ const consoleWarnStub = stub(console, "warn");
7
+ const { SpectrumElement } = await import("@spectrum-web-components/base");
8
+ expect(SpectrumElement).to.not.be.undefined;
9
+ expect(consoleWarnStub.called).to.be.true;
10
+ const spyCall = consoleWarnStub.getCall(0);
11
+ expect(
12
+ spyCall.args.at(0).includes("dev mode"),
13
+ 'confirm "dev mode"-centric message'
14
+ ).to.be.true;
15
+ expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
16
+ data: {
17
+ localName: "base",
18
+ type: "default",
19
+ level: "default"
20
+ }
21
+ });
22
+ consoleWarnStub.restore();
23
+ });
24
+ });
2
25
  //# sourceMappingURL=base-devmode.test.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["base-devmode.test.ts"],
4
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('Base', () => {\n it('warns in Dev Mode when no attributes', async () => {\n const consoleWarnStub = stub(console, 'warn');\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).includes('dev mode'),\n 'confirm \"dev mode\"-centric message'\n ).to.be.true;\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 consoleWarnStub.restore();\n });\n});\n"],
5
- "mappings": "AAUA,0CACA,6BAEA,SAAS,OAAQ,IAAM,CACnB,GAAG,uCAAwC,SAAY,CACnD,KAAM,GAAkB,EAAK,QAAS,MAAM,EACtC,CAAE,mBAAoB,KAAM,QAC9B,iCAEJ,EAAO,CAAe,EAAE,GAAG,IAAI,GAAG,UAElC,EAAO,EAAgB,MAAM,EAAE,GAAG,GAAG,KACrC,KAAM,GAAU,EAAgB,QAAQ,CAAC,EACzC,EACI,EAAQ,KAAK,GAAG,CAAC,EAAE,SAAS,UAAU,EACtC,oCACJ,EAAE,GAAG,GAAG,KACR,EAAO,EAAQ,KAAK,GAAG,EAAE,EAAG,sBAAsB,EAAE,GAAG,KAAK,MAAM,CAC9D,KAAM,CACF,UAAW,OACX,KAAM,UACN,MAAO,SACX,CACJ,CAAC,EACD,EAAgB,QAAQ,CAC5B,CAAC,CACL,CAAC",
5
+ "mappings": ";AAUA,SAAS,cAAc;AACvB,SAAS,YAAY;AAErB,SAAS,QAAQ,MAAM;AACnB,KAAG,wCAAwC,YAAY;AACnD,UAAM,kBAAkB,KAAK,SAAS,MAAM;AAC5C,UAAM,EAAE,gBAAgB,IAAI,MAAM,OAC9B;AAEJ,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,EAAE,SAAS,UAAU;AAAA,MACtC;AAAA,IACJ,EAAE,GAAG,GAAG;AACR,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;AACD,oBAAgB,QAAQ;AAAA,EAC5B,CAAC;AACL,CAAC;",
6
6
  "names": []
7
7
  }
package/test/base.test.js CHANGED
@@ -1,4 +1,23 @@
1
- import{SpectrumElement as r}from"@spectrum-web-components/base";import{elementUpdated as m,expect as t,fixture as i,html as d}from"@open-wc/testing";class l extends r{}customElements.define("dir-element",l),describe("Base",()=>{after(()=>{document.dir=""}),it("sets `dir` from `document`",async()=>{document.dir="rtl";const e=await i(d`
1
+ "use strict";
2
+ import { SpectrumElement } from "@spectrum-web-components/base";
3
+ import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
4
+ class DirElement extends SpectrumElement {
5
+ }
6
+ customElements.define("dir-element", DirElement);
7
+ describe("Base", () => {
8
+ after(() => {
9
+ document.dir = "";
10
+ });
11
+ it("sets `dir` from `document`", async () => {
12
+ document.dir = "rtl";
13
+ const el = await fixture(
14
+ html`
2
15
  <dir-element></dir-element>
3
- `);await m(e),t(e.dir).to.equal("rtl"),t(e.isLTR).to.be.false})});
16
+ `
17
+ );
18
+ await elementUpdated(el);
19
+ expect(el.dir).to.equal("rtl");
20
+ expect(el.isLTR).to.be.false;
21
+ });
22
+ });
4
23
  //# sourceMappingURL=base.test.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["base.test.ts"],
4
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 { SpectrumElement } from '@spectrum-web-components/base';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nclass DirElement extends SpectrumElement {}\n\ncustomElements.define('dir-element', DirElement);\n\ndescribe('Base', () => {\n after(() => {\n document.dir = '';\n });\n it('sets `dir` from `document`', async () => {\n document.dir = 'rtl';\n const el = await fixture<DirElement>(\n html`\n <dir-element></dir-element>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.dir).to.equal('rtl');\n expect(el.isLTR).to.be.false;\n });\n});\n"],
5
- "mappings": "AAUA,gEACA,qFAEA,MAAM,SAAmB,EAAgB,CAAC,CAE1C,eAAe,OAAO,cAAe,CAAU,EAE/C,SAAS,OAAQ,IAAM,CACnB,MAAM,IAAM,CACR,SAAS,IAAM,EACnB,CAAC,EACD,GAAG,6BAA8B,SAAY,CACzC,SAAS,IAAM,MACf,KAAM,GAAK,KAAM,GACb;AAAA;AAAA,aAGJ,EAEA,KAAM,GAAe,CAAE,EAEvB,EAAO,EAAG,GAAG,EAAE,GAAG,MAAM,KAAK,EAC7B,EAAO,EAAG,KAAK,EAAE,GAAG,GAAG,KAC3B,CAAC,CACL,CAAC",
5
+ "mappings": ";AAUA,SAAS,uBAAuB;AAChC,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAEtD,MAAM,mBAAmB,gBAAgB;AAAC;AAE1C,eAAe,OAAO,eAAe,UAAU;AAE/C,SAAS,QAAQ,MAAM;AACnB,QAAM,MAAM;AACR,aAAS,MAAM;AAAA,EACnB,CAAC;AACD,KAAG,8BAA8B,YAAY;AACzC,aAAS,MAAM;AACf,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,GAAG,EAAE,GAAG,MAAM,KAAK;AAC7B,WAAO,GAAG,KAAK,EAAE,GAAG,GAAG;AAAA,EAC3B,CAAC;AACL,CAAC;",
6
6
  "names": []
7
7
  }