@substrate-system/button 0.0.28 → 0.0.31
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/dist/client.cjs +11 -0
- package/dist/client.cjs.map +2 -2
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +11 -0
- package/dist/client.js.map +2 -2
- package/dist/client.min.js +1 -1
- package/dist/client.min.js.map +3 -3
- package/dist/html.cjs +6 -3
- package/dist/html.cjs.map +2 -2
- package/dist/html.d.ts +1 -0
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +6 -3
- package/dist/html.js.map +2 -2
- package/dist/html.min.js +4 -4
- package/dist/html.min.js.map +3 -3
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.css +70 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +2 -2
- package/dist/index.min.css +2 -2
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +3 -3
- package/dist/meta.json +12 -12
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -131,8 +131,10 @@ class SubstrateButton extends HTMLElement {
|
|
|
131
131
|
handleChange_spinning(_, newValue) {
|
|
132
132
|
if (newValue !== null) {
|
|
133
133
|
this.classList.add("substrate-loading");
|
|
134
|
+
this.button?.setAttribute("aria-busy", "true");
|
|
134
135
|
} else {
|
|
135
136
|
this.classList.remove("substrate-loading");
|
|
137
|
+
this.button?.setAttribute("aria-busy", "false");
|
|
136
138
|
}
|
|
137
139
|
}
|
|
138
140
|
/**
|
|
@@ -151,6 +153,15 @@ class SubstrateButton extends HTMLElement {
|
|
|
151
153
|
}
|
|
152
154
|
connectedCallback() {
|
|
153
155
|
this.render();
|
|
156
|
+
this._setupKeyboardHandlers();
|
|
157
|
+
}
|
|
158
|
+
_setupKeyboardHandlers() {
|
|
159
|
+
this.button?.addEventListener("keydown", (e) => {
|
|
160
|
+
if (e.key === " " || e.key === "Enter") {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
this.button?.click();
|
|
163
|
+
}
|
|
164
|
+
});
|
|
154
165
|
}
|
|
155
166
|
static define() {
|
|
156
167
|
return define(SubstrateButton.TAG, SubstrateButton);
|
package/dist/client.cjs.map
CHANGED
|
@@ -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 } else {\n this.classList.remove('substrate-loading')\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 }\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;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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B,QAAI,aAAa,KAAM,MAAK,QAAQ,gBAAgB,UAAU;AAAA,QACzD,MAAK,QAAQ,aAAa,YAAY,KAAK,QAAQ;AAAA,EAC5D;AAAA,EAEA,sBAAuB,GAAG,UAAkB;AACxC,QAAI,aAAa,MAAM;AACnB,WAAK,UAAU,IAAI,mBAAmB;AAAA,
|
|
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;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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xE,MAAI,CAAC,OAAQ;AACb,MAAI,EAAE,oBAAoB,QAAS;AAEnC,MAAI,CAAC,aAAa,IAAI,GAAG;AACrB,WAAO,eAAe,OAAO,MAAM,OAAO;AAAA,EAC9C;AACJ;AAPgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare class SubstrateButton extends HTMLElement {
|
|
|
52
52
|
*/
|
|
53
53
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
54
54
|
connectedCallback(): void;
|
|
55
|
+
_setupKeyboardHandlers(): void;
|
|
55
56
|
static define(): void;
|
|
56
57
|
render(): void;
|
|
57
58
|
}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -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,K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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;IAU1C;;;;;;;;;OASG;IACH,wBAAwB,CAAE,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAKvE,iBAAiB;IAMjB,sBAAsB;IAUtB,MAAM,CAAC,MAAM,IAAI,IAAI;IAIrB,MAAM;CAGT;AAED,wBAAgB,YAAY,CAAE,MAAM,EAAC,MAAM,GAAE,OAAO,CAEnD;AAED,wBAAgB,MAAM,CAAE,IAAI,EAAC,MAAM,EAAE,OAAO,EAAC,wBAAwB,GAAE,IAAI,CAO1E"}
|
package/dist/client.js
CHANGED
|
@@ -107,8 +107,10 @@ class SubstrateButton extends HTMLElement {
|
|
|
107
107
|
handleChange_spinning(_, newValue) {
|
|
108
108
|
if (newValue !== null) {
|
|
109
109
|
this.classList.add("substrate-loading");
|
|
110
|
+
this.button?.setAttribute("aria-busy", "true");
|
|
110
111
|
} else {
|
|
111
112
|
this.classList.remove("substrate-loading");
|
|
113
|
+
this.button?.setAttribute("aria-busy", "false");
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
/**
|
|
@@ -127,6 +129,15 @@ class SubstrateButton extends HTMLElement {
|
|
|
127
129
|
}
|
|
128
130
|
connectedCallback() {
|
|
129
131
|
this.render();
|
|
132
|
+
this._setupKeyboardHandlers();
|
|
133
|
+
}
|
|
134
|
+
_setupKeyboardHandlers() {
|
|
135
|
+
this.button?.addEventListener("keydown", (e) => {
|
|
136
|
+
if (e.key === " " || e.key === "Enter") {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
this.button?.click();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
130
141
|
}
|
|
131
142
|
static define() {
|
|
132
143
|
return define(SubstrateButton.TAG, SubstrateButton);
|
package/dist/client.js.map
CHANGED
|
@@ -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 } else {\n this.classList.remove('substrate-loading')\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 }\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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SAAK,WAAY,aAAa;AAC9B,QAAI,aAAa,KAAM,MAAK,QAAQ,gBAAgB,UAAU;AAAA,QACzD,MAAK,QAAQ,aAAa,YAAY,KAAK,QAAQ;AAAA,EAC5D;AAAA,EAEA,sBAAuB,GAAG,UAAkB;AACxC,QAAI,aAAa,MAAM;AACnB,WAAK,UAAU,IAAI,mBAAmB;AAAA,
|
|
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,E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oBAAoB,QAAS;AAEnC,MAAI,CAAC,aAAa,IAAI,GAAG;AACrB,WAAO,eAAe,OAAO,MAAM,OAAO;AAAA,EAC9C;AACJ;AAPgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/client.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var o=Object.defineProperty;var s=(i,t)=>o(i,"name",{value:t,configurable:!0});var r=class i extends HTMLElement{static{s(this,"SubstrateButton")}static observedAttributes=["autofocus","disabled","spinning"];static TAG="substrate-button";_isSpinning;constructor(){super(),this.getAttribute("disabled")!==null&&setTimeout(()=>{this.disabled=!0},0),this.autofocus=this.getAttribute("autofocus")!==null,this._isSpinning=this.getAttribute("spinning")!==null}get form(){return this.button?.form}get disabled(){return!!this.button?.hasAttribute("disabled")}set disabled(t){t?(this.button?.setAttribute("disabled",""),this.button?.setAttribute("aria-disabled","true")):(this._removeAttribute("disabled"),this.button?.setAttribute("aria-disabled","false"))}get type(){return this.button?.getAttribute("type")}get tabindex(){let t=this.button?.getAttribute("tabindex");return t?parseInt(t):0}get spinning(){return this._isSpinning}set spinning(t){t?this.setAttribute("spinning",""):this.removeAttribute("spinning")}set type(t){this._setAttribute("type",t)}get autofocus(){return!!this.button?.hasAttribute("autofocus")}set autofocus(t){t?this._setAttribute("autofocus",t):this._removeAttribute("autofocus")}_setAttribute(t,e){if(e===!1)this._removeAttribute(t),this.button?.removeAttribute(t);else{if(e===!0)return this.button?.setAttribute(t,"");if(e===null)return this._removeAttribute(t);this.button?.setAttribute(t,e)}}_removeAttribute(t){this.removeAttribute(t),this.button?.removeAttribute(t)}get button(){return this.querySelector("button")}handleChange_autofocus(t,e){this._setAttribute("autofocus",e)}handleChange_disabled(t,e){this.disabled=e!==null,e===null?this.button?.removeAttribute("disabled"):this.button?.setAttribute("disabled",""+e)}handleChange_spinning(t,e){e!==null?this.classList.add("substrate-loading"):this.classList.remove("substrate-loading")}attributeChangedCallback(t,e,u){let n=this[`handleChange_${t}`];n&&n.call(this,e,u)}connectedCallback(){this.render()}static define(){return l(i.TAG,i)}render(){}};function b(i){return document.createElement(i).constructor!==window.HTMLElement}s(b,"isRegistered");function l(i,t){window&&"customElements"in window&&(b(i)||window.customElements.define(i,t))}s(l,"define");export{r as SubstrateButton,l as define,b as isRegistered};
|
|
1
|
+
var o=Object.defineProperty;var s=(i,t)=>o(i,"name",{value:t,configurable:!0});var r=class i extends HTMLElement{static{s(this,"SubstrateButton")}static observedAttributes=["autofocus","disabled","spinning"];static TAG="substrate-button";_isSpinning;constructor(){super(),this.getAttribute("disabled")!==null&&setTimeout(()=>{this.disabled=!0},0),this.autofocus=this.getAttribute("autofocus")!==null,this._isSpinning=this.getAttribute("spinning")!==null}get form(){return this.button?.form}get disabled(){return!!this.button?.hasAttribute("disabled")}set disabled(t){t?(this.button?.setAttribute("disabled",""),this.button?.setAttribute("aria-disabled","true")):(this._removeAttribute("disabled"),this.button?.setAttribute("aria-disabled","false"))}get type(){return this.button?.getAttribute("type")}get tabindex(){let t=this.button?.getAttribute("tabindex");return t?parseInt(t):0}get spinning(){return this._isSpinning}set spinning(t){t?this.setAttribute("spinning",""):this.removeAttribute("spinning")}set type(t){this._setAttribute("type",t)}get autofocus(){return!!this.button?.hasAttribute("autofocus")}set autofocus(t){t?this._setAttribute("autofocus",t):this._removeAttribute("autofocus")}_setAttribute(t,e){if(e===!1)this._removeAttribute(t),this.button?.removeAttribute(t);else{if(e===!0)return this.button?.setAttribute(t,"");if(e===null)return this._removeAttribute(t);this.button?.setAttribute(t,e)}}_removeAttribute(t){this.removeAttribute(t),this.button?.removeAttribute(t)}get button(){return this.querySelector("button")}handleChange_autofocus(t,e){this._setAttribute("autofocus",e)}handleChange_disabled(t,e){this.disabled=e!==null,e===null?this.button?.removeAttribute("disabled"):this.button?.setAttribute("disabled",""+e)}handleChange_spinning(t,e){e!==null?(this.classList.add("substrate-loading"),this.button?.setAttribute("aria-busy","true")):(this.classList.remove("substrate-loading"),this.button?.setAttribute("aria-busy","false"))}attributeChangedCallback(t,e,u){let n=this[`handleChange_${t}`];n&&n.call(this,e,u)}connectedCallback(){this.render(),this._setupKeyboardHandlers()}_setupKeyboardHandlers(){this.button?.addEventListener("keydown",t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),this.button?.click())})}static define(){return l(i.TAG,i)}render(){}};function b(i){return document.createElement(i).constructor!==window.HTMLElement}s(b,"isRegistered");function l(i,t){window&&"customElements"in window&&(b(i)||window.customElements.define(i,t))}s(l,"define");export{r as SubstrateButton,l as define,b as isRegistered};
|
|
2
2
|
//# sourceMappingURL=client.min.js.map
|
package/dist/client.min.js.map
CHANGED
|
@@ -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 } else {\n this.classList.remove('substrate-loading')\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 }\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": "+EAUO,IAAMA,EAAN,MAAMC,UAAwB,WAAY,CAVjD,MAUiD,CAAAC,EAAA,wBAE7C,OAAO,mBAAqB,CAAC,YAAa,WAAY,UAAU,EAChE,OAAO,IAAM,mBACb,YAEA,aAAe,CACX,MAAM,EACW,KAAK,aAAa,UAAU,IAC5B,MACb,WAAW,IAAM,CAEb,KAAK,SAAW,EACpB,EAAG,CAAC,EAER,KAAK,UAAa,KAAK,aAAa,WAAW,IAAM,KACrD,KAAK,YAAe,KAAK,aAAa,UAAU,IAAM,IAC1D,CAEA,IAAI,MAAuC,CACvC,OAAO,KAAK,QAAQ,IACxB,CAEA,IAAI,UAAoB,CACpB,MAAO,CAAC,CAAE,KAAK,QAAQ,aAAa,UAAU,CAClD,CAEA,IAAI,SAAUC,EAAuB,CAC5BA,GAID,KAAK,QAAQ,aAAa,WAAY,EAAE,EACxC,KAAK,QAAQ,aAAa,gBAAiB,MAAM,IAJjD,KAAK,iBAAiB,UAAU,EAChC,KAAK,QAAQ,aAAa,gBAAiB,OAAO,EAK1D,CAEA,IAAI,MAA8B,CAC9B,OAAO,KAAK,QAAQ,aAAa,MAAM,CAC3C,CAEA,IAAI,UAAmB,CACnB,IAAMC,EAAI,KAAK,QAAQ,aAAa,UAAU,EAC9C,OAAKA,EACE,SAASA,CAAC,EADF,CAEnB,CAEA,IAAI,UAAoB,CACpB,OAAO,KAAK,WAChB,CAEA,IAAI,SAAUC,EAAe,CACrBA,EAAO,KAAK,aAAa,WAAY,EAAE,EACtC,KAAK,gBAAgB,UAAU,CACxC,CAEA,IAAI,KAAMA,EAAc,CACpB,KAAK,cAAc,OAAQA,CAAK,CACpC,CAEA,IAAI,WAAqB,CACrB,MAAO,CAAC,CAAE,KAAK,QAAQ,aAAa,WAAW,CACnD,CAEA,IAAI,UAAWA,EAAe,CACtBA,EACA,KAAK,cAAc,YAAaA,CAAK,EAErC,KAAK,iBAAiB,WAAW,CAEzC,CAKA,cAAeC,EAAaD,EAAgC,CACxD,GAAIA,IAAU,GAEV,KAAK,iBAAiBC,CAAI,EAC1B,KAAK,QAAQ,gBAAgBA,CAAI,MAC9B,CACH,GAAID,IAAU,GAEV,OAAO,KAAK,QAAQ,aAAaC,EAAM,EAAE,EAG7C,GAAID,IAAU,KAEV,OAAO,KAAK,iBAAiBC,CAAI,EAIrC,KAAK,QAAQ,aAAaA,EAAMD,CAAK,CACzC,CACJ,CAKA,iBAAkBC,EAAa,CAC3B,KAAK,gBAAgBA,CAAI,EACzB,KAAK,QAAQ,gBAAgBA,CAAI,CACrC,CAEA,IAAI,QAAiC,CACjC,OAAO,KAAK,cAAc,QAAQ,CACtC,CASA,uBAAwBC,EAAkBC,EAAiB,CACvD,KAAK,cAAc,YAAaA,CAAQ,CAC5C,CAEA,sBAAuBC,EAAMD,EAAyB,CAClD,KAAK,SAAYA,IAAa,KAC1BA,IAAa,KAAM,KAAK,QAAQ,gBAAgB,UAAU,EACzD,KAAK,QAAQ,aAAa,WAAY,GAAKA,CAAQ,CAC5D,CAEA,sBAAuBE,EAAGF,EAAkB,CACpCA,IAAa,
|
|
6
|
-
"names": ["SubstrateButton", "_SubstrateButton", "__name", "disabledValue", "i", "value", "name", "_oldValue", "newValue", "_old", "_", "oldValue", "handler", "define", "isRegistered", "elName", "element"]
|
|
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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3B,CAAC,CACL,CAEA,OAAO,QAAe,CAClB,OAAOC,EAAOb,EAAgB,IAAKA,CAAe,CACtD,CAEA,QAAU,CAEV,CACJ,EAEO,SAASc,EAAcC,EAAuB,CACjD,OAAO,SAAS,cAAcA,CAAM,EAAE,cAAgB,OAAO,WACjE,CAFgBd,EAAAa,EAAA,gBAIT,SAASD,EAAQR,EAAaW,EAAuC,CACnE,QACC,mBAAoB,SAErBF,EAAaT,CAAI,GAClB,OAAO,eAAe,OAAOA,EAAMW,CAAO,EAElD,CAPgBf,EAAAY,EAAA",
|
|
6
|
+
"names": ["SubstrateButton", "_SubstrateButton", "__name", "disabledValue", "i", "value", "name", "_oldValue", "newValue", "_old", "_", "oldValue", "handler", "e", "define", "isRegistered", "elName", "element"]
|
|
7
7
|
}
|
package/dist/html.cjs
CHANGED
|
@@ -29,7 +29,8 @@ function html(attrs, textContent) {
|
|
|
29
29
|
tabindex,
|
|
30
30
|
disabled,
|
|
31
31
|
classes,
|
|
32
|
-
name
|
|
32
|
+
name,
|
|
33
|
+
ariaLabel
|
|
33
34
|
} = attrs;
|
|
34
35
|
const _classes = new Set(classes);
|
|
35
36
|
_classes.add("substrate-button");
|
|
@@ -41,11 +42,13 @@ function html(attrs, textContent) {
|
|
|
41
42
|
type ? `type="${type}"` : "",
|
|
42
43
|
name ? `name=${name}` : "",
|
|
43
44
|
tabindex ? `tabindex="${tabindex}"` : 'tabindex="0"',
|
|
44
|
-
'role="button"'
|
|
45
|
+
'role="button"',
|
|
46
|
+
ariaLabel ? `aria-label="${ariaLabel}"` : "",
|
|
47
|
+
'aria-live="polite"'
|
|
45
48
|
].filter(Boolean).join(" ");
|
|
46
49
|
return typeof window === "undefined" ? `<substrate-button${disabled ? " disabled" : ""}>
|
|
47
50
|
<button ${btnProps}>${textContent}</button>
|
|
48
|
-
</substrate-button
|
|
51
|
+
</substrate-button>` : `<button ${btnProps}>
|
|
49
52
|
${textContent}
|
|
50
53
|
</button>`;
|
|
51
54
|
}
|
package/dist/html.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/html.ts"],
|
|
4
|
-
"sourcesContent": ["export type Attrs = {\n type:string|null;\n autofocus:boolean;\n tabindex:string|number;\n disabled:boolean;\n name:string|null;\n classes:string[]|Set<string>;\n}\n\nexport function html (attrs:Partial<Attrs>, textContent:string) {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n classes,\n name\n } = attrs\n\n const _classes = new Set(classes)\n _classes.add('substrate-button')\n const arr = Array.from(_classes)\n\n const btnProps = ([\n arr.length ? `class=\"${arr.filter(Boolean).join(' ')}\"` : '',\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${type}\"` : '',\n name ? `name=${name}` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n 'role=\"button\"'\n ]).filter(Boolean).join(' ')\n\n // rendering in node?\n return typeof window === 'undefined' ?\n `<substrate-button${disabled ? ' disabled' : ''}>\n <button ${btnProps}>${textContent}</button>\n </substrate-button
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["export type Attrs = {\n type:string|null;\n autofocus:boolean;\n tabindex:string|number;\n disabled:boolean;\n name:string|null;\n classes:string[]|Set<string>;\n ariaLabel:string|null;\n}\n\nexport function html (attrs:Partial<Attrs>, textContent:string) {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n classes,\n name,\n ariaLabel\n } = attrs\n\n const _classes = new Set(classes)\n _classes.add('substrate-button')\n const arr = Array.from(_classes)\n\n const btnProps = ([\n arr.length ? `class=\"${arr.filter(Boolean).join(' ')}\"` : '',\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${type}\"` : '',\n name ? `name=${name}` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n 'role=\"button\"',\n ariaLabel ? `aria-label=\"${ariaLabel}\"` : '',\n 'aria-live=\"polite\"'\n ]).filter(Boolean).join(' ')\n\n // rendering in node?\n return typeof window === 'undefined' ?\n `<substrate-button${disabled ? ' disabled' : ''}>\n <button ${btnProps}>${textContent}</button>\n </substrate-button>` :\n `<button ${btnProps}>\n ${textContent}\n </button>`\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,KAAM,OAAsB,aAAoB;AAC5D,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,IAAI;AAEJ,QAAM,WAAW,IAAI,IAAI,OAAO;AAChC,WAAS,IAAI,kBAAkB;AAC/B,QAAM,MAAM,MAAM,KAAK,QAAQ;AAE/B,QAAM,WAAY;AAAA,IACd,IAAI,SAAS,UAAU,IAAI,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,MAAM;AAAA,IAC1D,WAAW,aAAa;AAAA,IACxB,YAAY,cAAc;AAAA,IAC1B,OAAO,SAAS,IAAI,MAAM;AAAA,IAC1B,OAAO,QAAQ,IAAI,KAAK;AAAA,IACxB,WAAW,aAAa,QAAQ,MAAM;AAAA,IACtC;AAAA,IACA,YAAY,eAAe,SAAS,MAAM;AAAA,IAC1C;AAAA,EACJ,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG;AAG3B,SAAO,OAAO,WAAW,cACrB,oBAAoB,WAAW,cAAc,EAAE;AAAA,sBACjC,QAAQ,IAAI,WAAW;AAAA,+BAErC,WAAW,QAAQ;AAAA,cACb,WAAW;AAAA;AAEzB;AAnCgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/html.d.ts
CHANGED
package/dist/html.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAChB,IAAI,EAAC,MAAM,GAAC,IAAI,CAAC;IACjB,SAAS,EAAC,OAAO,CAAC;IAClB,QAAQ,EAAC,MAAM,GAAC,MAAM,CAAC;IACvB,QAAQ,EAAC,OAAO,CAAC;IACjB,IAAI,EAAC,MAAM,GAAC,IAAI,CAAC;IACjB,OAAO,EAAC,MAAM,EAAE,GAAC,GAAG,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAChB,IAAI,EAAC,MAAM,GAAC,IAAI,CAAC;IACjB,SAAS,EAAC,OAAO,CAAC;IAClB,QAAQ,EAAC,MAAM,GAAC,MAAM,CAAC;IACvB,QAAQ,EAAC,OAAO,CAAC;IACjB,IAAI,EAAC,MAAM,GAAC,IAAI,CAAC;IACjB,OAAO,EAAC,MAAM,EAAE,GAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAC,MAAM,GAAC,IAAI,CAAC;CACzB,CAAA;AAED,wBAAgB,IAAI,CAAE,KAAK,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW,EAAC,MAAM,UAmC7D"}
|
package/dist/html.js
CHANGED
|
@@ -7,7 +7,8 @@ function html(attrs, textContent) {
|
|
|
7
7
|
tabindex,
|
|
8
8
|
disabled,
|
|
9
9
|
classes,
|
|
10
|
-
name
|
|
10
|
+
name,
|
|
11
|
+
ariaLabel
|
|
11
12
|
} = attrs;
|
|
12
13
|
const _classes = new Set(classes);
|
|
13
14
|
_classes.add("substrate-button");
|
|
@@ -19,11 +20,13 @@ function html(attrs, textContent) {
|
|
|
19
20
|
type ? `type="${type}"` : "",
|
|
20
21
|
name ? `name=${name}` : "",
|
|
21
22
|
tabindex ? `tabindex="${tabindex}"` : 'tabindex="0"',
|
|
22
|
-
'role="button"'
|
|
23
|
+
'role="button"',
|
|
24
|
+
ariaLabel ? `aria-label="${ariaLabel}"` : "",
|
|
25
|
+
'aria-live="polite"'
|
|
23
26
|
].filter(Boolean).join(" ");
|
|
24
27
|
return typeof window === "undefined" ? `<substrate-button${disabled ? " disabled" : ""}>
|
|
25
28
|
<button ${btnProps}>${textContent}</button>
|
|
26
|
-
</substrate-button
|
|
29
|
+
</substrate-button>` : `<button ${btnProps}>
|
|
27
30
|
${textContent}
|
|
28
31
|
</button>`;
|
|
29
32
|
}
|
package/dist/html.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/html.ts"],
|
|
4
|
-
"sourcesContent": ["export type Attrs = {\n type:string|null;\n autofocus:boolean;\n tabindex:string|number;\n disabled:boolean;\n name:string|null;\n classes:string[]|Set<string>;\n}\n\nexport function html (attrs:Partial<Attrs>, textContent:string) {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n classes,\n name\n } = attrs\n\n const _classes = new Set(classes)\n _classes.add('substrate-button')\n const arr = Array.from(_classes)\n\n const btnProps = ([\n arr.length ? `class=\"${arr.filter(Boolean).join(' ')}\"` : '',\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${type}\"` : '',\n name ? `name=${name}` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n 'role=\"button\"'\n ]).filter(Boolean).join(' ')\n\n // rendering in node?\n return typeof window === 'undefined' ?\n `<substrate-button${disabled ? ' disabled' : ''}>\n <button ${btnProps}>${textContent}</button>\n </substrate-button
|
|
5
|
-
"mappings": ";;
|
|
4
|
+
"sourcesContent": ["export type Attrs = {\n type:string|null;\n autofocus:boolean;\n tabindex:string|number;\n disabled:boolean;\n name:string|null;\n classes:string[]|Set<string>;\n ariaLabel:string|null;\n}\n\nexport function html (attrs:Partial<Attrs>, textContent:string) {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n classes,\n name,\n ariaLabel\n } = attrs\n\n const _classes = new Set(classes)\n _classes.add('substrate-button')\n const arr = Array.from(_classes)\n\n const btnProps = ([\n arr.length ? `class=\"${arr.filter(Boolean).join(' ')}\"` : '',\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${type}\"` : '',\n name ? `name=${name}` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n 'role=\"button\"',\n ariaLabel ? `aria-label=\"${ariaLabel}\"` : '',\n 'aria-live=\"polite\"'\n ]).filter(Boolean).join(' ')\n\n // rendering in node?\n return typeof window === 'undefined' ?\n `<substrate-button${disabled ? ' disabled' : ''}>\n <button ${btnProps}>${textContent}</button>\n </substrate-button>` :\n `<button ${btnProps}>\n ${textContent}\n </button>`\n}\n"],
|
|
5
|
+
"mappings": ";;AAUO,SAAS,KAAM,OAAsB,aAAoB;AAC5D,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,IAAI;AAEJ,QAAM,WAAW,IAAI,IAAI,OAAO;AAChC,WAAS,IAAI,kBAAkB;AAC/B,QAAM,MAAM,MAAM,KAAK,QAAQ;AAE/B,QAAM,WAAY;AAAA,IACd,IAAI,SAAS,UAAU,IAAI,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,MAAM;AAAA,IAC1D,WAAW,aAAa;AAAA,IACxB,YAAY,cAAc;AAAA,IAC1B,OAAO,SAAS,IAAI,MAAM;AAAA,IAC1B,OAAO,QAAQ,IAAI,KAAK;AAAA,IACxB,WAAW,aAAa,QAAQ,MAAM;AAAA,IACtC;AAAA,IACA,YAAY,eAAe,SAAS,MAAM;AAAA,IAC1C;AAAA,EACJ,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG;AAG3B,SAAO,OAAO,WAAW,cACrB,oBAAoB,WAAW,cAAc,EAAE;AAAA,sBACjC,QAAQ,IAAI,WAAW;AAAA,+BAErC,WAAW,QAAQ;AAAA,cACb,WAAW;AAAA;AAEzB;AAnCgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/html.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
<button ${
|
|
3
|
-
</substrate-button
|
|
1
|
+
var $=Object.defineProperty;var u=(n,t)=>$(n,"name",{value:t,configurable:!0});function p(n,t){let{type:e,autofocus:d,tabindex:a,disabled:s,classes:c,name:o,ariaLabel:r}=n,l=new Set(c);l.add("substrate-button");let i=Array.from(l),b=[i.length?`class="${i.filter(Boolean).join(" ")}"`:"",s?"disabled":"",d?"autofocus":"",e?`type="${e}"`:"",o?`name=${o}`:"",a?`tabindex="${a}"`:'tabindex="0"','role="button"',r?`aria-label="${r}"`:"",'aria-live="polite"'].filter(Boolean).join(" ");return typeof window>"u"?`<substrate-button${s?" disabled":""}>
|
|
2
|
+
<button ${b}>${t}</button>
|
|
3
|
+
</substrate-button>`:`<button ${b}>
|
|
4
4
|
${t}
|
|
5
|
-
</button>`}
|
|
5
|
+
</button>`}u(p,"html");export{p as html};
|
|
6
6
|
//# sourceMappingURL=html.min.js.map
|
package/dist/html.min.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/html.ts"],
|
|
4
|
-
"sourcesContent": ["export type Attrs = {\n type:string|null;\n autofocus:boolean;\n tabindex:string|number;\n disabled:boolean;\n name:string|null;\n classes:string[]|Set<string>;\n}\n\nexport function html (attrs:Partial<Attrs>, textContent:string) {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n classes,\n name\n } = attrs\n\n const _classes = new Set(classes)\n _classes.add('substrate-button')\n const arr = Array.from(_classes)\n\n const btnProps = ([\n arr.length ? `class=\"${arr.filter(Boolean).join(' ')}\"` : '',\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${type}\"` : '',\n name ? `name=${name}` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n 'role=\"button\"'\n ]).filter(Boolean).join(' ')\n\n // rendering in node?\n return typeof window === 'undefined' ?\n `<substrate-button${disabled ? ' disabled' : ''}>\n <button ${btnProps}>${textContent}</button>\n </substrate-button
|
|
5
|
-
"mappings": "+
|
|
6
|
-
"names": ["html", "attrs", "textContent", "type", "autofocus", "tabindex", "disabled", "classes", "name", "_classes", "arr", "btnProps", "__name"]
|
|
4
|
+
"sourcesContent": ["export type Attrs = {\n type:string|null;\n autofocus:boolean;\n tabindex:string|number;\n disabled:boolean;\n name:string|null;\n classes:string[]|Set<string>;\n ariaLabel:string|null;\n}\n\nexport function html (attrs:Partial<Attrs>, textContent:string) {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n classes,\n name,\n ariaLabel\n } = attrs\n\n const _classes = new Set(classes)\n _classes.add('substrate-button')\n const arr = Array.from(_classes)\n\n const btnProps = ([\n arr.length ? `class=\"${arr.filter(Boolean).join(' ')}\"` : '',\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${type}\"` : '',\n name ? `name=${name}` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n 'role=\"button\"',\n ariaLabel ? `aria-label=\"${ariaLabel}\"` : '',\n 'aria-live=\"polite\"'\n ]).filter(Boolean).join(' ')\n\n // rendering in node?\n return typeof window === 'undefined' ?\n `<substrate-button${disabled ? ' disabled' : ''}>\n <button ${btnProps}>${textContent}</button>\n </substrate-button>` :\n `<button ${btnProps}>\n ${textContent}\n </button>`\n}\n"],
|
|
5
|
+
"mappings": "+EAUO,SAASA,EAAMC,EAAsBC,EAAoB,CAC5D,GAAM,CACF,KAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,KAAAC,EACA,UAAAC,CACJ,EAAIR,EAEES,EAAW,IAAI,IAAIH,CAAO,EAChCG,EAAS,IAAI,kBAAkB,EAC/B,IAAMC,EAAM,MAAM,KAAKD,CAAQ,EAEzBE,EAAY,CACdD,EAAI,OAAS,UAAUA,EAAI,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,IAAM,GAC1DL,EAAW,WAAa,GACxBF,EAAY,YAAc,GAC1BD,EAAO,SAASA,CAAI,IAAM,GAC1BK,EAAO,QAAQA,CAAI,GAAK,GACxBH,EAAW,aAAaA,CAAQ,IAAM,eACtC,gBACAI,EAAY,eAAeA,CAAS,IAAM,GAC1C,oBACJ,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG,EAG3B,OAAO,OAAO,OAAW,IACrB,oBAAoBH,EAAW,YAAc,EAAE;AAAA,sBACjCM,CAAQ,IAAIV,CAAW;AAAA,6BAErC,WAAWU,CAAQ;AAAA,cACbV,CAAW;AAAA,kBAEzB,CAnCgBW,EAAAb,EAAA",
|
|
6
|
+
"names": ["html", "attrs", "textContent", "type", "autofocus", "tabindex", "disabled", "classes", "name", "ariaLabel", "_classes", "arr", "btnProps", "__name"]
|
|
7
7
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ class SubstrateButton extends import_client.SubstrateButton {
|
|
|
46
46
|
disabled
|
|
47
47
|
} = this;
|
|
48
48
|
const name = this.getAttribute("name");
|
|
49
|
+
const ariaLabel = this.getAttribute("aria-label");
|
|
49
50
|
const classes = [
|
|
50
51
|
"substrate-button",
|
|
51
52
|
this.getAttribute("class")
|
|
@@ -57,7 +58,8 @@ class SubstrateButton extends import_client.SubstrateButton {
|
|
|
57
58
|
autofocus,
|
|
58
59
|
tabindex,
|
|
59
60
|
type,
|
|
60
|
-
name
|
|
61
|
+
name,
|
|
62
|
+
ariaLabel
|
|
61
63
|
};
|
|
62
64
|
this.innerHTML = (0, import_html.html)(btnProps, text);
|
|
63
65
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { html } from './html.js'\nimport { SubstrateButton as SubstrateButtonLight } from './client.js'\n\n/**\n * This is the full-version -- knows how to render itself in the browser.\n */\nexport class SubstrateButton extends SubstrateButtonLight {\n static define () {\n if (!('customElements' in window)) return\n\n return customElements.define(\n SubstrateButton.TAG || 'substrate-button',\n SubstrateButton\n )\n }\n\n connectedCallback ():void {\n this.render()\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n } = this\n const name = this.getAttribute('name')\n\n const classes:(string|null)[] = [\n 'substrate-button',\n this.getAttribute('class')\n ]\n const text = this.innerHTML\n\n const btnProps = {\n classes: classes.filter(Boolean),\n disabled,\n autofocus,\n tabindex,\n type,\n name,\n }\n\n this.innerHTML = html(btnProps, text)\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,oBAAwD;AAKjD,MAAM,wBAAwB,cAAAA,gBAAqB;AAAA,EAN1D,OAM0D;AAAA;AAAA;AAAA,EACtD,OAAO,SAAU;AACb,QAAI,EAAE,oBAAoB,QAAS;AAEnC,WAAO,eAAe;AAAA,MAClB,gBAAgB,OAAO;AAAA,MACvB;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,oBAA0B;AACtB,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,SAAU;AACN,UAAM;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,IAAI;AACJ,UAAM,OAAO,KAAK,aAAa,MAAM;
|
|
4
|
+
"sourcesContent": ["import { html } from './html.js'\nimport { SubstrateButton as SubstrateButtonLight } from './client.js'\n\n/**\n * This is the full-version -- knows how to render itself in the browser.\n */\nexport class SubstrateButton extends SubstrateButtonLight {\n static define () {\n if (!('customElements' in window)) return\n\n return customElements.define(\n SubstrateButton.TAG || 'substrate-button',\n SubstrateButton\n )\n }\n\n connectedCallback ():void {\n this.render()\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n } = this\n const name = this.getAttribute('name')\n const ariaLabel = this.getAttribute('aria-label')\n\n const classes:(string|null)[] = [\n 'substrate-button',\n this.getAttribute('class')\n ]\n const text = this.innerHTML\n\n const btnProps = {\n classes: classes.filter(Boolean),\n disabled,\n autofocus,\n tabindex,\n type,\n name,\n ariaLabel,\n }\n\n this.innerHTML = html(btnProps, text)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,oBAAwD;AAKjD,MAAM,wBAAwB,cAAAA,gBAAqB;AAAA,EAN1D,OAM0D;AAAA;AAAA;AAAA,EACtD,OAAO,SAAU;AACb,QAAI,EAAE,oBAAoB,QAAS;AAEnC,WAAO,eAAe;AAAA,MAClB,gBAAgB,OAAO;AAAA,MACvB;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,oBAA0B;AACtB,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,SAAU;AACN,UAAM;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,IAAI;AACJ,UAAM,OAAO,KAAK,aAAa,MAAM;AACrC,UAAM,YAAY,KAAK,aAAa,YAAY;AAEhD,UAAM,UAA0B;AAAA,MAC5B;AAAA,MACA,KAAK,aAAa,OAAO;AAAA,IAC7B;AACA,UAAM,OAAO,KAAK;AAElB,UAAM,WAAW;AAAA,MACb,SAAS,QAAQ,OAAO,OAAO;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAEA,SAAK,gBAAY,kBAAK,UAAU,IAAI;AAAA,EACxC;AACJ;",
|
|
6
6
|
"names": ["SubstrateButtonLight"]
|
|
7
7
|
}
|
package/dist/index.css
CHANGED
|
@@ -26,19 +26,51 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/* Respect user's motion preferences */
|
|
30
|
+
@media (prefers-reduced-motion: reduce) {
|
|
31
|
+
@keyframes spin {
|
|
32
|
+
from {
|
|
33
|
+
transform: rotate(0deg);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
to {
|
|
37
|
+
transform: rotate(0deg);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@keyframes spinner {
|
|
42
|
+
to {transform: rotate(0deg);}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@keyframes substrate-button-activate {
|
|
46
|
+
0%, 50%, 100% {
|
|
47
|
+
transform: scale(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
29
52
|
substrate-button {
|
|
30
53
|
display: inline-block;
|
|
31
54
|
user-select: none;
|
|
32
55
|
min-width: 8rem;
|
|
56
|
+
transition: all 0.3s;
|
|
33
57
|
}
|
|
34
58
|
|
|
59
|
+
substrate-button button {
|
|
60
|
+
transition: all 0.3s ease;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:is(substrate-button button):hover {
|
|
64
|
+
box-shadow: 0 4px 12px #00000026;
|
|
65
|
+
transform: translateY(-2px);
|
|
66
|
+
}
|
|
67
|
+
|
|
35
68
|
substrate-button.substrate-loading {
|
|
36
69
|
pointer-events: none;
|
|
37
70
|
}
|
|
38
71
|
|
|
39
72
|
substrate-button.substrate-loading button {
|
|
40
73
|
color: transparent;
|
|
41
|
-
transition: all 0.3s ease;
|
|
42
74
|
pointer-events: none;
|
|
43
75
|
}
|
|
44
76
|
|
|
@@ -70,30 +102,56 @@ substrate-button[aria-disabled="true"] button {
|
|
|
70
102
|
user-select: none;
|
|
71
103
|
background-color: transparent
|
|
72
104
|
}
|
|
73
|
-
|
|
105
|
+
|
|
106
|
+
/* Disable animations and transitions for users who prefer reduced motion */
|
|
107
|
+
@media (prefers-reduced-motion: reduce) {
|
|
108
|
+
substrate-button.substrate-loading button {
|
|
109
|
+
transition: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:is(substrate-button.substrate-loading button)::after {
|
|
113
|
+
animation: none;
|
|
114
|
+
/* Show a static indicator instead of spinning */
|
|
115
|
+
border: 2px solid black;
|
|
116
|
+
opacity: 0.5;
|
|
117
|
+
}
|
|
118
|
+
button.substrate-button:not([disabled]):active {
|
|
119
|
+
animation: none;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:root {
|
|
124
|
+
--default-color: #36393d;
|
|
125
|
+
}
|
|
126
|
+
|
|
74
127
|
button.substrate-button {
|
|
75
128
|
border: 1px solid black;
|
|
76
|
-
color: var(--
|
|
77
|
-
font-family: var(--substrate-font, 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif);
|
|
129
|
+
color: var(--default-color);
|
|
78
130
|
padding: 0.5em 1em;
|
|
79
131
|
position: relative;
|
|
80
132
|
background-color: var(--substrate-button-background, transparent);
|
|
81
133
|
appearance: none;
|
|
134
|
+
outline: 2px solid transparent;
|
|
82
135
|
}
|
|
83
|
-
|
|
84
|
-
button.substrate-button:active {
|
|
85
|
-
color: var(--substrate-medium, #999da0);
|
|
86
|
-
background-color: var(--substrate-button-background-disabled, #f7f7f5);
|
|
87
|
-
}
|
|
88
|
-
|
|
136
|
+
|
|
89
137
|
button.substrate-button:disabled {
|
|
90
138
|
pointer-events: none;
|
|
91
139
|
opacity: 0.4;
|
|
92
140
|
}
|
|
93
|
-
|
|
141
|
+
|
|
142
|
+
/* Enhanced focus visibility */
|
|
143
|
+
|
|
144
|
+
button.substrate-button:focus,button.substrate-button:focus-visible {
|
|
145
|
+
outline: 2px solid var(--default-color);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
button.substrate-button:focus:not(:focus-visible) {
|
|
149
|
+
outline-color: transparent;
|
|
150
|
+
}
|
|
151
|
+
|
|
94
152
|
button.substrate-button:not([disabled]):active {
|
|
95
153
|
animation-duration: .2s;
|
|
96
154
|
animation-name: substrate-button-activate;
|
|
97
155
|
transition-timing-function: ease;
|
|
98
156
|
}
|
|
99
|
-
/*# sourceMappingURL=data:application/json;base64,
|
|
157
|
+
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7SUFDSTtRQUNJLHVCQUF1QjtJQUMzQjs7SUFFQTtRQUNJLHlCQUF5QjtJQUM3QjtBQUNKOztBQUVBO0lBQ0ksSUFBSSx5QkFBeUIsQ0FBQztBQUNsQzs7QUFFQTtJQUNJO1FBQ0ksbUJBQW1CO0lBQ3ZCOztJQUVBO1FBQ0ksc0JBQXNCO0lBQzFCOztJQUVBO1FBQ0ksbUJBQW1CO0lBQ3ZCO0FBQ0o7O0FBRUEsc0NBQXNDO0FBQ3RDO0lBQ0k7UUFDSTtZQUNJLHVCQUF1QjtRQUMzQjs7UUFFQTtZQUNJLHVCQUF1QjtRQUMzQjtJQUNKOztJQUVBO1FBQ0ksSUFBSSx1QkFBdUIsQ0FBQztJQUNoQzs7SUFFQTtRQUNJO1lBQ0ksbUJBQW1CO1FBQ3ZCO0lBQ0o7QUFDSjs7QUFFQTtJQUNJLHFCQUFxQjtJQUNyQixpQkFBaUI7SUFDakIsZUFBZTtJQUNmLG9CQUFvQjtBQWdEeEI7O0FBOUNJO1FBQ0kseUJBQXlCO0lBTTdCOztBQUpJO1lBQ0ksZ0NBQWdDO1lBQ2hDLDJCQUEyQjtRQUMvQjs7QUFHSjtRQUNJLG9CQUFvQjtJQXlCeEI7O0FBdkJJO1lBQ0ksa0JBQWtCO1lBQ2xCLG9CQUFvQjtRQW9CeEI7O0FBbEJJO2dCQUNJLGtCQUFrQjtZQUN0Qjs7QUFFQTtnQkFDSSxXQUFXO2dCQUNYLHVCQUF1QjtnQkFDdkIsc0JBQXNCO2dCQUN0QixrQkFBa0I7Z0JBQ2xCLFdBQVc7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bCAwLjNzIGVhc2U7XG5cbiAgICAgICAgJjpob3ZlciB7XG4gICAgICAgICAgICBib3gtc2hhZG93OiAwIDRweCAxMnB4ICMwMDAwMDAyNjtcbiAgICAgICAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgtMnB4KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgICYuc3Vic3RyYXRlLWxvYWRpbmcge1xuICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcblxuICAgICAgICAmIGJ1dHRvbiB7XG4gICAgICAgICAgICBjb2xvcjogdHJhbnNwYXJlbnQ7XG4gICAgICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcblxuICAgICAgICAgICAgJjpob3ZlciB7XG4gICAgICAgICAgICAgICAgY29sb3I6IHRyYW5zcGFyZW50O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAmOjphZnRlciB7XG4gICAgICAgICAgICAgICAgY29udGVudDogXCJcIjtcbiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudDtcbiAgICAgICAgICAgICAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgICAgICAgICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgICAgICAgICB3aWR0aDogMTZweDtcbiAgICAgICAgICAgICAgICBoZWlnaHQ6IDE2cHg7XG4gICAgICAgICAgICAgICAgaW5zZXQ6IDA7XG4gICAgICAgICAgICAgICAgbWFyZ2luOiBhdXRvO1xuICAgICAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6IDUwJTtcbiAgICAgICAgICAgICAgICBib3JkZXItdG9wOiAycHggc29saWQgYmxhY2s7XG4gICAgICAgICAgICAgICAgYm9yZGVyLXJpZ2h0OiAycHggc29saWQgdHJhbnNwYXJlbnQ7XG4gICAgICAgICAgICAgICAgYW5pbWF0aW9uOiBzcGlubmVyIDAuNnMgbGluZWFyIGluZmluaXRlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgICZbYXJpYS1kaXNhYmxlZD1cInRydWVcIl0ge1xuICAgICAgICB1c2VyLXNlbGVjdDogbm9uZTtcbiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG5cbiAgICAgICAgJiBidXR0b24ge1xuICAgICAgICAgICAgdXNlci1zZWxlY3Q6IG5vbmU7XG4gICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudFxuICAgICAgICB9XG4gICAgfVxufVxuXG4vKiBEaXNhYmxlIGFuaW1hdGlvbnMgYW5kIHRyYW5zaXRpb25zIGZvciB1c2VycyB3aG8gcHJlZmVyIHJlZHVjZWQgbW90aW9uICovXG5AbWVkaWEgKHByZWZlcnMtcmVkdWNlZC1tb3Rpb246IHJlZHVjZSkge1xuICAgIHN1YnN0cmF0ZS1idXR0b24ge1xuICAgICAgICAmLnN1YnN0cmF0ZS1sb2FkaW5nIHtcbiAgICAgICAgICAgICYgYnV0dG9uIHtcbiAgICAgICAgICAgICAgICB0cmFuc2l0aW9uOiBub25lO1xuXG4gICAgICAgICAgICAgICAgJjo6YWZ0ZXIge1xuICAgICAgICAgICAgICAgICAgICBhbmltYXRpb246IG5vbmU7XG4gICAgICAgICAgICAgICAgICAgIC8qIFNob3cgYSBzdGF0aWMgaW5kaWNhdG9yIGluc3RlYWQgb2Ygc3Bpbm5pbmcgKi9cbiAgICAgICAgICAgICAgICAgICAgYm9yZGVyOiAycHggc29saWQgYmxhY2s7XG4gICAgICAgICAgICAgICAgICAgIG9wYWNpdHk6IDAuNTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBidXR0b24uc3Vic3RyYXRlLWJ1dHRvbiB7XG4gICAgICAgICY6bm90KFtkaXNhYmxlZF0pIHtcbiAgICAgICAgICAgICY6YWN0aXZlIHtcbiAgICAgICAgICAgICAgICBhbmltYXRpb246IG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4gICAgICAgIH1cbiAgICB9XG59Il19 */
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAErE;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBAAoB;IACrD,MAAM,CAAC,MAAM;IASb,iBAAiB,IAAI,IAAI;IAIzB,MAAM;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAErE;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBAAoB;IACrD,MAAM,CAAC,MAAM;IASb,iBAAiB,IAAI,IAAI;IAIzB,MAAM;CA4BT"}
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ class SubstrateButton extends SubstrateButtonLight {
|
|
|
24
24
|
disabled
|
|
25
25
|
} = this;
|
|
26
26
|
const name = this.getAttribute("name");
|
|
27
|
+
const ariaLabel = this.getAttribute("aria-label");
|
|
27
28
|
const classes = [
|
|
28
29
|
"substrate-button",
|
|
29
30
|
this.getAttribute("class")
|
|
@@ -35,7 +36,8 @@ class SubstrateButton extends SubstrateButtonLight {
|
|
|
35
36
|
autofocus,
|
|
36
37
|
tabindex,
|
|
37
38
|
type,
|
|
38
|
-
name
|
|
39
|
+
name,
|
|
40
|
+
ariaLabel
|
|
39
41
|
};
|
|
40
42
|
this.innerHTML = html(btnProps, text);
|
|
41
43
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { html } from './html.js'\nimport { SubstrateButton as SubstrateButtonLight } from './client.js'\n\n/**\n * This is the full-version -- knows how to render itself in the browser.\n */\nexport class SubstrateButton extends SubstrateButtonLight {\n static define () {\n if (!('customElements' in window)) return\n\n return customElements.define(\n SubstrateButton.TAG || 'substrate-button',\n SubstrateButton\n )\n }\n\n connectedCallback ():void {\n this.render()\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n } = this\n const name = this.getAttribute('name')\n\n const classes:(string|null)[] = [\n 'substrate-button',\n this.getAttribute('class')\n ]\n const text = this.innerHTML\n\n const btnProps = {\n classes: classes.filter(Boolean),\n disabled,\n autofocus,\n tabindex,\n type,\n name,\n }\n\n this.innerHTML = html(btnProps, text)\n }\n}\n"],
|
|
5
|
-
"mappings": ";;AAAA,SAAS,YAAY;AACrB,SAAS,mBAAmB,4BAA4B;AAKjD,MAAM,wBAAwB,qBAAqB;AAAA,EAN1D,OAM0D;AAAA;AAAA;AAAA,EACtD,OAAO,SAAU;AACb,QAAI,EAAE,oBAAoB,QAAS;AAEnC,WAAO,eAAe;AAAA,MAClB,gBAAgB,OAAO;AAAA,MACvB;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,oBAA0B;AACtB,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,SAAU;AACN,UAAM;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,IAAI;AACJ,UAAM,OAAO,KAAK,aAAa,MAAM;
|
|
4
|
+
"sourcesContent": ["import { html } from './html.js'\nimport { SubstrateButton as SubstrateButtonLight } from './client.js'\n\n/**\n * This is the full-version -- knows how to render itself in the browser.\n */\nexport class SubstrateButton extends SubstrateButtonLight {\n static define () {\n if (!('customElements' in window)) return\n\n return customElements.define(\n SubstrateButton.TAG || 'substrate-button',\n SubstrateButton\n )\n }\n\n connectedCallback ():void {\n this.render()\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n } = this\n const name = this.getAttribute('name')\n const ariaLabel = this.getAttribute('aria-label')\n\n const classes:(string|null)[] = [\n 'substrate-button',\n this.getAttribute('class')\n ]\n const text = this.innerHTML\n\n const btnProps = {\n classes: classes.filter(Boolean),\n disabled,\n autofocus,\n tabindex,\n type,\n name,\n ariaLabel,\n }\n\n this.innerHTML = html(btnProps, text)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA,SAAS,YAAY;AACrB,SAAS,mBAAmB,4BAA4B;AAKjD,MAAM,wBAAwB,qBAAqB;AAAA,EAN1D,OAM0D;AAAA;AAAA;AAAA,EACtD,OAAO,SAAU;AACb,QAAI,EAAE,oBAAoB,QAAS;AAEnC,WAAO,eAAe;AAAA,MAClB,gBAAgB,OAAO;AAAA,MACvB;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,oBAA0B;AACtB,SAAK,OAAO;AAAA,EAChB;AAAA,EAEA,SAAU;AACN,UAAM;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,IAAI;AACJ,UAAM,OAAO,KAAK,aAAa,MAAM;AACrC,UAAM,YAAY,KAAK,aAAa,YAAY;AAEhD,UAAM,UAA0B;AAAA,MAC5B;AAAA,MACA,KAAK,aAAa,OAAO;AAAA,IAC7B;AACA,UAAM,OAAO,KAAK;AAElB,UAAM,WAAW;AAAA,MACb,SAAS,QAAQ,OAAO,OAAO;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAEA,SAAK,YAAY,KAAK,UAAU,IAAI;AAAA,EACxC;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.min.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes spinner{to{transform:rotate(1turn)}}@keyframes substrate-button-activate{0%{transform:scale(1)}50%{transform:scale(.95)}to{transform:scale(1)}}substrate-button{display:inline-block;min-width:8rem;user-select:none}substrate-button.substrate-loading{pointer-events:none}substrate-button.substrate-loading button{color:transparent;pointer-events:none
|
|
2
|
-
/*# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes spinner{to{transform:rotate(1turn)}}@keyframes substrate-button-activate{0%{transform:scale(1)}50%{transform:scale(.95)}to{transform:scale(1)}}@media (prefers-reduced-motion:reduce){@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(0deg)}}@keyframes spinner{to{transform:rotate(0deg)}}@keyframes substrate-button-activate{0%,50%,to{transform:scale(1)}}}substrate-button{display:inline-block;min-width:8rem;transition:all .3s;user-select:none}substrate-button button{transition:all .3s ease}:is(substrate-button button):hover{box-shadow:0 4px 12px #00000026;transform:translateY(-2px)}substrate-button.substrate-loading{pointer-events:none}substrate-button.substrate-loading button{color:transparent;pointer-events:none}:is(substrate-button.substrate-loading button):hover{color:transparent}:is(substrate-button.substrate-loading button):after{animation:spinner .6s linear infinite;background:transparent;border-radius:50%;border-right:2px solid transparent;border-top:2px solid #000;box-sizing:border-box;content:"";height:16px;inset:0;margin:auto;position:absolute;width:16px}substrate-button[aria-disabled=true],substrate-button[aria-disabled=true] button{background-color:transparent;user-select:none}@media (prefers-reduced-motion:reduce){substrate-button.substrate-loading button{transition:none}:is(substrate-button.substrate-loading button):after{animation:none;border:2px solid #000;opacity:.5}button.substrate-button:not([disabled]):active{animation:none}}:root{--default-color:#36393d}button.substrate-button{appearance:none;background-color:var(--substrate-button-background,transparent);border:1px solid #000;color:var(--default-color);outline:2px solid transparent;padding:.5em 1em;position:relative}button.substrate-button:disabled{opacity:.4;pointer-events:none}button.substrate-button:focus,button.substrate-button:focus-visible{outline:2px solid var(--default-color)}button.substrate-button:focus:not(:focus-visible){outline-color:transparent}button.substrate-button:not([disabled]):active{animation-duration:.2s;animation-name:substrate-button-activate;transition-timing-function:ease}
|
|
2
|
+
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5j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lcyBzcGlubmVyIHtcbiAgICAgICAgdG8ge3RyYW5zZm9ybTogcm90YXRlKDBkZWcpO31cbiAgICB9XG5cbiAgICBAa2V5ZnJhbWVzIHN1YnN0cmF0ZS1idXR0b24tYWN0aXZhdGUge1xuICAgICAgICAwJSwgNTAlLCAxMDAlIHtcbiAgICAgICAgICAgIHRyYW5zZm9ybTogc2NhbGUoMSk7XG4gICAgICAgIH1cbiAgICB9XG59XG5cbnN1YnN0cmF0ZS1idXR0b24ge1xuICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICB1c2VyLXNlbGVjdDogbm9uZTtcbiAgICBtaW4td2lkdGg6IDhyZW07XG4gICAgdHJhbnNpdGlvbjogYWxsIDAuM3M7XG5cbiAgICAmIGJ1dHRvbiB7XG4gICAgICAgIHRyYW5zaXRpb246IGFsbCAwLjNzIGVhc2U7XG5cbiAgICAgICAgJjpob3ZlciB7XG4gICAgICAgICAgICBib3gtc2hhZG93OiAwIDRweCAxMnB4ICMwMDAwMDAyNjtcbiAgICAgICAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgtMnB4KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgICYuc3Vic3RyYXRlLWxvYWRpbmcge1xuICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcblxuICAgICAgICAmIGJ1dHRvbiB7XG4gICAgICAgICAgICBjb2xvcjogdHJhbnNwYXJlbnQ7XG4gICAgICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcblxuICAgICAgICAgICAgJjpob3ZlciB7XG4gICAgICAgICAgICAgICAgY29sb3I6IHRyYW5zcGFyZW50O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAmOjphZnRlciB7XG4gICAgICAgICAgICAgICAgY29udGVudDogXCJcIjtcbiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudDtcbiAgICAgICAgICAgICAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgICAgICAgICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgICAgICAgICB3aWR0aDogMTZweDtcbiAgICAgICAgICAgICAgICBoZWlnaHQ6IDE2cHg7XG4gICAgICAgICAgICAgICAgaW5zZXQ6IDA7XG4gICAgICAgICAgICAgICAgbWFyZ2luOiBhdXRvO1xuICAgICAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6IDUwJTtcbiAgICAgICAgICAgICAgICBib3JkZXItdG9wOiAycHggc29saWQgYmxhY2s7XG4gICAgICAgICAgICAgICAgYm9yZGVyLXJpZ2h0OiAycHggc29saWQgdHJhbnNwYXJlbnQ7XG4gICAgICAgICAgICAgICAgYW5pbWF0aW9uOiBzcGlubmVyIDAuNnMgbGluZWFyIGluZmluaXRlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgICZbYXJpYS1kaXNhYmxlZD1cInRydWVcIl0ge1xuICAgICAgICB1c2VyLXNlbGVjdDogbm9uZTtcbiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG5cbiAgICAgICAgJiBidXR0b24ge1xuICAgICAgICAgICAgdXNlci1zZWxlY3Q6IG5vbmU7XG4gICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudFxuICAgICAgICB9XG4gICAgfVxufVxuXG4vKiBEaXNhYmxlIGFuaW1hdGlvbnMgYW5kIHRyYW5zaXRpb25zIGZvciB1c2VycyB3aG8gcHJlZmVyIHJlZHVjZWQgbW90aW9uICovXG5AbWVkaWEgKHByZWZlcnMtcmVkdWNlZC1tb3Rpb246IHJlZHVjZSkge1xuICAgIHN1YnN0cmF0ZS1idXR0b24ge1xuICAgICAgICAmLnN1YnN0cmF0ZS1sb2FkaW5nIHtcbiAgICAgICAgICAgICYgYnV0dG9uIHtcbiAgICAgICAgICAgICAgICB0cmFuc2l0aW9uOiBub25lO1xuXG4gICAgICAgICAgICAgICAgJjo6YWZ0ZXIge1xuICAgICAgICAgICAgICAgICAgICBhbmltYXRpb246IG5vbmU7XG4gICAgICAgICAgICAgICAgICAgIC8qIFNob3cgYSBzdGF0aWMgaW5kaWNhdG9yIGluc3RlYWQgb2Ygc3Bpbm5pbmcgKi9cbiAgICAgICAgICAgICAgICAgICAgYm9yZGVyOiAycHggc29saWQgYmxhY2s7XG4gICAgICAgICAgICAgICAgICAgIG9wYWNpdHk6IDAuNTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBidXR0b24uc3Vic3RyYXRlLWJ1dHRvbiB7XG4gICAgICAgICY6bm90KFtkaXNhYmxlZF0pIHtcbiAgICAgICAgICAgICY6YWN0aXZlIHtcbiAgICAgICAgICAgICAgICBhbmltYXRpb246IG5vbmU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG5cbjpyb290IHtcbiAgICAtLWRlZmF1bHQtY29sb3I6ICMzNjM5M2Q7XG59XG5cbmJ1dHRvbi5zdWJzdHJhdGUtYnV0dG9uIHtcbiAgICBib3JkZXI6IDFweCBzb2xpZCBibGFjaztcbiAgICBjb2xvcjogdmFyKC0tZGVmYXVsdC1jb2xvcik7XG4gICAgcGFkZGluZzogMC41ZW0gMWVtO1xuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiB2YXIoLS1zdWJzdHJhdGUtYnV0dG9uLWJhY2tncm91bmQsIHRyYW5zcGFyZW50KTtcbiAgICBhcHBlYXJhbmNlOiBub25lO1xuICAgIG91dGxpbmU6IDJweCBzb2xpZCB0cmFuc3BhcmVudDtcblxuICAgICY6ZGlzYWJsZWQge1xuICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcbiAgICAgICAgb3BhY2l0eTogMC40O1xuICAgIH1cblxuICAgIC8qIEVuaGFuY2VkIGZvY3VzIHZpc2liaWxpdHkgKi9cbiAgICAmOmZvY3VzLCAmOmZvY3VzLXZpc2libGUge1xuICAgICAgICBvdXRsaW5lOiAycHggc29saWQgdmFyKC0tZGVmYXVsdC1jb2xvcik7XG4gICAgfVxuXG4gICAgJjpmb2N1czpub3QoOmZvY3VzLXZpc2libGUpIHtcbiAgICAgICAgb3V0bGluZS1jb2xvcjogdHJhbnNwYXJlbnQ7XG4gICAgfVxuXG4gICAgJjpub3QoW2Rpc2FibGVkXSkge1xuICAgICAgICAmOmFjdGl2ZSB7XG4gICAgICAgICAgICBhbmltYXRpb24tZHVyYXRpb246IC4ycztcbiAgICAgICAgICAgIGFuaW1hdGlvbi1uYW1lOiBzdWJzdHJhdGUtYnV0dG9uLWFjdGl2YXRlO1xuICAgICAgICAgICAgdHJhbnNpdGlvbi10aW1pbmctZnVuY3Rpb246IGVhc2U7XG4gICAgICAgIH1cbiAgICB9XG59Il19 */
|
package/dist/index.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
<button ${
|
|
3
|
-
</substrate-button
|
|
1
|
+
var m=Object.defineProperty;var i=(s,t)=>m(s,"name",{value:t,configurable:!0});function g(s,t){let{type:e,autofocus:r,tabindex:n,disabled:o,classes:d,name:u,ariaLabel:a}=s,b=new Set(d);b.add("substrate-button");let c=Array.from(b),h=[c.length?`class="${c.filter(Boolean).join(" ")}"`:"",o?"disabled":"",r?"autofocus":"",e?`type="${e}"`:"",u?`name=${u}`:"",n?`tabindex="${n}"`:'tabindex="0"','role="button"',a?`aria-label="${a}"`:"",'aria-live="polite"'].filter(Boolean).join(" ");return typeof window>"u"?`<substrate-button${o?" disabled":""}>
|
|
2
|
+
<button ${h}>${t}</button>
|
|
3
|
+
</substrate-button>`:`<button ${h}>
|
|
4
4
|
${t}
|
|
5
|
-
</button>`}
|
|
5
|
+
</button>`}i(g,"html");var l=class s extends HTMLElement{static{i(this,"SubstrateButton")}static observedAttributes=["autofocus","disabled","spinning"];static TAG="substrate-button";_isSpinning;constructor(){super(),this.getAttribute("disabled")!==null&&setTimeout(()=>{this.disabled=!0},0),this.autofocus=this.getAttribute("autofocus")!==null,this._isSpinning=this.getAttribute("spinning")!==null}get form(){return this.button?.form}get disabled(){return!!this.button?.hasAttribute("disabled")}set disabled(t){t?(this.button?.setAttribute("disabled",""),this.button?.setAttribute("aria-disabled","true")):(this._removeAttribute("disabled"),this.button?.setAttribute("aria-disabled","false"))}get type(){return this.button?.getAttribute("type")}get tabindex(){let t=this.button?.getAttribute("tabindex");return t?parseInt(t):0}get spinning(){return this._isSpinning}set spinning(t){t?this.setAttribute("spinning",""):this.removeAttribute("spinning")}set type(t){this._setAttribute("type",t)}get autofocus(){return!!this.button?.hasAttribute("autofocus")}set autofocus(t){t?this._setAttribute("autofocus",t):this._removeAttribute("autofocus")}_setAttribute(t,e){if(e===!1)this._removeAttribute(t),this.button?.removeAttribute(t);else{if(e===!0)return this.button?.setAttribute(t,"");if(e===null)return this._removeAttribute(t);this.button?.setAttribute(t,e)}}_removeAttribute(t){this.removeAttribute(t),this.button?.removeAttribute(t)}get button(){return this.querySelector("button")}handleChange_autofocus(t,e){this._setAttribute("autofocus",e)}handleChange_disabled(t,e){this.disabled=e!==null,e===null?this.button?.removeAttribute("disabled"):this.button?.setAttribute("disabled",""+e)}handleChange_spinning(t,e){e!==null?(this.classList.add("substrate-loading"),this.button?.setAttribute("aria-busy","true")):(this.classList.remove("substrate-loading"),this.button?.setAttribute("aria-busy","false"))}attributeChangedCallback(t,e,r){let n=this[`handleChange_${t}`];n&&n.call(this,e,r)}connectedCallback(){this.render(),this._setupKeyboardHandlers()}_setupKeyboardHandlers(){this.button?.addEventListener("keydown",t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),this.button?.click())})}static define(){return p(s.TAG,s)}render(){}};function A(s){return document.createElement(s).constructor!==window.HTMLElement}i(A,"isRegistered");function p(s,t){window&&"customElements"in window&&(A(s)||window.customElements.define(s,t))}i(p,"define");var f=class s extends l{static{i(this,"SubstrateButton")}static define(){if("customElements"in window)return customElements.define(s.TAG||"substrate-button",s)}connectedCallback(){this.render()}render(){let{type:t,autofocus:e,tabindex:r,disabled:n}=this,o=this.getAttribute("name"),d=this.getAttribute("aria-label"),u=["substrate-button",this.getAttribute("class")],a=this.innerHTML,b={classes:u.filter(Boolean),disabled:n,autofocus:e,tabindex:r,type:t,name:o,ariaLabel:d};this.innerHTML=g(b,a)}};export{f as SubstrateButton};
|
|
6
6
|
//# sourceMappingURL=index.min.js.map
|
package/dist/index.min.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/html.ts", "../src/client.ts", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export type Attrs = {\n type:string|null;\n autofocus:boolean;\n tabindex:string|number;\n disabled:boolean;\n name:string|null;\n classes:string[]|Set<string>;\n}\n\nexport function html (attrs:Partial<Attrs>, textContent:string) {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n classes,\n name\n } = attrs\n\n const _classes = new Set(classes)\n _classes.add('substrate-button')\n const arr = Array.from(_classes)\n\n const btnProps = ([\n arr.length ? `class=\"${arr.filter(Boolean).join(' ')}\"` : '',\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${type}\"` : '',\n name ? `name=${name}` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n 'role=\"button\"'\n ]).filter(Boolean).join(' ')\n\n // rendering in node?\n return typeof window === 'undefined' ?\n `<substrate-button${disabled ? ' disabled' : ''}>\n <button ${btnProps}>${textContent}</button>\n </substrate-button
|
|
5
|
-
"mappings": "+
|
|
6
|
-
"names": ["html", "attrs", "textContent", "type", "autofocus", "tabindex", "disabled", "classes", "name", "_classes", "arr", "btnProps", "__name", "SubstrateButton", "_SubstrateButton", "__name", "disabledValue", "i", "value", "name", "_oldValue", "newValue", "_old", "_", "oldValue", "handler", "define", "isRegistered", "elName", "element", "SubstrateButton", "_SubstrateButton", "__name", "type", "autofocus", "tabindex", "disabled", "name", "classes", "text", "btnProps", "html"]
|
|
4
|
+
"sourcesContent": ["export type Attrs = {\n type:string|null;\n autofocus:boolean;\n tabindex:string|number;\n disabled:boolean;\n name:string|null;\n classes:string[]|Set<string>;\n ariaLabel:string|null;\n}\n\nexport function html (attrs:Partial<Attrs>, textContent:string) {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n classes,\n name,\n ariaLabel\n } = attrs\n\n const _classes = new Set(classes)\n _classes.add('substrate-button')\n const arr = Array.from(_classes)\n\n const btnProps = ([\n arr.length ? `class=\"${arr.filter(Boolean).join(' ')}\"` : '',\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${type}\"` : '',\n name ? `name=${name}` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n 'role=\"button\"',\n ariaLabel ? `aria-label=\"${ariaLabel}\"` : '',\n 'aria-live=\"polite\"'\n ]).filter(Boolean).join(' ')\n\n // rendering in node?\n return typeof window === 'undefined' ?\n `<substrate-button${disabled ? ' disabled' : ''}>\n <button ${btnProps}>${textContent}</button>\n </substrate-button>` :\n `<button ${btnProps}>\n ${textContent}\n </button>`\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 + 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", "import { html } from './html.js'\nimport { SubstrateButton as SubstrateButtonLight } from './client.js'\n\n/**\n * This is the full-version -- knows how to render itself in the browser.\n */\nexport class SubstrateButton extends SubstrateButtonLight {\n static define () {\n if (!('customElements' in window)) return\n\n return customElements.define(\n SubstrateButton.TAG || 'substrate-button',\n SubstrateButton\n )\n }\n\n connectedCallback ():void {\n this.render()\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n } = this\n const name = this.getAttribute('name')\n const ariaLabel = this.getAttribute('aria-label')\n\n const classes:(string|null)[] = [\n 'substrate-button',\n this.getAttribute('class')\n ]\n const text = this.innerHTML\n\n const btnProps = {\n classes: classes.filter(Boolean),\n disabled,\n autofocus,\n tabindex,\n type,\n name,\n ariaLabel,\n }\n\n this.innerHTML = html(btnProps, text)\n }\n}\n"],
|
|
5
|
+
"mappings": "+EAUO,SAASA,EAAMC,EAAsBC,EAAoB,CAC5D,GAAM,CACF,KAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,KAAAC,EACA,UAAAC,CACJ,EAAIR,EAEES,EAAW,IAAI,IAAIH,CAAO,EAChCG,EAAS,IAAI,kBAAkB,EAC/B,IAAMC,EAAM,MAAM,KAAKD,CAAQ,EAEzBE,EAAY,CACdD,EAAI,OAAS,UAAUA,EAAI,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,IAAM,GAC1DL,EAAW,WAAa,GACxBF,EAAY,YAAc,GAC1BD,EAAO,SAASA,CAAI,IAAM,GAC1BK,EAAO,QAAQA,CAAI,GAAK,GACxBH,EAAW,aAAaA,CAAQ,IAAM,eACtC,gBACAI,EAAY,eAAeA,CAAS,IAAM,GAC1C,oBACJ,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG,EAG3B,OAAO,OAAO,OAAW,IACrB,oBAAoBH,EAAW,YAAc,EAAE;AAAA,sBACjCM,CAAQ,IAAIV,CAAW;AAAA,6BAErC,WAAWU,CAAQ;AAAA,cACbV,CAAW;AAAA,kBAEzB,CAnCgBW,EAAAb,EAAA,QCAT,IAAMc,EAAN,MAAMC,UAAwB,WAAY,CAVjD,MAUiD,CAAAC,EAAA,wBAE7C,OAAO,mBAAqB,CAAC,YAAa,WAAY,UAAU,EAChE,OAAO,IAAM,mBACb,YAEA,aAAe,CACX,MAAM,EACW,KAAK,aAAa,UAAU,IAC5B,MACb,WAAW,IAAM,CAEb,KAAK,SAAW,EACpB,EAAG,CAAC,EAER,KAAK,UAAa,KAAK,aAAa,WAAW,IAAM,KACrD,KAAK,YAAe,KAAK,aAAa,UAAU,IAAM,IAC1D,C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E,EAAA,wBACtD,OAAO,QAAU,CACb,GAAM,mBAAoB,OAE1B,OAAO,eAAe,OAClBD,EAAgB,KAAO,mBACvBA,CACJ,CACJ,CAEA,mBAA0B,CACtB,KAAK,OAAO,CAChB,CAEA,QAAU,CACN,GAAM,CACF,KAAAE,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,CACJ,EAAI,KACEC,EAAO,KAAK,aAAa,MAAM,EAC/BC,EAAY,KAAK,aAAa,YAAY,EAE1CC,EAA0B,CAC5B,mBACA,KAAK,aAAa,OAAO,CAC7B,EACMC,EAAO,KAAK,UAEZC,EAAW,CACb,QAASF,EAAQ,OAAO,OAAO,EAC/B,SAAAH,EACA,UAAAF,EACA,SAAAC,EACA,KAAAF,EACA,KAAAI,EACA,UAAAC,CACJ,EAEA,KAAK,UAAYI,EAAKD,EAAUD,CAAI,CACxC,CACJ",
|
|
6
|
+
"names": ["html", "attrs", "textContent", "type", "autofocus", "tabindex", "disabled", "classes", "name", "ariaLabel", "_classes", "arr", "btnProps", "__name", "SubstrateButton", "_SubstrateButton", "__name", "disabledValue", "i", "value", "name", "_oldValue", "newValue", "_old", "_", "oldValue", "handler", "e", "define", "isRegistered", "elName", "element", "SubstrateButton", "_SubstrateButton", "__name", "type", "autofocus", "tabindex", "disabled", "name", "ariaLabel", "classes", "text", "btnProps", "html"]
|
|
7
7
|
}
|
package/dist/meta.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"inputs": {
|
|
3
3
|
"src/client.ts": {
|
|
4
|
-
"bytes":
|
|
4
|
+
"bytes": 5793,
|
|
5
5
|
"imports": [],
|
|
6
6
|
"format": "esm"
|
|
7
7
|
},
|
|
8
8
|
"src/html.ts": {
|
|
9
|
-
"bytes":
|
|
9
|
+
"bytes": 1265,
|
|
10
10
|
"imports": [],
|
|
11
11
|
"format": "esm"
|
|
12
12
|
},
|
|
13
13
|
"src/index.ts": {
|
|
14
|
-
"bytes":
|
|
14
|
+
"bytes": 1183,
|
|
15
15
|
"imports": [],
|
|
16
16
|
"format": "esm"
|
|
17
17
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"imports": [],
|
|
22
22
|
"exports": [],
|
|
23
23
|
"inputs": {},
|
|
24
|
-
"bytes":
|
|
24
|
+
"bytes": 9012
|
|
25
25
|
},
|
|
26
26
|
"dist/client.js": {
|
|
27
27
|
"imports": [],
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"entryPoint": "src/client.ts",
|
|
34
34
|
"inputs": {
|
|
35
35
|
"src/client.ts": {
|
|
36
|
-
"bytesInOutput":
|
|
36
|
+
"bytesInOutput": 4480
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
"bytes":
|
|
39
|
+
"bytes": 4700
|
|
40
40
|
},
|
|
41
41
|
"dist/html.js.map": {
|
|
42
42
|
"imports": [],
|
|
43
43
|
"exports": [],
|
|
44
44
|
"inputs": {},
|
|
45
|
-
"bytes":
|
|
45
|
+
"bytes": 2084
|
|
46
46
|
},
|
|
47
47
|
"dist/html.js": {
|
|
48
48
|
"imports": [],
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"entryPoint": "src/html.ts",
|
|
53
53
|
"inputs": {
|
|
54
54
|
"src/html.ts": {
|
|
55
|
-
"bytesInOutput":
|
|
55
|
+
"bytesInOutput": 933
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
|
-
"bytes":
|
|
58
|
+
"bytes": 1114
|
|
59
59
|
},
|
|
60
60
|
"dist/index.js.map": {
|
|
61
61
|
"imports": [],
|
|
62
62
|
"exports": [],
|
|
63
63
|
"inputs": {},
|
|
64
|
-
"bytes":
|
|
64
|
+
"bytes": 1988
|
|
65
65
|
},
|
|
66
66
|
"dist/index.js": {
|
|
67
67
|
"imports": [
|
|
@@ -82,10 +82,10 @@
|
|
|
82
82
|
"entryPoint": "src/index.ts",
|
|
83
83
|
"inputs": {
|
|
84
84
|
"src/index.ts": {
|
|
85
|
-
"bytesInOutput":
|
|
85
|
+
"bytesInOutput": 967
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
|
-
"bytes":
|
|
88
|
+
"bytes": 1160
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|