@substrate-system/button 0.0.31 → 0.0.35

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/LICENSE CHANGED
@@ -1,121 +1,168 @@
1
- # PolyForm Small Business License 1.0.0
1
+ # Big Time Public License
2
2
 
3
- <https://polyformproject.org/licenses/small-business/1.0.0>
3
+ Version 2.0.2
4
+
5
+ <https://bigtimelicense.com/versions/2.0.2>
6
+
7
+ ## Purpose
8
+
9
+ These terms let you use and share this software for noncommercial purposes
10
+ and in small business for free, while also guaranteeing that paid licenses
11
+ for big businesses will be available on fair, reasonable, and
12
+ nondiscriminatory terms.
4
13
 
5
14
  ## Acceptance
6
15
 
7
- In order to get any license under these terms, you must agree
8
- to them as both strict obligations and conditions to all
9
- your licenses.
16
+ In order to get any license under these terms, you must agree to them as
17
+ both strict obligations and conditions to all your licenses.
10
18
 
11
- ## Copyright License
19
+ ## Noncommercial Purposes
12
20
 
13
- The licensor grants you a copyright license for the
14
- software to do everything you might do with the software
15
- that would otherwise infringe the licensor's copyright
16
- in it for any permitted purpose. However, you may
17
- only distribute the software according to [Distribution
18
- License](#distribution-license) and make changes or new works
19
- based on the software according to [Changes and New Works
20
- License](#changes-and-new-works-license).
21
+ You may use the software for any noncommercial purpose.
21
22
 
22
- ## Distribution License
23
+ ## Personal Uses
23
24
 
24
- The licensor grants you an additional copyright license
25
- to distribute copies of the software. Your license
26
- to distribute covers distributing the software with
27
- changes and new works permitted by [Changes and New Works
28
- License](#changes-and-new-works-license).
25
+ Personal use for research, experiment, and testing for the benefit of
26
+ public knowledge, personal study, private entertainment, hobby projects,
27
+ amateur pursuits, or religious observance, without any anticipated
28
+ commercial application, count as use for noncommercial purposes.
29
29
 
30
- ## Notices
30
+ ## Noncommercial Organizations
31
31
 
32
- You must ensure that anyone who gets a copy of any part of
33
- the software from you also gets a copy of these terms or the
34
- URL for them above, as well as copies of any plain-text lines
35
- beginning with `Required Notice:` that the licensor provided
36
- with the software. For example:
32
+ Use by any charitable organization, educational institution, public
33
+ research organization, public safety or health organization, environmental
34
+ protection organization, or government institution counts as use for
35
+ noncommercial purposes, regardless of the source of funding or obligations
36
+ resulting from the funding.
37
37
 
38
- > Required Notice: Copyright Nick Thomas. (https://nichoth.com)
38
+ ## Small Business
39
39
 
40
- ## Changes and New Works License
40
+ You may use the software for the benefit of your company if it meets all
41
+ these criteria:
41
42
 
42
- The licensor grants you an additional copyright license to
43
- make changes and new works based on the software for any
44
- permitted purpose.
43
+ 1. had fewer than 20 total individuals working as employees and
44
+ independent contractors at all times during the last tax year
45
45
 
46
- ## Patent License
46
+ 2. earned less than $1,000,000 total revenue in the last tax year
47
47
 
48
- The licensor grants you a patent license for the software that
49
- covers patent claims the licensor can license, or becomes able
50
- to license, that you would infringe by using the software.
48
+ 3. received less than $1,000,000 total debt, equity, and other investment
49
+ in the last five tax years, counting investment in predecessor
50
+ companies that reorganized into, merged with, or spun out your company
51
51
 
52
- ## Fair Use
52
+ All dollar figures are United States dollars as of 2019. Adjust for them
53
+ inflation according to the United States Bureau of Labor Statistics'
54
+ consumer price index for all urban consumers, United States city average,
55
+ for all items, not seasonally adjusted, with 1982–1984=100 reference base.
53
56
 
54
- You may have "fair use" rights for the software under the
55
- law. These terms do not limit them.
57
+ ## Big Business
56
58
 
57
- ## Small Business
59
+ You may use the software for the benefit of your company:
60
+
61
+ 1. for 128 days after your company stops qualifying under
62
+ [Small Business](#small-business)
63
+
64
+ 2. indefinitely, if the licensor or their legal successor does not offer
65
+ fair, reasonable, and nondiscriminatory terms for a commercial license for
66
+ the software within 32 days of [written request](#how-to-request) and
67
+ negotiate in good faith to conclude a deal
68
+
69
+ ## How to Request
70
+
71
+ If this software includes an address for the licensor or an agent of the
72
+ licensor in a standard place, such as in documentation, software package
73
+ metadata, or an "about" page or screen, try to request a fair commercial
74
+ license at that address. If this package includes both online and offline
75
+ addresses, try online before offline. If you can't deliver a request that
76
+ way, or this software doesn't include any addressees, spend one hour online
77
+ researching an address, recording all your searches and inquiries as you
78
+ go, and try any addresses that you find. If you can't find any addresses,
79
+ or if those addresses also fail, that counts as failure to offer a fair
80
+ commercial license by the licensor under [Big Business](#big-business).
81
+
82
+ ## Fair, Reasonable, and Nondiscriminatory Terms
83
+
84
+ Fair, reasonable, and nondiscriminatory terms may license the software
85
+ perpetually or for a term, and may or may not cover new versions of the
86
+ software. If the licensor advertises license terms and a pricing structure
87
+ for generally available commercial licenses, the licensor proposes license
88
+ terms and a price as advertised, and a customer not affiliated with the
89
+ licensor has bought a commercial license for the software on substantially
90
+ equivalent terms in the past year, the proposal is fair, reasonable, and
91
+ nondiscriminatory.
58
92
 
59
- Use of the software for the benefit of your company is use for
60
- a permitted purpose if your company has fewer than 100 total
61
- individuals working as employees and independent contractors,
62
- and less than 1,000,000 USD (2019) total revenue in the prior
63
- tax year. Adjust this revenue threshold for inflation according
64
- to the United States Bureau of Labor Statistics' consumer price
65
- index for all urban consumers, U.S. city average, for all items,
66
- not seasonally adjusted, with 1982–1984=100 reference base.
93
+ ## Copyright License
94
+
95
+ The licensor grants you a copyright license to do everything with the
96
+ software that would otherwise infringe the licensor's copyright in it for
97
+ any purpose allowed by these terms.
98
+
99
+ ## Notices
100
+
101
+ You must ensure that anyone who gets a copy of any part of the software
102
+ from you also gets a copy of these terms or the URL for them above, as well
103
+ as copies of any plain-text lines beginning with `Required Notice:` that
104
+ the licensor provided with the software. For example:
105
+
106
+ > Required Notice: Copyright Nick Thomas (https://nichoth.com)
107
+
108
+ ## Patent License
109
+
110
+ The licensor grants you a patent license for the software that covers
111
+ patent claims the licensor can license, or becomes able to license, that
112
+ you would infringe by using the software.
113
+
114
+ ## Fair Use
115
+
116
+ You may have "fair use" rights for the software under the law. These terms
117
+ do not limit them.
67
118
 
68
119
  ## No Other Rights
69
120
 
70
- These terms do not allow you to sublicense or transfer any of
71
- your licenses to anyone else, or prevent the licensor from
72
- granting licenses to anyone else. These terms do not imply
73
- any other licenses.
121
+ These terms do not allow you to sublicense or transfer any of your licenses
122
+ to anyone else, or prevent the licensor from granting licenses to anyone
123
+ else. These terms do not imply any other licenses.
74
124
 
75
125
  ## Patent Defense
76
126
 
77
- If you make any written claim that the software infringes or
78
- contributes to infringement of any patent, your patent license
79
- for the software granted under these terms ends immediately. If
80
- your company makes such a claim, your patent license ends
81
- immediately for work on behalf of your company.
127
+ If you make any written claim that the software infringes or contributes to
128
+ infringement of any patent, your patent license for the software granted
129
+ under these terms ends immediately. If your company makes such a claim,
130
+ your patent license ends immediately for work on behalf of your company.
82
131
 
83
132
  ## Violations
84
133
 
85
- The first time you are notified in writing that you have
86
- violated any of these terms, or done anything with the software
87
- not covered by your licenses, your licenses can nonetheless
88
- continue if you come into full compliance with these terms,
89
- and take practical steps to correct past violations, within
90
- 32 days of receiving notice. Otherwise, all your licenses
91
- end immediately.
134
+ The first time you are notified in writing that you have violated any of
135
+ these terms, or done anything with the software not covered by your
136
+ licenses, your licenses can nonetheless continue if you come into full
137
+ compliance with these terms, and take practical steps to correct past
138
+ violations, within 32 days of receiving notice. Otherwise, all your
139
+ licenses end immediately.
92
140
 
93
141
  ## No Liability
94
142
 
95
- ***As far as the law allows, the software comes as is, without
96
- any warranty or condition, and the licensor will not be liable
97
- to you for any damages arising out of these terms or the use
98
- or nature of the software, under any kind of legal claim.***
143
+ ***As far as the law allows, the software comes as is, without any warranty
144
+ or condition, and the licensor will not be liable to you for any damages
145
+ arising out of these terms or the use or nature of the software, under any
146
+ kind of legal claim.***
99
147
 
100
148
  ## Definitions
101
149
 
102
- The **licensor** is the individual or entity offering these
103
- terms, and the **software** is the software the licensor makes
104
- available under these terms.
105
-
106
- **You** refers to the individual or entity agreeing to these
150
+ The **licensor** is the individual or entity offering these terms, and
151
+ the **software** is the software the licensor makes available under these
107
152
  terms.
108
153
 
109
- **Your company** is any legal entity, sole proprietorship,
110
- or other kind of organization that you work for, plus all
111
- organizations that have control over, are under the control of,
112
- or are under common control with that organization. **Control**
113
- means ownership of substantially all the assets of an entity,
114
- or the power to direct its management and policies by vote,
154
+ **You** refers to the individual or entity agreeing to these terms.
155
+
156
+ **Your company** is any legal entity, sole proprietorship, or other kind of
157
+ organization that you work for, plus all organizations that have control
158
+ over, are under the control of, or are under common control with that
159
+ organization. **Control** means ownership of substantially all the assets
160
+ of an entity, or the power to direct its management and policies by vote,
115
161
  contract, or otherwise. Control can be direct or indirect.
116
162
 
117
- **Your licenses** are all the licenses granted to you for the
118
- software under these terms.
163
+ **Your licenses** are all the licenses granted to you for the software
164
+ under these terms.
165
+
166
+ **Use** means anything you do with the software requiring one of your
167
+ licenses.
119
168
 
120
- **Use** means anything you do with the software requiring one
121
- of your licenses.
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![gzip size](https://img.shields.io/bundlephobia/minzip/@substrate-system/button?style=flat-square)](https://bundlephobia.com/package/@substrate-system/button)
8
8
  [![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/)
9
9
  [![Common Changelog](https://nichoth.github.io/badge/common-changelog.svg)](./CHANGELOG.md)
10
- [![license](https://img.shields.io/badge/license-Polyform_Small_Business-249fbc?style=flat-square)](LICENSE)
10
+ [![license](https://img.shields.io/badge/license-Big_Time-blue?style=flat-square)](LICENSE)
11
11
 
12
12
 
13
13
  A button web component, with a visual "loading" state.
package/dist/client.cjs CHANGED
@@ -19,12 +19,11 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var client_exports = {};
21
21
  __export(client_exports, {
22
- SubstrateButton: () => SubstrateButton,
23
- define: () => define,
24
- isRegistered: () => isRegistered
22
+ SubstrateButton: () => SubstrateButton
25
23
  });
26
24
  module.exports = __toCommonJS(client_exports);
27
- class SubstrateButton extends HTMLElement {
25
+ var import_web_component = require("@substrate-system/web-component");
26
+ class SubstrateButton extends import_web_component.WebComponent.create("substrate-button") {
28
27
  static {
29
28
  __name(this, "SubstrateButton");
30
29
  }
@@ -32,6 +31,9 @@ class SubstrateButton extends HTMLElement {
32
31
  static observedAttributes = ["autofocus", "disabled", "spinning"];
33
32
  static TAG = "substrate-button";
34
33
  _isSpinning;
34
+ static define() {
35
+ (0, import_web_component.define)(SubstrateButton.TAG, SubstrateButton);
36
+ }
35
37
  constructor() {
36
38
  super();
37
39
  const disabled = this.getAttribute("disabled");
@@ -70,8 +72,17 @@ class SubstrateButton extends HTMLElement {
70
72
  return this._isSpinning;
71
73
  }
72
74
  set spinning(value) {
73
- if (value) this.setAttribute("spinning", "");
74
- else this.removeAttribute("spinning");
75
+ if (value) {
76
+ this.classList.add("spinning");
77
+ this.button?.classList.add("spinning");
78
+ this.button?.setAttribute("disabled", "");
79
+ this.setAttribute("spinning", "");
80
+ } else {
81
+ this.classList.remove("spinning");
82
+ this.button?.classList.remove("spinning");
83
+ this.button?.removeAttribute("disabled");
84
+ this.removeAttribute("spinning");
85
+ }
75
86
  }
76
87
  set type(value) {
77
88
  this._setAttribute("type", value);
@@ -130,27 +141,17 @@ class SubstrateButton extends HTMLElement {
130
141
  }
131
142
  handleChange_spinning(_, newValue) {
132
143
  if (newValue !== null) {
133
- this.classList.add("substrate-loading");
144
+ this.classList.add("spinning");
145
+ this.button?.classList.add("spinning");
146
+ this.button?.setAttribute("disabled", "");
134
147
  this.button?.setAttribute("aria-busy", "true");
135
148
  } else {
136
- this.classList.remove("substrate-loading");
149
+ this.classList.remove("spinning");
150
+ this.button?.classList.remove("spinning");
151
+ this.button?.removeAttribute("disabled");
137
152
  this.button?.setAttribute("aria-busy", "false");
138
153
  }
139
154
  }
140
- /**
141
- * Runs when the value of an attribute is changed.
142
- *
143
- * Should add methods to this class like `handleChange_class`, to
144
- * listen for changes to `class` attribute.
145
- *
146
- * @param {string} name The attribute name
147
- * @param {string} oldValue The old attribute value
148
- * @param {string} newValue The new attribute value
149
- */
150
- attributeChangedCallback(name, oldValue, newValue) {
151
- const handler = this[`handleChange_${name}`];
152
- handler && handler.call(this, oldValue, newValue);
153
- }
154
155
  connectedCallback() {
155
156
  this.render();
156
157
  this._setupKeyboardHandlers();
@@ -163,22 +164,7 @@ class SubstrateButton extends HTMLElement {
163
164
  }
164
165
  });
165
166
  }
166
- static define() {
167
- return define(SubstrateButton.TAG, SubstrateButton);
168
- }
169
167
  render() {
170
168
  }
171
169
  }
172
- function isRegistered(elName) {
173
- return document.createElement(elName).constructor !== window.HTMLElement;
174
- }
175
- __name(isRegistered, "isRegistered");
176
- function define(name, element) {
177
- if (!window) return;
178
- if (!("customElements" in window)) return;
179
- if (!isRegistered(name)) {
180
- window.customElements.define(name, element);
181
- }
182
- }
183
- __name(define, "define");
184
170
  //# sourceMappingURL=client.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/client.ts"],
4
- "sourcesContent": ["// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'substrate-button': SubstrateButton\n }\n}\n\n/**\n * This is the lightweight version for browsers + server-side rendering.\n */\nexport class SubstrateButton extends HTMLElement {\n // for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static TAG = 'substrate-button'\n _isSpinning:boolean\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n this.autofocus = (this.getAttribute('autofocus') !== null)\n this._isSpinning = (this.getAttribute('spinning') !== null)\n }\n\n get form ():HTMLFormElement|undefined|null {\n return this.button?.form\n }\n\n get disabled ():boolean {\n return !!(this.button?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.button?.setAttribute('aria-disabled', 'false')\n } else {\n this.button?.setAttribute('disabled', '')\n this.button?.setAttribute('aria-disabled', 'true')\n }\n }\n\n get type ():string|null|undefined {\n return this.button?.getAttribute('type')\n }\n\n get tabindex ():number {\n const i = this.button?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n get spinning ():boolean {\n return this._isSpinning\n }\n\n set spinning (value:boolean) {\n if (value) this.setAttribute('spinning', '')\n else this.removeAttribute('spinning')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get autofocus ():boolean {\n return !!(this.button?.hasAttribute('autofocus'))\n }\n\n set autofocus (value:boolean) {\n if (value) {\n this._setAttribute('autofocus', value)\n } else {\n this._removeAttribute('autofocus')\n }\n }\n\n /**\n * Set attributes on the internal button element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (value === false) {\n // false means remove the attribute\n this._removeAttribute(name)\n this.button?.removeAttribute(name)\n } else {\n if (value === true) {\n // true means set the attribute with no value\n return this.button?.setAttribute(name, '')\n }\n\n if (value === null) {\n // null means remove\n return this._removeAttribute(name)\n }\n\n // else, set value to a string\n this.button?.setAttribute(name, value)\n }\n }\n\n /**\n * Remove from `this` and also button child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.button?.removeAttribute(name)\n }\n\n get button ():HTMLButtonElement|null {\n return this.querySelector('button')\n }\n\n /**\n * Handle 'autofocus' attribute changes\n * @see {@link https://gomakethings.com/how-to-detect-when-attributes-change-on-a-web-component/#organizing-your-code Go Make Things article}\n *\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n handleChange_autofocus (_oldValue:string, newValue:string) {\n this._setAttribute('autofocus', newValue)\n }\n\n handleChange_disabled (_old, newValue:boolean|string) {\n this.disabled = (newValue !== null)\n if (newValue === null) this.button?.removeAttribute('disabled')\n else this.button?.setAttribute('disabled', '' + newValue)\n }\n\n handleChange_spinning (_, newValue:boolean) {\n if (newValue !== null) {\n this.classList.add('substrate-loading')\n this.button?.setAttribute('aria-busy', 'true')\n } else {\n this.classList.remove('substrate-loading')\n this.button?.setAttribute('aria-busy', 'false')\n }\n }\n\n /**\n * Runs when the value of an attribute is changed.\n *\n * Should add methods to this class like `handleChange_class`, to\n * listen for changes to `class` attribute.\n *\n * @param {string} name The attribute name\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n attributeChangedCallback (name:string, oldValue:string, newValue:string) {\n const handler = this[`handleChange_${name}`];\n (handler && handler.call(this, oldValue, newValue))\n }\n\n connectedCallback () {\n // connect event listeners\n this.render()\n this._setupKeyboardHandlers()\n }\n\n _setupKeyboardHandlers () {\n // Ensure keyboard accessibility - Space and Enter should trigger click\n this.button?.addEventListener('keydown', (e:KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault()\n this.button?.click()\n }\n })\n }\n\n static define ():void {\n return define(SubstrateButton.TAG, SubstrateButton)\n }\n\n render () {\n // noop\n }\n}\n\nexport function isRegistered (elName:string):boolean {\n return document.createElement(elName).constructor !== window.HTMLElement\n}\n\nexport function define (name:string, element:CustomElementConstructor):void {\n if (!window) return\n if (!('customElements' in window)) return\n\n if (!isRegistered(name)) {\n window.customElements.define(name, element)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,wBAAwB,YAAY;AAAA,EAVjD,OAUiD;AAAA;AAAA;AAAA;AAAA,EAE7C,OAAO,qBAAqB,CAAC,aAAa,YAAY,UAAU;AAAA,EAChE,OAAO,MAAM;AAAA,EACb;AAAA,EAEA,cAAe;AACX,UAAM;AACN,UAAM,WAAW,KAAK,aAAa,UAAU;AAC7C,QAAI,aAAa,MAAM;AACnB,iBAAW,MAAM;AAEb,aAAK,WAAW;AAAA,MACpB,GAAG,CAAC;AAAA,IACR;AACA,SAAK,YAAa,KAAK,aAAa,WAAW,MAAM;AACrD,SAAK,cAAe,KAAK,aAAa,UAAU,MAAM;AAAA,EAC1D;AAAA,EAEA,IAAI,OAAuC;AACvC,WAAO,KAAK,QAAQ;AAAA,EACxB;AAAA,EAEA,IAAI,WAAoB;AACpB,WAAO,CAAC,CAAE,KAAK,QAAQ,aAAa,UAAU;AA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AAM;AAAA,MACvB;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,OAAO,SAAe;AAClB,WAAO,OAAO,gBAAgB,KAAK,eAAe;AAAA,EACtD;AAAA,EAEA,SAAU;AAAA,EAEV;AACJ;AAEO,SAAS,aAAc,QAAuB;AACjD,SAAO,SAAS,cAAc,MAAM,EAAE,gBAAgB,OAAO;AACjE;AAFgB;AAIT,SAAS,OAAQ,MAAa,SAAuC;AACxE,MAAI,CAAC,OAAQ;AACb,MAAI,EAAE,oBAAoB,QAAS;AAEnC,MAAI,CAAC,aAAa,IAAI,GAAG;AACrB,WAAO,eAAe,OAAO,MAAM,OAAO;AAAA,EAC9C;AACJ;AAPgB;",
4
+ "sourcesContent": ["import { WebComponent, define } from '@substrate-system/web-component'\n\n// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'substrate-button': SubstrateButton\n }\n}\n\n/**\n * This is the lightweight version for browsers.\n * It \"hydrates\" only, meaining sets up event listeners.\n * It does not know how to render itself.\n */\n\nexport class SubstrateButton extends WebComponent.create('substrate-button') {\n // for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static TAG = 'substrate-button'\n _isSpinning:boolean\n\n static define () {\n define(SubstrateButton.TAG, SubstrateButton)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n this.autofocus = (this.getAttribute('autofocus') !== null)\n this._isSpinning = (this.getAttribute('spinning') !== null)\n }\n\n get form ():HTMLFormElement|undefined|null {\n return this.button?.form\n }\n\n get disabled ():boolean {\n return !!(this.button?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.button?.setAttribute('aria-disabled', 'false')\n } else {\n this.button?.setAttribute('disabled', '')\n this.button?.setAttribute('aria-disabled', 'true')\n }\n }\n\n get type ():string|null|undefined {\n return this.button?.getAttribute('type')\n }\n\n get tabindex ():number {\n const i = this.button?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n get spinning ():boolean {\n return this._isSpinning\n }\n\n set spinning (value:boolean) {\n if (value) {\n this.classList.add('spinning')\n this.button?.classList.add('spinning')\n this.button?.setAttribute('disabled', '')\n this.setAttribute('spinning', '')\n } else {\n this.classList.remove('spinning')\n this.button?.classList.remove('spinning')\n this.button?.removeAttribute('disabled')\n this.removeAttribute('spinning')\n }\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get autofocus ():boolean {\n return !!(this.button?.hasAttribute('autofocus'))\n }\n\n set autofocus (value:boolean) {\n if (value) {\n this._setAttribute('autofocus', value)\n } else {\n this._removeAttribute('autofocus')\n }\n }\n\n /**\n * Set attributes on the internal button element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (value === false) {\n // false means remove the attribute\n this._removeAttribute(name)\n this.button?.removeAttribute(name)\n } else {\n if (value === true) {\n // true means set the attribute with no value\n return this.button?.setAttribute(name, '')\n }\n\n if (value === null) {\n // null means remove\n return this._removeAttribute(name)\n }\n\n // else, set value to a string\n this.button?.setAttribute(name, value)\n }\n }\n\n /**\n * Remove from `this` and also button child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.button?.removeAttribute(name)\n }\n\n get button ():HTMLButtonElement|null {\n return this.querySelector('button')\n }\n\n /**\n * Handle 'autofocus' attribute changes\n * @see {@link https://gomakethings.com/how-to-detect-when-attributes-change-on-a-web-component/#organizing-your-code Go Make Things article}\n *\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n handleChange_autofocus (_oldValue:string, newValue:string) {\n this._setAttribute('autofocus', newValue)\n }\n\n handleChange_disabled (_old, newValue:boolean|string) {\n this.disabled = (newValue !== null)\n if (newValue === null) this.button?.removeAttribute('disabled')\n else this.button?.setAttribute('disabled', '' + newValue)\n }\n\n handleChange_spinning (_, newValue:boolean) {\n if (newValue !== null) {\n this.classList.add('spinning')\n this.button?.classList.add('spinning')\n this.button?.setAttribute('disabled', '')\n this.button?.setAttribute('aria-busy', 'true')\n } else {\n this.classList.remove('spinning')\n this.button?.classList.remove('spinning')\n this.button?.removeAttribute('disabled')\n this.button?.setAttribute('aria-busy', 'false')\n }\n }\n\n connectedCallback () {\n // connect event listeners\n this.render()\n this._setupKeyboardHandlers()\n }\n\n _setupKeyboardHandlers () {\n // Space and Enter should trigger click\n this.button?.addEventListener('keydown', (e:KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault()\n this.button?.click()\n }\n })\n }\n\n render () {\n // noop\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAqC;AAe9B,MAAM,wBAAwB,kCAAa,OAAO,kBAAkB,EAAE;AAAA,EAf7E,OAe6E;AAAA;AAAA;AAAA;AAAA,EAEzE,OAAO,qBAAqB,CAAC,aAAa,YAAY,UAAU;AAAA,EAChE,OAAO,MAAM;AAAA,EACb;AAAA,EAEA,OAAO,SAAU;AACb,qCAAO,gBAAgB,KAAK,eAAe;AAAA,EAC/C;AAAA,EAEA,cAAe;AACX,UAAM;AACN,UAAM,WAAW,KAAK,aAAa,UAAU;AAC7C,QAAI,aAAa,MAAM;AACnB,iBAAW,MAAM;AAEb,aAAK,WAAW;AAAA,MACpB,GAAG,CAAC;AAAA,IACR;AACA,SAAK,YAAa,KAAK,aAAa,WAAW,MAAM;AACrD,SAAK,cAAe,KAAK,aAAa,UAAU,MAAM;AAAA,EAC1D;AAAA,EAEA,IAAI,OAAuC;AACvC,WAAO,KAAK,QAAQ;AAAA,EACxB;AAAA,EAEA,IAAI,WAAoB;AACpB,WAAO,CAAC,CAAE,KAAK,QAAQ,aAAa,UAAU;AAAA,EAClD;AAAA,EAEA,IAAI,SAAU,eAAuB;AACjC,QAAI,CAAC,eAAe;AAChB,WAAK,iBAAiB,UAAU;AAChC,WAAK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,OAAO,EAAE,QAAQ,SAAS;AACpC,UAAE,eAAe;AACjB,aAAK,QAAQ,MAAM;AAAA,MACvB;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,SAAU;AAAA,EAEV;AACJ;",
6
6
  "names": []
7
7
  }
package/dist/client.d.ts CHANGED
@@ -1,15 +1,25 @@
1
+ import { WebComponent } from '@substrate-system/web-component';
1
2
  declare global {
2
3
  interface HTMLElementTagNameMap {
3
4
  'substrate-button': SubstrateButton;
4
5
  }
5
6
  }
7
+ declare const SubstrateButton_base: typeof WebComponent & {
8
+ new (...args: any[]): WebComponent;
9
+ TAG: string;
10
+ define: typeof WebComponent.define;
11
+ event: typeof WebComponent.event;
12
+ };
6
13
  /**
7
- * This is the lightweight version for browsers + server-side rendering.
14
+ * This is the lightweight version for browsers.
15
+ * It "hydrates" only, meaining sets up event listeners.
16
+ * It does not know how to render itself.
8
17
  */
9
- export declare class SubstrateButton extends HTMLElement {
18
+ export declare class SubstrateButton extends SubstrateButton_base {
10
19
  static observedAttributes: string[];
11
20
  static TAG: string;
12
21
  _isSpinning: boolean;
22
+ static define(): void;
13
23
  constructor();
14
24
  get form(): HTMLFormElement | undefined | null;
15
25
  get disabled(): boolean;
@@ -40,22 +50,9 @@ export declare class SubstrateButton extends HTMLElement {
40
50
  handleChange_autofocus(_oldValue: string, newValue: string): void;
41
51
  handleChange_disabled(_old: any, newValue: boolean | string): void;
42
52
  handleChange_spinning(_: any, newValue: boolean): void;
43
- /**
44
- * Runs when the value of an attribute is changed.
45
- *
46
- * Should add methods to this class like `handleChange_class`, to
47
- * listen for changes to `class` attribute.
48
- *
49
- * @param {string} name The attribute name
50
- * @param {string} oldValue The old attribute value
51
- * @param {string} newValue The new attribute value
52
- */
53
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
54
53
  connectedCallback(): void;
55
54
  _setupKeyboardHandlers(): void;
56
- static define(): void;
57
55
  render(): void;
58
56
  }
59
- export declare function isRegistered(elName: string): boolean;
60
- export declare function define(name: string, element: CustomElementConstructor): void;
57
+ export {};
61
58
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,kBAAkB,EAAE,eAAe,CAAA;KACtC;CACJ;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAE5C,MAAM,CAAC,kBAAkB,WAAwC;IACjE,MAAM,CAAC,GAAG,SAAqB;IAC/B,WAAW,EAAC,OAAO,CAAA;;IAenB,IAAI,IAAI,IAAI,eAAe,GAAC,SAAS,GAAC,IAAI,CAEzC;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,QAAQ,CAAE,aAAa,EAAC,OAAO,EAQlC;IAED,IAAI,IAAI,IAAI,MAAM,GAAC,IAAI,GAAC,SAAS,CAEhC;IAED,IAAI,QAAQ,IAAI,MAAM,CAIrB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,QAAQ,CAAE,KAAK,EAAC,OAAO,EAG1B;IAED,IAAI,IAAI,CAAE,KAAK,EAAC,MAAM,EAErB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,SAAS,CAAE,KAAK,EAAC,OAAO,EAM3B;IAED;;OAEG;IACH,aAAa,CAAE,IAAI,EAAC,MAAM,EAAE,KAAK,EAAC,OAAO,GAAC,MAAM,GAAC,IAAI,GAAE,IAAI;IAqB3D;;OAEG;IACH,gBAAgB,CAAE,IAAI,EAAC,MAAM;IAK7B,IAAI,MAAM,IAAI,iBAAiB,GAAC,IAAI,CAEnC;IAED;;;;;;OAMG;IACH,sBAAsB,CAAE,SAAS,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAIzD,qBAAqB,CAAE,IAAI,KAAA,EAAE,QAAQ,EAAC,OAAO,GAAC,MAAM;IAMpD,qBAAqB,CAAE,C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AAO,EAM3B;IAED;;OAEG;IACH,aAAa,CAAE,IAAI,EAAC,MAAM,EAAE,KAAK,EAAC,OAAO,GAAC,MAAM,GAAC,IAAI,GAAE,IAAI;IAqB3D;;OAEG;IACH,gBAAgB,CAAE,IAAI,EAAC,MAAM;IAK7B,IAAI,MAAM,IAAI,iBAAiB,GAAC,IAAI,CAEnC;IAED;;;;;;OAMG;IACH,sBAAsB,CAAE,SAAS,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAIzD,qBAAqB,CAAE,IAAI,KAAA,EAAE,QAAQ,EAAC,OAAO,GAAC,MAAM;IAMpD,qBAAqB,CAAE,CAAC,KAAA,EAAE,QAAQ,EAAC,OAAO;IAc1C,iBAAiB;IAMjB,sBAAsB;IAUtB,MAAM;CAGT"}
package/dist/client.js CHANGED
@@ -1,6 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- class SubstrateButton extends HTMLElement {
3
+ import { WebComponent, define } from "@substrate-system/web-component";
4
+ class SubstrateButton extends WebComponent.create("substrate-button") {
4
5
  static {
5
6
  __name(this, "SubstrateButton");
6
7
  }
@@ -8,6 +9,9 @@ class SubstrateButton extends HTMLElement {
8
9
  static observedAttributes = ["autofocus", "disabled", "spinning"];
9
10
  static TAG = "substrate-button";
10
11
  _isSpinning;
12
+ static define() {
13
+ define(SubstrateButton.TAG, SubstrateButton);
14
+ }
11
15
  constructor() {
12
16
  super();
13
17
  const disabled = this.getAttribute("disabled");
@@ -46,8 +50,17 @@ class SubstrateButton extends HTMLElement {
46
50
  return this._isSpinning;
47
51
  }
48
52
  set spinning(value) {
49
- if (value) this.setAttribute("spinning", "");
50
- else this.removeAttribute("spinning");
53
+ if (value) {
54
+ this.classList.add("spinning");
55
+ this.button?.classList.add("spinning");
56
+ this.button?.setAttribute("disabled", "");
57
+ this.setAttribute("spinning", "");
58
+ } else {
59
+ this.classList.remove("spinning");
60
+ this.button?.classList.remove("spinning");
61
+ this.button?.removeAttribute("disabled");
62
+ this.removeAttribute("spinning");
63
+ }
51
64
  }
52
65
  set type(value) {
53
66
  this._setAttribute("type", value);
@@ -106,27 +119,17 @@ class SubstrateButton extends HTMLElement {
106
119
  }
107
120
  handleChange_spinning(_, newValue) {
108
121
  if (newValue !== null) {
109
- this.classList.add("substrate-loading");
122
+ this.classList.add("spinning");
123
+ this.button?.classList.add("spinning");
124
+ this.button?.setAttribute("disabled", "");
110
125
  this.button?.setAttribute("aria-busy", "true");
111
126
  } else {
112
- this.classList.remove("substrate-loading");
127
+ this.classList.remove("spinning");
128
+ this.button?.classList.remove("spinning");
129
+ this.button?.removeAttribute("disabled");
113
130
  this.button?.setAttribute("aria-busy", "false");
114
131
  }
115
132
  }
116
- /**
117
- * Runs when the value of an attribute is changed.
118
- *
119
- * Should add methods to this class like `handleChange_class`, to
120
- * listen for changes to `class` attribute.
121
- *
122
- * @param {string} name The attribute name
123
- * @param {string} oldValue The old attribute value
124
- * @param {string} newValue The new attribute value
125
- */
126
- attributeChangedCallback(name, oldValue, newValue) {
127
- const handler = this[`handleChange_${name}`];
128
- handler && handler.call(this, oldValue, newValue);
129
- }
130
133
  connectedCallback() {
131
134
  this.render();
132
135
  this._setupKeyboardHandlers();
@@ -139,27 +142,10 @@ class SubstrateButton extends HTMLElement {
139
142
  }
140
143
  });
141
144
  }
142
- static define() {
143
- return define(SubstrateButton.TAG, SubstrateButton);
144
- }
145
145
  render() {
146
146
  }
147
147
  }
148
- function isRegistered(elName) {
149
- return document.createElement(elName).constructor !== window.HTMLElement;
150
- }
151
- __name(isRegistered, "isRegistered");
152
- function define(name, element) {
153
- if (!window) return;
154
- if (!("customElements" in window)) return;
155
- if (!isRegistered(name)) {
156
- window.customElements.define(name, element);
157
- }
158
- }
159
- __name(define, "define");
160
148
  export {
161
- SubstrateButton,
162
- define,
163
- isRegistered
149
+ SubstrateButton
164
150
  };
165
151
  //# sourceMappingURL=client.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/client.ts"],
4
- "sourcesContent": ["// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'substrate-button': SubstrateButton\n }\n}\n\n/**\n * This is the lightweight version for browsers + server-side rendering.\n */\nexport class SubstrateButton extends HTMLElement {\n // for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static TAG = 'substrate-button'\n _isSpinning:boolean\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n this.autofocus = (this.getAttribute('autofocus') !== null)\n this._isSpinning = (this.getAttribute('spinning') !== null)\n }\n\n get form ():HTMLFormElement|undefined|null {\n return this.button?.form\n }\n\n get disabled ():boolean {\n return !!(this.button?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.button?.setAttribute('aria-disabled', 'false')\n } else {\n this.button?.setAttribute('disabled', '')\n this.button?.setAttribute('aria-disabled', 'true')\n }\n }\n\n get type ():string|null|undefined {\n return this.button?.getAttribute('type')\n }\n\n get tabindex ():number {\n const i = this.button?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n get spinning ():boolean {\n return this._isSpinning\n }\n\n set spinning (value:boolean) {\n if (value) this.setAttribute('spinning', '')\n else this.removeAttribute('spinning')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get autofocus ():boolean {\n return !!(this.button?.hasAttribute('autofocus'))\n }\n\n set autofocus (value:boolean) {\n if (value) {\n this._setAttribute('autofocus', value)\n } else {\n this._removeAttribute('autofocus')\n }\n }\n\n /**\n * Set attributes on the internal button element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (value === false) {\n // false means remove the attribute\n this._removeAttribute(name)\n this.button?.removeAttribute(name)\n } else {\n if (value === true) {\n // true means set the attribute with no value\n return this.button?.setAttribute(name, '')\n }\n\n if (value === null) {\n // null means remove\n return this._removeAttribute(name)\n }\n\n // else, set value to a string\n this.button?.setAttribute(name, value)\n }\n }\n\n /**\n * Remove from `this` and also button child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.button?.removeAttribute(name)\n }\n\n get button ():HTMLButtonElement|null {\n return this.querySelector('button')\n }\n\n /**\n * Handle 'autofocus' attribute changes\n * @see {@link https://gomakethings.com/how-to-detect-when-attributes-change-on-a-web-component/#organizing-your-code Go Make Things article}\n *\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n handleChange_autofocus (_oldValue:string, newValue:string) {\n this._setAttribute('autofocus', newValue)\n }\n\n handleChange_disabled (_old, newValue:boolean|string) {\n this.disabled = (newValue !== null)\n if (newValue === null) this.button?.removeAttribute('disabled')\n else this.button?.setAttribute('disabled', '' + newValue)\n }\n\n handleChange_spinning (_, newValue:boolean) {\n if (newValue !== null) {\n this.classList.add('substrate-loading')\n this.button?.setAttribute('aria-busy', 'true')\n } else {\n this.classList.remove('substrate-loading')\n this.button?.setAttribute('aria-busy', 'false')\n }\n }\n\n /**\n * Runs when the value of an attribute is changed.\n *\n * Should add methods to this class like `handleChange_class`, to\n * listen for changes to `class` attribute.\n *\n * @param {string} name The attribute name\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n attributeChangedCallback (name:string, oldValue:string, newValue:string) {\n const handler = this[`handleChange_${name}`];\n (handler && handler.call(this, oldValue, newValue))\n }\n\n connectedCallback () {\n // connect event listeners\n this.render()\n this._setupKeyboardHandlers()\n }\n\n _setupKeyboardHandlers () {\n // Ensure keyboard accessibility - Space and Enter should trigger click\n this.button?.addEventListener('keydown', (e:KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault()\n this.button?.click()\n }\n })\n }\n\n static define ():void {\n return define(SubstrateButton.TAG, SubstrateButton)\n }\n\n render () {\n // noop\n }\n}\n\nexport function isRegistered (elName:string):boolean {\n return document.createElement(elName).constructor !== window.HTMLElement\n}\n\nexport function define (name:string, element:CustomElementConstructor):void {\n if (!window) return\n if (!('customElements' in window)) return\n\n if (!isRegistered(name)) {\n window.customElements.define(name, element)\n }\n}\n"],
5
- "mappings": ";;AAUO,MAAM,wBAAwB,YAAY;AAAA,EAVjD,OAUiD;AAAA;AAAA;AAAA;AAAA,EAE7C,OAAO,qBAAqB,CAAC,aAAa,YAAY,UAAU;AAAA,EAChE,OAAO,MAAM;AAAA,EACb;AAAA,EAEA,cAAe;AACX,UAAM;AACN,UAAM,WAAW,KAAK,aAAa,UAAU;AAC7C,QAAI,aAAa,MAAM;AACnB,iBAAW,MAAM;AAEb,aAAK,WAAW;AAAA,MACpB,GAAG,CAAC;AAAA,IACR;AACA,SAAK,YAAa,KAAK,aAAa,WAAW,MAAM;AACrD,SAAK,cAAe,KAAK,aAAa,UAAU,MAAM;AAAA,EAC1D;AAAA,EAEA,IAAI,OAAuC;AACvC,WAAO,KAAK,QAAQ;AAAA,EACxB;AAAA,EAEA,IAAI,WAAoB;AACpB,WAAO,CAAC,CAAE,KAAK,QAAQ,aAAa,UAAU;AAAA,EAClD;AAAA,EAEA,IAAI,SAAU,eAAuB;AACjC,QAAI,CAAC,eAAe;AAChB,WAAK,iBAAiB,UAAU;AAChC,WAAK,QAAQ,aAAa,iBAAiB,OAAO;AAAA,IACtD,OAAO;AACH,WAAK,QAAQ,aAAa,YAAY,EAAE;AACxC,WAAK,QAAQ,aAAa,iBAAiB,MAAM;AAAA,IACrD;AAAA,EACJ;AAAA,EAEA,IAAI,OAA8B;AAC9B,WAAO,KAAK,QAAQ,aAAa,MAAM;AAAA,EAC3C;AAAA,EAEA,IAAI,WAAmB;AACnB,UAAM,IAAI,KAAK,QAAQ,aAAa,UAAU;AAC9C,QAAI,CAAC,EAAG,QAAO;AACf,WAAO,SAAS,CAAC;AAAA,EACrB;AAAA,EAEA,IAAI,WAAoB;AACpB,WAAO,KAAK;AAAA,EAChB;AAAA,E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AY,KAAK,QAAQ;AAAA,EAC5D;AAAA,EAEA,sBAAuB,GAAG,UAAkB;AACxC,QAAI,aAAa,MAAM;AACnB,WAAK,UAAU,IAAI,mBAAmB;AACtC,WAAK,QAAQ,aAAa,aAAa,MAAM;AAAA,IACjD,OAAO;AACH,WAAK,UAAU,OAAO,mBAAmB;AACzC,WAAK,QAAQ,aAAa,aAAa,OAAO;AAAA,IAClD;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,yBAA0B,MAAa,UAAiB,UAAiB;AACrE,UAAM,UAAU,KAAK,gBAAgB,IAAI,EAAE;AAC3C,IAAC,WAAW,QAAQ,KAAK,MAAM,UAAU,QAAQ;AAAA,EACrD;AAAA,EAEA,oBAAqB;AAEjB,SAAK,OAAO;AACZ,SAAK,uBAAuB;AAAA,EAChC;AAAA,EAEA,yBAA0B;AAEtB,SAAK,QAAQ,iBAAiB,WAAW,CAAC,MAAoB;AAC1D,UAAI,EAAE,QAAQ,OAAO,EAAE,QAAQ,SAAS;AACpC,UAAE,eAAe;AACjB,aAAK,QAAQ,MAAM;AAAA,MACvB;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,OAAO,SAAe;AAClB,WAAO,OAAO,gBAAgB,KAAK,eAAe;AAAA,EACtD;AAAA,EAEA,SAAU;AAAA,EAEV;AACJ;AAEO,SAAS,aAAc,QAAuB;AACjD,SAAO,SAAS,cAAc,MAAM,EAAE,gBAAgB,OAAO;AACjE;AAFgB;AAIT,SAAS,OAAQ,MAAa,SAAuC;AACxE,MAAI,CAAC,OAAQ;AACb,MAAI,EAAE,oBAAoB,QAAS;AAEnC,MAAI,CAAC,aAAa,IAAI,GAAG;AACrB,WAAO,eAAe,OAAO,MAAM,OAAO;AAAA,EAC9C;AACJ;AAPgB;",
4
+ "sourcesContent": ["import { WebComponent, define } from '@substrate-system/web-component'\n\n// for docuement.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'substrate-button': SubstrateButton\n }\n}\n\n/**\n * This is the lightweight version for browsers.\n * It \"hydrates\" only, meaining sets up event listeners.\n * It does not know how to render itself.\n */\n\nexport class SubstrateButton extends WebComponent.create('substrate-button') {\n // for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static TAG = 'substrate-button'\n _isSpinning:boolean\n\n static define () {\n define(SubstrateButton.TAG, SubstrateButton)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n this.autofocus = (this.getAttribute('autofocus') !== null)\n this._isSpinning = (this.getAttribute('spinning') !== null)\n }\n\n get form ():HTMLFormElement|undefined|null {\n return this.button?.form\n }\n\n get disabled ():boolean {\n return !!(this.button?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.button?.setAttribute('aria-disabled', 'false')\n } else {\n this.button?.setAttribute('disabled', '')\n this.button?.setAttribute('aria-disabled', 'true')\n }\n }\n\n get type ():string|null|undefined {\n return this.button?.getAttribute('type')\n }\n\n get tabindex ():number {\n const i = this.button?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n get spinning ():boolean {\n return this._isSpinning\n }\n\n set spinning (value:boolean) {\n if (value) {\n this.classList.add('spinning')\n this.button?.classList.add('spinning')\n this.button?.setAttribute('disabled', '')\n this.setAttribute('spinning', '')\n } else {\n this.classList.remove('spinning')\n this.button?.classList.remove('spinning')\n this.button?.removeAttribute('disabled')\n this.removeAttribute('spinning')\n }\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get autofocus ():boolean {\n return !!(this.button?.hasAttribute('autofocus'))\n }\n\n set autofocus (value:boolean) {\n if (value) {\n this._setAttribute('autofocus', value)\n } else {\n this._removeAttribute('autofocus')\n }\n }\n\n /**\n * Set attributes on the internal button element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (value === false) {\n // false means remove the attribute\n this._removeAttribute(name)\n this.button?.removeAttribute(name)\n } else {\n if (value === true) {\n // true means set the attribute with no value\n return this.button?.setAttribute(name, '')\n }\n\n if (value === null) {\n // null means remove\n return this._removeAttribute(name)\n }\n\n // else, set value to a string\n this.button?.setAttribute(name, value)\n }\n }\n\n /**\n * Remove from `this` and also button child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.button?.removeAttribute(name)\n }\n\n get button ():HTMLButtonElement|null {\n return this.querySelector('button')\n }\n\n /**\n * Handle 'autofocus' attribute changes\n * @see {@link https://gomakethings.com/how-to-detect-when-attributes-change-on-a-web-component/#organizing-your-code Go Make Things article}\n *\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n handleChange_autofocus (_oldValue:string, newValue:string) {\n this._setAttribute('autofocus', newValue)\n }\n\n handleChange_disabled (_old, newValue:boolean|string) {\n this.disabled = (newValue !== null)\n if (newValue === null) this.button?.removeAttribute('disabled')\n else this.button?.setAttribute('disabled', '' + newValue)\n }\n\n handleChange_spinning (_, newValue:boolean) {\n if (newValue !== null) {\n this.classList.add('spinning')\n this.button?.classList.add('spinning')\n this.button?.setAttribute('disabled', '')\n this.button?.setAttribute('aria-busy', 'true')\n } else {\n this.classList.remove('spinning')\n this.button?.classList.remove('spinning')\n this.button?.removeAttribute('disabled')\n this.button?.setAttribute('aria-busy', 'false')\n }\n }\n\n connectedCallback () {\n // connect event listeners\n this.render()\n this._setupKeyboardHandlers()\n }\n\n _setupKeyboardHandlers () {\n // Space and Enter should trigger click\n this.button?.addEventListener('keydown', (e:KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault()\n this.button?.click()\n }\n })\n }\n\n render () {\n // noop\n }\n}\n"],
5
+ "mappings": ";;AAAA,SAAS,cAAc,cAAc;AAe9B,MAAM,wBAAwB,aAAa,OAAO,kBAAkB,EAAE;AAAA,EAf7E,OAe6E;AAAA;A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