@spectrum-web-components/underlay 0.40.5 → 0.41.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,6 +26,15 @@
26
26
  "description": "",
27
27
  "name": "Underlay",
28
28
  "members": [
29
+ {
30
+ "kind": "field",
31
+ "name": "canClick",
32
+ "type": {
33
+ "text": "boolean"
34
+ },
35
+ "privacy": "private",
36
+ "default": "false"
37
+ },
29
38
  {
30
39
  "kind": "field",
31
40
  "name": "open",
@@ -36,6 +45,45 @@
36
45
  "default": "false",
37
46
  "attribute": "open",
38
47
  "reflects": true
48
+ },
49
+ {
50
+ "kind": "method",
51
+ "name": "click",
52
+ "privacy": "public",
53
+ "return": {
54
+ "type": {
55
+ "text": "void"
56
+ }
57
+ }
58
+ },
59
+ {
60
+ "kind": "method",
61
+ "name": "handlePointerdown",
62
+ "privacy": "protected",
63
+ "return": {
64
+ "type": {
65
+ "text": "void"
66
+ }
67
+ }
68
+ },
69
+ {
70
+ "kind": "method",
71
+ "name": "handlePointerup",
72
+ "privacy": "protected",
73
+ "return": {
74
+ "type": {
75
+ "text": "void"
76
+ }
77
+ }
78
+ }
79
+ ],
80
+ "events": [
81
+ {
82
+ "name": "close",
83
+ "type": {
84
+ "text": "Event"
85
+ },
86
+ "description": "When the underlay is \"clicked\" and the consuming pattern should chose whether to close based on that interaction"
39
87
  }
40
88
  ],
41
89
  "attributes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/underlay",
3
- "version": "0.40.5",
3
+ "version": "0.41.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -57,7 +57,7 @@
57
57
  "lit-html"
58
58
  ],
59
59
  "dependencies": {
60
- "@spectrum-web-components/base": "^0.40.5"
60
+ "@spectrum-web-components/base": "^0.41.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@spectrum-css/underlay": "^3.2.0"
@@ -68,5 +68,5 @@
68
68
  "./sp-*.js",
69
69
  "./**/*.dev.js"
70
70
  ],
71
- "gitHead": "2e0006478841b07af63c19a0167a136bf724d064"
71
+ "gitHead": "0bf38fd427adc39804b228a4c61de623e5ebb82e"
72
72
  }
package/src/Underlay.d.ts CHANGED
@@ -1,9 +1,16 @@
1
1
  import { CSSResultArray, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
2
  /**
3
3
  * @element sp-underlay
4
+ *
5
+ * @fires close - When the underlay is "clicked" and the consuming pattern should chose whether to close based on that interaction
4
6
  */
5
7
  export declare class Underlay extends SpectrumElement {
6
8
  static get styles(): CSSResultArray;
9
+ private canClick;
7
10
  open: boolean;
11
+ click(): void;
12
+ protected handlePointerdown(): void;
13
+ protected handlePointerup(): void;
8
14
  protected render(): TemplateResult;
15
+ protected firstUpdated(): void;
9
16
  }
@@ -19,14 +19,31 @@ import styles from "./underlay.css.js";
19
19
  export class Underlay extends SpectrumElement {
20
20
  constructor() {
21
21
  super(...arguments);
22
+ this.canClick = false;
22
23
  this.open = false;
23
24
  }
24
25
  static get styles() {
25
26
  return [styles];
26
27
  }
28
+ click() {
29
+ this.dispatchEvent(new Event("close"));
30
+ }
31
+ handlePointerdown() {
32
+ this.canClick = true;
33
+ }
34
+ handlePointerup() {
35
+ if (this.canClick) {
36
+ this.click();
37
+ }
38
+ this.canClick = false;
39
+ }
27
40
  render() {
28
41
  return html``;
29
42
  }
43
+ firstUpdated() {
44
+ this.addEventListener("pointerdown", this.handlePointerdown);
45
+ this.addEventListener("pointerup", this.handlePointerup);
46
+ }
30
47
  }
31
48
  __decorateClass([
32
49
  property({ type: Boolean, reflect: true })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Underlay.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 {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './underlay.css.js';\n\n/**\n * @element sp-underlay\n */\nexport class Underlay extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n protected override render(): TemplateResult {\n return html``;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO,YAAY;AAKZ,aAAM,iBAAiB,gBAAgB;AAAA,EAAvC;AAAA;AAMH,SAAO,OAAO;AAAA;AAAA,EALd,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAKmB,SAAyB;AACxC,WAAO;AAAA,EACX;AACJ;AALW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GALjC,SAMF;",
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 {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './underlay.css.js';\n\n/**\n * @element sp-underlay\n *\n * @fires close - When the underlay is \"clicked\" and the consuming pattern should chose whether to close based on that interaction\n */\nexport class Underlay extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n private canClick = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n public override click(): void {\n this.dispatchEvent(new Event('close'));\n }\n\n protected handlePointerdown(): void {\n this.canClick = true;\n }\n\n protected handlePointerup(): void {\n if (this.canClick) {\n this.click();\n }\n this.canClick = false;\n }\n\n protected override render(): TemplateResult {\n return html``;\n }\n\n protected override firstUpdated(): void {\n this.addEventListener('pointerdown', this.handlePointerdown);\n this.addEventListener('pointerup', this.handlePointerup);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO,YAAY;AAOZ,aAAM,iBAAiB,gBAAgB;AAAA,EAAvC;AAAA;AAKH,SAAQ,WAAW;AAGnB,SAAO,OAAO;AAAA;AAAA,EAPd,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAOgB,QAAc;AAC1B,SAAK,cAAc,IAAI,MAAM,OAAO,CAAC;AAAA,EACzC;AAAA,EAEU,oBAA0B;AAChC,SAAK,WAAW;AAAA,EACpB;AAAA,EAEU,kBAAwB;AAC9B,QAAI,KAAK,UAAU;AACf,WAAK,MAAM;AAAA,IACf;AACA,SAAK,WAAW;AAAA,EACpB;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA,EACX;AAAA,EAEmB,eAAqB;AACpC,SAAK,iBAAiB,eAAe,KAAK,iBAAiB;AAC3D,SAAK,iBAAiB,aAAa,KAAK,eAAe;AAAA,EAC3D;AACJ;AAzBW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAPjC,SAQF;",
6
6
  "names": []
7
7
  }
package/src/Underlay.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var m=(l,r,o,t)=>{for(var e=t>1?void 0:t?a(r,o):r,p=l.length-1,s;p>=0;p--)(s=l[p])&&(e=(t?s(r,o,e):s(e))||e);return t&&e&&u(r,o,e),e};import{html as i,SpectrumElement as c}from"@spectrum-web-components/base";import{property as n}from"@spectrum-web-components/base/src/decorators.js";import y from"./underlay.css.js";export class Underlay extends c{constructor(){super(...arguments);this.open=!1}static get styles(){return[y]}render(){return i``}}m([n({type:Boolean,reflect:!0})],Underlay.prototype,"open",2);
1
+ "use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=(i,t,o,r)=>{for(var e=r>1?void 0:r?p(t,o):t,n=i.length-1,l;n>=0;n--)(l=i[n])&&(e=(r?l(t,o,e):l(e))||e);return r&&e&&d(t,o,e),e};import{html as c,SpectrumElement as a}from"@spectrum-web-components/base";import{property as h}from"@spectrum-web-components/base/src/decorators.js";import u from"./underlay.css.js";export class Underlay extends a{constructor(){super(...arguments);this.canClick=!1;this.open=!1}static get styles(){return[u]}click(){this.dispatchEvent(new Event("close"))}handlePointerdown(){this.canClick=!0}handlePointerup(){this.canClick&&this.click(),this.canClick=!1}render(){return c``}firstUpdated(){this.addEventListener("pointerdown",this.handlePointerdown),this.addEventListener("pointerup",this.handlePointerup)}}s([h({type:Boolean,reflect:!0})],Underlay.prototype,"open",2);
2
2
  //# sourceMappingURL=Underlay.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Underlay.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 {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './underlay.css.js';\n\n/**\n * @element sp-underlay\n */\nexport class Underlay extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n protected override render(): TemplateResult {\n return html``;\n }\n}\n"],
5
- "mappings": "qNAYA,OAEI,QAAAA,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAY,oBAKZ,aAAM,iBAAiBF,CAAgB,CAAvC,kCAMH,KAAO,KAAO,GALd,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAM,CAClB,CAKmB,QAAyB,CACxC,OAAOH,GACX,CACJ,CALWI,EAAA,CADNF,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GALjC,SAMF",
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 {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './underlay.css.js';\n\n/**\n * @element sp-underlay\n *\n * @fires close - When the underlay is \"clicked\" and the consuming pattern should chose whether to close based on that interaction\n */\nexport class Underlay extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n private canClick = false;\n\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n public override click(): void {\n this.dispatchEvent(new Event('close'));\n }\n\n protected handlePointerdown(): void {\n this.canClick = true;\n }\n\n protected handlePointerup(): void {\n if (this.canClick) {\n this.click();\n }\n this.canClick = false;\n }\n\n protected override render(): TemplateResult {\n return html``;\n }\n\n protected override firstUpdated(): void {\n this.addEventListener('pointerdown', this.handlePointerdown);\n this.addEventListener('pointerup', this.handlePointerup);\n }\n}\n"],
5
+ "mappings": "qNAYA,OAEI,QAAAA,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAY,oBAOZ,aAAM,iBAAiBF,CAAgB,CAAvC,kCAKH,KAAQ,SAAW,GAGnB,KAAO,KAAO,GAPd,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAM,CAClB,CAOgB,OAAc,CAC1B,KAAK,cAAc,IAAI,MAAM,OAAO,CAAC,CACzC,CAEU,mBAA0B,CAChC,KAAK,SAAW,EACpB,CAEU,iBAAwB,CAC1B,KAAK,UACL,KAAK,MAAM,EAEf,KAAK,SAAW,EACpB,CAEmB,QAAyB,CACxC,OAAOH,GACX,CAEmB,cAAqB,CACpC,KAAK,iBAAiB,cAAe,KAAK,iBAAiB,EAC3D,KAAK,iBAAiB,YAAa,KAAK,eAAe,CAC3D,CACJ,CAzBWI,EAAA,CADNF,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAPjC,SAQF",
6
6
  "names": ["html", "SpectrumElement", "property", "styles", "__decorateClass"]
7
7
  }