@burger-editor/frozen-patty 0.10.0 → 0.11.0

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 (49) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +11 -12
  3. package/{lib → dist}/frozen-patty.d.ts +4 -16
  4. package/dist/frozen-patty.js +43 -0
  5. package/dist/get-value.d.ts +10 -0
  6. package/dist/get-value.js +15 -0
  7. package/dist/get-values.d.ts +10 -0
  8. package/{lib/getValue.js → dist/get-values.js} +30 -32
  9. package/dist/get.d.ts +2 -0
  10. package/dist/get.js +12 -0
  11. package/dist/index.d.ts +9 -0
  12. package/dist/index.js +10 -0
  13. package/dist/set-value.d.ts +14 -0
  14. package/{lib/setValue.js → dist/set-value.js} +96 -103
  15. package/dist/set.d.ts +2 -0
  16. package/dist/set.js +52 -0
  17. package/dist/types.d.ts +6 -0
  18. package/dist/types.js +1 -0
  19. package/{lib/util.d.ts → dist/utils.d.ts} +1 -5
  20. package/dist/utils.js +21 -0
  21. package/package.json +34 -39
  22. package/lib/frozen-patty.d.ts.map +0 -1
  23. package/lib/frozen-patty.js +0 -47
  24. package/lib/frozen-patty.js.map +0 -1
  25. package/lib/get.d.ts +0 -4
  26. package/lib/get.d.ts.map +0 -1
  27. package/lib/get.js +0 -20
  28. package/lib/get.js.map +0 -1
  29. package/lib/getValue.d.ts +0 -10
  30. package/lib/getValue.d.ts.map +0 -1
  31. package/lib/getValue.js.map +0 -1
  32. package/lib/index.d.ts +0 -35
  33. package/lib/index.d.ts.map +0 -1
  34. package/lib/index.js +0 -55
  35. package/lib/index.js.map +0 -1
  36. package/lib/polyfill.d.ts +0 -1
  37. package/lib/polyfill.d.ts.map +0 -1
  38. package/lib/polyfill.js +0 -20
  39. package/lib/polyfill.js.map +0 -1
  40. package/lib/set.d.ts +0 -4
  41. package/lib/set.d.ts.map +0 -1
  42. package/lib/set.js +0 -56
  43. package/lib/set.js.map +0 -1
  44. package/lib/setValue.d.ts +0 -15
  45. package/lib/setValue.d.ts.map +0 -1
  46. package/lib/setValue.js.map +0 -1
  47. package/lib/util.d.ts.map +0 -1
  48. package/lib/util.js +0 -30
  49. package/lib/util.js.map +0 -1
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  /**
4
2
  * Set value to an element
5
3
  *
@@ -7,34 +5,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
5
  * <div [target-attribute] data-[attr]="[name]:[target-attribute]"></div>
8
6
  * ```
9
7
  *
8
+ * @param el A target element
10
9
  * @param name A label name
11
10
  * @param datum A datum of value
12
- * @param el A target element
13
- * @param attr Field data attribute name
11
+ * @param attr Data attribute name for specifying the node that FrozenPatty treats as a field
14
12
  */
15
- function default_1(name, datum, el, attr, filter) {
16
- var bindingFormats = el.getAttribute("data-".concat(attr)) || '';
17
- for (var _i = 0, _a = bindingFormats.split(/\s*,\s*/); _i < _a.length; _i++) {
18
- var bindingFormat = _a[_i];
13
+ export function setValue(el, name, datum, attr = 'field', filter) {
14
+ const bindingFormats = el.getAttribute(`data-${attr}`) || '';
15
+ for (let bindingFormat of bindingFormats.split(/\s*,\s*/)) {
19
16
  bindingFormat = bindingFormat.trim();
20
17
  /**
21
18
  * 抽出した対象キー
22
19
  */
23
- var key = void 0;
20
+ let key;
24
21
  /**
25
22
  * 対象属性
26
23
  *
27
24
  * `null`の場合は`innerHTML`が対象となる
28
25
  * ただし要素がinput要素の場合は`value`に設定
29
26
  */
30
- var targetAttr = void 0;
27
+ let targetAttr;
31
28
  //
32
29
  // 対象属性名の抽出
33
30
  //
34
- if (/^[a-z_-](?:[a-z0-9_-])*:[a-z_-](?:[a-z0-9_-])*(?:\([a-z-]+\))?/i.test(bindingFormat)) {
35
- var splitKey = bindingFormat.split(':');
36
- key = splitKey[0].trim();
37
- targetAttr = splitKey[1].trim();
31
+ if (/^[_a-z-][\w-]*:[_a-z-][\w-]*(?:\([a-z-]+\))?/i.test(bindingFormat)) {
32
+ const splitKey = bindingFormat.split(':');
33
+ key = splitKey[0]?.trim() ?? '';
34
+ targetAttr = splitKey[1]?.trim() ?? '';
38
35
  }
39
36
  else {
40
37
  key = bindingFormat.trim();
@@ -57,8 +54,8 @@ function default_1(name, datum, el, attr, filter) {
57
54
  // style属性
58
55
  //
59
56
  if (/^style\([a-z-]+\)$/i.test(targetAttr)) {
60
- var cssPropertyName = targetAttr.replace(/^style\(([a-z-]+)\)$/i, '$1');
61
- var cssValue = void 0;
57
+ const cssPropertyName = targetAttr.replace(/^style\(([a-z-]+)\)$/i, '$1');
58
+ let cssValue;
62
59
  switch (cssPropertyName) {
63
60
  case 'background-image': {
64
61
  //
@@ -69,18 +66,18 @@ function default_1(name, datum, el, attr, filter) {
69
66
  // デモサーバーから本番サーバーへの移行ができなくなってしまうので避ける
70
67
  // 単純な文字列を流し込む(setAttributeを利用)
71
68
  // urlはマルチバイト文字や空白記号を含まないはずであるがエスケープする
72
- var url = encodeURI("".concat(datum));
73
- cssValue = "url(".concat(url, ")");
69
+ const url = encodeURI(`${datum}`);
70
+ cssValue = `url(${url})`;
74
71
  break;
75
72
  }
76
73
  //
77
74
  // TODO: 他にもvalueに単位が必要なケースなどに対応したい
78
75
  //
79
76
  default: {
80
- cssValue = "".concat(datum);
77
+ cssValue = `${datum}`;
81
78
  }
82
79
  }
83
- el.setAttribute('style', "".concat(cssPropertyName, ": ").concat(cssValue));
80
+ el.setAttribute('style', `${cssPropertyName}: ${cssValue}`);
84
81
  //
85
82
  // 属性
86
83
  //
@@ -90,7 +87,7 @@ function default_1(name, datum, el, attr, filter) {
90
87
  }
91
88
  else {
92
89
  // SVGElement or more
93
- el.setAttribute(targetAttr, "".concat(datum));
90
+ el.setAttribute(targetAttr, `${datum}`);
94
91
  }
95
92
  //
96
93
  // 属性指定がない場合
@@ -100,15 +97,14 @@ function default_1(name, datum, el, attr, filter) {
100
97
  if (el instanceof HTMLInputElement ||
101
98
  el instanceof HTMLSelectElement ||
102
99
  el instanceof HTMLTextAreaElement) {
103
- el.value = "".concat(datum);
100
+ el.value = `${datum}`;
104
101
  }
105
102
  else {
106
- el.innerHTML = "".concat(datum);
103
+ el.innerHTML = `${datum}`;
107
104
  }
108
105
  }
109
106
  }
110
107
  }
111
- exports.default = default_1;
112
108
  /**
113
109
  * Set attribute
114
110
  *
@@ -117,15 +113,13 @@ exports.default = default_1;
117
113
  * @param datum Datum
118
114
  *
119
115
  */
120
- // tslint:disable-next-line:cyclomatic-complexity
121
116
  function setAttribute(el, attr, datum) {
122
117
  if (datum == null) {
123
118
  el.removeAttribute(attr);
124
119
  return;
125
120
  }
126
121
  switch (attr) {
127
- // ⚠️ Dosen't test
128
- case 'contentediable': {
122
+ case 'contenteditable': {
129
123
  switch (datum) {
130
124
  case 'true':
131
125
  case '': {
@@ -145,7 +139,7 @@ function setAttribute(el, attr, datum) {
145
139
  el.dir = datum;
146
140
  break;
147
141
  }
148
- case 'auto':
142
+ // case 'auto':
149
143
  default: {
150
144
  el.removeAttribute(attr);
151
145
  }
@@ -166,7 +160,7 @@ function setAttribute(el, attr, datum) {
166
160
  el.draggable = false;
167
161
  break;
168
162
  }
169
- case 'auto':
163
+ // case 'auto':
170
164
  default: {
171
165
  el.removeAttribute(attr);
172
166
  }
@@ -182,17 +176,17 @@ function setAttribute(el, attr, datum) {
182
176
  break;
183
177
  }
184
178
  case 'tabindex': {
185
- var i = void 0;
179
+ let i;
186
180
  if (typeof datum === 'boolean') {
187
181
  i = datum ? 0 : -1;
188
182
  }
189
183
  else if (typeof datum === 'string') {
190
- i = parseInt(datum, 10);
184
+ i = Number.parseInt(datum, 10);
191
185
  }
192
186
  else {
193
187
  i = datum;
194
188
  }
195
- el.tabIndex = isNaN(i) ? -1 : Math.floor(i);
189
+ el.tabIndex = Number.isNaN(i) ? -1 : Math.floor(i);
196
190
  break;
197
191
  }
198
192
  case 'async': {
@@ -200,16 +194,17 @@ function setAttribute(el, attr, datum) {
200
194
  el.async = !!datum;
201
195
  }
202
196
  else {
203
- el.setAttribute(attr, "".concat(datum));
197
+ el.setAttribute(attr, `${datum}`);
204
198
  }
205
199
  break;
206
200
  }
207
201
  case 'autocomplete': {
208
202
  if (el instanceof HTMLInputElement || el instanceof HTMLFormElement) {
209
- el.autocomplete = datum ? "".concat(datum) : 'off';
203
+ // @ts-ignore
204
+ el.autocomplete = datum ? `${datum}` : 'off';
210
205
  }
211
206
  else {
212
- el.setAttribute(attr, "".concat(datum));
207
+ el.setAttribute(attr, `${datum}`);
213
208
  }
214
209
  break;
215
210
  }
@@ -221,7 +216,7 @@ function setAttribute(el, attr, datum) {
221
216
  el.autofocus = datum === '' ? true : !!datum;
222
217
  }
223
218
  else {
224
- el.setAttribute(attr, "".concat(datum));
219
+ el.setAttribute(attr, `${datum}`);
225
220
  }
226
221
  break;
227
222
  }
@@ -230,7 +225,7 @@ function setAttribute(el, attr, datum) {
230
225
  el.autoplay = datum === '' ? true : !!datum;
231
226
  }
232
227
  else {
233
- el.setAttribute(attr, "".concat(datum));
228
+ el.setAttribute(attr, `${datum}`);
234
229
  }
235
230
  break;
236
231
  }
@@ -239,14 +234,14 @@ function setAttribute(el, attr, datum) {
239
234
  el.checked = datum === '' ? true : !!datum;
240
235
  }
241
236
  else {
242
- el.setAttribute(attr, "".concat(datum));
237
+ el.setAttribute(attr, `${datum}`);
243
238
  }
244
239
  break;
245
240
  }
246
241
  case 'cols': {
247
242
  if (el instanceof HTMLTextAreaElement) {
248
- var cols = toInt(datum);
249
- if (isNaN(cols)) {
243
+ const cols = toInt(datum);
244
+ if (Number.isNaN(cols)) {
250
245
  el.removeAttribute(attr);
251
246
  }
252
247
  else {
@@ -254,14 +249,14 @@ function setAttribute(el, attr, datum) {
254
249
  }
255
250
  }
256
251
  else {
257
- el.setAttribute(attr, "".concat(datum));
252
+ el.setAttribute(attr, `${datum}`);
258
253
  }
259
254
  break;
260
255
  }
261
256
  case 'colspan': {
262
257
  if (el instanceof HTMLTableCellElement) {
263
- var colSpan = toInt(datum);
264
- if (isNaN(colSpan)) {
258
+ const colSpan = toInt(datum);
259
+ if (Number.isNaN(colSpan)) {
265
260
  el.removeAttribute(attr);
266
261
  }
267
262
  else {
@@ -269,7 +264,7 @@ function setAttribute(el, attr, datum) {
269
264
  }
270
265
  }
271
266
  else {
272
- el.setAttribute(attr, "".concat(datum));
267
+ el.setAttribute(attr, `${datum}`);
273
268
  }
274
269
  break;
275
270
  }
@@ -278,7 +273,7 @@ function setAttribute(el, attr, datum) {
278
273
  el.controls = datum === '' ? true : !!datum;
279
274
  }
280
275
  else {
281
- el.setAttribute(attr, "".concat(datum));
276
+ el.setAttribute(attr, `${datum}`);
282
277
  }
283
278
  break;
284
279
  }
@@ -287,7 +282,7 @@ function setAttribute(el, attr, datum) {
287
282
  el.default = datum === '' ? true : !!datum;
288
283
  }
289
284
  else {
290
- el.setAttribute(attr, "".concat(datum));
285
+ el.setAttribute(attr, `${datum}`);
291
286
  }
292
287
  break;
293
288
  }
@@ -296,7 +291,7 @@ function setAttribute(el, attr, datum) {
296
291
  el.defer = !!datum;
297
292
  }
298
293
  else {
299
- el.setAttribute(attr, "".concat(datum));
294
+ el.setAttribute(attr, `${datum}`);
300
295
  }
301
296
  break;
302
297
  }
@@ -311,28 +306,28 @@ function setAttribute(el, attr, datum) {
311
306
  el.disabled = datum === '' ? true : !!datum;
312
307
  }
313
308
  else {
314
- el.setAttribute(attr, "".concat(datum));
309
+ el.setAttribute(attr, `${datum}`);
315
310
  }
316
311
  break;
317
312
  }
318
313
  case 'download': {
319
314
  if (el instanceof HTMLAnchorElement) {
320
315
  if (datum || datum === '') {
321
- el.download = "".concat(datum);
316
+ el.download = `${datum}`;
322
317
  }
323
318
  else {
324
319
  el.removeAttribute(attr);
325
320
  }
326
321
  }
327
322
  else {
328
- el.setAttribute(attr, "".concat(datum));
323
+ el.setAttribute(attr, `${datum}`);
329
324
  }
330
325
  break;
331
326
  }
332
327
  case 'high': {
333
328
  if (el instanceof HTMLMeterElement) {
334
- var high = toInt(datum);
335
- if (isNaN(high)) {
329
+ const high = toInt(datum);
330
+ if (Number.isNaN(high)) {
336
331
  el.removeAttribute(attr);
337
332
  }
338
333
  else {
@@ -340,7 +335,7 @@ function setAttribute(el, attr, datum) {
340
335
  }
341
336
  }
342
337
  else {
343
- el.setAttribute(attr, "".concat(datum));
338
+ el.setAttribute(attr, `${datum}`);
344
339
  }
345
340
  break;
346
341
  }
@@ -349,7 +344,7 @@ function setAttribute(el, attr, datum) {
349
344
  el.isMap = datum === '' ? true : !!datum;
350
345
  }
351
346
  else {
352
- el.setAttribute(attr, "".concat(datum));
347
+ el.setAttribute(attr, `${datum}`);
353
348
  }
354
349
  break;
355
350
  }
@@ -358,14 +353,14 @@ function setAttribute(el, attr, datum) {
358
353
  el.loop = datum === '' ? true : !!datum;
359
354
  }
360
355
  else {
361
- el.setAttribute(attr, "".concat(datum));
356
+ el.setAttribute(attr, `${datum}`);
362
357
  }
363
358
  break;
364
359
  }
365
360
  case 'low': {
366
361
  if (el instanceof HTMLMeterElement) {
367
- var low = toInt(datum);
368
- if (isNaN(low)) {
362
+ const low = toInt(datum);
363
+ if (Number.isNaN(low)) {
369
364
  el.removeAttribute(attr);
370
365
  }
371
366
  else {
@@ -373,7 +368,7 @@ function setAttribute(el, attr, datum) {
373
368
  }
374
369
  }
375
370
  else {
376
- el.setAttribute(attr, "".concat(datum));
371
+ el.setAttribute(attr, `${datum}`);
377
372
  }
378
373
  break;
379
374
  }
@@ -381,8 +376,8 @@ function setAttribute(el, attr, datum) {
381
376
  if (el instanceof HTMLInputElement ||
382
377
  el instanceof HTMLMeterElement ||
383
378
  el instanceof HTMLProgressElement) {
384
- var max = toInt(datum);
385
- if (isNaN(max)) {
379
+ const max = toInt(datum);
380
+ if (Number.isNaN(max)) {
386
381
  el.removeAttribute(attr);
387
382
  }
388
383
  else {
@@ -390,14 +385,14 @@ function setAttribute(el, attr, datum) {
390
385
  }
391
386
  }
392
387
  else {
393
- el.setAttribute(attr, "".concat(datum));
388
+ el.setAttribute(attr, `${datum}`);
394
389
  }
395
390
  break;
396
391
  }
397
392
  case 'maxlength': {
398
393
  if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
399
- var maxLength = toInt(datum);
400
- if (isNaN(maxLength)) {
394
+ const maxLength = toInt(datum);
395
+ if (Number.isNaN(maxLength)) {
401
396
  el.removeAttribute(attr);
402
397
  }
403
398
  else {
@@ -405,14 +400,14 @@ function setAttribute(el, attr, datum) {
405
400
  }
406
401
  }
407
402
  else {
408
- el.setAttribute(attr, "".concat(datum));
403
+ el.setAttribute(attr, `${datum}`);
409
404
  }
410
405
  break;
411
406
  }
412
407
  case 'min': {
413
408
  if (el instanceof HTMLInputElement || el instanceof HTMLMeterElement) {
414
- var min = toInt(datum);
415
- if (isNaN(min)) {
409
+ const min = toInt(datum);
410
+ if (Number.isNaN(min)) {
416
411
  el.removeAttribute(attr);
417
412
  }
418
413
  else {
@@ -420,7 +415,7 @@ function setAttribute(el, attr, datum) {
420
415
  }
421
416
  }
422
417
  else {
423
- el.setAttribute(attr, "".concat(datum));
418
+ el.setAttribute(attr, `${datum}`);
424
419
  }
425
420
  break;
426
421
  }
@@ -429,7 +424,7 @@ function setAttribute(el, attr, datum) {
429
424
  el.multiple = datum === '' ? true : !!datum;
430
425
  }
431
426
  else {
432
- el.setAttribute(attr, "".concat(datum));
427
+ el.setAttribute(attr, `${datum}`);
433
428
  }
434
429
  break;
435
430
  }
@@ -438,14 +433,14 @@ function setAttribute(el, attr, datum) {
438
433
  el.noValidate = datum === '' ? true : !!datum;
439
434
  }
440
435
  else {
441
- el.setAttribute(attr, "".concat(datum));
436
+ el.setAttribute(attr, `${datum}`);
442
437
  }
443
438
  break;
444
439
  }
445
440
  // ⚰️ Unsupported HTMLDetailsElement yet...
446
- // case 'oepn': {
441
+ // case 'open': {
447
442
  // if (el instanceof HTMLDetailsElement) {
448
- // el.oepn = datum === '' ? true : !!datum;
443
+ // el.open = datum === '' ? true : !!datum;
449
444
  // } else {
450
445
  // el.setAttribute(attr, `${datum}`);
451
446
  // }
@@ -453,8 +448,8 @@ function setAttribute(el, attr, datum) {
453
448
  // }
454
449
  case 'optimum': {
455
450
  if (el instanceof HTMLMeterElement) {
456
- var optimum = toInt(datum);
457
- if (isNaN(optimum)) {
451
+ const optimum = toInt(datum);
452
+ if (Number.isNaN(optimum)) {
458
453
  el.removeAttribute(attr);
459
454
  }
460
455
  else {
@@ -462,7 +457,7 @@ function setAttribute(el, attr, datum) {
462
457
  }
463
458
  }
464
459
  else {
465
- el.setAttribute(attr, "".concat(datum));
460
+ el.setAttribute(attr, `${datum}`);
466
461
  }
467
462
  break;
468
463
  }
@@ -481,7 +476,7 @@ function setAttribute(el, attr, datum) {
481
476
  }
482
477
  }
483
478
  else {
484
- el.setAttribute(attr, "".concat(datum));
479
+ el.setAttribute(attr, `${datum}`);
485
480
  }
486
481
  break;
487
482
  }
@@ -490,7 +485,7 @@ function setAttribute(el, attr, datum) {
490
485
  el.readOnly = datum === '' ? true : !!datum;
491
486
  }
492
487
  else {
493
- el.setAttribute(attr, "".concat(datum));
488
+ el.setAttribute(attr, `${datum}`);
494
489
  }
495
490
  break;
496
491
  }
@@ -501,24 +496,23 @@ function setAttribute(el, attr, datum) {
501
496
  el.required = datum === '' ? true : !!datum;
502
497
  }
503
498
  else {
504
- el.setAttribute(attr, "".concat(datum));
499
+ el.setAttribute(attr, `${datum}`);
505
500
  }
506
501
  break;
507
502
  }
508
503
  case 'reversed': {
509
504
  if (el instanceof HTMLOListElement) {
510
- // tslint:disable-next-line:no-any
511
505
  el.reversed = datum === '' ? true : !!datum;
512
506
  }
513
507
  else {
514
- el.setAttribute(attr, "".concat(datum));
508
+ el.setAttribute(attr, `${datum}`);
515
509
  }
516
510
  break;
517
511
  }
518
512
  case 'rows': {
519
513
  if (el instanceof HTMLTextAreaElement) {
520
- var rows = toInt(datum);
521
- if (isNaN(rows)) {
514
+ const rows = toInt(datum);
515
+ if (Number.isNaN(rows)) {
522
516
  el.removeAttribute(attr);
523
517
  }
524
518
  else {
@@ -526,14 +520,14 @@ function setAttribute(el, attr, datum) {
526
520
  }
527
521
  }
528
522
  else {
529
- el.setAttribute(attr, "".concat(datum));
523
+ el.setAttribute(attr, `${datum}`);
530
524
  }
531
525
  break;
532
526
  }
533
527
  case 'rowspan': {
534
528
  if (el instanceof HTMLTableCellElement) {
535
- var rowSpan = toInt(datum);
536
- if (isNaN(rowSpan)) {
529
+ const rowSpan = toInt(datum);
530
+ if (Number.isNaN(rowSpan)) {
537
531
  el.removeAttribute(attr);
538
532
  }
539
533
  else {
@@ -541,14 +535,14 @@ function setAttribute(el, attr, datum) {
541
535
  }
542
536
  }
543
537
  else {
544
- el.setAttribute(attr, "".concat(datum));
538
+ el.setAttribute(attr, `${datum}`);
545
539
  }
546
540
  break;
547
541
  }
548
542
  case 'size': {
549
543
  if (el instanceof HTMLInputElement || el instanceof HTMLSelectElement) {
550
- var size = toInt(datum);
551
- if (isNaN(size)) {
544
+ const size = toInt(datum);
545
+ if (Number.isNaN(size)) {
552
546
  el.removeAttribute(attr);
553
547
  }
554
548
  else {
@@ -556,14 +550,14 @@ function setAttribute(el, attr, datum) {
556
550
  }
557
551
  }
558
552
  else {
559
- el.setAttribute(attr, "".concat(datum));
553
+ el.setAttribute(attr, `${datum}`);
560
554
  }
561
555
  break;
562
556
  }
563
557
  case 'span': {
564
558
  if (el instanceof HTMLTableColElement) {
565
- var span = toInt(datum);
566
- if (isNaN(span)) {
559
+ const span = toInt(datum);
560
+ if (Number.isNaN(span)) {
567
561
  el.removeAttribute(attr);
568
562
  }
569
563
  else {
@@ -571,14 +565,14 @@ function setAttribute(el, attr, datum) {
571
565
  }
572
566
  }
573
567
  else {
574
- el.setAttribute(attr, "".concat(datum));
568
+ el.setAttribute(attr, `${datum}`);
575
569
  }
576
570
  break;
577
571
  }
578
572
  case 'start': {
579
573
  if (el instanceof HTMLOListElement) {
580
- var start = toInt(datum);
581
- if (isNaN(start)) {
574
+ const start = toInt(datum);
575
+ if (Number.isNaN(start)) {
582
576
  el.removeAttribute(attr);
583
577
  }
584
578
  else {
@@ -586,7 +580,7 @@ function setAttribute(el, attr, datum) {
586
580
  }
587
581
  }
588
582
  else {
589
- el.setAttribute(attr, "".concat(datum));
583
+ el.setAttribute(attr, `${datum}`);
590
584
  }
591
585
  break;
592
586
  }
@@ -596,8 +590,8 @@ function setAttribute(el, attr, datum) {
596
590
  el.step = datum;
597
591
  break;
598
592
  }
599
- var step = toNum(datum);
600
- if (isNaN(step)) {
593
+ const step = toNum(datum);
594
+ if (Number.isNaN(step)) {
601
595
  el.removeAttribute(attr);
602
596
  }
603
597
  else {
@@ -605,7 +599,7 @@ function setAttribute(el, attr, datum) {
605
599
  }
606
600
  }
607
601
  else {
608
- el.setAttribute(attr, "".concat(datum));
602
+ el.setAttribute(attr, `${datum}`);
609
603
  }
610
604
  break;
611
605
  }
@@ -614,14 +608,14 @@ function setAttribute(el, attr, datum) {
614
608
  el instanceof HTMLAreaElement ||
615
609
  el instanceof HTMLFormElement) {
616
610
  if (datum) {
617
- el.target = "".concat(datum);
611
+ el.target = `${datum}`;
618
612
  }
619
613
  else {
620
614
  el.removeAttribute(attr);
621
615
  }
622
616
  }
623
617
  else {
624
- el.setAttribute(attr, "".concat(datum));
618
+ el.setAttribute(attr, `${datum}`);
625
619
  }
626
620
  break;
627
621
  }
@@ -675,17 +669,17 @@ function setAttribute(el, attr, datum) {
675
669
  // case 'wrap':
676
670
  // and Data-* attributes
677
671
  default: {
678
- el.setAttribute(attr, "".concat(datum));
672
+ el.setAttribute(attr, `${datum}`);
679
673
  }
680
674
  }
681
675
  }
682
676
  function toNum(datum) {
683
- var i;
677
+ let i;
684
678
  if (typeof datum === 'boolean') {
685
679
  i = +datum;
686
680
  }
687
681
  else if (typeof datum === 'string') {
688
- i = parseFloat(datum);
682
+ i = Number.parseFloat(datum);
689
683
  }
690
684
  else {
691
685
  i = datum;
@@ -695,4 +689,3 @@ function toNum(datum) {
695
689
  function toInt(datum) {
696
690
  return Math.floor(toNum(datum));
697
691
  }
698
- //# sourceMappingURL=setValue.js.map
package/dist/set.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { Filter, FrozenPattyData } from './types.js';
2
+ export default function (el: Element, data: FrozenPattyData, attr: string, filter?: Filter): Element;