godown 2.6.0 → 2.6.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.
Files changed (109) hide show
  1. package/lib/event-collection.d.ts +1 -1
  2. package/package.json +4 -4
  3. package/react/index.d.ts +0 -1
  4. package/react/index.d.ts.map +1 -1
  5. package/react/index.js +0 -3
  6. package/react/index.js.map +1 -1
  7. package/web-components/a/avatar-a.js +40 -40
  8. package/web-components/a/avatar-a.js.map +1 -1
  9. package/web-components/a/super-a.js +22 -22
  10. package/web-components/a/super-a.js.map +1 -1
  11. package/web-components/button/base-button.js +86 -86
  12. package/web-components/button/base-button.js.map +1 -1
  13. package/web-components/carousel/carousel-slider.d.ts +1 -1
  14. package/web-components/carousel/carousel-slider.d.ts.map +1 -1
  15. package/web-components/carousel/carousel-slider.js +70 -70
  16. package/web-components/carousel/carousel-slider.js.map +1 -1
  17. package/web-components/form/base-form.js +15 -15
  18. package/web-components/form/base-form.js.map +1 -1
  19. package/web-components/group/avatar-group.js +13 -13
  20. package/web-components/group/avatar-group.js.map +1 -1
  21. package/web-components/group/details-group.js +7 -7
  22. package/web-components/group/details-group.js.map +1 -1
  23. package/web-components/group/tab-group.js +45 -45
  24. package/web-components/group/tab-group.js.map +1 -1
  25. package/web-components/index.d.ts +0 -1
  26. package/web-components/index.d.ts.map +1 -1
  27. package/web-components/index.js +0 -1
  28. package/web-components/index.js.map +1 -1
  29. package/web-components/input/base-input.js +73 -73
  30. package/web-components/input/base-input.js.map +1 -1
  31. package/web-components/input/input.js +15 -15
  32. package/web-components/input/input.js.map +1 -1
  33. package/web-components/input/label-input.js +49 -49
  34. package/web-components/input/label-input.js.map +1 -1
  35. package/web-components/input/search-input.js +53 -53
  36. package/web-components/input/search-input.js.map +1 -1
  37. package/web-components/input/select-input.js +88 -88
  38. package/web-components/input/select-input.js.map +1 -1
  39. package/web-components/input/split-input.js +51 -51
  40. package/web-components/input/split-input.js.map +1 -1
  41. package/web-components/input/switch-input.js +36 -36
  42. package/web-components/input/switch-input.js.map +1 -1
  43. package/web-components/items/alert-item.js +32 -33
  44. package/web-components/items/alert-item.js.map +1 -1
  45. package/web-components/items/card-item.js +54 -54
  46. package/web-components/items/card-item.js.map +1 -1
  47. package/web-components/items/drag-box.js +8 -8
  48. package/web-components/items/drag-box.js.map +1 -1
  49. package/web-components/items/time-bar.js +8 -9
  50. package/web-components/items/time-bar.js.map +1 -1
  51. package/web-components/layout/divider-line.js +11 -11
  52. package/web-components/layout/divider-line.js.map +1 -1
  53. package/web-components/layout/flex-flow.js +7 -7
  54. package/web-components/layout/flex-flow.js.map +1 -1
  55. package/web-components/layout/nav-aside.js +14 -14
  56. package/web-components/layout/nav-aside.js.map +1 -1
  57. package/web-components/layout/nav-layout.js +26 -26
  58. package/web-components/layout/nav-layout.js.map +1 -1
  59. package/web-components/loading/loading-progress.d.ts +1 -1
  60. package/web-components/loading/loading-progress.d.ts.map +1 -1
  61. package/web-components/loading/loading-progress.js +28 -28
  62. package/web-components/loading/loading-progress.js.map +1 -1
  63. package/web-components/loading/skeleton-screen.js +19 -19
  64. package/web-components/loading/skeleton-screen.js.map +1 -1
  65. package/web-components/open/open-details.d.ts.map +1 -1
  66. package/web-components/open/open-details.js +73 -22
  67. package/web-components/open/open-details.js.map +1 -1
  68. package/web-components/open/open-dialog.d.ts +5 -16
  69. package/web-components/open/open-dialog.d.ts.map +1 -1
  70. package/web-components/open/open-dialog.js +92 -102
  71. package/web-components/open/open-dialog.js.map +1 -1
  72. package/web-components/open/open-offset.d.ts +0 -1
  73. package/web-components/open/open-offset.d.ts.map +1 -1
  74. package/web-components/open/open-offset.js +50 -53
  75. package/web-components/open/open-offset.js.map +1 -1
  76. package/web-components/open/open-tooltip.d.ts +2 -2
  77. package/web-components/open/open-tooltip.d.ts.map +1 -1
  78. package/web-components/open/open-tooltip.js +14 -15
  79. package/web-components/open/open-tooltip.js.map +1 -1
  80. package/web-components/open/open.d.ts +3 -2
  81. package/web-components/open/open.d.ts.map +1 -1
  82. package/web-components/open/open.js +13 -59
  83. package/web-components/open/open.js.map +1 -1
  84. package/web-components/text/clip-text.js +8 -8
  85. package/web-components/text/clip-text.js.map +1 -1
  86. package/web-components/text/overbreath-text.js +17 -17
  87. package/web-components/text/overbreath-text.js.map +1 -1
  88. package/web-components/text/typewriter-text.js +32 -32
  89. package/web-components/text/typewriter-text.js.map +1 -1
  90. package/web-components/view/route-view.d.ts +2 -2
  91. package/web-components/view/route-view.js +7 -7
  92. package/web-components/view/route-view.js.map +1 -1
  93. package/web-components/view/scroll-x.js +29 -29
  94. package/web-components/view/scroll-x.js.map +1 -1
  95. package/web-components/view/wrap-view.d.ts +1 -1
  96. package/web-components/view/wrap-view.js +15 -15
  97. package/web-components/view/wrap-view.js.map +1 -1
  98. package/open-list.d.ts +0 -2
  99. package/open-list.d.ts.map +0 -1
  100. package/open-list.js +0 -2
  101. package/open-list.js.map +0 -1
  102. package/web-components/layout/index.d.ts +0 -5
  103. package/web-components/layout/index.d.ts.map +0 -1
  104. package/web-components/layout/index.js +0 -6
  105. package/web-components/layout/index.js.map +0 -1
  106. package/web-components/open/open-list.d.ts +0 -20
  107. package/web-components/open/open-list.d.ts.map +0 -1
  108. package/web-components/open/open-list.js +0 -71
  109. package/web-components/open/open-list.js.map +0 -1
@@ -35,9 +35,77 @@ let BaseInput = class BaseInput extends InputElement {
35
35
  */
36
36
  this.step = 1;
37
37
  }
38
- static { this.styles = [
39
- InputElement.styles,
40
- css `
38
+ render() {
39
+ if (this.type === "range") {
40
+ return html `<div class="range">
41
+ <input id="input" type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._handleRange}" @change="${this._handleRange}" />
42
+ <b></b>
43
+ <b>
44
+ <i></i>
45
+ </b>
46
+ </div>`;
47
+ }
48
+ return html `<label for="input"> ${htmlSlot("pre")} ${this._typeSwitcher()} ${htmlSlot("suf")} </label>`;
49
+ }
50
+ connectedCallback() {
51
+ super.connectedCallback();
52
+ if (this.type === "file") {
53
+ this.value = null;
54
+ }
55
+ else {
56
+ if (!this.def) {
57
+ this.def = this.value || "";
58
+ }
59
+ if (!this.value) {
60
+ this.value = this.def;
61
+ }
62
+ }
63
+ this._initName();
64
+ }
65
+ firstUpdated() {
66
+ super.firstUpdated();
67
+ if (this.type === "range") {
68
+ this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + "%";
69
+ }
70
+ }
71
+ _handleRange(e) {
72
+ this.value = e.target.value;
73
+ this._ranged.style.width = (100 * parseInt(e.target.value)) / (this.max - this.min) + "%";
74
+ this.dispatchEvent(new CustomEvent("input", { detail: this.value }));
75
+ }
76
+ _handleFile(e) {
77
+ this.value = !this.only ? e.target.files : e.target.files[0];
78
+ this.dispatchEvent(new CustomEvent("change", { detail: this.value }));
79
+ }
80
+ reset() {
81
+ if (this.type === "file") {
82
+ this.value = null;
83
+ return;
84
+ }
85
+ if (this.type === "range") {
86
+ this._input.value = this.def || ((this.max - this.min) / 2).toString();
87
+ this.value = this._input.value;
88
+ this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + "%";
89
+ }
90
+ else {
91
+ this._input.value = this.def.toString();
92
+ this.value = this.def;
93
+ }
94
+ }
95
+ _typeSwitcher() {
96
+ switch (this.type) {
97
+ case "file":
98
+ return html `<input id="input" class="input" type="file" accept="${this.accept}" ?multiple="${!this.only}" @change="${this._handleFile}" />${htmlSlot()}`;
99
+ case "number":
100
+ return html `<input .value="${this.value}" ?autofocus="${this.autofocus}" id="input" class="input" type="number" placeholder="${this.pla}" min="${this.min}" max="${this.max}" @input="${this._handleInput}" @change="${this._handleChange}" />`;
101
+ default:
102
+ return html `<input .value="${this.value}" ?autofocus="${this.autofocus}" id="input" class="input" type="${this.type}" placeholder="${this.pla}" @input="${this._handleInput}" @change="${this._handleChange}" />`;
103
+ }
104
+ }
105
+ };
106
+ BaseInput.styles = [
107
+ InputElement.styles,
108
+ css `
41
109
  :host {
42
110
  width: var(${cssvarValues.input}--width);
43
111
  height: var(${cssvarValues.input}--height);
@@ -74,7 +142,7 @@ let BaseInput = class BaseInput extends InputElement {
74
142
  border-radius: 0.25em;
75
143
  }
76
144
  `,
77
- css `
145
+ css `
78
146
  :host([type="range"]) {
79
147
  height: auto !important;
80
148
  margin: 0.3em 0;
@@ -145,75 +213,7 @@ let BaseInput = class BaseInput extends InputElement {
145
213
  box-shadow: 0 0.1em 0.1em var(${cssvar}--shadow);
146
214
  }
147
215
  `,
148
- ]; }
149
- render() {
150
- if (this.type === "range") {
151
- return html `<div class="range">
152
- <input id="input" type="range" min="${this.min}" max="${this.max}" step="${this.step}" @input="${this._handleRange}" @change="${this._handleRange}" />
153
- <b></b>
154
- <b>
155
- <i></i>
156
- </b>
157
- </div>`;
158
- }
159
- return html `<label for="input"> ${htmlSlot("pre")} ${this._typeSwitcher()} ${htmlSlot("suf")} </label>`;
160
- }
161
- connectedCallback() {
162
- super.connectedCallback();
163
- if (this.type === "file") {
164
- this.value = null;
165
- }
166
- else {
167
- if (!this.def) {
168
- this.def = this.value || "";
169
- }
170
- if (!this.value) {
171
- this.value = this.def;
172
- }
173
- }
174
- this._initName();
175
- }
176
- firstUpdated() {
177
- super.firstUpdated();
178
- if (this.type === "range") {
179
- this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + "%";
180
- }
181
- }
182
- _handleRange(e) {
183
- this.value = e.target.value;
184
- this._ranged.style.width = (100 * parseInt(e.target.value)) / (this.max - this.min) + "%";
185
- this.dispatchEvent(new CustomEvent("input", { detail: this.value }));
186
- }
187
- _handleFile(e) {
188
- this.value = !this.only ? e.target.files : e.target.files[0];
189
- this.dispatchEvent(new CustomEvent("change", { detail: this.value }));
190
- }
191
- reset() {
192
- if (this.type === "file") {
193
- this.value = null;
194
- return;
195
- }
196
- if (this.type === "range") {
197
- this._input.value = this.def || ((this.max - this.min) / 2).toString();
198
- this.value = this._input.value;
199
- this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + "%";
200
- }
201
- else {
202
- this._input.value = this.def.toString();
203
- this.value = this.def;
204
- }
205
- }
206
- _typeSwitcher() {
207
- switch (this.type) {
208
- case "file":
209
- return html `<input id="input" class="input" type="file" accept="${this.accept}" ?multiple="${!this.only}" @change="${this._handleFile}" />${htmlSlot()}`;
210
- case "number":
211
- return html `<input .value="${this.value}" ?autofocus="${this.autofocus}" id="input" class="input" type="number" placeholder="${this.pla}" min="${this.min}" max="${this.max}" @input="${this._handleInput}" @change="${this._handleChange}" />`;
212
- default:
213
- return html `<input .value="${this.value}" ?autofocus="${this.autofocus}" id="input" class="input" type="${this.type}" placeholder="${this.pla}" @input="${this._handleInput}" @change="${this._handleChange}" />`;
214
- }
215
- }
216
- };
216
+ ];
217
217
  __decorate([
218
218
  property()
219
219
  ], BaseInput.prototype, "accept", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"base-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/base-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC;;GAEG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,YAAY;IAApC;;QACL;;WAEG;QACS,WAAM,GAAG,SAAS,CAAC;QAC/B;;WAEG;QACS,UAAK,GAA6B,SAAS,CAAC;QACxD;;WAEG;QAC0B,SAAI,GAAG,KAAK,CAAC;QAC1C;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACyB,QAAG,GAAG,GAAG,CAAC;QACtC;;WAEG;QACyB,SAAI,GAAG,CAAC,CAAC;I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,MAAM,CAAC;YAElP;gBACE,OAAO,IAAI,CAAA,kBAAkB,IAAI,CAAC,KAAK,iBAAiB,IAAI,CAAC,SAAS,oCAAoC,IAAI,CAAC,IAAI,kBAAkB,IAAI,CAAC,GAAG,aAAa,IAAI,CAAC,YAAY,cAAc,IAAI,CAAC,aAAa,MAAM,CAAC;QACtN,CAAC;IACH,CAAC;;AAjNW;IAAX,QAAQ,EAAE;yCAAoB;AAInB;IAAX,QAAQ,EAAE;wCAA6C;AAI3B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAAc;AAId;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAS;AAIR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAU;AAEpB;IAAhB,KAAK,CAAC,QAAQ,CAAC;yCAA0B;AACvB;IAAlB,KAAK,CAAC,UAAU,CAAC;0CAAsB;AA3B7B,SAAS;IADrB,MAAM,CAAC,UAAU,CAAC;GACN,SAAS,CAsNrB;;AAED,eAAe,SAAS,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { cssvar, cssvarValues, define } from \"../../root.js\";\nimport { InputElement } from \"./input.js\";\n\nconst defineName = \"base-input\";\n\n/**\n * BaseInput.\n */\n@define(defineName)\nexport class BaseInput extends InputElement {\n /**\n * Input sccept.\n */\n @property() accept = undefined;\n /**\n * Value.\n */\n @property() value: string | File | FileList = undefined;\n /**\n * Only single files are allowed to be selected.\n */\n @property({ type: Boolean }) only = false;\n /**\n * Input min.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input max.\n */\n @property({ type: Number }) max = 100;\n /**\n * Input step.\n */\n @property({ type: Number }) step = 1;\n\n @query(\"#input\") _input: HTMLInputElement;\n @query(\".range i\") _ranged: HTMLElement;\n\n static styles = [\n InputElement.styles,\n css`\n :host {\n width: var(${cssvarValues.input}--width);\n height: var(${cssvarValues.input}--height);\n background: var(${cssvarValues.input}--background);\n margin: var(${cssvarValues.input}--outline-width);\n outline: var(${cssvarValues.input}--outline);\n border-radius: var(${cssvarValues.input}--radius);\n }\n\n input[type=\"file\"] {\n display: none;\n }\n\n label,\n div {\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n * {\n border-radius: inherit;\n cursor: inherit;\n }\n\n input {\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n margin: 0;\n color: inherit;\n background: transparent;\n padding: 0 0.25em;\n border-radius: 0.25em;\n }\n `,\n css`\n :host([type=\"range\"]) {\n height: auto !important;\n margin: 0.3em 0;\n background: var(${cssvarValues.input}--false);\n border-radius: 2em;\n }\n\n .range b:nth-of-type(1) {\n width: 1em;\n left: 0;\n background: var(${cssvarValues.input}--true);\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .range b {\n pointer-events: none;\n width: calc(100% - 1em);\n height: 100%;\n left: 1em;\n position: absolute;\n }\n\n .range {\n height: fit-content;\n position: relative;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n }\n\n .range input {\n padding: 0;\n height: 0.6em;\n margin: 0px -0.5em;\n appearance: none;\n -webkit-appearance: none;\n outline: none;\n background: transparent;\n }\n\n .range i {\n position: absolute;\n left: 0;\n width: 50%;\n height: 100%;\n pointer-events: none;\n background: var(${cssvarValues.input}--true);\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n .range input::-webkit-slider-runnable-track {\n height: 0.6em;\n }\n\n .range input::-webkit-slider-thumb {\n z-index: 1;\n appearance: none;\n -webkit-appearance: none;\n position: relative;\n height: 1.2em;\n width: 1.2em;\n margin-top: -0.3em;\n background: var(${cssvarValues.input}--control);\n border-radius: 50%;\n border: solid 0.125em var(${cssvarValues.input}--control-edge);\n box-shadow: 0 0.1em 0.1em var(${cssvar}--shadow);\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n if (this.type === \"range\") {\n return html`<div class=\"range\">\n <input id=\"input\" type=\"range\" min=\"${this.min}\" max=\"${this.max}\" step=\"${this.step}\" @input=\"${this._handleRange}\" @change=\"${this._handleRange}\" />\n <b></b>\n <b>\n <i></i>\n </b>\n </div>`;\n }\n return html`<label for=\"input\"> ${htmlSlot(\"pre\")} ${this._typeSwitcher()} ${htmlSlot(\"suf\")} </label>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.type === \"file\") {\n this.value = null;\n } else {\n if (!this.def) {\n this.def = (this.value as string) || \"\";\n }\n if (!this.value) {\n this.value = this.def;\n }\n }\n this._initName();\n }\n\n protected firstUpdated() {\n super.firstUpdated();\n if (this.type === \"range\") {\n this._ranged.style.width = 100 * (parseInt(this.value as string) / (this.max - this.min)) + \"%\";\n }\n }\n\n protected _handleRange(e: any | Event) {\n this.value = e.target.value;\n this._ranged.style.width = (100 * parseInt(e.target.value)) / (this.max - this.min) + \"%\";\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value }));\n }\n\n protected _handleFile(e: any | Event) {\n this.value = !this.only ? e.target.files : e.target.files[0];\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value }));\n }\n\n reset() {\n if (this.type === \"file\") {\n this.value = null;\n return;\n }\n if (this.type === \"range\") {\n this._input.value = this.def || ((this.max - this.min) / 2).toString();\n this.value = this._input.value;\n this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + \"%\";\n } else {\n this._input.value = this.def.toString();\n this.value = this.def;\n }\n }\n\n protected _typeSwitcher(): HTMLTemplate {\n switch (this.type) {\n case \"file\":\n return html`<input id=\"input\" class=\"input\" type=\"file\" accept=\"${this.accept}\" ?multiple=\"${!this.only}\" @change=\"${this._handleFile}\" />${htmlSlot()}`;\n\n case \"number\":\n return html`<input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"input\" class=\"input\" type=\"number\" placeholder=\"${this.pla}\" min=\"${this.min}\" max=\"${this.max}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />`;\n\n default:\n return html`<input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"input\" class=\"input\" type=\"${this.type}\" placeholder=\"${this.pla}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />`;\n }\n }\n}\n\nexport default BaseInput;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"base-input\": BaseInput;\n }\n}\n"]}
1
+ {"version":3,"file":"base-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/base-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC;;GAEG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,YAAY;IAApC;;QACL;;WAEG;QACS,WAAM,GAAG,SAAS,CAAC;QAC/B;;WAEG;QACS,UAAK,GAA6B,SAAS,CAAC;QACxD;;WAEG;QAC0B,SAAI,GAAG,KAAK,CAAC;QAC1C;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACyB,QAAG,GAAG,GAAG,CAAC;QACtC;;WAEG;QACyB,SAAI,GAAG,CAAC,CAAC;IA8LvC,CAAC;IAzEW,MAAM;QACd,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAA;8CAC6B,IAAI,CAAC,GAAG,UAAU,IAAI,CAAC,GAAG,WAAW,IAAI,CAAC,I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,YAAY,CAAC,KAAK;wCACd,MAAM;;KAEzC;CACgB,AA9GN,CA8GO;AAvIR;IAAX,QAAQ,EAAE;yCAAoB;AAInB;IAAX,QAAQ,EAAE;wCAA6C;AAI3B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAAc;AAId;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAS;AAIR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAU;AAEpB;IAAhB,KAAK,CAAC,QAAQ,CAAC;yCAA0B;AACvB;IAAlB,KAAK,CAAC,UAAU,CAAC;0CAAsB;AA3B7B,SAAS;IADrB,MAAM,CAAC,UAAU,CAAC;GACN,SAAS,CAsNrB;;AAED,eAAe,SAAS,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { cssvar, cssvarValues, define } from \"../../root.js\";\nimport { InputElement } from \"./input.js\";\n\nconst defineName = \"base-input\";\n\n/**\n * BaseInput.\n */\n@define(defineName)\nexport class BaseInput extends InputElement {\n /**\n * Input sccept.\n */\n @property() accept = undefined;\n /**\n * Value.\n */\n @property() value: string | File | FileList = undefined;\n /**\n * Only single files are allowed to be selected.\n */\n @property({ type: Boolean }) only = false;\n /**\n * Input min.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input max.\n */\n @property({ type: Number }) max = 100;\n /**\n * Input step.\n */\n @property({ type: Number }) step = 1;\n\n @query(\"#input\") _input: HTMLInputElement;\n @query(\".range i\") _ranged: HTMLElement;\n\n static styles = [\n InputElement.styles,\n css`\n :host {\n width: var(${cssvarValues.input}--width);\n height: var(${cssvarValues.input}--height);\n background: var(${cssvarValues.input}--background);\n margin: var(${cssvarValues.input}--outline-width);\n outline: var(${cssvarValues.input}--outline);\n border-radius: var(${cssvarValues.input}--radius);\n }\n\n input[type=\"file\"] {\n display: none;\n }\n\n label,\n div {\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n * {\n border-radius: inherit;\n cursor: inherit;\n }\n\n input {\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n margin: 0;\n color: inherit;\n background: transparent;\n padding: 0 0.25em;\n border-radius: 0.25em;\n }\n `,\n css`\n :host([type=\"range\"]) {\n height: auto !important;\n margin: 0.3em 0;\n background: var(${cssvarValues.input}--false);\n border-radius: 2em;\n }\n\n .range b:nth-of-type(1) {\n width: 1em;\n left: 0;\n background: var(${cssvarValues.input}--true);\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .range b {\n pointer-events: none;\n width: calc(100% - 1em);\n height: 100%;\n left: 1em;\n position: absolute;\n }\n\n .range {\n height: fit-content;\n position: relative;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n }\n\n .range input {\n padding: 0;\n height: 0.6em;\n margin: 0px -0.5em;\n appearance: none;\n -webkit-appearance: none;\n outline: none;\n background: transparent;\n }\n\n .range i {\n position: absolute;\n left: 0;\n width: 50%;\n height: 100%;\n pointer-events: none;\n background: var(${cssvarValues.input}--true);\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n .range input::-webkit-slider-runnable-track {\n height: 0.6em;\n }\n\n .range input::-webkit-slider-thumb {\n z-index: 1;\n appearance: none;\n -webkit-appearance: none;\n position: relative;\n height: 1.2em;\n width: 1.2em;\n margin-top: -0.3em;\n background: var(${cssvarValues.input}--control);\n border-radius: 50%;\n border: solid 0.125em var(${cssvarValues.input}--control-edge);\n box-shadow: 0 0.1em 0.1em var(${cssvar}--shadow);\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n if (this.type === \"range\") {\n return html`<div class=\"range\">\n <input id=\"input\" type=\"range\" min=\"${this.min}\" max=\"${this.max}\" step=\"${this.step}\" @input=\"${this._handleRange}\" @change=\"${this._handleRange}\" />\n <b></b>\n <b>\n <i></i>\n </b>\n </div>`;\n }\n return html`<label for=\"input\"> ${htmlSlot(\"pre\")} ${this._typeSwitcher()} ${htmlSlot(\"suf\")} </label>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.type === \"file\") {\n this.value = null;\n } else {\n if (!this.def) {\n this.def = (this.value as string) || \"\";\n }\n if (!this.value) {\n this.value = this.def;\n }\n }\n this._initName();\n }\n\n protected firstUpdated() {\n super.firstUpdated();\n if (this.type === \"range\") {\n this._ranged.style.width = 100 * (parseInt(this.value as string) / (this.max - this.min)) + \"%\";\n }\n }\n\n protected _handleRange(e: any | Event) {\n this.value = e.target.value;\n this._ranged.style.width = (100 * parseInt(e.target.value)) / (this.max - this.min) + \"%\";\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value }));\n }\n\n protected _handleFile(e: any | Event) {\n this.value = !this.only ? e.target.files : e.target.files[0];\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value }));\n }\n\n reset() {\n if (this.type === \"file\") {\n this.value = null;\n return;\n }\n if (this.type === \"range\") {\n this._input.value = this.def || ((this.max - this.min) / 2).toString();\n this.value = this._input.value;\n this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + \"%\";\n } else {\n this._input.value = this.def.toString();\n this.value = this.def;\n }\n }\n\n protected _typeSwitcher(): HTMLTemplate {\n switch (this.type) {\n case \"file\":\n return html`<input id=\"input\" class=\"input\" type=\"file\" accept=\"${this.accept}\" ?multiple=\"${!this.only}\" @change=\"${this._handleFile}\" />${htmlSlot()}`;\n\n case \"number\":\n return html`<input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"input\" class=\"input\" type=\"number\" placeholder=\"${this.pla}\" min=\"${this.min}\" max=\"${this.max}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />`;\n\n default:\n return html`<input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"input\" class=\"input\" type=\"${this.type}\" placeholder=\"${this.pla}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />`;\n }\n }\n}\n\nexport default BaseInput;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"base-input\": BaseInput;\n }\n}\n"]}
@@ -13,21 +13,6 @@ export class InputElement extends GodownElement {
13
13
  this.autofocus = false;
14
14
  this.nameValue = () => this.namevalue();
15
15
  }
16
- static { this.styles = [
17
- GodownElement.styles,
18
- css `
19
- :host {
20
- display: flex;
21
- }
22
- ::-ms-reveal {
23
- display: none;
24
- }
25
- ::-webkit-calendar-picker-indicator {
26
- background-color: var(${cssvarValues.input}-true);
27
- border-radius: 0.1rem;
28
- }
29
- `,
30
- ]; }
31
16
  namevalue() {
32
17
  return [this.name, this.value];
33
18
  }
@@ -93,6 +78,21 @@ export class InputElement extends GodownElement {
93
78
  return target.value;
94
79
  }
95
80
  }
81
+ InputElement.styles = [
82
+ GodownElement.styles,
83
+ css `
84
+ :host {
85
+ display: flex;
86
+ }
87
+ ::-ms-reveal {
88
+ display: none;
89
+ }
90
+ ::-webkit-calendar-picker-indicator {
91
+ background-color: var(${cssvarValues.input}-true);
92
+ border-radius: 0.1rem;
93
+ }
94
+ `,
95
+ ];
96
96
  __decorate([
97
97
  property({ reflect: true })
98
98
  ], InputElement.prototype, "type", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI5D,MAAM,OAAO,YAAa,SAAQ,aAAa;IAA/C;;QAC+B,SAAI,GAAc,MAAM,CAAC;QAC1C,SAAI,GAAW,SAAS,CAAC;QACzB,UAAK,GAAiB,SAAS,CAAC;QACf,UAAK,GAAG,EAAE,CAAC;QAC5B,QAAG,GAAG,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EAAE,CAAC;QACzB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAES,WAAW,CAAC,CAAQ;QAC5B,MAAM,MAAM,GAAG,CAAC,CAAC,MAA0B,CAAC;QAC5C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;;AAtG4B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAA0B;AAC1C;IAAX,QAAQ,EAAE;0CAA0B;AACzB;IAAX,QAAQ,EAAE;2CAAiC;AACf;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAY;AAC5B;IAAX,QAAQ,EAAE;yCAAU;AACQ;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAA0B;AACV;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAmB","sourcesContent":["import { css, type CSSResultGroup, property } from \"../../deps.js\";\nimport { cssvarValues, GodownElement } from \"../../root.js\";\n\nexport type InputType = \"hidden\" | \"text\" | \"search\" | \"tel\" | \"url\" | \"email\" | \"password\" | \"datetime\" | \"date\" | \"month\" | \"week\" | \"time\" | \"datetime-local\" | \"number\" | \"range\" | \"color\" | \"checkbox\" | \"radio\" | \"file\" | \"image\";\n\nexport class InputElement extends GodownElement {\n @property({ reflect: true }) type: InputType = \"text\";\n @property() name: string = undefined;\n @property() value: string | any = undefined;\n @property({ reflect: true }) label = \"\";\n @property() def = \"\";\n @property({ reflect: true }) pla?: string = undefined;\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n _input: HTMLInputElement;\n compositing: boolean;\n\n static styles = [\n GodownElement.styles,\n css`\n :host {\n display: flex;\n }\n ::-ms-reveal {\n display: none;\n }\n ::-webkit-calendar-picker-indicator {\n background-color: var(${cssvarValues.input}-true);\n border-radius: 0.1rem;\n }\n `,\n ] as CSSResultGroup;\n\n namevalue(): [string, any] {\n return [this.name, this.value];\n }\n\n nameValue = () => this.namevalue();\n\n reset() {\n this.value = this.def;\n this._input.value = this.def;\n }\n\n protected _handleInput(e: any) {\n e.stopPropagation();\n this.value = e.target.value?.trim();\n if (this.compositing) {\n return;\n }\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value, bubbles: true, composed: true }));\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n protected _handleChange() {\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.def) {\n this.def = this.value || \"\";\n }\n if (!this.value) {\n this.value = this.def;\n }\n this._initName();\n }\n\n protected _initName() {\n if (!this.name) {\n if (this.label || this.type) {\n this.name = this.label || this.type;\n }\n }\n }\n\n protected _compositionCheck() {\n if (this._input) {\n this.addEvent(this._input, \"compositionstart\", () => {\n this.compositing = true;\n });\n this.addEvent(this._input, \"compositionend\", (e: MouseEvent) => {\n this.compositing = false;\n this._handleInput(e);\n });\n }\n }\n\n protected _changeInputType(t: InputType) {\n this._input.type = t;\n }\n\n focus(options?: FocusOptions) {\n this._input?.focus(options);\n }\n\n protected firstUpdated() {\n this._compositionCheck();\n this.reset();\n }\n\n protected targetValue(e: Event): string | any {\n const target = e.target as HTMLInputElement;\n if (target.value.trim) {\n return target.value.trim();\n }\n return target.value;\n }\n}\n"]}
1
+ {"version":3,"file":"input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI5D,MAAM,OAAO,YAAa,SAAQ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ES,YAAY;QACpB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAES,WAAW,CAAC,CAAQ;QAC5B,MAAM,MAAM,GAAG,CAAC,CAAC,MAA0B,CAAC;QAC5C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;;AA3FM,mBAAM,GAAG;IACd,aAAa,CAAC,MAAM;IACpB,GAAG,CAAA;;;;;;;;gCAQyB,YAAY,CAAC,KAAK;;;KAG7C;CACgB,AAdN,CAcO;AAzBS;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAA0B;AAC1C;IAAX,QAAQ,EAAE;0CAA0B;AACzB;IAAX,QAAQ,EAAE;2CAAiC;AACf;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAY;AAC5B;IAAX,QAAQ,EAAE;yCAAU;AACQ;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAA0B;AACV;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAmB","sourcesContent":["import { css, type CSSResultGroup, property } from \"../../deps.js\";\nimport { cssvarValues, GodownElement } from \"../../root.js\";\n\nexport type InputType = \"hidden\" | \"text\" | \"search\" | \"tel\" | \"url\" | \"email\" | \"password\" | \"datetime\" | \"date\" | \"month\" | \"week\" | \"time\" | \"datetime-local\" | \"number\" | \"range\" | \"color\" | \"checkbox\" | \"radio\" | \"file\" | \"image\";\n\nexport class InputElement extends GodownElement {\n @property({ reflect: true }) type: InputType = \"text\";\n @property() name: string = undefined;\n @property() value: string | any = undefined;\n @property({ reflect: true }) label = \"\";\n @property() def = \"\";\n @property({ reflect: true }) pla?: string = undefined;\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n _input: HTMLInputElement;\n compositing: boolean;\n\n static styles = [\n GodownElement.styles,\n css`\n :host {\n display: flex;\n }\n ::-ms-reveal {\n display: none;\n }\n ::-webkit-calendar-picker-indicator {\n background-color: var(${cssvarValues.input}-true);\n border-radius: 0.1rem;\n }\n `,\n ] as CSSResultGroup;\n\n namevalue(): [string, any] {\n return [this.name, this.value];\n }\n\n nameValue = () => this.namevalue();\n\n reset() {\n this.value = this.def;\n this._input.value = this.def;\n }\n\n protected _handleInput(e: any) {\n e.stopPropagation();\n this.value = e.target.value?.trim();\n if (this.compositing) {\n return;\n }\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value, bubbles: true, composed: true }));\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n protected _handleChange() {\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.def) {\n this.def = this.value || \"\";\n }\n if (!this.value) {\n this.value = this.def;\n }\n this._initName();\n }\n\n protected _initName() {\n if (!this.name) {\n if (this.label || this.type) {\n this.name = this.label || this.type;\n }\n }\n }\n\n protected _compositionCheck() {\n if (this._input) {\n this.addEvent(this._input, \"compositionstart\", () => {\n this.compositing = true;\n });\n this.addEvent(this._input, \"compositionend\", (e: MouseEvent) => {\n this.compositing = false;\n this._handleInput(e);\n });\n }\n }\n\n protected _changeInputType(t: InputType) {\n this._input.type = t;\n }\n\n focus(options?: FocusOptions) {\n this._input?.focus(options);\n }\n\n protected firstUpdated() {\n this._compositionCheck();\n this.reset();\n }\n\n protected targetValue(e: Event): string | any {\n const target = e.target as HTMLInputElement;\n if (target.value.trim) {\n return target.value.trim();\n }\n return target.value;\n }\n}\n"]}
@@ -42,9 +42,54 @@ let LabelInput = class LabelInput extends InputElement {
42
42
  */
43
43
  this.mobile = "540px";
44
44
  }
45
- static { this.styles = [
46
- InputElement.styles,
47
- css `
45
+ render() {
46
+ const result = html `<fieldset>
47
+ <i>${htmlSlot("pre")}</i>
48
+ <input .value="${this.value}" ?autofocus="${this.autofocus}" id="${this.name}" type="${this.type}" placeholder="${this.pla}" class="${this.type}" @input="${this._handleInput}" @change="${this._handleChange}" />
49
+ ${this.renderSuf()}
50
+ </fieldset>`;
51
+ if (this.label) {
52
+ const style = this.mobile && `${styleWithLabel}@media (max-width: ${this.mobile}){${styleInMedia}}`;
53
+ return [
54
+ html `<label for="${this.name}">
55
+ <span>${this.label}${htmlSlot()}</span>
56
+ ${result}
57
+ </label>`,
58
+ htmlStyle(style),
59
+ ];
60
+ }
61
+ return [result, htmlStyle(styleNoLabel.toString())];
62
+ }
63
+ renderSuf() {
64
+ if (this.type === PASSWORD) {
65
+ return html `<i
66
+ @mousedown="${this._passwordSwitcher}"
67
+ @mouseup="${() => {
68
+ this._changeInputType(PASSWORD);
69
+ }}"
70
+ @mouseleave="${() => {
71
+ this._changeInputType(PASSWORD);
72
+ }}"
73
+ >
74
+ ${htmlSlot("suf", svgEye(), this)}
75
+ </i>`;
76
+ }
77
+ else {
78
+ return html `<i>${htmlSlot("suf")}</i>`;
79
+ }
80
+ }
81
+ _passwordSwitcher() {
82
+ if (this._input.type === PASSWORD) {
83
+ this._changeInputType("text");
84
+ }
85
+ else {
86
+ this._changeInputType(PASSWORD);
87
+ }
88
+ }
89
+ };
90
+ LabelInput.styles = [
91
+ InputElement.styles,
92
+ css `
48
93
  :host {
49
94
  margin: var(${cssvarValues.input}--outline-width);
50
95
  border-radius: var(${cssvarValues.input}--radius);
@@ -102,52 +147,7 @@ let LabelInput = class LabelInput extends InputElement {
102
147
  min-width: var(${cssvarValues.input}--width);
103
148
  }
104
149
  `,
105
- ]; }
106
- render() {
107
- const result = html `<fieldset>
108
- <i>${htmlSlot("pre")}</i>
109
- <input .value="${this.value}" ?autofocus="${this.autofocus}" id="${this.name}" type="${this.type}" placeholder="${this.pla}" class="${this.type}" @input="${this._handleInput}" @change="${this._handleChange}" />
110
- ${this.renderSuf()}
111
- </fieldset>`;
112
- if (this.label) {
113
- const style = this.mobile && `${styleWithLabel}@media (max-width: ${this.mobile}){${styleInMedia}}`;
114
- return [
115
- html `<label for="${this.name}">
116
- <span>${this.label}${htmlSlot()}</span>
117
- ${result}
118
- </label>`,
119
- htmlStyle(style),
120
- ];
121
- }
122
- return [result, htmlStyle(styleNoLabel.toString())];
123
- }
124
- renderSuf() {
125
- if (this.type === PASSWORD) {
126
- return html `<i
127
- @mousedown="${this._passwordSwitcher}"
128
- @mouseup="${() => {
129
- this._changeInputType(PASSWORD);
130
- }}"
131
- @mouseleave="${() => {
132
- this._changeInputType(PASSWORD);
133
- }}"
134
- >
135
- ${htmlSlot("suf", svgEye(), this)}
136
- </i>`;
137
- }
138
- else {
139
- return html `<i>${htmlSlot("suf")}</i>`;
140
- }
141
- }
142
- _passwordSwitcher() {
143
- if (this._input.type === PASSWORD) {
144
- this._changeInputType("text");
145
- }
146
- else {
147
- this._changeInputType(PASSWORD);
148
- }
149
- }
150
- };
150
+ ];
151
151
  __decorate([
152
152
  property()
153
153
  ], LabelInput.prototype, "mobile", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"label-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAqB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;iBAQP,YAAY,CAAC,KAAK;;;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AC7B,MAAM;iBACD;gBACT,SAAS,CAAC,KAAK,CAAC;aACjB,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IAEO,SAAS;QACf,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAA;sBACK,IAAI,CAAC,iBAAiB;oBACxB,GAAG,EAAE;gBACf,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;uBACc,GAAG,EAAE;gBAClB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;;UAEC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC;WAC9B,CAAC;QACR,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAA,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QACzC,CAAC;IACH,CAAC;IAES,iBAAiB;QACzB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAClC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;;AA7GW;IAAX,QAAQ,EAAE;0CAAkB;AAEb;IAAf,KAAK,CAAC,OAAO,CAAC;0CAA0B;AAN9B,UAAU;IADtB,MAAM,CAAC,UAAU,CAAC;GACN,UAAU,CAkHtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, htmlStyle, type HTMLTemplate, svgEye } from \"../../lib/templates.js\";\nimport { cssvarValues, define } from \"../../root.js\";\nimport { InputElement } from \"./input.js\";\n\nconst PASSWORD = \"password\";\n\nconst styleInMedia = css`\n label[for] {\n justify-content: flex-start;\n flex-direction: column;\n align-items: inherit;\n width: fit-content;\n }\n :host {\n width: var(${cssvarValues.input}--width);\n margin: auto;\n }\n`;\n\nconst styleNoLabel = css`\n :host {\n width: var(${cssvarValues.input}--width);\n }\n`;\n\nconst styleWithLabel = css`\n :host {\n width: calc(var(${cssvarValues.input}--width) * 2);\n }\n`;\n\nconst defineName = \"label-input\";\n\n/**\n * LabelInput renders label and input.\n *\n * When there is a label, the layout will be adjusted according to the width of the screen.\n *\n * Otherwise it behaves similarly to the `BaseInput`.\n */\n@define(defineName)\nexport class LabelInput extends InputElement {\n /**\n * Conditions for adjust layout.\n */\n @property() mobile = \"540px\";\n\n @query(\"input\") _input: HTMLInputElement;\n\n static styles = [\n InputElement.styles,\n css`\n :host {\n margin: var(${cssvarValues.input}--outline-width);\n border-radius: var(${cssvarValues.input}--radius);\n }\n\n label {\n width: 100%;\n margin: auto;\n box-sizing: border-box;\n height: fit-content;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-radius: inherit;\n }\n\n span {\n white-space: nowrap;\n }\n\n input {\n padding: 0 0.25em;\n background-color: transparent;\n border-radius: inherit;\n flex: 1;\n width: 100%;\n height: inherit;\n }\n\n fieldset:focus-within {\n outline: var(${cssvarValues.input}--outline);\n }\n\n i {\n margin: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n i > svg {\n height: 1em;\n width: 1em;\n margin: 0.25em;\n }\n\n fieldset {\n position: relative;\n background-color: var(${cssvarValues.input}--background);\n display: flex;\n align-items: center;\n border-radius: inherit;\n height: var(${cssvarValues.input}--height);\n width: var(${cssvarValues.input}--width);\n min-width: var(${cssvarValues.input}--width);\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate[] {\n const result = html`<fieldset>\n <i>${htmlSlot(\"pre\")}</i>\n <input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"${this.name}\" type=\"${this.type}\" placeholder=\"${this.pla}\" class=\"${this.type}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />\n ${this.renderSuf()}\n </fieldset>`;\n if (this.label) {\n const style = this.mobile && `${styleWithLabel}@media (max-width: ${this.mobile}){${styleInMedia}}`;\n return [\n html`<label for=\"${this.name}\">\n <span>${this.label}${htmlSlot()}</span>\n ${result}\n </label>`,\n htmlStyle(style),\n ];\n }\n return [result, htmlStyle(styleNoLabel.toString())];\n }\n\n private renderSuf(): HTMLTemplate {\n if (this.type === PASSWORD) {\n return html`<i\n @mousedown=\"${this._passwordSwitcher}\"\n @mouseup=\"${() => {\n this._changeInputType(PASSWORD);\n }}\"\n @mouseleave=\"${() => {\n this._changeInputType(PASSWORD);\n }}\"\n >\n ${htmlSlot(\"suf\", svgEye(), this)}\n </i>`;\n } else {\n return html`<i>${htmlSlot(\"suf\")}</i>`;\n }\n }\n\n protected _passwordSwitcher() {\n if (this._input.type === PASSWORD) {\n this._changeInputType(\"text\");\n } else {\n this._changeInputType(PASSWORD);\n }\n }\n}\n\nexport default LabelInput;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"label-input\": LabelInput;\n }\n}\n"]}
1
+ {"version":3,"file":"label-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAqB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;iBAQP,YAAY,CAAC,KAAK;;;CAGlC,CAAC;AAEF,MAAM,YAAY,GAAG,GAAG,CAAA;;iBAEP,YA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;gBAClB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;;UAEC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC;WAC9B,CAAC;QACR,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAA,MAAM,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QACzC,CAAC;IACH,CAAC;IAES,iBAAiB;QACzB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAClC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;;AAzGM,iBAAM,GAAG;IACd,YAAY,CAAC,MAAM;IACnB,GAAG,CAAA;;sBAEe,YAAY,CAAC,KAAK;6BACX,YAAY,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA4BxB,YAAY,CAAC,KAAK;;;;;;;;;;;;;;;;;;gCAkBT,YAAY,CAAC,KAAK;;;;sBAI5B,YAAY,CAAC,KAAK;qBACnB,YAAY,CAAC,KAAK;yBACd,YAAY,CAAC,KAAK;;KAEtC;CACgB,AA5DN,CA4DO;AAhER;IAAX,QAAQ,EAAE;0CAAkB;AAEb;IAAf,KAAK,CAAC,OAAO,CAAC;0CAA0B;AAN9B,UAAU;IADtB,MAAM,CAAC,UAAU,CAAC;GACN,UAAU,CAkHtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, htmlStyle, type HTMLTemplate, svgEye } from \"../../lib/templates.js\";\nimport { cssvarValues, define } from \"../../root.js\";\nimport { InputElement } from \"./input.js\";\n\nconst PASSWORD = \"password\";\n\nconst styleInMedia = css`\n label[for] {\n justify-content: flex-start;\n flex-direction: column;\n align-items: inherit;\n width: fit-content;\n }\n :host {\n width: var(${cssvarValues.input}--width);\n margin: auto;\n }\n`;\n\nconst styleNoLabel = css`\n :host {\n width: var(${cssvarValues.input}--width);\n }\n`;\n\nconst styleWithLabel = css`\n :host {\n width: calc(var(${cssvarValues.input}--width) * 2);\n }\n`;\n\nconst defineName = \"label-input\";\n\n/**\n * LabelInput renders label and input.\n *\n * When there is a label, the layout will be adjusted according to the width of the screen.\n *\n * Otherwise it behaves similarly to the `BaseInput`.\n */\n@define(defineName)\nexport class LabelInput extends InputElement {\n /**\n * Conditions for adjust layout.\n */\n @property() mobile = \"540px\";\n\n @query(\"input\") _input: HTMLInputElement;\n\n static styles = [\n InputElement.styles,\n css`\n :host {\n margin: var(${cssvarValues.input}--outline-width);\n border-radius: var(${cssvarValues.input}--radius);\n }\n\n label {\n width: 100%;\n margin: auto;\n box-sizing: border-box;\n height: fit-content;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-radius: inherit;\n }\n\n span {\n white-space: nowrap;\n }\n\n input {\n padding: 0 0.25em;\n background-color: transparent;\n border-radius: inherit;\n flex: 1;\n width: 100%;\n height: inherit;\n }\n\n fieldset:focus-within {\n outline: var(${cssvarValues.input}--outline);\n }\n\n i {\n margin: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n i > svg {\n height: 1em;\n width: 1em;\n margin: 0.25em;\n }\n\n fieldset {\n position: relative;\n background-color: var(${cssvarValues.input}--background);\n display: flex;\n align-items: center;\n border-radius: inherit;\n height: var(${cssvarValues.input}--height);\n width: var(${cssvarValues.input}--width);\n min-width: var(${cssvarValues.input}--width);\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate[] {\n const result = html`<fieldset>\n <i>${htmlSlot(\"pre\")}</i>\n <input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"${this.name}\" type=\"${this.type}\" placeholder=\"${this.pla}\" class=\"${this.type}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />\n ${this.renderSuf()}\n </fieldset>`;\n if (this.label) {\n const style = this.mobile && `${styleWithLabel}@media (max-width: ${this.mobile}){${styleInMedia}}`;\n return [\n html`<label for=\"${this.name}\">\n <span>${this.label}${htmlSlot()}</span>\n ${result}\n </label>`,\n htmlStyle(style),\n ];\n }\n return [result, htmlStyle(styleNoLabel.toString())];\n }\n\n private renderSuf(): HTMLTemplate {\n if (this.type === PASSWORD) {\n return html`<i\n @mousedown=\"${this._passwordSwitcher}\"\n @mouseup=\"${() => {\n this._changeInputType(PASSWORD);\n }}\"\n @mouseleave=\"${() => {\n this._changeInputType(PASSWORD);\n }}\"\n >\n ${htmlSlot(\"suf\", svgEye(), this)}\n </i>`;\n } else {\n return html`<i>${htmlSlot(\"suf\")}</i>`;\n }\n }\n\n protected _passwordSwitcher() {\n if (this._input.type === PASSWORD) {\n this._changeInputType(\"text\");\n } else {\n this._changeInputType(PASSWORD);\n }\n }\n}\n\nexport default LabelInput;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"label-input\": LabelInput;\n }\n}\n"]}
@@ -40,9 +40,58 @@ let SearchInput = class SearchInput extends InputElement {
40
40
  */
41
41
  this.name = "q";
42
42
  }
43
- static { this.styles = [
44
- InputElement.styles,
45
- css `
43
+ render() {
44
+ return html `<form action="${this.action}" method="${this.method}">
45
+ <div>
46
+ <input .value="${this.value}" ?autofocus="${this.autofocus}" name="${this.name}" @focus="${this._handleInput}" @input="${this._handleInput}" title="" placeholder="${this.pla}" />
47
+ <button @click="${this._handleSubmit}">${htmlSlot("search", svgSearch(), this)}</button>
48
+ </div>
49
+ <ul>
50
+ ${htmlSlot()}
51
+ </ul>
52
+ </form>`;
53
+ }
54
+ _handleSubmit(e) {
55
+ if (!this.action) {
56
+ e.preventDefault();
57
+ }
58
+ this.dispatchEvent(new CustomEvent("submit", { detail: this.value }));
59
+ }
60
+ _handleInput(e) {
61
+ e.stopPropagation();
62
+ const value = this.targetValue(e);
63
+ if (value === this.value) {
64
+ return;
65
+ }
66
+ this.value = value;
67
+ if (this.compositing) {
68
+ return;
69
+ }
70
+ if (this.target && this.query) {
71
+ this.searchElements(this.value);
72
+ }
73
+ this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true, composed: true }));
74
+ this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
75
+ }
76
+ searchElements(s) {
77
+ const targetElement = document.body.querySelector(this.target);
78
+ const queryElementsCollection = document.body.querySelectorAll(this.query);
79
+ if (!targetElement) {
80
+ return;
81
+ }
82
+ targetElement.replaceChildren();
83
+ if (s && queryElementsCollection.length) {
84
+ for (const e of queryElementsCollection) {
85
+ if (e.textContent.includes(this.value)) {
86
+ targetElement.appendChild(e.cloneNode(true));
87
+ }
88
+ }
89
+ }
90
+ }
91
+ };
92
+ SearchInput.styles = [
93
+ InputElement.styles,
94
+ css `
46
95
  :host {
47
96
  ${cssScope}--width:var(${cssvarValues.input}--width);
48
97
  ${cssScope}--input-padding: 0 0 0 .35em;
@@ -126,56 +175,7 @@ let SearchInput = class SearchInput extends InputElement {
126
175
  padding: 1px;
127
176
  }
128
177
  `,
129
- ]; }
130
- render() {
131
- return html `<form action="${this.action}" method="${this.method}">
132
- <div>
133
- <input .value="${this.value}" ?autofocus="${this.autofocus}" name="${this.name}" @focus="${this._handleInput}" @input="${this._handleInput}" title="" placeholder="${this.pla}" />
134
- <button @click="${this._handleSubmit}">${htmlSlot("search", svgSearch(), this)}</button>
135
- </div>
136
- <ul>
137
- ${htmlSlot()}
138
- </ul>
139
- </form>`;
140
- }
141
- _handleSubmit(e) {
142
- if (!this.action) {
143
- e.preventDefault();
144
- }
145
- this.dispatchEvent(new CustomEvent("submit", { detail: this.value }));
146
- }
147
- _handleInput(e) {
148
- e.stopPropagation();
149
- const value = this.targetValue(e);
150
- if (value === this.value) {
151
- return;
152
- }
153
- this.value = value;
154
- if (this.compositing) {
155
- return;
156
- }
157
- if (this.target && this.query) {
158
- this.searchElements(this.value);
159
- }
160
- this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true, composed: true }));
161
- this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
162
- }
163
- searchElements(s) {
164
- const targetElement = document.body.querySelector(this.target);
165
- const queryElementsCollection = document.body.querySelectorAll(this.query);
166
- if (!targetElement) {
167
- return;
168
- }
169
- targetElement.replaceChildren();
170
- if (s && queryElementsCollection.length) {
171
- for (const e of queryElementsCollection) {
172
- if (e.textContent.includes(this.value)) {
173
- targetElement.appendChild(e.cloneNode(true));
174
- }
175
- }
176
- }
177
- }
178
- };
178
+ ];
179
179
  __decorate([
180
180
  property()
181
181
  ], SearchInput.prototype, "query", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"search-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/search-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAEzC;;GAEG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,YAAY;IAAtC;;QACL;;WAEG;QACS,UAAK,GAAG,EAAE,CAAC;QACvB;;WAEG;QACS,WAAM,GAAG,EAAE,CAAC;QACxB;;WAEG;QAC0B,UAAK,GAAG,KAAK,CAAC;QAC3C;;WAEG;QACyC,UAAK,GAAG,KAAK,CAAC;QAC1D;;WAEG;QACS,WAAM,GAAG,EAAE,CAAC;QACxB;;WAEG;QACS,WAAM,GAAmB,KAAK,CAAC;QAC3C;;WAEG;QACS,SAAI,GAAG,GAAG,CAAC;IA+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QACH,CAAC;IACH,CAAC;;AAtKW;IAAX,QAAQ,EAAE;0CAAY;AAIX;IAAX,QAAQ,EAAE;2CAAa;AAIK;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAe;AAIC;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAI9C;IAAX,QAAQ,EAAE;2CAAa;AAIZ;IAAX,QAAQ,EAAE;2CAAgC;AAI/B;IAAX,QAAQ,EAAE;yCAAY;AAEP;IAAf,KAAK,CAAC,OAAO,CAAC;2CAA2B;AA9B/B,WAAW;IADvB,MAAM,CAAC,UAAU,CAAC;GACN,WAAW,CA2KvB;;AAED,eAAe,WAAW,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate, svgSearch } from \"../../lib/templates.js\";\nimport { createScope, cssvarValues, define } from \"../../root.js\";\nimport { InputElement } from \"./input.js\";\n\nconst defineName = \"search-input\";\n\nconst cssScope = createScope(defineName);\n\n/**\n * SearchInput used for search behavior.\n */\n@define(defineName)\nexport class SearchInput extends InputElement {\n /**\n * Query selectors.\n */\n @property() query = \"\";\n /**\n * Target selectors.\n */\n @property() target = \"\";\n /**\n * Enable infer.\n */\n @property({ type: Boolean }) infer = false;\n /**\n * Float result.\n */\n @property({ type: Boolean, reflect: true }) float = false;\n /**\n * Form action.\n */\n @property() action = \"\";\n /**\n * Form method.\n */\n @property() method: \"get\" | \"post\" = \"get\";\n /**\n * Form name.\n */\n @property() name = \"q\";\n\n @query(\"input\") _input!: HTMLInputElement;\n\n static styles = [\n InputElement.styles,\n css`\n :host {\n ${cssScope}--width:var(${cssvarValues.input}--width);\n ${cssScope}--input-padding: 0 0 0 .35em;\n width: var(${cssvarValues.input}--width);\n margin: var(${cssvarValues.input}-outline-width);\n border-radius: var(${cssvarValues.input}--radius);\n background: var(${cssvarValues.input}--background);\n }\n\n div {\n padding: var(${cssScope}--input-padding);\n height: var(${cssvarValues.input}--height);\n flex: 1;\n display: flex;\n z-index: 2;\n }\n\n form {\n min-height: 100%;\n outline: 0.145em solid transparent;\n display: flex;\n flex-direction: column;\n border-radius: inherit;\n padding: 0;\n width: 100%;\n margin: 0;\n position: relative;\n overflow: hidden;\n }\n\n :host([float]) form {\n overflow: visible;\n }\n\n :host(:focus) form {\n outline: var(${cssvarValues.input}--outline);\n }\n\n ul {\n list-style: none;\n width: 100%;\n pointer-events: none;\n border-radius: inherit;\n z-index: 2;\n }\n\n :host([float]) ul {\n background: var(${cssvarValues.input}--background);\n padding-top: 1.5em;\n position: absolute;\n z-index: 1;\n top: 0;\n }\n\n :host([float]:focus) form {\n outline: none;\n }\n\n :host([float]:focus) ul {\n outline: var(${cssvarValues.input}--outline);\n }\n\n button,\n input {\n background: none;\n }\n\n button {\n width: 1.8em;\n height: inherit;\n }\n\n input {\n flex: 1;\n min-width: 0;\n box-sizing: border-box;\n }\n\n svg {\n height: 100%;\n padding: 1px;\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n return html`<form action=\"${this.action}\" method=\"${this.method}\">\n <div>\n <input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" name=\"${this.name}\" @focus=\"${this._handleInput}\" @input=\"${this._handleInput}\" title=\"\" placeholder=\"${this.pla}\" />\n <button @click=\"${this._handleSubmit}\">${htmlSlot(\"search\", svgSearch(), this)}</button>\n </div>\n <ul>\n ${htmlSlot()}\n </ul>\n </form>`;\n }\n\n protected _handleSubmit(e: Event) {\n if (!this.action) {\n e.preventDefault();\n }\n this.dispatchEvent(new CustomEvent(\"submit\", { detail: this.value }));\n }\n\n protected _handleInput(e: Event) {\n e.stopPropagation();\n const value: string = this.targetValue(e);\n if (value === this.value) {\n return;\n }\n this.value = value;\n if (this.compositing) {\n return;\n }\n if (this.target && this.query) {\n this.searchElements(this.value);\n }\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value, bubbles: true, composed: true }));\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n searchElements(s: string) {\n const targetElement = document.body.querySelector(this.target);\n const queryElementsCollection = document.body.querySelectorAll(this.query);\n if (!targetElement) {\n return;\n }\n targetElement.replaceChildren();\n if (s && queryElementsCollection.length) {\n for (const e of queryElementsCollection) {\n if (e.textContent.includes(this.value)) {\n targetElement.appendChild(e.cloneNode(true));\n }\n }\n }\n }\n}\n\nexport default SearchInput;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"search-input\": SearchInput;\n }\n}\n"]}
1
+ {"version":3,"file":"search-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/search-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAEzC;;GAEG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,YAAY;IAAtC;;QACL;;WAEG;QACS,UAAK,GAAG,EAAE,CAAC;QACvB;;WAEG;QACS,WAAM,GAAG,EAAE,CAAC;QACxB;;WAEG;QAC0B,UAAK,GAAG,KAAK,CAAC;QAC3C;;WAEG;QACyC,UAAK,GAAG,KAAK,CAAC;QAC1D;;WAEG;QACS,WAAM,GAAG,EAAE,CAAC;QACxB;;WAEG;QACS,WAAM,GAAmB,KAAK,CAAC;QAC3C;;WAEG;QACS,SAAI,GAAG,GAAG,CAAC;IA+IzB,CAAC;IAnD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,CAsFO;AAlHR;IAAX,QAAQ,EAAE;0CAAY;AAIX;IAAX,QAAQ,EAAE;2CAAa;AAIK;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAe;AAIC;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAI9C;IAAX,QAAQ,EAAE;2CAAa;AAIZ;IAAX,QAAQ,EAAE;2CAAgC;AAI/B;IAAX,QAAQ,EAAE;yCAAY;AAEP;IAAf,KAAK,CAAC,OAAO,CAAC;2CAA2B;AA9B/B,WAAW;IADvB,MAAM,CAAC,UAAU,CAAC;GACN,WAAW,CA2KvB;;AAED,eAAe,WAAW,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate, svgSearch } from \"../../lib/templates.js\";\nimport { createScope, cssvarValues, define } from \"../../root.js\";\nimport { InputElement } from \"./input.js\";\n\nconst defineName = \"search-input\";\n\nconst cssScope = createScope(defineName);\n\n/**\n * SearchInput used for search behavior.\n */\n@define(defineName)\nexport class SearchInput extends InputElement {\n /**\n * Query selectors.\n */\n @property() query = \"\";\n /**\n * Target selectors.\n */\n @property() target = \"\";\n /**\n * Enable infer.\n */\n @property({ type: Boolean }) infer = false;\n /**\n * Float result.\n */\n @property({ type: Boolean, reflect: true }) float = false;\n /**\n * Form action.\n */\n @property() action = \"\";\n /**\n * Form method.\n */\n @property() method: \"get\" | \"post\" = \"get\";\n /**\n * Form name.\n */\n @property() name = \"q\";\n\n @query(\"input\") _input!: HTMLInputElement;\n\n static styles = [\n InputElement.styles,\n css`\n :host {\n ${cssScope}--width:var(${cssvarValues.input}--width);\n ${cssScope}--input-padding: 0 0 0 .35em;\n width: var(${cssvarValues.input}--width);\n margin: var(${cssvarValues.input}-outline-width);\n border-radius: var(${cssvarValues.input}--radius);\n background: var(${cssvarValues.input}--background);\n }\n\n div {\n padding: var(${cssScope}--input-padding);\n height: var(${cssvarValues.input}--height);\n flex: 1;\n display: flex;\n z-index: 2;\n }\n\n form {\n min-height: 100%;\n outline: 0.145em solid transparent;\n display: flex;\n flex-direction: column;\n border-radius: inherit;\n padding: 0;\n width: 100%;\n margin: 0;\n position: relative;\n overflow: hidden;\n }\n\n :host([float]) form {\n overflow: visible;\n }\n\n :host(:focus) form {\n outline: var(${cssvarValues.input}--outline);\n }\n\n ul {\n list-style: none;\n width: 100%;\n pointer-events: none;\n border-radius: inherit;\n z-index: 2;\n }\n\n :host([float]) ul {\n background: var(${cssvarValues.input}--background);\n padding-top: 1.5em;\n position: absolute;\n z-index: 1;\n top: 0;\n }\n\n :host([float]:focus) form {\n outline: none;\n }\n\n :host([float]:focus) ul {\n outline: var(${cssvarValues.input}--outline);\n }\n\n button,\n input {\n background: none;\n }\n\n button {\n width: 1.8em;\n height: inherit;\n }\n\n input {\n flex: 1;\n min-width: 0;\n box-sizing: border-box;\n }\n\n svg {\n height: 100%;\n padding: 1px;\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n return html`<form action=\"${this.action}\" method=\"${this.method}\">\n <div>\n <input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" name=\"${this.name}\" @focus=\"${this._handleInput}\" @input=\"${this._handleInput}\" title=\"\" placeholder=\"${this.pla}\" />\n <button @click=\"${this._handleSubmit}\">${htmlSlot(\"search\", svgSearch(), this)}</button>\n </div>\n <ul>\n ${htmlSlot()}\n </ul>\n </form>`;\n }\n\n protected _handleSubmit(e: Event) {\n if (!this.action) {\n e.preventDefault();\n }\n this.dispatchEvent(new CustomEvent(\"submit\", { detail: this.value }));\n }\n\n protected _handleInput(e: Event) {\n e.stopPropagation();\n const value: string = this.targetValue(e);\n if (value === this.value) {\n return;\n }\n this.value = value;\n if (this.compositing) {\n return;\n }\n if (this.target && this.query) {\n this.searchElements(this.value);\n }\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value, bubbles: true, composed: true }));\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n searchElements(s: string) {\n const targetElement = document.body.querySelector(this.target);\n const queryElementsCollection = document.body.querySelectorAll(this.query);\n if (!targetElement) {\n return;\n }\n targetElement.replaceChildren();\n if (s && queryElementsCollection.length) {\n for (const e of queryElementsCollection) {\n if (e.textContent.includes(this.value)) {\n targetElement.appendChild(e.cloneNode(true));\n }\n }\n }\n }\n}\n\nexport default SearchInput;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"search-input\": SearchInput;\n }\n}\n"]}