@substrate-system/input 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![types](https://img.shields.io/npm/types/@substrate-system/input?style=flat-square)](README.md)
4
4
  [![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)
5
5
  [![install size](https://packagephobia.com/badge?p=@substrate-system/input)](https://packagephobia.com/result?p=@substrate-system/input)
6
- <!-- [![GZip size](https://img.badgesize.io/https%3A%2F%2Fesm.sh%2F%40substrate-system%2Finput%2Fes2022%2Finput.mjs?style=flat-square&compression=gzip)](https://esm.sh/@substrate-system/input/es2022/input.mjs) -->
6
+ [![GZip size](https://img.badgesize.io/https%3A%2F%2Fesm.sh%2F%40substrate-system%2Finput%2Fes2022%2Finput.mjs?style=flat-square&compression=gzip)](https://esm.sh/@substrate-system/input/es2022/input.mjs)
7
7
  [![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json)
8
8
  [![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/)
9
9
  [![Common Changelog](https://nichoth.github.io/badge/common-changelog.svg)](./CHANGELOG.md)
@@ -16,6 +16,15 @@ A parent web component to inherit from.
16
16
 
17
17
  <!-- toc -->
18
18
 
19
+ - [install](#install)
20
+ - [API](#api)
21
+ * [ESM](#esm)
22
+ * [Common JS](#common-js)
23
+ - [Use](#use)
24
+ * [JS](#js)
25
+
26
+ <!-- tocstop -->
27
+
19
28
  ## install
20
29
 
21
30
  ```sh
package/dist/index.cjs CHANGED
@@ -22,8 +22,6 @@ __export(index_exports, {
22
22
  Input: () => Input
23
23
  });
24
24
  module.exports = __toCommonJS(index_exports);
25
- var import_debug = require("@substrate-system/debug");
26
- const debug = (0, import_debug.createDebug)();
27
25
  class Input extends HTMLElement {
28
26
  static {
29
27
  __name(this, "Input");
@@ -47,9 +45,9 @@ class Input extends HTMLElement {
47
45
  }
48
46
  setTimeout(() => {
49
47
  const attr = this.getAttribute("value");
50
- if (attr) {
51
- this.value = attr;
52
- }
48
+ if (attr) this.value = attr;
49
+ const type = this.getAttribute("type");
50
+ if (type) this.type = type;
53
51
  }, 0);
54
52
  }
55
53
  get input() {
@@ -87,9 +85,7 @@ class Input extends HTMLElement {
87
85
  * @param {string} newValue The new attribute value
88
86
  */
89
87
  handleChange_disabled(oldValue, newValue) {
90
- debug("changing disabled", oldValue, newValue);
91
88
  if (!this.input) {
92
- debug("not input");
93
89
  setTimeout(() => {
94
90
  if (newValue === null) {
95
91
  this.disabled = false;
@@ -98,9 +94,7 @@ class Input extends HTMLElement {
98
94
  }
99
95
  }, 0);
100
96
  } else {
101
- debug("input");
102
97
  if (newValue === null) {
103
- debug("is null");
104
98
  this.disabled = false;
105
99
  } else {
106
100
  this.disabled = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { createDebug } from '@substrate-system/debug'\nconst debug = createDebug()\n\nexport abstract class Input extends HTMLElement {\n // Define the attributes to observe\n // need this for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static tag:string\n\n static define (this:((new (...args:any[]) => Input) & typeof Input)) {\n if (!('customElements' in window)) return\n if (customElements.get(this.tag)) return // only define it once\n\n return customElements.define(this.tag, this)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n\n setTimeout(() => {\n const attr = this.getAttribute('value')\n if (attr) {\n this.value = attr\n }\n }, 0)\n }\n\n get input ():HTMLInputElement|null {\n return this.querySelector('input')\n }\n\n get tabindex ():number {\n const i = this.input?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n /**\n * Remove from `this` element and also child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.input?.removeAttribute(name)\n }\n\n get disabled ():boolean {\n return !!(this.input?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.input?.setAttribute('aria-disabled', 'false')\n } else {\n this.input?.setAttribute('disabled', '')\n this.input?.setAttribute('aria-disabled', 'true')\n }\n }\n\n /**\n * Handle 'example' 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_disabled (oldValue:string, newValue:string) {\n debug('changing disabled', oldValue, newValue)\n if (!this.input) {\n debug('not input')\n setTimeout(() => {\n if (newValue === null) {\n // [example] was removed\n this.disabled = false\n } else {\n // set [example] attribute\n this.disabled = true\n }\n }, 0) // wait to render\n } else {\n debug('input')\n if (newValue === null) {\n debug('is null')\n this.disabled = false\n } else {\n this.disabled = true\n }\n }\n }\n\n /**\n * Runs when the value of an attribute is changed\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 this.render()\n }\n\n connectedCallback () {\n this.render()\n }\n\n get type ():string|null|undefined {\n return this.input?.getAttribute('type')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get value () {\n return this.input?.value\n }\n\n set value (text:string|undefined|null) {\n if (!text) this.input?.removeAttribute('value')\n else {\n this.input!.value = text\n }\n }\n\n /**\n * Set attributes on the internal input element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (!value) {\n return this._removeAttribute(name)\n }\n\n if (value === true) {\n // true means set the attribute with no value\n return this.input?.setAttribute(name, '')\n }\n\n // else, set the value\n this.input?.setAttribute(name, value)\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n value\n } = this\n\n const classes:string[] = ['substrate-input']\n\n const btn = !!(this.type === 'submit' || this.type === 'button')\n\n const props = ([\n `class=\"${classes.filter(Boolean).join(' ')}\"`,\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${this.type}\"` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n btn ? 'role=\"button\"' : '',\n value ? `value=${value}` : ''\n ]).filter(Boolean).join(' ')\n\n this.innerHTML = `<input\n ${props}\n />`\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4B;AAC5B,MAAM,YAAQ,0BAAY;AAEnB,MAAe,cAAc,YAAY;AAAA,EAHhD,OAGgD;AAAA;AAAA;AAAA;AAAA;AAAA,EAG5C,OAAO,qBAAqB,CAAC,aAAa,YAAY,UAAU;AAAA,EAChE,OAAO;AAAA,EAEP,OAAO,SAA8D;AACjE,QAAI,EAAE,oBAAoB,QAAS;AACnC,QAAI,eAAe,IAAI,KAAK,GAAG,EAAG;AAElC,WAAO,eAAe,OAAO,KAAK,KAAK,IAAI;AAAA,EAC/C;AAAA,EAEA,cAAe;AACX,UAAM;AACN,UAAM,WAAW,KAAK,aAAa,UAAU;AAC7C,QAAI,aAAa,MAAM;AACnB,iBAAW,MAAM;AAEb,aAAK,WAAW;AAAA,MACpB,GAAG,CAAC;AAAA,IACR;AAEA,eAAW,MAAM;AACb,YAAM,OAAO,KAAK,aAAa,OAAO;AACtC,UAAI,MAAM;AACN,aAAK,QAAQ;AAAA,MACjB;AAAA,IACJ,GAAG,CAAC;AAAA,EACR;AAAA,EAEA,IAAI,QAA+B;AAC/B,WAAO,KAAK,cAAc,OAAO;AAAA,EACrC;AAAA,EAEA,IAAI,WAAmB;AACnB,UAAM,IAAI,KAAK,OAAO,aAAa,UAAU;AAC7C,QAAI,CAAC,EAAG,QAAO;AACf,WAAO,SAAS,CAAC;AAAA,EACr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A,EAEA,IAAI,KAAM,OAAc;AACpB,SAAK,cAAc,QAAQ,KAAK;AAAA,EACpC;AAAA,EAEA,IAAI,QAAS;AACT,WAAO,KAAK,OAAO;AAAA,EACvB;AAAA,EAEA,IAAI,MAAO,MAA4B;AACnC,QAAI,CAAC,KAAM,MAAK,OAAO,gBAAgB,OAAO;AAAA,SACzC;AACD,WAAK,MAAO,QAAQ;AAAA,IACxB;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,cAAe,MAAa,OAAgC;AACxD,QAAI,CAAC,OAAO;AACR,aAAO,KAAK,iBAAiB,IAAI;AAAA,IACrC;AAEA,QAAI,UAAU,MAAM;AAEhB,aAAO,KAAK,OAAO,aAAa,MAAM,EAAE;AAAA,IAC5C;AAGA,SAAK,OAAO,aAAa,MAAM,KAAK;AAAA,EACxC;AAAA,EAEA,SAAU;AACN,UAAM;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,IAAI;AAEJ,UAAM,UAAmB,CAAC,iBAAiB;AAE3C,UAAM,MAAM,CAAC,EAAE,KAAK,SAAS,YAAY,KAAK,SAAS;AAEvD,UAAM,QAAS;AAAA,MACX,UAAU,QAAQ,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC;AAAA,MAC3C,WAAW,aAAa;AAAA,MACxB,YAAY,cAAc;AAAA,MAC1B,OAAO,SAAS,KAAK,IAAI,MAAM;AAAA,MAC/B,WAAW,aAAa,QAAQ,MAAM;AAAA,MACtC,MAAM,kBAAkB;AAAA,MACxB,QAAQ,SAAS,KAAK,KAAK;AAAA,IAC/B,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG;AAE3B,SAAK,YAAY;AAAA,cACX,KAAK;AAAA;AAAA,EAEf;AACJ;",
4
+ "sourcesContent": ["export abstract class Input extends HTMLElement {\n // Define the attributes to observe\n // need this for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static tag:string\n\n static define (this:((new (...args:any[]) => Input) & typeof Input)) {\n if (!('customElements' in window)) return\n if (customElements.get(this.tag)) return // only define it once\n\n return customElements.define(this.tag, this)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n\n // timeout b/c we need to render first\n setTimeout(() => {\n const attr = this.getAttribute('value')\n if (attr) this.value = attr\n\n const type = this.getAttribute('type')\n if (type) this.type = type\n }, 0)\n }\n\n get input ():HTMLInputElement|null {\n return this.querySelector('input')\n }\n\n get tabindex ():number {\n const i = this.input?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n /**\n * Remove from `this` element and also child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.input?.removeAttribute(name)\n }\n\n get disabled ():boolean {\n return !!(this.input?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.input?.setAttribute('aria-disabled', 'false')\n } else {\n this.input?.setAttribute('disabled', '')\n this.input?.setAttribute('aria-disabled', 'true')\n }\n }\n\n /**\n * Handle 'example' 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_disabled (oldValue:string, newValue:string) {\n if (!this.input) {\n setTimeout(() => {\n if (newValue === null) {\n // [example] was removed\n this.disabled = false\n } else {\n // set [example] attribute\n this.disabled = true\n }\n }, 0) // wait to render\n } else {\n if (newValue === null) {\n this.disabled = false\n } else {\n this.disabled = true\n }\n }\n }\n\n /**\n * Runs when the value of an attribute is changed\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 this.render()\n }\n\n connectedCallback () {\n this.render()\n }\n\n get type ():string|null|undefined {\n return this.input?.getAttribute('type')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get value () {\n return this.input?.value\n }\n\n set value (text:string|undefined|null) {\n if (!text) this.input?.removeAttribute('value')\n else {\n this.input!.value = text\n }\n }\n\n /**\n * Set attributes on the internal input element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (!value) {\n return this._removeAttribute(name)\n }\n\n if (value === true) {\n // true means set the attribute with no value\n return this.input?.setAttribute(name, '')\n }\n\n // else, set the value\n this.input?.setAttribute(name, value)\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n value\n } = this\n\n const classes:string[] = ['substrate-input']\n\n const btn = !!(this.type === 'submit' || this.type === 'button')\n\n const props = ([\n `class=\"${classes.filter(Boolean).join(' ')}\"`,\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${this.type}\"` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n btn ? 'role=\"button\"' : '',\n value ? `value=${value}` : ''\n ]).filter(Boolean).join(' ')\n\n this.innerHTML = `<input\n ${props}\n />`\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAe,cAAc,YAAY;AAAA,EAAhD,OAAgD;AAAA;AAAA;AAAA;AAAA;AAAA,EAG5C,OAAO,qBAAqB,CAAC,aAAa,YAAY,UAAU;AAAA,EAChE,OAAO;AAAA,EAEP,OAAO,SAA8D;AACjE,QAAI,EAAE,oBAAoB,QAAS;AACnC,QAAI,eAAe,IAAI,KAAK,GAAG,EAAG;AAElC,WAAO,eAAe,OAAO,KAAK,KAAK,IAAI;AAAA,EAC/C;AAAA,EAEA,cAAe;AACX,UAAM;AACN,UAAM,WAAW,KAAK,aAAa,UAAU;AAC7C,QAAI,aAAa,MAAM;AACnB,iBAAW,MAAM;AAEb,aAAK,WAAW;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BT"}
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { createDebug } from "@substrate-system/debug";
4
- const debug = createDebug();
5
3
  class Input extends HTMLElement {
6
4
  static {
7
5
  __name(this, "Input");
@@ -25,9 +23,9 @@ class Input extends HTMLElement {
25
23
  }
26
24
  setTimeout(() => {
27
25
  const attr = this.getAttribute("value");
28
- if (attr) {
29
- this.value = attr;
30
- }
26
+ if (attr) this.value = attr;
27
+ const type = this.getAttribute("type");
28
+ if (type) this.type = type;
31
29
  }, 0);
32
30
  }
33
31
  get input() {
@@ -65,9 +63,7 @@ class Input extends HTMLElement {
65
63
  * @param {string} newValue The new attribute value
66
64
  */
67
65
  handleChange_disabled(oldValue, newValue) {
68
- debug("changing disabled", oldValue, newValue);
69
66
  if (!this.input) {
70
- debug("not input");
71
67
  setTimeout(() => {
72
68
  if (newValue === null) {
73
69
  this.disabled = false;
@@ -76,9 +72,7 @@ class Input extends HTMLElement {
76
72
  }
77
73
  }, 0);
78
74
  } else {
79
- debug("input");
80
75
  if (newValue === null) {
81
- debug("is null");
82
76
  this.disabled = false;
83
77
  } else {
84
78
  this.disabled = true;
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 { createDebug } from '@substrate-system/debug'\nconst debug = createDebug()\n\nexport abstract class Input extends HTMLElement {\n // Define the attributes to observe\n // need this for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static tag:string\n\n static define (this:((new (...args:any[]) => Input) & typeof Input)) {\n if (!('customElements' in window)) return\n if (customElements.get(this.tag)) return // only define it once\n\n return customElements.define(this.tag, this)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n\n setTimeout(() => {\n const attr = this.getAttribute('value')\n if (attr) {\n this.value = attr\n }\n }, 0)\n }\n\n get input ():HTMLInputElement|null {\n return this.querySelector('input')\n }\n\n get tabindex ():number {\n const i = this.input?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n /**\n * Remove from `this` element and also child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.input?.removeAttribute(name)\n }\n\n get disabled ():boolean {\n return !!(this.input?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.input?.setAttribute('aria-disabled', 'false')\n } else {\n this.input?.setAttribute('disabled', '')\n this.input?.setAttribute('aria-disabled', 'true')\n }\n }\n\n /**\n * Handle 'example' 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_disabled (oldValue:string, newValue:string) {\n debug('changing disabled', oldValue, newValue)\n if (!this.input) {\n debug('not input')\n setTimeout(() => {\n if (newValue === null) {\n // [example] was removed\n this.disabled = false\n } else {\n // set [example] attribute\n this.disabled = true\n }\n }, 0) // wait to render\n } else {\n debug('input')\n if (newValue === null) {\n debug('is null')\n this.disabled = false\n } else {\n this.disabled = true\n }\n }\n }\n\n /**\n * Runs when the value of an attribute is changed\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 this.render()\n }\n\n connectedCallback () {\n this.render()\n }\n\n get type ():string|null|undefined {\n return this.input?.getAttribute('type')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get value () {\n return this.input?.value\n }\n\n set value (text:string|undefined|null) {\n if (!text) this.input?.removeAttribute('value')\n else {\n this.input!.value = text\n }\n }\n\n /**\n * Set attributes on the internal input element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (!value) {\n return this._removeAttribute(name)\n }\n\n if (value === true) {\n // true means set the attribute with no value\n return this.input?.setAttribute(name, '')\n }\n\n // else, set the value\n this.input?.setAttribute(name, value)\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n value\n } = this\n\n const classes:string[] = ['substrate-input']\n\n const btn = !!(this.type === 'submit' || this.type === 'button')\n\n const props = ([\n `class=\"${classes.filter(Boolean).join(' ')}\"`,\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${this.type}\"` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n btn ? 'role=\"button\"' : '',\n value ? `value=${value}` : ''\n ]).filter(Boolean).join(' ')\n\n this.innerHTML = `<input\n ${props}\n />`\n }\n}\n"],
5
- "mappings": ";;AAAA,SAAS,mBAAmB;AAC5B,MAAM,QAAQ,YAAY;AAEnB,MAAe,cAAc,YAAY;AAAA,EAHhD,OAGgD;AAAA;AAAA;AAAA;AAAA;AAAA,EAG5C,OAAO,qBAAqB,CAAC,aAAa,YAAY,UAAU;AAAA,EAChE,OAAO;AAAA,EAEP,OAAO,SAA8D;AACjE,QAAI,EAAE,oBAAoB,QAAS;AACnC,QAAI,eAAe,IAAI,KAAK,GAAG,EAAG;AAElC,WAAO,eAAe,OAAO,KAAK,KAAK,IAAI;AAAA,EAC/C;AAAA,EAEA,cAAe;AACX,UAAM;AACN,UAAM,WAAW,KAAK,aAAa,UAAU;AAC7C,QAAI,aAAa,MAAM;AACnB,iBAAW,MAAM;AAEb,aAAK,WAAW;AAAA,MACpB,GAAG,CAAC;AAAA,IACR;AAEA,eAAW,MAAM;AACb,YAAM,OAAO,KAAK,aAAa,OAAO;AACtC,UAAI,MAAM;AACN,aAAK,QAAQ;AAAA,MACjB;AAAA,IACJ,GAAG,CAAC;AAAA,EACR;AAAA,EAEA,IAAI,QAA+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;AAAA,cACX,KAAK;AAAA;AAAA,EAEf;AACJ;",
4
+ "sourcesContent": ["export abstract class Input extends HTMLElement {\n // Define the attributes to observe\n // need this for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static tag:string\n\n static define (this:((new (...args:any[]) => Input) & typeof Input)) {\n if (!('customElements' in window)) return\n if (customElements.get(this.tag)) return // only define it once\n\n return customElements.define(this.tag, this)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n\n // timeout b/c we need to render first\n setTimeout(() => {\n const attr = this.getAttribute('value')\n if (attr) this.value = attr\n\n const type = this.getAttribute('type')\n if (type) this.type = type\n }, 0)\n }\n\n get input ():HTMLInputElement|null {\n return this.querySelector('input')\n }\n\n get tabindex ():number {\n const i = this.input?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n /**\n * Remove from `this` element and also child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.input?.removeAttribute(name)\n }\n\n get disabled ():boolean {\n return !!(this.input?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.input?.setAttribute('aria-disabled', 'false')\n } else {\n this.input?.setAttribute('disabled', '')\n this.input?.setAttribute('aria-disabled', 'true')\n }\n }\n\n /**\n * Handle 'example' 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_disabled (oldValue:string, newValue:string) {\n if (!this.input) {\n setTimeout(() => {\n if (newValue === null) {\n // [example] was removed\n this.disabled = false\n } else {\n // set [example] attribute\n this.disabled = true\n }\n }, 0) // wait to render\n } else {\n if (newValue === null) {\n this.disabled = false\n } else {\n this.disabled = true\n }\n }\n }\n\n /**\n * Runs when the value of an attribute is changed\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 this.render()\n }\n\n connectedCallback () {\n this.render()\n }\n\n get type ():string|null|undefined {\n return this.input?.getAttribute('type')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get value () {\n return this.input?.value\n }\n\n set value (text:string|undefined|null) {\n if (!text) this.input?.removeAttribute('value')\n else {\n this.input!.value = text\n }\n }\n\n /**\n * Set attributes on the internal input element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (!value) {\n return this._removeAttribute(name)\n }\n\n if (value === true) {\n // true means set the attribute with no value\n return this.input?.setAttribute(name, '')\n }\n\n // else, set the value\n this.input?.setAttribute(name, value)\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n value\n } = this\n\n const classes:string[] = ['substrate-input']\n\n const btn = !!(this.type === 'submit' || this.type === 'button')\n\n const props = ([\n `class=\"${classes.filter(Boolean).join(' ')}\"`,\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${this.type}\"` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n btn ? 'role=\"button\"' : '',\n value ? `value=${value}` : ''\n ]).filter(Boolean).join(' ')\n\n this.innerHTML = `<input\n ${props}\n />`\n }\n}\n"],
5
+ "mappings": ";;AAAO,MAAe,cAAc,YAAY;AAAA,EAAhD,OAAgD;AAAA;AAAA;AAAA;AAAA;AAAA,EAG5C,OAAO,qBAAqB,CAAC,aAAa,YAAY,UAAU;AAAA,EAChE,OAAO;AAAA,EAEP,OAAO,SAA8D;AACjE,QAAI,EAAE,oBAAoB,QAAS;AACnC,QAAI,eAAe,IAAI,KAAK,GAAG,EAAG;AAElC,WAAO,eAAe,OAAO,KAAK,KAAK,IAAI;AAAA,EAC/C;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AAE,KAAK,GAAG,CAAC;AAAA,MAC3C,WAAW,aAAa;AAAA,MACxB,YAAY,cAAc;AAAA,MAC1B,OAAO,SAAS,KAAK,IAAI,MAAM;AAAA,MAC/B,WAAW,aAAa,QAAQ,MAAM;AAAA,MACtC,MAAM,kBAAkB;AAAA,MACxB,QAAQ,SAAS,KAAK,KAAK;AAAA,IAC/B,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG;AAE3B,SAAK,YAAY;AAAA,cACX,KAAK;AAAA;AAAA,EAEf;AACJ;",
6
6
  "names": []
7
7
  }
package/dist/index.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var U=Object.create;var b=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var s=(e,t)=>b(e,"name",{value:t,configurable:!0});var L=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var V=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of k(t))!I.call(e,i)&&i!==r&&b(e,i,{get:()=>t[i],enumerable:!(n=$(t,i))||n.enumerable});return e};var R=(e,t,r)=>(r=e!=null?U(G(e)):{},V(t||!e||!e.__esModule?b(r,"default",{value:e,enumerable:!0}):r,e));var y=L((Y,m)=>{"use strict";var C=1e3,d=C*60,f=d*60,a=f*24,N=a*7,O=a*365.25;m.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return j(e);if(r==="number"&&isFinite(e))return t.long?H(e):z(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function j(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*O;case"weeks":case"week":case"w":return r*N;case"days":case"day":case"d":return r*a;case"hours":case"hour":case"hrs":case"hr":case"h":return r*f;case"minutes":case"minute":case"mins":case"min":case"m":return r*d;case"seconds":case"second":case"secs":case"sec":case"s":return r*C;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}s(j,"parse");function z(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+"d":t>=f?Math.round(e/f)+"h":t>=d?Math.round(e/d)+"m":t>=C?Math.round(e/C)+"s":e+"ms"}s(z,"fmtShort");function H(e){var t=Math.abs(e);return t>=a?h(e,t,a,"day"):t>=f?h(e,t,f,"hour"):t>=d?h(e,t,d,"minute"):t>=C?h(e,t,C,"second"):e+" ms"}s(H,"fmtLong");function h(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}s(h,"plural")});var D=R(y(),1);function A(e){return e instanceof Error?e.stack||e.message:String(e)}s(A,"coerce");function E(e,t){let r=0;for(let n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t[Math.abs(r)%t.length]}s(E,"selectColor");function v(e){return e.split(/[\s,]+/).filter(Boolean).map(n=>n.replace(/\*/g,".*?")).map(n=>new RegExp("^"+n+"$"))}s(v,"createRegexFromEnvVar");function x(e=6){return Math.random().toString(20).substring(2,e)}s(x,"generateRandomString");var w=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];var J=console.log||(()=>{});function P(e,t){return t&&(t.VITE_DEBUG==="*"||t.DEBUG==="*")?!0:e==="DEV"?!t||!t.VITE_DEBUG&&!t.DEBUG:!t||!t.VITE_DEBUG&&!t.DEBUG?!1:v(e).some(n=>n.test(t.VITE_DEBUG||t.DEBUG))}s(P,"isEnabled");function Z(){return{j:s(function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+String(t)}},"j")}}s(Z,"createFormatters");function q(e,t,{prevTime:r,color:n},i){if(!P(e,i||import.meta.env))return;let u=Number(new Date),c=u-(r||u);r=u,t[0]=A(t[0]);let l=Z();typeof t[0]!="string"&&t.unshift("%O");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(F,S)=>{if(F==="%%")return"%";o++;let p=l[S];if(typeof p=="function"){let T=t[o];F=p.call(self,T),t.splice(o,1),o--}return F});let B=Q({diff:c,color:n,useColors:K(),namespace:e},t);J(...B)}s(q,"logger");function K(){return typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:!!(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.webkitAppearance||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}s(K,"shouldUseColors");function Q({diff:e,color:t,namespace:r,useColors:n},i){if(i[0]=(n?"%c":"")+r+(n?" %c":" ")+i[0]+(n?"%c ":" ")+"+"+(0,D.default)(e),!n)return;let u="color: "+t;i.splice(1,0,u,"color: inherit");let c=0,l=0;return i[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(c++,o==="%c"&&(l=c))}),i.splice(l,0,u),i}s(Q,"formatArgs");function M(e,t){if(e===!1)return W;let r=Number(new Date),n=E(typeof e=="string"?e:x(10),w);return s(function(...u){return q(typeof e=="string"?e:"DEV",u,{prevTime:r,color:n},t)},"debug")}s(M,"createDebug");function W(){}s(W,"noop");var g=M(),_=class extends HTMLElement{static{s(this,"Input")}static observedAttributes=["autofocus","disabled","spinning"];static tag;static define(){if("customElements"in window&&!customElements.get(this.tag))return customElements.define(this.tag,this)}constructor(){super(),this.getAttribute("disabled")!==null&&setTimeout(()=>{this.disabled=!0},0),setTimeout(()=>{let r=this.getAttribute("value");r&&(this.value=r)},0)}get input(){return this.querySelector("input")}get tabindex(){let t=this.input?.getAttribute("tabindex");return t?parseInt(t):0}_removeAttribute(t){this.removeAttribute(t),this.input?.removeAttribute(t)}get disabled(){return!!this.input?.hasAttribute("disabled")}set disabled(t){t?(this.input?.setAttribute("disabled",""),this.input?.setAttribute("aria-disabled","true")):(this._removeAttribute("disabled"),this.input?.setAttribute("aria-disabled","false"))}handleChange_disabled(t,r){g("changing disabled",t,r),this.input?(g("input"),r===null?(g("is null"),this.disabled=!1):this.disabled=!0):(g("not input"),setTimeout(()=>{r===null?this.disabled=!1:this.disabled=!0},0))}attributeChangedCallback(t,r,n){let i=this[`handleChange_${t}`];i&&i.call(this,r,n),this.render()}connectedCallback(){this.render()}get type(){return this.input?.getAttribute("type")}set type(t){this._setAttribute("type",t)}get value(){return this.input?.value}set value(t){t?this.input.value=t:this.input?.removeAttribute("value")}_setAttribute(t,r){if(!r)return this._removeAttribute(t);if(r===!0)return this.input?.setAttribute(t,"");this.input?.setAttribute(t,r)}render(){let{type:t,autofocus:r,tabindex:n,disabled:i,value:u}=this,c=["substrate-input"],l=this.type==="submit"||this.type==="button",o=[`class="${c.filter(Boolean).join(" ")}"`,i?"disabled":"",r?"autofocus":"",t?`type="${this.type}"`:"",n?`tabindex="${n}"`:'tabindex="0"',l?'role="button"':"",u?`value=${u}`:""].filter(Boolean).join(" ");this.innerHTML=`<input
2
- ${o}
3
- />`}};export{_ as Input};
1
+ var o=Object.defineProperty;var u=(n,t)=>o(n,"name",{value:t,configurable:!0});var l=class extends HTMLElement{static{u(this,"Input")}static observedAttributes=["autofocus","disabled","spinning"];static tag;static define(){if("customElements"in window&&!customElements.get(this.tag))return customElements.define(this.tag,this)}constructor(){super(),this.getAttribute("disabled")!==null&&setTimeout(()=>{this.disabled=!0},0),setTimeout(()=>{let e=this.getAttribute("value");e&&(this.value=e);let i=this.getAttribute("type");i&&(this.type=i)},0)}get input(){return this.querySelector("input")}get tabindex(){let t=this.input?.getAttribute("tabindex");return t?parseInt(t):0}_removeAttribute(t){this.removeAttribute(t),this.input?.removeAttribute(t)}get disabled(){return!!this.input?.hasAttribute("disabled")}set disabled(t){t?(this.input?.setAttribute("disabled",""),this.input?.setAttribute("aria-disabled","true")):(this._removeAttribute("disabled"),this.input?.setAttribute("aria-disabled","false"))}handleChange_disabled(t,e){this.input?e===null?this.disabled=!1:this.disabled=!0:setTimeout(()=>{e===null?this.disabled=!1:this.disabled=!0},0)}attributeChangedCallback(t,e,i){let s=this[`handleChange_${t}`];s&&s.call(this,e,i),this.render()}connectedCallback(){this.render()}get type(){return this.input?.getAttribute("type")}set type(t){this._setAttribute("type",t)}get value(){return this.input?.value}set value(t){t?this.input.value=t:this.input?.removeAttribute("value")}_setAttribute(t,e){if(!e)return this._removeAttribute(t);if(e===!0)return this.input?.setAttribute(t,"");this.input?.setAttribute(t,e)}render(){let{type:t,autofocus:e,tabindex:i,disabled:s,value:r}=this,a=["substrate-input"],d=this.type==="submit"||this.type==="button",b=[`class="${a.filter(Boolean).join(" ")}"`,s?"disabled":"",e?"autofocus":"",t?`type="${this.type}"`:"",i?`tabindex="${i}"`:'tabindex="0"',d?'role="button"':"",r?`value=${r}`:""].filter(Boolean).join(" ");this.innerHTML=`<input
2
+ ${b}
3
+ />`}};export{l as Input};
4
4
  //# sourceMappingURL=index.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../node_modules/ms/index.js", "../node_modules/@substrate-system/debug/src/browser/index.ts", "../node_modules/@substrate-system/debug/src/common.ts", "../node_modules/@substrate-system/debug/src/browser/util.ts", "../src/index.ts"],
4
- "sourcesContent": ["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", null, null, null, "import { createDebug } from '@substrate-system/debug'\nconst debug = createDebug()\n\nexport abstract class Input extends HTMLElement {\n // Define the attributes to observe\n // need this for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static tag:string\n\n static define (this:((new (...args:any[]) => Input) & typeof Input)) {\n if (!('customElements' in window)) return\n if (customElements.get(this.tag)) return // only define it once\n\n return customElements.define(this.tag, this)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n\n setTimeout(() => {\n const attr = this.getAttribute('value')\n if (attr) {\n this.value = attr\n }\n }, 0)\n }\n\n get input ():HTMLInputElement|null {\n return this.querySelector('input')\n }\n\n get tabindex ():number {\n const i = this.input?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n /**\n * Remove from `this` element and also child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.input?.removeAttribute(name)\n }\n\n get disabled ():boolean {\n return !!(this.input?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.input?.setAttribute('aria-disabled', 'false')\n } else {\n this.input?.setAttribute('disabled', '')\n this.input?.setAttribute('aria-disabled', 'true')\n }\n }\n\n /**\n * Handle 'example' 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_disabled (oldValue:string, newValue:string) {\n debug('changing disabled', oldValue, newValue)\n if (!this.input) {\n debug('not input')\n setTimeout(() => {\n if (newValue === null) {\n // [example] was removed\n this.disabled = false\n } else {\n // set [example] attribute\n this.disabled = true\n }\n }, 0) // wait to render\n } else {\n debug('input')\n if (newValue === null) {\n debug('is null')\n this.disabled = false\n } else {\n this.disabled = true\n }\n }\n }\n\n /**\n * Runs when the value of an attribute is changed\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 this.render()\n }\n\n connectedCallback () {\n this.render()\n }\n\n get type ():string|null|undefined {\n return this.input?.getAttribute('type')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get value () {\n return this.input?.value\n }\n\n set value (text:string|undefined|null) {\n if (!text) this.input?.removeAttribute('value')\n else {\n this.input!.value = text\n }\n }\n\n /**\n * Set attributes on the internal input element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (!value) {\n return this._removeAttribute(name)\n }\n\n if (value === true) {\n // true means set the attribute with no value\n return this.input?.setAttribute(name, '')\n }\n\n // else, set the value\n this.input?.setAttribute(name, value)\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n value\n } = this\n\n const classes:string[] = ['substrate-input']\n\n const btn = !!(this.type === 'submit' || this.type === 'button')\n\n const props = ([\n `class=\"${classes.filter(Boolean).join(' ')}\"`,\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${this.type}\"` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n btn ? 'role=\"button\"' : '',\n value ? `value=${value}` : ''\n ]).filter(Boolean).join(' ')\n\n this.innerHTML = `<input\n ${props}\n />`\n }\n}\n"],
5
- "mappings": "4jBAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,cAIA,IAAIC,EAAI,IACJC,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,EACRE,EAAIF,EAAI,OAgBZJ,EAAO,QAAU,SAAUO,EAAKC,EAAS,CACvCA,EAAUA,GAAW,CAAC,EACtB,IAAIC,EAAO,OAAOF,EAClB,GAAIE,IAAS,UAAYF,EAAI,OAAS,EACpC,OAAOG,EAAMH,CAAG,EACX,GAAIE,IAAS,UAAY,SAASF,CAAG,EAC1C,OAAOC,EAAQ,KAAOG,EAAQJ,CAAG,EAAIK,EAASL,CAAG,EAEnD,MAAM,IAAI,MACR,wDACE,KAAK,UAAUA,CAAG,CACtB,CACF,EAUA,SAASG,EAAMG,EAAK,CAElB,GADAA,EAAM,OAAOA,CAAG,EACZ,EAAAA,EAAI,OAAS,KAGjB,KAAIC,EAAQ,mIAAmI,KAC7ID,CACF,EACA,GAAKC,EAGL,KAAIC,EAAI,WAAWD,EAAM,CAAC,CAAC,EACvBL,GAAQK,EAAM,CAAC,GAAK,MAAM,Y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K,OAAS,UAAY,KAAK,OAAS,SAEjDC,EAAS,CACX,UAAUF,EAAQ,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,IAC3CD,EAAW,WAAa,GACxBF,EAAY,YAAc,GAC1BD,EAAO,SAAS,KAAK,IAAI,IAAM,GAC/BE,EAAW,aAAaA,CAAQ,IAAM,eACtCG,EAAM,gBAAkB,GACxBP,EAAQ,SAASA,CAAK,GAAK,EAC/B,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG,EAE3B,KAAK,UAAY;AAAA,cACXQ,CAAK;AAAA,WAEf,CACJ",
6
- "names": ["require_ms", "__commonJSMin", "exports", "module", "s", "m", "h", "d", "w", "y", "val", "options", "type", "parse", "fmtLong", "fmtShort", "str", "match", "n", "__name", "ms", "msAbs", "plural", "name", "isPlural", "import_ms", "coerce", "val", "__name", "selectColor", "namespace", "colors", "hash", "i", "createRegexFromEnvVar", "names", "word", "r", "generateRandomString", "length", "colors", "log", "isEnabled", "namespace", "env", "createRegexFromEnvVar", "regex", "__name", "createFormatters", "v", "error", "logger", "args", "prevTime", "color", "curr", "diff", "coerce", "formatters", "index", "match", "format", "formatter", "val", "_args", "formatArgs", "shouldUseColors", "log", "useColors", "humanize", "c", "lastC", "createDebug", "noop", "selectColor", "generateRandomString", "colors", "debug", "createDebug", "Input", "__name", "attr", "i", "name", "disabledValue", "oldValue", "newValue", "handler", "value", "text", "type", "autofocus", "tabindex", "disabled", "classes", "btn", "props"]
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export abstract class Input extends HTMLElement {\n // Define the attributes to observe\n // need this for `attributeChangedCallback`\n static observedAttributes = ['autofocus', 'disabled', 'spinning']\n static tag:string\n\n static define (this:((new (...args:any[]) => Input) & typeof Input)) {\n if (!('customElements' in window)) return\n if (customElements.get(this.tag)) return // only define it once\n\n return customElements.define(this.tag, this)\n }\n\n constructor () {\n super()\n const disabled = this.getAttribute('disabled')\n if (disabled !== null) {\n setTimeout(() => {\n // need to wait for it to render\n this.disabled = true\n }, 0)\n }\n\n // timeout b/c we need to render first\n setTimeout(() => {\n const attr = this.getAttribute('value')\n if (attr) this.value = attr\n\n const type = this.getAttribute('type')\n if (type) this.type = type\n }, 0)\n }\n\n get input ():HTMLInputElement|null {\n return this.querySelector('input')\n }\n\n get tabindex ():number {\n const i = this.input?.getAttribute('tabindex')\n if (!i) return 0\n return parseInt(i)\n }\n\n /**\n * Remove from `this` element and also child.\n */\n _removeAttribute (name:string) {\n this.removeAttribute(name)\n this.input?.removeAttribute(name)\n }\n\n get disabled ():boolean {\n return !!(this.input?.hasAttribute('disabled'))\n }\n\n set disabled (disabledValue:boolean) {\n if (!disabledValue) {\n this._removeAttribute('disabled')\n this.input?.setAttribute('aria-disabled', 'false')\n } else {\n this.input?.setAttribute('disabled', '')\n this.input?.setAttribute('aria-disabled', 'true')\n }\n }\n\n /**\n * Handle 'example' 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_disabled (oldValue:string, newValue:string) {\n if (!this.input) {\n setTimeout(() => {\n if (newValue === null) {\n // [example] was removed\n this.disabled = false\n } else {\n // set [example] attribute\n this.disabled = true\n }\n }, 0) // wait to render\n } else {\n if (newValue === null) {\n this.disabled = false\n } else {\n this.disabled = true\n }\n }\n }\n\n /**\n * Runs when the value of an attribute is changed\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 this.render()\n }\n\n connectedCallback () {\n this.render()\n }\n\n get type ():string|null|undefined {\n return this.input?.getAttribute('type')\n }\n\n set type (value:string) {\n this._setAttribute('type', value)\n }\n\n get value () {\n return this.input?.value\n }\n\n set value (text:string|undefined|null) {\n if (!text) this.input?.removeAttribute('value')\n else {\n this.input!.value = text\n }\n }\n\n /**\n * Set attributes on the internal input element.\n */\n _setAttribute (name:string, value:boolean|string|null):void {\n if (!value) {\n return this._removeAttribute(name)\n }\n\n if (value === true) {\n // true means set the attribute with no value\n return this.input?.setAttribute(name, '')\n }\n\n // else, set the value\n this.input?.setAttribute(name, value)\n }\n\n render () {\n const {\n type,\n autofocus,\n tabindex,\n disabled,\n value\n } = this\n\n const classes:string[] = ['substrate-input']\n\n const btn = !!(this.type === 'submit' || this.type === 'button')\n\n const props = ([\n `class=\"${classes.filter(Boolean).join(' ')}\"`,\n disabled ? 'disabled' : '',\n autofocus ? 'autofocus' : '',\n type ? `type=\"${this.type}\"` : '',\n tabindex ? `tabindex=\"${tabindex}\"` : 'tabindex=\"0\"',\n btn ? 'role=\"button\"' : '',\n value ? `value=${value}` : ''\n ]).filter(Boolean).join(' ')\n\n this.innerHTML = `<input\n ${props}\n />`\n }\n}\n"],
5
+ "mappings": "+EAAO,IAAeA,EAAf,cAA6B,WAAY,CAAhD,MAAgD,CAAAC,EAAA,cAG5C,OAAO,mBAAqB,CAAC,YAAa,WAAY,UAAU,EAChE,OAAO,IAEP,OAAO,QAA8D,CACjE,GAAM,mBAAoB,QACtB,gBAAe,IAAI,KAAK,GAAG,EAE/B,OAAO,eAAe,OAAO,KAAK,IAAK,IAAI,CAC/C,CAEA,aAAe,CACX,MAAM,EACW,KAAK,aAAa,UAAU,IAC5B,MACb,WAAW,IAAM,CAEb,KAAK,SAAW,EACpB,EAAG,CAAC,EAIR,WAAW,IAAM,CACb,IAAMC,EAAO,KAAK,aAAa,OAAO,EAClCA,IAAM,KAAK,MAAQA,GAEvB,IAAMC,EAAO,KAAK,aAAa,MAAM,EACjCA,IAAM,KAAK,KAAOA,EAC1B,EAAG,CAAC,CACR,CAEA,IAAI,OAA+B,CAC/B,OAAO,KAAK,cAAc,OAAO,CACrC,CAEA,IAAI,UAAmB,CACnB,IAAMC,EAAI,KAAK,OAAO,aAAa,UAAU,EAC7C,OA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,CACN,GAAM,CACF,KAAAP,EACA,UAAAS,EACA,SAAAC,EACA,SAAAC,EACA,MAAAJ,CACJ,EAAI,KAEEK,EAAmB,CAAC,iBAAiB,EAErCC,EAAS,KAAK,OAAS,UAAY,KAAK,OAAS,SAEjDC,EAAS,CACX,UAAUF,EAAQ,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,IAC3CD,EAAW,WAAa,GACxBF,EAAY,YAAc,GAC1BT,EAAO,SAAS,KAAK,IAAI,IAAM,GAC/BU,EAAW,aAAaA,CAAQ,IAAM,eACtCG,EAAM,gBAAkB,GACxBN,EAAQ,SAASA,CAAK,GAAK,EAC/B,EAAG,OAAO,OAAO,EAAE,KAAK,GAAG,EAE3B,KAAK,UAAY;AAAA,cACXO,CAAK;AAAA,WAEf,CACJ",
6
+ "names": ["Input", "__name", "attr", "type", "i", "name", "disabledValue", "oldValue", "newValue", "handler", "value", "text", "autofocus", "tabindex", "disabled", "classes", "btn", "props"]
7
7
  }
package/dist/meta.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "inputs": {
3
3
  "src/index.ts": {
4
- "bytes": 5061,
4
+ "bytes": 4938,
5
5
  "imports": [],
6
6
  "format": "esm"
7
7
  }
@@ -11,26 +11,20 @@
11
11
  "imports": [],
12
12
  "exports": [],
13
13
  "inputs": {},
14
- "bytes": 8058
14
+ "bytes": 7859
15
15
  },
16
16
  "dist/index.js": {
17
- "imports": [
18
- {
19
- "path": "@substrate-system/debug",
20
- "kind": "import-statement",
21
- "external": true
22
- }
23
- ],
17
+ "imports": [],
24
18
  "exports": [
25
19
  "Input"
26
20
  ],
27
21
  "entryPoint": "src/index.ts",
28
22
  "inputs": {
29
23
  "src/index.ts": {
30
- "bytesInOutput": 4016
24
+ "bytesInOutput": 3868
31
25
  }
32
26
  },
33
- "bytes": 4199
27
+ "bytes": 4051
34
28
  }
35
29
  }
36
30
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@substrate-system/input",
3
3
  "type": "module",
4
- "version": "0.0.0",
4
+ "version": "0.0.1",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "./dist/*"
@@ -44,10 +44,10 @@
44
44
  ]
45
45
  }
46
46
  },
47
- "dependencies": {},
48
47
  "devDependencies": {
49
48
  "@bicycle-codes/dom": "^0.1.2",
50
49
  "@substrate-system/debug": "^0.9.0",
50
+ "@substrate-system/dom": "^0.1.7",
51
51
  "@substrate-system/tapzero": "^0.10.13",
52
52
  "@typescript-eslint/eslint-plugin": "^8.7.0",
53
53
  "@typescript-eslint/parser": "^8.7.0",
@@ -70,4 +70,4 @@
70
70
  },
71
71
  "author": "nichoth <nichoth@nichoth.com> (https://nichoth.com)",
72
72
  "license": "MIT"
73
- }
73
+ }