@kizmann/pico-js 1.0.14 → 2.0.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 (125) hide show
  1. package/README.md +27 -7
  2. package/dist/pico-js.browser.js +2 -0
  3. package/dist/pico-js.browser.js.map +1 -0
  4. package/dist/pico-js.esm.js +2 -0
  5. package/dist/pico-js.esm.js.map +1 -0
  6. package/package.json +20 -7
  7. package/src/dom/DomAttribute.js +374 -0
  8. package/src/dom/DomBuilder.js +152 -0
  9. package/src/dom/DomEvent.js +253 -0
  10. package/src/dom/DomFinder.js +669 -0
  11. package/src/dom/DomForm.js +57 -0
  12. package/src/dom/DomGlobal.js +193 -0
  13. package/src/dom/DomInview.js +332 -0
  14. package/src/dom/DomMeta.js +66 -0
  15. package/src/dom/DomObserver.js +57 -0
  16. package/src/dom/DomRectangle.js +657 -0
  17. package/src/format/FormatFile.js +54 -0
  18. package/src/format/FormatOption.js +108 -0
  19. package/src/format/FormatParam.js +107 -0
  20. package/src/format/FormatParser.js +156 -0
  21. package/src/format/FormatUrl.js +75 -0
  22. package/src/index.browser.js +10 -0
  23. package/src/index.esm.js +138 -0
  24. package/src/now/NowDefault.js +533 -0
  25. package/src/now/NowFormat.js +196 -0
  26. package/src/now/NowGrid.js +251 -0
  27. package/src/now/NowHuman.js +118 -0
  28. package/src/now/NowMatch.js +175 -0
  29. package/src/now/NowRange.js +70 -0
  30. package/src/now/NowWalker.js +544 -0
  31. package/src/tool/scope.js +103 -0
  32. package/src/utils/Array.js +986 -0
  33. package/src/utils/Cookie.js +184 -0
  34. package/src/utils/Data.js +200 -0
  35. package/src/utils/Dom.js +208 -0
  36. package/src/utils/Event.js +140 -0
  37. package/src/utils/Format.js +62 -0
  38. package/src/utils/Hash.js +164 -0
  39. package/src/utils/Locale.js +229 -0
  40. package/src/utils/Mixed.js +887 -0
  41. package/src/utils/Now.js +234 -0
  42. package/src/utils/Number.js +238 -0
  43. package/src/utils/Object.js +655 -0
  44. package/src/utils/Route.js +67 -0
  45. package/src/utils/Runner.js +327 -0
  46. package/src/utils/String.js +618 -0
  47. package/src/{library/element.js → wip/Element.js} +90 -16
  48. package/src/{library/map.js → wip/Map.js} +256 -40
  49. package/types/dom/DomAttribute.d.ts +137 -0
  50. package/types/dom/DomBuilder.d.ts +67 -0
  51. package/types/dom/DomEvent.d.ts +103 -0
  52. package/types/dom/DomFinder.d.ts +321 -0
  53. package/types/dom/DomForm.d.ts +21 -0
  54. package/types/dom/DomGlobal.d.ts +79 -0
  55. package/types/dom/DomInview.d.ts +114 -0
  56. package/types/dom/DomMeta.d.ts +29 -0
  57. package/types/dom/DomObserver.d.ts +21 -0
  58. package/types/dom/DomRectangle.d.ts +270 -0
  59. package/types/format/FormatFile.d.ts +18 -0
  60. package/types/format/FormatOption.d.ts +40 -0
  61. package/types/format/FormatParam.d.ts +39 -0
  62. package/types/format/FormatParser.d.ts +46 -0
  63. package/types/format/FormatUrl.d.ts +17 -0
  64. package/types/index.browser.d.ts +1 -0
  65. package/types/index.esm.d.ts +52 -0
  66. package/types/now/NowDefault.d.ts +183 -0
  67. package/types/now/NowFormat.d.ts +70 -0
  68. package/types/now/NowGrid.d.ts +107 -0
  69. package/types/now/NowHuman.d.ts +37 -0
  70. package/types/now/NowMatch.d.ts +108 -0
  71. package/types/now/NowRange.d.ts +21 -0
  72. package/types/now/NowWalker.d.ts +301 -0
  73. package/types/tool/scope.d.ts +24 -0
  74. package/types/utils/Array.d.ts +480 -0
  75. package/types/utils/Cookie.d.ts +60 -0
  76. package/types/utils/Data.d.ts +91 -0
  77. package/types/utils/Dom.d.ts +138 -0
  78. package/types/utils/Event.d.ts +58 -0
  79. package/types/utils/Format.d.ts +37 -0
  80. package/types/utils/Hash.d.ts +81 -0
  81. package/types/utils/Locale.d.ts +115 -0
  82. package/types/utils/Mixed.d.ts +469 -0
  83. package/types/utils/Now.d.ts +125 -0
  84. package/types/utils/Number.d.ts +127 -0
  85. package/types/utils/Object.d.ts +255 -0
  86. package/types/utils/Route.d.ts +37 -0
  87. package/types/utils/Runner.d.ts +139 -0
  88. package/types/utils/String.d.ts +330 -0
  89. package/types/wip/Element.d.ts +119 -0
  90. package/types/wip/Map.d.ts +254 -0
  91. package/dist/.ignore.js +0 -0
  92. package/dist/pico-js.js +0 -2
  93. package/dist/pico-js.js.map +0 -1
  94. package/src/element/default.js +0 -46
  95. package/src/element/example.js +0 -58
  96. package/src/index.js +0 -90
  97. package/src/library/cookie.js +0 -123
  98. package/src/library/data.js +0 -111
  99. package/src/library/event.js +0 -91
  100. package/src/library/locale.js +0 -84
  101. package/src/library/queue.js +0 -64
  102. package/src/library/route.js +0 -28
  103. package/src/utility/any.js +0 -369
  104. package/src/utility/array.js +0 -410
  105. package/src/utility/dom.js +0 -1425
  106. package/src/utility/now.js +0 -544
  107. package/src/utility/number.js +0 -128
  108. package/src/utility/object.js +0 -429
  109. package/src/utility/string.js +0 -328
  110. package/types/index.d.ts +0 -77
  111. package/types/library/cookie.d.ts +0 -10
  112. package/types/library/data.d.ts +0 -15
  113. package/types/library/element.d.ts +0 -22
  114. package/types/library/event.d.ts +0 -13
  115. package/types/library/locale.d.ts +0 -14
  116. package/types/library/map.d.ts +0 -43
  117. package/types/library/queue.d.ts +0 -18
  118. package/types/library/route.d.ts +0 -11
  119. package/types/utility/any.d.ts +0 -35
  120. package/types/utility/array.d.ts +0 -46
  121. package/types/utility/dom.d.ts +0 -101
  122. package/types/utility/now.d.ts +0 -79
  123. package/types/utility/number.d.ts +0 -17
  124. package/types/utility/object.d.ts +0 -29
  125. package/types/utility/string.d.ts +0 -26
@@ -0,0 +1,669 @@
1
+ import { Arr, Mix, Obj, Dom } from "#src/index.esm.js";
2
+
3
+ /**
4
+ * @memberof PicoDom
5
+ */
6
+ export class PicoDomFinderStatic
7
+ {
8
+
9
+ /**
10
+ * Filter nodes by type
11
+ *
12
+ * @example Dom.filterNodes(nodes, 1)
13
+ *
14
+ * @param {any} nodes Source nodes
15
+ * @param {number} [filter] Node type
16
+ * @returns {Array<Element>} Filtered nodes
17
+ */
18
+ static filterNodes(nodes, filter = 1)
19
+ {
20
+ return Arr.filter(Mix.nodes(nodes), (el) => {
21
+ return el.nodeType === filter;
22
+ });
23
+ }
24
+
25
+ /**
26
+ * Get nodes at point
27
+ *
28
+ * @example Dom.getNodePoint(100, 100)
29
+ *
30
+ * @param {number} posx X position
31
+ * @param {number} posy Y position
32
+ * @returns {Array<Element>} Nodes at point
33
+ */
34
+ static getNodePoint(posx, posy)
35
+ {
36
+ let el = null;
37
+
38
+ if ( Dom.doc().elementsFromPoint != null ) {
39
+ el = document.elementsFromPoint(posx, posy);
40
+ }
41
+
42
+ if ( Dom.doc().msElementsFromPoint != null ) {
43
+ el = document.msElementsFromPoint(posx, posy);
44
+ }
45
+
46
+ return el;
47
+ }
48
+
49
+ /**
50
+ * Get target by selector
51
+ *
52
+ * @example Dom.getNodeEvent(".item", event)
53
+ *
54
+ * @param {string} selector Node selector
55
+ * @param {any} [event] Event object
56
+ * @returns {Element} Found element
57
+ */
58
+ static getNodeEvent(selector, event = {})
59
+ {
60
+ let target = event.srcElement;
61
+
62
+ if ( target == null ) {
63
+ target = event.target;
64
+ }
65
+
66
+ let { type, clientX, clientY } = event;
67
+
68
+ if ( /^(drag[a-z]*|drop$)/.test(type) ) {
69
+ target = Dom.getNodePoint(clientX, clientY);
70
+ }
71
+
72
+ if ( Mix.isArr(target) ) {
73
+ target = Arr.first(target);
74
+ }
75
+
76
+ if ( target == null ) {
77
+ target = event.target;
78
+ }
79
+
80
+ return target.closest(selector);
81
+ }
82
+
83
+ }
84
+
85
+ /**
86
+ * @memberof PicoDom
87
+ * @extends {PicoDom}
88
+ */
89
+ export class PicoDomFinderInstance
90
+ {
91
+ /**
92
+ * Resolve input elements
93
+ *
94
+ * @example Dom._constructFinder(".item")
95
+ *
96
+ * @param {any} el Input value
97
+ * @returns {any} Resolved elements
98
+ */
99
+ static _constructFinder(el)
100
+ {
101
+ if ( typeof el === 'string' ) {
102
+ el = document.querySelectorAll(el);
103
+ }
104
+
105
+ if ( el instanceof NodeList ) {
106
+ el = Mix.nodes(el);
107
+ }
108
+
109
+ return el;
110
+ }
111
+
112
+ /**
113
+ * Get node type
114
+ *
115
+ * @example Dom.find("div").getNodeType() // => 1
116
+ *
117
+ * @param {number} [fallback] Fallback value
118
+ * @returns {number} Node type
119
+ */
120
+ getNodeType(fallback = -1)
121
+ {
122
+ if ( ! this.el ) {
123
+ return fallback;
124
+ }
125
+
126
+ return this.el.nodeType;
127
+ }
128
+
129
+ /**
130
+ * Get parent node
131
+ *
132
+ * @example Dom.find("div").getNodeParent() // => PicoDom
133
+ *
134
+ * @param {any} [fallback] Fallback value
135
+ * @returns {PicoDom} Parent instance
136
+ */
137
+ getNodeParent(fallback = null)
138
+ {
139
+ if ( ! this.el ) {
140
+ return fallback;
141
+ }
142
+
143
+ return Dom.find(this.el.parentNode);
144
+ }
145
+
146
+ /**
147
+ * Get previous node
148
+ *
149
+ * @example Dom.find("div").getNodePrev() // => PicoDom
150
+ *
151
+ * @param {any} [fallback] Fallback value
152
+ * @returns {PicoDom} Prev instance
153
+ */
154
+ getNodePrev(fallback = null)
155
+ {
156
+ if ( ! this.el ) {
157
+ return fallback;
158
+ }
159
+
160
+ return Dom.find(this.el.previousSibling);
161
+ }
162
+
163
+ /**
164
+ * Get next node
165
+ *
166
+ * @example Dom.find("div").getNodeNext() // => PicoDom
167
+ *
168
+ * @param {any} [fallback] Fallback value
169
+ * @returns {PicoDom} Next instance
170
+ */
171
+ getNodeNext(fallback = null)
172
+ {
173
+ if ( ! this.el ) {
174
+ return fallback;
175
+ }
176
+
177
+ return Dom.find(this.el.nextSibling);
178
+ }
179
+
180
+ /**
181
+ * Get child nodes
182
+ *
183
+ * @example Dom.find("div").getNodeChilds(1)
184
+ *
185
+ * @param {number} [type] Node type
186
+ * @param {any} [fallback] Fallback value
187
+ * @returns {Array<Element>} Child nodes
188
+ */
189
+ getNodeChilds(type = -1, fallback = [])
190
+ {
191
+ if ( ! this.el ) {
192
+ return fallback;
193
+ }
194
+
195
+ let childs = Mix.nodes(this.el.childNodes);
196
+
197
+ if ( type === -1 ) {
198
+ return childs;
199
+ }
200
+
201
+ return Arr.filter(childs, (el) => {
202
+ return el.nodeType === type;
203
+ });
204
+ }
205
+
206
+ /**
207
+ * Filter instances nodes
208
+ *
209
+ * @example Dom.find("div").sanatize(1)
210
+ *
211
+ * @param {number} [filter] Node type
212
+ * @returns {this} Current instance
213
+ */
214
+ sanatize(filter = 1)
215
+ {
216
+ this.els = Dom.filterNodes(this.els, filter);
217
+
218
+ return this;
219
+ }
220
+
221
+ /**
222
+ * Filter elements by selector
223
+ *
224
+ * @example Dom.find("div").filter(".active")
225
+ *
226
+ * @param {any} selector Filter selector
227
+ * @returns {Array<Element>} Filtered nodes
228
+ */
229
+ filter(selector)
230
+ {
231
+ if ( typeof selector !== 'function' ) {
232
+ selector = (el) => Dom.find(el).is(selector);
233
+ }
234
+
235
+ return Arr.filter(this.els, selector);
236
+ }
237
+
238
+ /**
239
+ * Exclude elements by selector
240
+ *
241
+ * @example Dom.find("div").except(".active")
242
+ *
243
+ * @param {any} selector Exclude selector
244
+ * @returns {Array<Element>} Filtered nodes
245
+ */
246
+ except(selector)
247
+ {
248
+ if ( typeof selector !== 'function' ) {
249
+ selector = (el) => ! Dom.find(el).is(selector);
250
+ }
251
+
252
+ return Arr.filter(this.els, selector);
253
+ }
254
+
255
+ /**
256
+ * Find elements in instance
257
+ *
258
+ * @example Dom.find("div").find(".item")
259
+ *
260
+ * @param {any} selector Search selector
261
+ * @returns {PicoDom} Dom instance
262
+ */
263
+ find(selector)
264
+ {
265
+ if ( this.el == null ) {
266
+ return Dom.find(null);
267
+ }
268
+
269
+ let el = this.el;
270
+
271
+ if ( el instanceof Window ) {
272
+ el = document.body;
273
+ }
274
+
275
+ let nodes = selector;
276
+
277
+ if ( Mix.isStr(nodes) ) {
278
+ nodes = el.querySelectorAll(selector);
279
+ }
280
+
281
+ return Dom.find(nodes);
282
+ }
283
+
284
+ /**
285
+ * Get element by index
286
+ *
287
+ * @example Dom.find("div").get(0) // => Element
288
+ *
289
+ * @param {number} [index] Node index
290
+ * @returns {any} Found element
291
+ */
292
+ get(index = - 1)
293
+ {
294
+ let nodes = this.els;
295
+
296
+ if ( index === - 1 ) {
297
+ return nodes;
298
+ }
299
+
300
+ return Arr.get(nodes, index);
301
+ }
302
+
303
+ /**
304
+ * Get first element
305
+ *
306
+ * @example Dom.find("div").first() // => Element
307
+ *
308
+ * @param {number} [offset] Node offset
309
+ * @returns {any} Found element
310
+ */
311
+ first(offset = 0)
312
+ {
313
+ return this.get(offset);
314
+ }
315
+
316
+ /**
317
+ * Get last element
318
+ *
319
+ * @example Dom.find("div").last() // => Element
320
+ *
321
+ * @param {number} [offset] Node offset
322
+ * @returns {any} Found element
323
+ */
324
+ last(offset = 1)
325
+ {
326
+ return Arr.get(this.els, this.els.length - offset);
327
+ }
328
+
329
+ /**
330
+ * Iterate over elements
331
+ *
332
+ * @example Dom.find("div").each((el) => console.log(el))
333
+ *
334
+ * @param {function} cb Callback fn
335
+ * @returns {this} Current instance
336
+ */
337
+ each(cb)
338
+ {
339
+ return (this, Arr.each(this.els, cb));
340
+ }
341
+
342
+ /**
343
+ * Loop through parent nodes
344
+ *
345
+ * @example Dom.find("div").loopParent((el) => console.log(el))
346
+ *
347
+ * @param {function} cb Callback fn
348
+ * @param {any} [boundry] Loop limit
349
+ * @returns {this} Current instance
350
+ */
351
+ loopParent(cb, boundry = null)
352
+ {
353
+ if ( boundry == null ) {
354
+ boundry = Dom.win();
355
+ }
356
+
357
+ for ( let el = this.el; el && el !== boundry; el = el.parentNode ) {
358
+ cb.call({}, el);
359
+ }
360
+
361
+ return this;
362
+ }
363
+
364
+ /**
365
+ * Get parent instance
366
+ *
367
+ * @example Dom.find("div").parent() // => PicoDom
368
+ *
369
+ * @returns {PicoDom} Parent instance
370
+ */
371
+ parent()
372
+ {
373
+ let parent = this.getNodeParent();
374
+
375
+ if ( parent == null ) {
376
+ return Dom.find(null);
377
+ }
378
+
379
+ return parent;
380
+ }
381
+
382
+ /**
383
+ * Get first child match
384
+ *
385
+ * @example Dom.find("div").child(".item")
386
+ *
387
+ * @param {any} selector Child selector
388
+ * @param {number} [filter] Node type
389
+ * @returns {PicoDom} Child instance
390
+ */
391
+ child(selector, filter = 1)
392
+ {
393
+ for ( let el of this.els ) {
394
+ if ( el.nodeType === filter ) {
395
+ return Dom.find(el);
396
+ }
397
+ }
398
+
399
+ return Dom.find(null);
400
+ }
401
+
402
+ /**
403
+ * Get child elements
404
+ *
405
+ * @example Dom.find("div").childs(".item")
406
+ *
407
+ * @param {any} [selector] Child selector
408
+ * @param {number} [filter] Node type
409
+ * @returns {Array<Element>} Child elements
410
+ */
411
+ childs(selector = null, filter = 1)
412
+ {
413
+ let childs = this.getNodeChilds(filter);
414
+
415
+ if ( selector == null ) {
416
+ return childs;
417
+ }
418
+
419
+ return Arr.filter(childs, (el) => {
420
+ return Dom.find(el).is(selector);
421
+ });
422
+ }
423
+
424
+ /**
425
+ * Get closest element
426
+ *
427
+ * @example Dom.find("div").closest(".container")
428
+ *
429
+ * @param {any} selector Target selector
430
+ * @returns {Element} Found element
431
+ */
432
+ closest(selector)
433
+ {
434
+ if ( this.el === selector ) {
435
+ return this.el;
436
+ }
437
+
438
+ for ( let el = this; el.el != null; el = el.getNodeParent() ) {
439
+ if ( el.is(selector) ) return el.el;
440
+ }
441
+
442
+ return null;
443
+ }
444
+
445
+ /**
446
+ * Get previous element
447
+ *
448
+ * @example Dom.find("div").prev() // => PicoDom
449
+ *
450
+ * @param {number} [type] Node type
451
+ * @returns {PicoDom} Prev instance
452
+ */
453
+ prev(type = 1)
454
+ {
455
+ let el = this.getNodePrev();
456
+
457
+ for ( el; el != null; el = el.getNodePrev() ) {
458
+ if ( el.getNodeType() === type ) return Dom.find(el);
459
+ }
460
+
461
+ return Dom.find(null);
462
+ }
463
+
464
+ /**
465
+ * Get next element
466
+ *
467
+ * @example Dom.find("div").next() // => PicoDom
468
+ *
469
+ * @param {number} [type] Node type
470
+ * @returns {PicoDom} Next instance
471
+ */
472
+ next(type = 1)
473
+ {
474
+ let el = this.getNodeNext();
475
+
476
+ for ( el; el != null; el = el.getNodeNext() ) {
477
+ if ( el.getNodeType() === type ) return Dom.find(el);
478
+ }
479
+
480
+ return Dom.find(null);
481
+ }
482
+
483
+ /**
484
+ * Get number of elements
485
+ *
486
+ * @example Dom.find("div").length() // => 1
487
+ *
488
+ * @returns {number} Count value
489
+ */
490
+ length()
491
+ {
492
+ return this.els.length;
493
+ }
494
+
495
+ /**
496
+ * Check if element matches
497
+ *
498
+ * @example Dom.find("div").is(".active") // => true
499
+ *
500
+ * @param {any} selector Test selector
501
+ * @returns {boolean} True if matches
502
+ */
503
+ is(selector)
504
+ {
505
+ if ( this.el === selector ) {
506
+ return true;
507
+ }
508
+
509
+ if ( this.el == null ) {
510
+ return false;
511
+ }
512
+
513
+ for ( let el of this.parent().find(selector).get() ) {
514
+ if ( el === this.el ) return true;
515
+ }
516
+
517
+ return false;
518
+ }
519
+
520
+ /**
521
+ * Check if contains match
522
+ *
523
+ * @example Dom.find("div").matches(".active")
524
+ *
525
+ * @param {any} selector Test selector
526
+ * @returns {boolean} True if matches
527
+ */
528
+ matches(selector)
529
+ {
530
+ if ( this.el === selector ) {
531
+ return true;
532
+ }
533
+
534
+ if ( this.el == null ) {
535
+ return false;
536
+ }
537
+
538
+ for ( let el of this.find(selector).get() ) {
539
+ if ( el === this.el ) return true;
540
+ }
541
+
542
+ return false;
543
+ }
544
+
545
+ /**
546
+ * Check if instance is empty
547
+ *
548
+ * @example Dom.find(".none").empty() // => true
549
+ *
550
+ * @returns {boolean} True if empty
551
+ */
552
+ empty()
553
+ {
554
+ return this.length() < 1 || this.el == null;
555
+ }
556
+
557
+ /**
558
+ * Check if element is visible
559
+ *
560
+ * @example Dom.find("div").visible() // => true
561
+ *
562
+ * @returns {boolean} True if visible
563
+ */
564
+ visible()
565
+ {
566
+ if ( this.el == null ) {
567
+ return false;
568
+ }
569
+
570
+ return this.el.is(':visible');
571
+ }
572
+
573
+ /**
574
+ * Check if parent matches
575
+ *
576
+ * @example Dom.find("div").above(".container")
577
+ *
578
+ * @param {any} selector Parent selector
579
+ * @returns {boolean} True if matches
580
+ */
581
+ above(selector)
582
+ {
583
+ // Parent is exacly selector
584
+ return this.parent().is(selector);
585
+ }
586
+
587
+ /**
588
+ * Check if inside match
589
+ *
590
+ * @example Dom.find("div").inside(".container")
591
+ *
592
+ * @param {any} selector Target selector
593
+ * @returns {boolean} True if inside
594
+ */
595
+ inside(selector)
596
+ {
597
+ // Has parent of selector
598
+ return this.closest(selector) != null;
599
+ }
600
+
601
+ /**
602
+ * Check if contains match
603
+ *
604
+ * @example Dom.find("div").contains(".item")
605
+ *
606
+ * @param {any} selector Target selector
607
+ * @returns {boolean} True if contains
608
+ */
609
+ contains(selector)
610
+ {
611
+ // Has child of selector
612
+ return this.find(selector) != null;
613
+ }
614
+
615
+ }
616
+
617
+ /**
618
+ * @see PicoDom.above
619
+ */
620
+ PicoDomFinderInstance.prototype.isParent = function (...args) {
621
+ console.warn('Dom.isParent() is deprecated, use Dom.above() instead.');
622
+ return this.above(...args);
623
+ };
624
+
625
+ /**
626
+ * @see PicoDom.prev
627
+ */
628
+ PicoDomFinderInstance.prototype.previous = function () {
629
+ console.warn('Dom.previous() is deprecated, use Dom.prev() instead.');
630
+ return this.prev();
631
+ };
632
+
633
+ /**
634
+ * @see PicoDom.filter
635
+ */
636
+ PicoDomFinderInstance.prototype.where = function (...args) {
637
+ console.warn('Dom.where() is deprecated, use Dom.filter() instead.');
638
+ return this.filter(...args);
639
+ };
640
+
641
+ /**
642
+ * @see PicoDom.except
643
+ */
644
+ PicoDomFinderInstance.prototype.not = function (...args) {
645
+ console.warn('Dom.not() is deprecated, use Dom.except() instead.');
646
+ return this.except(...args);
647
+ };
648
+
649
+ PicoDomFinderInstance.prototype.getNot = () => {
650
+ console.error('Dom.getNot() is not implemented anymore.');
651
+ };
652
+
653
+ /**
654
+ * @returns {typeof import('#src/utils/Dom.js').PicoDom}
655
+ */
656
+ export const PicoDomFinderPlugin = function (self) {
657
+
658
+ Obj.each(Mix.class(PicoDomFinderStatic), (fn, id) => {
659
+ self[id] = fn;
660
+ });
661
+
662
+ Obj.each(Mix.proto(PicoDomFinderInstance), (fn, id) => {
663
+ self.prototype[id] = fn;
664
+ });
665
+
666
+ self.init.push(PicoDomFinderInstance._constructFinder);
667
+
668
+ return self;
669
+ }
@@ -0,0 +1,57 @@
1
+ import { Arr, Mix, Obj, Dom } from "#src/index.esm.js";
2
+
3
+ /**
4
+ * @memberof PicoDom
5
+ */
6
+ export class PicoDomFormStatic
7
+ {
8
+
9
+ }
10
+
11
+ /**
12
+ * @memberof PicoDom
13
+ * @extends {PicoDom}
14
+ */
15
+ export class PicoDomFormInstance
16
+ {
17
+
18
+ /**
19
+ * Get or set input value
20
+ *
21
+ * @example Dom.find("input").value("hello")
22
+ *
23
+ * @param {any} [value] Input value
24
+ * @returns {any|this} Value or instance
25
+ */
26
+ value(value = undefined)
27
+ {
28
+ if ( value === undefined ) {
29
+ return this.el.value;
30
+ }
31
+
32
+ this.each((el) => {
33
+ el.value = value;
34
+ });
35
+
36
+ return this;
37
+ }
38
+
39
+ }
40
+
41
+ /**
42
+ * @returns {typeof import('#src/utils/Dom.js').PicoDom}
43
+ */
44
+ export const PicoDomFormPlugin = function (self) {
45
+
46
+ Obj.each(Mix.class(PicoDomFormStatic), (fn, id) => {
47
+ self[id] = fn;
48
+ });
49
+
50
+ Obj.each(Mix.proto(PicoDomFormInstance), (fn, id) => {
51
+ self.prototype[id] = fn;
52
+ });
53
+
54
+ // self.init.push(PicoDomFormInstance.constructor);
55
+
56
+ return self;
57
+ }