@pageboard/html 0.10.13 → 0.10.16

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/ui/card.css CHANGED
@@ -6,19 +6,19 @@
6
6
  max-width:100%;
7
7
  }
8
8
  .ui.square > .ui > .image::after {
9
- content: '';
9
+ content: "";
10
10
  display: block;
11
11
  height: 0;
12
12
  padding-bottom: 100%;
13
13
  }
14
14
  .ui.tall > .ui > .image::after {
15
- content: '';
15
+ content: "";
16
16
  display: block;
17
17
  height: 0;
18
18
  padding-bottom: 150%;
19
19
  }
20
20
  .ui.wide > .ui > .image::after {
21
- content: '';
21
+ content: "";
22
22
  display: block;
23
23
  height: 0;
24
24
  padding-bottom:50%;
@@ -34,10 +34,10 @@
34
34
  background: #FFFFFF;
35
35
  padding: 0em;
36
36
  border: none;
37
- border-radius: 0.28571429rem;
37
+ border-radius: 0.2857rem;
38
38
  box-shadow: 0px 1px 3px 0px #D4D4D5, 0px 0px 0px 1px #D4D4D5;
39
39
  transition: box-shadow 0.1s ease, transform 0.1s ease;
40
- z-index: '';
40
+ z-index: auto;
41
41
  margin: 0.875em 0.5em;
42
42
  float: none;
43
43
  font-size: 1em;
@@ -67,7 +67,7 @@
67
67
  .ui.cards::after,
68
68
  .ui.cards > .ui::after {
69
69
  display: block;
70
- content: ' ';
70
+ content: " ";
71
71
  height: 0px;
72
72
  clear: both;
73
73
  overflow: hidden;
@@ -84,14 +84,14 @@
84
84
  ---------------*/
85
85
 
86
86
  .ui.cards > .ui > :first-child {
87
- border-radius: 0.28571429rem 0.28571429rem 0em 0em !important;
87
+ border-radius: 0.2857rem 0.2857rem 0em 0em !important;
88
88
  border-top: none !important;
89
89
  }
90
90
  .ui.cards > .ui > :last-child {
91
- border-radius: 0em 0em 0.28571429rem 0.28571429rem !important;
91
+ border-radius: 0em 0em 0.2857rem 0.2857rem !important;
92
92
  }
93
93
  .ui.cards > .ui > :only-child {
94
- border-radius: 0.28571429rem !important;
94
+ border-radius: 0.2857rem !important;
95
95
  }
96
96
 
97
97
  /*--------------
@@ -103,7 +103,7 @@
103
103
  display: block;
104
104
  flex: 0 0 auto;
105
105
  padding: 0em;
106
- background: rgba(0, 0, 0, 0.05);
106
+ background: rgba(0 0 0 / 5%);
107
107
  overflow: hidden;
108
108
  }
109
109
  .ui.cards > .ui > .image > img {
@@ -123,17 +123,17 @@
123
123
  .ui.cards > .ui > .content {
124
124
  flex-grow: 1;
125
125
  border: none;
126
- border-top: 1px solid rgba(34, 36, 38, 0.1);
126
+ border-top: 1px solid rgba(34 36 38 / 10%);
127
127
  background: none;
128
128
  margin: 0em;
129
- padding: 1em 1em;
129
+ padding: 1em;
130
130
  box-shadow: none;
131
131
  font-size: 1em;
132
132
  border-radius: 0em;
133
133
  }
134
134
  .ui.cards > .ui > .content::after {
135
135
  display: block;
136
- content: ' ';
136
+ content: " ";
137
137
  height: 0px;
138
138
  clear: both;
139
139
  overflow: hidden;
@@ -141,17 +141,17 @@
141
141
  }
142
142
  .ui.cards > .ui > .content > .header {
143
143
  display: block;
144
- margin: '';
145
- font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif;
146
- color: rgba(0, 0, 0, 0.85);
144
+ margin: 0;
145
+ font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
146
+ color: rgba(0 0 0 / 85%);
147
147
  }
148
148
 
149
149
  /* Default Header Size */
150
150
  .ui.cards > .ui > .content > .header:not(.ui) {
151
151
  font-weight: bold;
152
- font-size: 1.28571429em;
153
- margin-top: -0.21425em;
154
- line-height: 1.28571429em;
152
+ font-size: 1.2857em;
153
+ margin-top: -0.2142em;
154
+ line-height: 1.2857em;
155
155
  }
156
156
  .ui.cards > .ui > .content > .meta + .description,
157
157
  .ui.cards > .ui > .content > .header + .description {
@@ -190,7 +190,7 @@
190
190
  .ui.cards > .ui .content img {
191
191
  display: inline-block;
192
192
  vertical-align: middle;
193
- width: '';
193
+ width: "";
194
194
  }
195
195
  .ui.cards > .ui img.avatar,
196
196
  .ui.cards > .ui .avatar img {
@@ -205,7 +205,7 @@
205
205
 
206
206
  .ui.cards > .ui > .content > .description {
207
207
  clear: both;
208
- color: rgba(0, 0, 0, 0.68);
208
+ color: rgba(0 0 0 / 68%);
209
209
  }
210
210
 
211
211
  /*--------------
@@ -225,7 +225,7 @@
225
225
 
226
226
  .ui.cards > .ui .meta {
227
227
  font-size: 1em;
228
- color: rgba(0, 0, 0, 0.4);
228
+ color: rgb(0 0 0 / 40%);
229
229
  }
230
230
  .ui.cards > .ui .meta * {
231
231
  margin-right: 0.3em;
@@ -245,16 +245,16 @@
245
245
 
246
246
  /* Generic */
247
247
  .ui.cards > .ui > .content a:not(.ui) {
248
- color: '';
248
+ color: "";
249
249
  transition: color 0.1s ease;
250
250
  }
251
251
  .ui.cards > .ui > .content a:not(.ui):hover {
252
- color: '';
252
+ color: "";
253
253
  }
254
254
 
255
255
  /* Header */
256
256
  .ui.cards > .ui > .content > a.header {
257
- color: rgba(0, 0, 0, 0.85);
257
+ color: rgb(0 0 0 / 85%);
258
258
  }
259
259
  .ui.cards > .ui > .content > a.header:hover {
260
260
  color: #1e70bf;
@@ -262,10 +262,10 @@
262
262
 
263
263
  /* Meta */
264
264
  .ui.cards > .ui .meta > a:not(.ui) {
265
- color: rgba(0, 0, 0, 0.4);
265
+ color: rgb(0 0 0 / 40%);
266
266
  }
267
267
  .ui.cards > .ui .meta > a:not(.ui):hover {
268
- color: rgba(0, 0, 0, 0.87);
268
+ color: rgb(0 0 0 / 87%);
269
269
  }
270
270
 
271
271
  /*--------------
@@ -283,7 +283,7 @@
283
283
  ---------------*/
284
284
 
285
285
  .ui.cards > .ui .dimmer {
286
- background-color: '';
286
+ background-color: "";
287
287
  z-index: 10;
288
288
  }
289
289
 
@@ -298,11 +298,11 @@
298
298
  /* Icon */
299
299
  .ui.cards > .ui > .content .star.icon {
300
300
  cursor: pointer;
301
- opacity: 0.75;
301
+ opacity: 75%;
302
302
  transition: color 0.1s ease;
303
303
  }
304
304
  .ui.cards > .ui > .content .star.icon:hover {
305
- opacity: 1;
305
+ opacity: 100%;
306
306
  color: #FFB70A;
307
307
  }
308
308
  .ui.cards > .ui > .content .active.star.icon {
@@ -315,11 +315,11 @@
315
315
  /* Icon */
316
316
  .ui.cards > .ui > .content .like.icon {
317
317
  cursor: pointer;
318
- opacity: 0.75;
318
+ opacity: 75%;
319
319
  transition: color 0.1s ease;
320
320
  }
321
321
  .ui.cards > .ui > .content .like.icon:hover {
322
- opacity: 1;
322
+ opacity: 100%;
323
323
  color: #FF2733;
324
324
  }
325
325
  .ui.cards > .ui > .content .active.like.icon {
@@ -334,20 +334,20 @@
334
334
  max-width: 100%;
335
335
  min-height: 0em !important;
336
336
  flex-grow: 0;
337
- border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
337
+ border-top: 1px solid rgb(0 0 0 / 5%) !important;
338
338
  position: static;
339
339
  background: none;
340
340
  width: auto;
341
- margin: 0em 0em;
341
+ margin: 0em;
342
342
  padding: 0.75em 1em;
343
343
  top: 0em;
344
344
  left: 0em;
345
- color: rgba(0, 0, 0, 0.4);
345
+ color: rgb(0 0 0 / 40%);
346
346
  box-shadow: none;
347
347
  transition: color 0.1s ease;
348
348
  }
349
349
  .ui.cards > .ui > .extra a:not(.ui) {
350
- color: rgba(0, 0, 0, 0.4);
350
+ color: rgb(0 0 0 / 40%);
351
351
  }
352
352
  .ui.cards > .ui > .extra a:not(.ui):hover {
353
353
  color: #1e70bf;
@@ -364,11 +364,11 @@
364
364
  --------------------*/
365
365
 
366
366
  .ui.raised.cards > .ui {
367
- box-shadow: 0px 0px 0px 1px #D4D4D5, 0px 2px 4px 0px rgba(34, 36, 38, 0.12), 0px 2px 10px 0px rgba(34, 36, 38, 0.15);
367
+ box-shadow: 0px 0px 0px 1px #D4D4D5, 0px 2px 4px 0px rgb(34 36 38 / 12%), 0px 2px 10px 0px rgb(34 36 38 / 15%);
368
368
  }
369
369
  .ui.raised.cards > a.ui:hover,
370
370
  .ui.link.cards > .raised.ui:hover {
371
- box-shadow: 0px 0px 0px 1px #D4D4D5, 0px 2px 4px 0px rgba(34, 36, 38, 0.15), 0px 2px 10px 0px rgba(34, 36, 38, 0.25);
371
+ box-shadow: 0px 0px 0px 1px #D4D4D5, 0px 2px 4px 0px rgb(34 36 38 / 15%), 0px 2px 10px 0px rgb(34 36 38 / 25%);
372
372
  }
373
373
 
374
374
  /*-------------------
@@ -434,7 +434,7 @@
434
434
  margin-right: -1em;
435
435
  }
436
436
  .ui.three.cards > .ui {
437
- width: calc(33.33333333% - 2em);
437
+ width: calc(33.3333% - 2em);
438
438
  margin-left: 1em;
439
439
  margin-right: 1em;
440
440
  }
@@ -461,7 +461,7 @@
461
461
  margin-right: -0.75em;
462
462
  }
463
463
  .ui.six.cards > .ui {
464
- width: calc(16.66666667% - 1.5em);
464
+ width: calc(16.6667% - 1.5em);
465
465
  margin-left: 0.75em;
466
466
  margin-right: 0.75em;
467
467
  }
@@ -470,7 +470,7 @@
470
470
  margin-right: -0.5em;
471
471
  }
472
472
  .ui.seven.cards > .ui {
473
- width: calc(14.28571429% - 1em);
473
+ width: calc(14.2857% - 1em);
474
474
  margin-left: 0.5em;
475
475
  margin-right: 0.5em;
476
476
  }
@@ -489,7 +489,7 @@
489
489
  margin-right: -0.5em;
490
490
  }
491
491
  .ui.nine.cards > .ui {
492
- width: calc(11.11111111% - 1em);
492
+ width: calc(11.1111% - 1em);
493
493
  margin-left: 0.5em;
494
494
  margin-right: 0.5em;
495
495
  font-size: 10px;
@@ -561,7 +561,7 @@
561
561
  margin-right: -1em;
562
562
  }
563
563
  .ui.seven.doubling.cards > .ui {
564
- width: calc(33.33333333% - 2em);
564
+ width: calc(33.3333% - 2em);
565
565
  margin-left: 1em;
566
566
  margin-right: 1em;
567
567
  }
@@ -570,7 +570,7 @@
570
570
  margin-right: -1em;
571
571
  }
572
572
  .ui.eight.doubling.cards > .ui {
573
- width: calc(33.33333333% - 2em);
573
+ width: calc(33.3333% - 2em);
574
574
  margin-left: 1em;
575
575
  margin-right: 1em;
576
576
  }
@@ -579,7 +579,7 @@
579
579
  margin-right: -1em;
580
580
  }
581
581
  .ui.nine.doubling.cards > .ui {
582
- width: calc(33.33333333% - 2em);
582
+ width: calc(33.3333% - 2em);
583
583
  margin-left: 1em;
584
584
  margin-right: 1em;
585
585
  }
@@ -588,7 +588,7 @@
588
588
  margin-right: -1em;
589
589
  }
590
590
  .ui.ten.doubling.cards > .ui {
591
- width: calc(33.33333333% - 2em);
591
+ width: calc(33.3333% - 2em);
592
592
  margin-left: 1em;
593
593
  margin-right: 1em;
594
594
  }
@@ -628,7 +628,7 @@
628
628
  margin-right: -1em;
629
629
  }
630
630
  .ui.five.doubling.cards > .ui {
631
- width: calc(33.33333333% - 2em);
631
+ width: calc(33.3333% - 2em);
632
632
  margin-left: 1em;
633
633
  margin-right: 1em;
634
634
  }
@@ -637,7 +637,7 @@
637
637
  margin-right: -1em;
638
638
  }
639
639
  .ui.six.doubling.cards > .ui {
640
- width: calc(33.33333333% - 2em);
640
+ width: calc(33.3333% - 2em);
641
641
  margin-left: 1em;
642
642
  margin-right: 1em;
643
643
  }
@@ -684,7 +684,7 @@
684
684
  .ui.stackable.cards > .ui {
685
685
  display: block !important;
686
686
  height: auto !important;
687
- margin: 1em 1em;
687
+ margin: 1em;
688
688
  padding: 0 !important;
689
689
  width: calc(100% - 2em) !important;
690
690
  }
package/ui/form.css CHANGED
@@ -3,20 +3,11 @@ fieldset.plain {
3
3
  padding-right:0;
4
4
  padding-left:0;
5
5
  }
6
- textarea::-webkit-selection,
7
- input::-webkit-selection {
8
- background-color: rgba(100, 100, 100, 0.4);
9
- color: rgba(0, 0, 0, 0.87);
10
- }
11
- textarea::-moz-selection,
12
- input::-moz-selection {
13
- background-color: rgba(100, 100, 100, 0.4);
14
- color: rgba(0, 0, 0, 0.87);
15
- }
6
+
16
7
  textarea::selection,
17
8
  input::selection {
18
- background-color: rgba(100, 100, 100, 0.4);
19
- color: rgba(0, 0, 0, 0.87);
9
+ background-color: rgb(100 100 100 / 40%);
10
+ color: rgb(0 0 0 / 87%);
20
11
  }
21
12
 
22
13
  label[for] {
package/ui/form.js CHANGED
@@ -33,27 +33,26 @@ class HTMLCustomFormElement extends HTMLFormElement {
33
33
  delete state.query.submit;
34
34
  state.finish(() => {
35
35
  if (state.status != 200) return;
36
- const e = document.createEvent('HTMLEvents');
37
- e.initEvent('submit', true, true);
38
- this.dispatchEvent(e);
36
+ this.dispatchEvent(new Event('submit', {
37
+ bubbles: true,
38
+ cancelable: true
39
+ }));
39
40
  });
40
41
  }
41
- read(withDefaults) {
42
+ read(withDefaults = false) {
42
43
  const fd = new FormData(this);
43
44
  const query = {};
44
45
  fd.forEach((val, key) => {
45
- if (val == null || val == "") {
46
- const cur = this.querySelectorAll(`[name="${key}"]`).slice(-1).pop();
47
- if (cur.required == false) {
48
- val = undefined;
49
- } else {
50
- val = null;
51
- }
46
+ const cur = this.querySelectorAll(`[name="${key}"]`).slice(-1).pop();
47
+ if (cur.type == "file") {
48
+ val = cur.value;
52
49
  }
50
+ if (val == "") val = null;
51
+ // build array-like values
53
52
  const old = query[key];
54
53
  if (old !== undefined) {
55
54
  if (!Array.isArray(old)) {
56
- query[key] = [old];
55
+ query[key] = old == null ? [] : [old];
57
56
  }
58
57
  if (val !== undefined) query[key].push(val);
59
58
  } else {
@@ -61,37 +60,48 @@ class HTMLCustomFormElement extends HTMLFormElement {
61
60
  }
62
61
  });
63
62
 
63
+ // withDefaults: keep value if equals to its default
64
+ // else unset value
64
65
  for (const node of this.elements) {
65
- if (node.name == null || node.name == "" || node.type == "button") continue;
66
+ const { name, type } = node;
67
+ if (name == null || name == "" || type == "button") {
68
+ continue;
69
+ }
66
70
  let val = node.value;
67
71
  if (val == "") val = null;
68
- if (node.type == "radio") {
69
- if (!withDefaults && node.checked == node.defaultChecked && query[node.name] == val) {
70
- query[node.name] = undefined;
71
- }
72
- } else if (node.type == "checkbox") {
73
- if (!(node.name in query)) {
74
- if (!withDefaults) query[node.name] = undefined;
75
- }
76
- } else if (node.type == "hidden") {
77
- // always include them
78
- } else {
79
- let defVal = node.defaultValue;
80
- if (defVal == "") defVal = null;
81
- if (!withDefaults && query[node.name] == defVal) {
82
- query[node.name] = undefined;
83
- } else {
84
- // not yet using form-associated custom input
85
- query[node.name] = node.value;
86
- }
87
- }
88
- if (query[node.name] === undefined && withDefaults) {
89
- query[node.name] = null;
72
+ let defVal = node.defaultValue;
73
+ if (defVal == "") defVal = null;
74
+
75
+ switch (type) {
76
+ case "radio":
77
+ if (!withDefaults && node.checked == node.defaultChecked) {
78
+ if (query[name] == val) {
79
+ query[name] = undefined;
80
+ }
81
+ }
82
+ break;
83
+ case "checkbox":
84
+ if (!withDefaults) {
85
+ if (!(name in query)) {
86
+ query[name] = undefined;
87
+ }
88
+ }
89
+ break;
90
+ case "hidden":
91
+ break;
92
+ default:
93
+ if (withDefaults) {
94
+ if (query[name] === undefined) {
95
+ query[name] = defVal;
96
+ }
97
+ } else if (val === defVal) {
98
+ query[name] = node.required ? null : undefined;
99
+ }
90
100
  }
91
101
  }
102
+ // FIXME use e.submitter polyfill when available
103
+ // https://github.com/Financial-Times/polyfill-library/issues/1111
92
104
  const btn = document.activeElement;
93
- // FIXME https://github.com/whatwg/html/issues/3195 use e.submitter polyfill
94
- // https://github.com/whatwg/xhr/issues/262 it's a mess
95
105
  if (btn && btn.type == "submit" && btn.name && btn.value) {
96
106
  query[btn.name] = btn.value;
97
107
  }
@@ -344,6 +354,9 @@ HTMLInputElement.prototype.fill = function (val) {
344
354
  if (val == null) val = "";
345
355
  if (this.type == "radio" || this.type == "checkbox") {
346
356
  this.checked = val;
357
+ } else if (this.type == "file") {
358
+ if (val == '' || val == null) this.removeAttribute('value');
359
+ else this.setAttribute('value', val);
347
360
  } else {
348
361
  this.value = val;
349
362
  }
@@ -360,6 +373,8 @@ HTMLInputElement.prototype.reset = function () {
360
373
  HTMLInputElement.prototype.save = function () {
361
374
  if (this.type == "radio" || this.type == "checkbox") {
362
375
  this.defaultChecked = this.checked;
376
+ } else if (this.type == "file") {
377
+ this.defaultValue = this.getAttribute('value') || '';
363
378
  } else {
364
379
  this.defaultValue = this.value;
365
380
  }
@@ -377,11 +392,13 @@ Object.defineProperty(HTMLInputElement.prototype, 'defaultValue', {
377
392
  configurable: true,
378
393
  enumerable: true,
379
394
  get: function () {
395
+ // FIXME might not be needed anymore
380
396
  if (this.form?.method == "get") return '';
381
397
  else return this.getAttribute('value');
382
398
  },
383
399
  set: function (val) {
384
- this.setAttribute('value', val);
400
+ if (val == '' || val == null) this.removeAttribute('value');
401
+ else this.setAttribute('value', val);
385
402
  }
386
403
  });
387
404
 
@@ -464,6 +481,7 @@ Page.ready((state) => {
464
481
  // new way
465
482
  }
466
483
  HTMLCustomFormElement.prototype.fill.call(form, linearizeValues(values), state.scope);
484
+ HTMLCustomFormElement.prototype.save.call(form);
467
485
  }
468
486
  } else if (action == "read") {
469
487
  const obj = {};
package/ui/input-file.css CHANGED
@@ -14,10 +14,10 @@
14
14
  .form .field > input[type="file"]:focus,
15
15
  .form .field > input[type="file"]:hover {
16
16
  position:relative;
17
- color: rgba(0 0 0 / 0%);
17
+ color: transparent !important;
18
18
  }
19
- .form .field > input[type="file"][filename]::after {
20
- content:attr(filename);
19
+ .form .field > input[type="file"][value]::after {
20
+ content:attr(value);
21
21
  color: black;
22
22
  text-align: left;
23
23
  position: absolute;
@@ -26,11 +26,11 @@
26
26
  padding-left: inherit;
27
27
  padding-right: inherit;
28
28
  }
29
- .form .field.error > input[type="file"][filename]::after {
29
+ .form .field.error > input[type="file"][value]::after {
30
30
  color:inherit;
31
31
  }
32
32
  .form .field > input[type="file"]::after,
33
- .form .field > input[type="file"]:not([filename])::after {
33
+ .form .field > input[type="file"]:not([value])::after {
34
34
  content:attr(placeholder);
35
35
  color: rgba(0 0 0 / 50%);
36
36
  float: left;
@@ -53,6 +53,6 @@ input[type="file"]::file-selector-button {
53
53
  z-index: 1;
54
54
  }
55
55
 
56
- input[type="file"][filename]::file-selector-button {
56
+ input[type="file"][value]::file-selector-button {
57
57
  background-image: url('data:image/svg+xml,<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg"><path d="m40.9 31.9 21-21a6.4 6.4 0 1 0-9-9l-21 21-21-21a6.4 6.4 0 1 0-9 9l21 21-21 21a6.4 6.4 0 0 0 0 9C3 63 4.6 63.8 6.2 63.8s3.3-.7 4.5-2l21-21 21 21c1.2 1.3 2.8 2 4.5 2s3.2-.7 4.5-2a6.4 6.4 0 0 0 0-9z"/></svg>');
58
58
  }
package/ui/input-file.js CHANGED
@@ -1,35 +1,39 @@
1
1
  class HTMLElementInputFile extends HTMLInputElement {
2
2
  #xhr;
3
3
  #promise;
4
- #value;
4
+ #defaultValue;
5
+
6
+ /* Since input[type=file] does not allow setting "value" property,
7
+ * it is stored in the "value" attribute,
8
+ * forcing defaultValue to be handled with a private field.
9
+ * The "filename" attribute is used to display both selected value property,
10
+ * and filled value attribute.
11
+ */
5
12
 
6
13
  constructor() {
7
14
  super();
8
15
  if (this.init) this.init();
9
16
  this.save();
10
17
  }
11
-
12
- get value() {
13
- return this.getAttribute('value');
18
+ get defaultValue() {
19
+ return this.#defaultValue;
14
20
  }
15
- save() {
16
- this.#value = this.value;
21
+ set defaultValue(str) {
22
+ this.#defaultValue = str;
17
23
  }
18
- reset() {
19
- if (this.#value != null) this.setAttribute('value', this.#value);
20
- else this.removeAttribute('value');
21
- this.value = this.#value;
24
+ get value() {
25
+ return this.getAttribute('value');
22
26
  }
23
27
  set value(str) {
24
- if (str != null) {
25
- this.setAttribute('filename', str.split(/\/|\\/).pop());
28
+ if (str) {
29
+ this.setAttribute('value', str);
26
30
  } else {
27
- this.removeAttribute('filename');
31
+ this.removeAttribute('value');
28
32
  super.value = "";
29
33
  }
30
34
  }
31
35
  captureClick(e, state) {
32
- if (super.value) {
36
+ if (this.value) {
33
37
  e.preventDefault();
34
38
  if (this.#xhr) {
35
39
  this.#xhr.abort();
@@ -72,7 +76,7 @@ class HTMLElementInputFile extends HTMLInputElement {
72
76
  const pass = (obj) => {
73
77
  if (!obj.items || obj.items.length == 0) return fail(new Error("File rejected"));
74
78
  const val = obj.items[0];
75
- this.setAttribute('value', val);
79
+ this.value = val;
76
80
  field.classList.add('success');
77
81
  field.classList.remove('loading');
78
82
  this.#xhr = null;
package/ui/input-range.js CHANGED
@@ -81,9 +81,10 @@ class HTMLElementInputRange extends HTMLInputElement {
81
81
  helper.classList.remove('indeterminate');
82
82
  if (isInt) values = values.map((n) => parseInt(n));
83
83
  this.rangeValue = values;
84
- const e = document.createEvent('HTMLEvents');
85
- e.initEvent('change', true, true);
86
- this.dispatchEvent(e);
84
+ this.dispatchEvent(new Event('change', {
85
+ bubbles: true,
86
+ cancelable: true
87
+ }));
87
88
  });
88
89
  helper.addEventListener('keydown', this, true);
89
90
  helper.addEventListener('dblclick', this, true);
@@ -92,9 +93,10 @@ class HTMLElementInputRange extends HTMLInputElement {
92
93
  handleEvent(e) {
93
94
  if (e.type == "dblclick" || e.keyCode == 8 || e.keyCode == 46) {
94
95
  this.fill();
95
- const ne = document.createEvent('HTMLEvents');
96
- ne.initEvent('change', true, true);
97
- this.dispatchEvent(ne);
96
+ this.dispatchEvent(new Event('change', {
97
+ bubbles: true,
98
+ cancelable: true
99
+ }));
98
100
  }
99
101
  }
100
102