umaki 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -216,7 +216,7 @@ bgScrollStop(); // scroll stop
|
|
|
216
216
|
bgScrollStop(false); // scroll start
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
-
[View file →](src/libs/control/
|
|
219
|
+
[View file →](src/libs/control/bg-scroll-stop.ts)
|
|
220
220
|
|
|
221
221
|
### pd
|
|
222
222
|
|
|
@@ -248,7 +248,7 @@ import { scrollToHash } from "umaki";
|
|
|
248
248
|
})();
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
-
[View file →](src/libs/control/
|
|
251
|
+
[View file →](src/libs/control/scroll-to-hash.ts)
|
|
252
252
|
|
|
253
253
|
### videoPlayControl
|
|
254
254
|
|
|
@@ -265,7 +265,7 @@ videoPlayControl(videoElement, false); // pause
|
|
|
265
265
|
videoPlayControl(videoElement, true, 10); // play and set currentTime to 10
|
|
266
266
|
```
|
|
267
267
|
|
|
268
|
-
[View file →](src/libs/control/
|
|
268
|
+
[View file →](src/libs/control/video-play-control.ts)
|
|
269
269
|
|
|
270
270
|
## Convert
|
|
271
271
|
|
|
@@ -301,7 +301,7 @@ console.log(formattedDateWithDifferentTz); // '2025-04-24 20:00:00'
|
|
|
301
301
|
|
|
302
302
|
Note: This function focuses on timezone handling rather than locale-specific formatting. When a timezone is specified, the date will be converted to that timezone before formatting.
|
|
303
303
|
|
|
304
|
-
[View file →](src/libs/convert/
|
|
304
|
+
[View file →](src/libs/convert/change-date-string-to-specific-format.ts)
|
|
305
305
|
|
|
306
306
|
### jsonStringToJsonObject
|
|
307
307
|
|
|
@@ -315,7 +315,7 @@ const jsonObject = jsonStringToJsonObject(jsonString);
|
|
|
315
315
|
console.log(jsonObject); // { name: 'John', age: 30 }
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
-
[View file →](src/libs/convert/
|
|
318
|
+
[View file →](src/libs/convert/json-string-to-json-object.ts)
|
|
319
319
|
|
|
320
320
|
## EventControl
|
|
321
321
|
|
|
@@ -364,7 +364,7 @@ const aspectRatio = getAspectRatio(1920, 1080);
|
|
|
364
364
|
console.log(aspectRatio); // { w: 16, h: 9 }
|
|
365
365
|
```
|
|
366
366
|
|
|
367
|
-
[View file →](src/libs/get/
|
|
367
|
+
[View file →](src/libs/get/get-aspect-ratio.ts)
|
|
368
368
|
|
|
369
369
|
### getClassNames
|
|
370
370
|
|
|
@@ -379,7 +379,7 @@ const classNames = getClassNames(element);
|
|
|
379
379
|
console.log(classNames); // ['class1', 'class2', 'class3']
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
-
[View file →](src/libs/get/
|
|
382
|
+
[View file →](src/libs/get/get-class-names.ts)
|
|
383
383
|
|
|
384
384
|
### getDocumentHeight
|
|
385
385
|
|
|
@@ -392,7 +392,7 @@ const height = getDocumentHeight();
|
|
|
392
392
|
console.log(height);
|
|
393
393
|
```
|
|
394
394
|
|
|
395
|
-
[View file →](src/libs/get/
|
|
395
|
+
[View file →](src/libs/get/get-document-height.ts)
|
|
396
396
|
|
|
397
397
|
### getEventPaths
|
|
398
398
|
|
|
@@ -407,7 +407,7 @@ document.addEventListener("click", (event) => {
|
|
|
407
407
|
});
|
|
408
408
|
```
|
|
409
409
|
|
|
410
|
-
[View file →](src/libs/get/
|
|
410
|
+
[View file →](src/libs/get/get-event-paths.ts)
|
|
411
411
|
|
|
412
412
|
### getGcd
|
|
413
413
|
|
|
@@ -420,7 +420,7 @@ const gcd = getGcd(48, 18);
|
|
|
420
420
|
console.log(gcd); // 6
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
-
[View file →](src/libs/get/
|
|
423
|
+
[View file →](src/libs/get/get-gcd.ts)
|
|
424
424
|
|
|
425
425
|
### getGravatarUrl
|
|
426
426
|
|
|
@@ -441,7 +441,7 @@ const normalizedAvatar = getGravatarUrl(' USER@EXAMPLE.COM ', 80);
|
|
|
441
441
|
// Same result as above due to normalization
|
|
442
442
|
```
|
|
443
443
|
|
|
444
|
-
[View file →](src/libs/get/
|
|
444
|
+
[View file →](src/libs/get/get-gravatar-url.ts)
|
|
445
445
|
|
|
446
446
|
### getOrientation
|
|
447
447
|
|
|
@@ -454,7 +454,7 @@ const orientation = getOrientation();
|
|
|
454
454
|
console.log(orientation); // 'landscape' or 'portrait'
|
|
455
455
|
```
|
|
456
456
|
|
|
457
|
-
[View file →](src/libs/get/
|
|
457
|
+
[View file →](src/libs/get/get-orientation.ts)
|
|
458
458
|
|
|
459
459
|
### getParentList
|
|
460
460
|
|
|
@@ -468,7 +468,7 @@ const parentList = getParentList(element);
|
|
|
468
468
|
console.log(parentList);
|
|
469
469
|
```
|
|
470
470
|
|
|
471
|
-
[View file →](src/libs/get/
|
|
471
|
+
[View file →](src/libs/get/get-parent-list.ts)
|
|
472
472
|
|
|
473
473
|
### getQueryParams
|
|
474
474
|
|
|
@@ -495,7 +495,7 @@ const customParamWithOptions = getQueryParams("id", {
|
|
|
495
495
|
});
|
|
496
496
|
```
|
|
497
497
|
|
|
498
|
-
[View file →](src/libs/get/
|
|
498
|
+
[View file →](src/libs/get/get-query-params.ts)
|
|
499
499
|
|
|
500
500
|
### getRem
|
|
501
501
|
|
|
@@ -508,7 +508,7 @@ const remValue = getRem(16);
|
|
|
508
508
|
console.log(remValue); // '1rem'
|
|
509
509
|
```
|
|
510
510
|
|
|
511
|
-
[View file →](src/libs/get/
|
|
511
|
+
[View file →](src/libs/get/get-rem.ts)
|
|
512
512
|
|
|
513
513
|
### getScrollbarWidth
|
|
514
514
|
|
|
@@ -521,7 +521,7 @@ const scrollbarWidth = getScrollbarWidth();
|
|
|
521
521
|
console.log(scrollbarWidth); // 15
|
|
522
522
|
```
|
|
523
523
|
|
|
524
|
-
[View file →](src/libs/get/
|
|
524
|
+
[View file →](src/libs/get/get-scrollbar-width.ts)
|
|
525
525
|
|
|
526
526
|
### getSessionStorage
|
|
527
527
|
|
|
@@ -534,7 +534,7 @@ const value = getSessionStorage("testKey");
|
|
|
534
534
|
console.log(value); // 'testValue'
|
|
535
535
|
```
|
|
536
536
|
|
|
537
|
-
[View file →](src/libs/get/
|
|
537
|
+
[View file →](src/libs/get/get-session-storage.ts)
|
|
538
538
|
|
|
539
539
|
### getStringLength
|
|
540
540
|
|
|
@@ -547,7 +547,7 @@ const length = getStringLength("こんにちは");
|
|
|
547
547
|
console.log(length); // 5
|
|
548
548
|
```
|
|
549
549
|
|
|
550
|
-
[View file →](src/libs/get/
|
|
550
|
+
[View file →](src/libs/get/get-string-length.ts)
|
|
551
551
|
|
|
552
552
|
### getStylePropertyValue
|
|
553
553
|
|
|
@@ -560,7 +560,7 @@ const value = getStylePropertyValue("--custom-property");
|
|
|
560
560
|
console.log(value);
|
|
561
561
|
```
|
|
562
562
|
|
|
563
|
-
[View file →](src/libs/get/
|
|
563
|
+
[View file →](src/libs/get/get-style-property-value.ts)
|
|
564
564
|
|
|
565
565
|
### getStylePropertyValueToNumber
|
|
566
566
|
|
|
@@ -573,7 +573,7 @@ const value = getStylePropertyValueToNumber("--custom-property");
|
|
|
573
573
|
console.log(value);
|
|
574
574
|
```
|
|
575
575
|
|
|
576
|
-
[View file →](src/libs/get/
|
|
576
|
+
[View file →](src/libs/get/get-style-property-value-to-number.ts)
|
|
577
577
|
|
|
578
578
|
### getUaData
|
|
579
579
|
|
|
@@ -594,7 +594,7 @@ console.log(uaData);
|
|
|
594
594
|
// }
|
|
595
595
|
```
|
|
596
596
|
|
|
597
|
-
[View file →](src/libs/get/
|
|
597
|
+
[View file →](src/libs/get/get-ua-data.ts)
|
|
598
598
|
|
|
599
599
|
## Is
|
|
600
600
|
|
|
@@ -616,7 +616,7 @@ const customCurrentDate = "2023-11-15";
|
|
|
616
616
|
const resultWithCustomDate = isAfterDateTime(targetDate, dayjs(customCurrentDate));
|
|
617
617
|
```
|
|
618
618
|
|
|
619
|
-
[View file →](src/libs/is/
|
|
619
|
+
[View file →](src/libs/is/is-after-date-time.ts)
|
|
620
620
|
|
|
621
621
|
### isBetweenDateTime
|
|
622
622
|
|
|
@@ -631,7 +631,7 @@ const result = isBetweenDateTime(dateA, dateB);
|
|
|
631
631
|
console.log(result); // true or false
|
|
632
632
|
```
|
|
633
633
|
|
|
634
|
-
[View file →](src/libs/is/
|
|
634
|
+
[View file →](src/libs/is/is-between-date-time.ts)
|
|
635
635
|
|
|
636
636
|
### isExistAllElements
|
|
637
637
|
|
|
@@ -648,7 +648,7 @@ const result = isExistAllElements(elements);
|
|
|
648
648
|
console.log(result); // true or false
|
|
649
649
|
```
|
|
650
650
|
|
|
651
|
-
[View file →](src/libs/is/
|
|
651
|
+
[View file →](src/libs/is/is-exist-all-elements.ts)
|
|
652
652
|
|
|
653
653
|
### isIpad
|
|
654
654
|
|
|
@@ -661,7 +661,7 @@ const result = isIpad();
|
|
|
661
661
|
console.log(result); // true or false
|
|
662
662
|
```
|
|
663
663
|
|
|
664
|
-
[View file →](src/libs/is/
|
|
664
|
+
[View file →](src/libs/is/is-ipad.ts)
|
|
665
665
|
|
|
666
666
|
### isKeyExists
|
|
667
667
|
|
|
@@ -675,7 +675,7 @@ const result = isKeyExists(obj, "a");
|
|
|
675
675
|
console.log(result); // true or false
|
|
676
676
|
```
|
|
677
677
|
|
|
678
|
-
[View file →](src/libs/is/
|
|
678
|
+
[View file →](src/libs/is/is-key-exists.ts)
|
|
679
679
|
|
|
680
680
|
### isSafari
|
|
681
681
|
|
|
@@ -688,7 +688,7 @@ const result = isSafari();
|
|
|
688
688
|
console.log(result); // true or false
|
|
689
689
|
```
|
|
690
690
|
|
|
691
|
-
[View file →](src/libs/is/
|
|
691
|
+
[View file →](src/libs/is/is-safari.ts)
|
|
692
692
|
|
|
693
693
|
### isScrollable
|
|
694
694
|
|
|
@@ -704,7 +704,7 @@ const result = isScrollable(element);
|
|
|
704
704
|
console.log(result); // true or false
|
|
705
705
|
```
|
|
706
706
|
|
|
707
|
-
[View file →](src/libs/is/
|
|
707
|
+
[View file →](src/libs/is/is-scrollable.ts)
|
|
708
708
|
|
|
709
709
|
### isTouchSupport
|
|
710
710
|
|
|
@@ -717,7 +717,7 @@ const result = isTouchSupport();
|
|
|
717
717
|
console.log(result); // true or false
|
|
718
718
|
```
|
|
719
719
|
|
|
720
|
-
[View file →](src/libs/is/
|
|
720
|
+
[View file →](src/libs/is/is-touch-support.ts)
|
|
721
721
|
|
|
722
722
|
### checkDeviceSize
|
|
723
723
|
|
|
@@ -736,7 +736,7 @@ const newDeviceSize = checkDeviceSize();
|
|
|
736
736
|
console.log(newDeviceSize); // 'md' if window.innerWidth > 1024, otherwise 'sm'
|
|
737
737
|
```
|
|
738
738
|
|
|
739
|
-
[View file →](src/libs/is/
|
|
739
|
+
[View file →](src/libs/is/check-device-size.ts)
|
|
740
740
|
|
|
741
741
|
## Remove
|
|
742
742
|
|
|
@@ -752,7 +752,7 @@ const output = removeAllHtmlTags(input);
|
|
|
752
752
|
console.log(output); // 'Hello World!'
|
|
753
753
|
```
|
|
754
754
|
|
|
755
|
-
[View file →](src/libs/remove/
|
|
755
|
+
[View file →](src/libs/remove/remove-all-html-tags.ts)
|
|
756
756
|
|
|
757
757
|
### removeAttribute
|
|
758
758
|
|
|
@@ -767,7 +767,7 @@ removeAttribute(element, "data-test");
|
|
|
767
767
|
console.log(element.hasAttribute("data-test")); // false
|
|
768
768
|
```
|
|
769
769
|
|
|
770
|
-
[View file →](src/libs/remove/
|
|
770
|
+
[View file →](src/libs/remove/remove-attribute.ts)
|
|
771
771
|
|
|
772
772
|
### removeSessionStorage
|
|
773
773
|
|
|
@@ -781,7 +781,7 @@ removeSessionStorage(key);
|
|
|
781
781
|
console.log(sessionStorage.getItem(key)); // null
|
|
782
782
|
```
|
|
783
783
|
|
|
784
|
-
[View file →](src/libs/remove/
|
|
784
|
+
[View file →](src/libs/remove/remove-session-storage.ts)
|
|
785
785
|
|
|
786
786
|
### removeStylePropertyValue
|
|
787
787
|
|
|
@@ -795,7 +795,7 @@ removeStylePropertyValue(key);
|
|
|
795
795
|
console.log(getComputedStyle(document.documentElement).getPropertyValue(key)); // ''
|
|
796
796
|
```
|
|
797
797
|
|
|
798
|
-
[View file →](src/libs/remove/
|
|
798
|
+
[View file →](src/libs/remove/remove-style-property-value.ts)
|
|
799
799
|
|
|
800
800
|
## Set
|
|
801
801
|
|
|
@@ -809,7 +809,7 @@ import { set100vh } from "umaki";
|
|
|
809
809
|
set100vh();
|
|
810
810
|
```
|
|
811
811
|
|
|
812
|
-
[View file →](src/libs/set/
|
|
812
|
+
[View file →](src/libs/set/set-100vh.ts)
|
|
813
813
|
|
|
814
814
|
### set100vw
|
|
815
815
|
|
|
@@ -821,7 +821,7 @@ import { set100vw } from "umaki";
|
|
|
821
821
|
set100vw();
|
|
822
822
|
```
|
|
823
823
|
|
|
824
|
-
[View file →](src/libs/set/
|
|
824
|
+
[View file →](src/libs/set/set-100vw.ts)
|
|
825
825
|
|
|
826
826
|
### setAttribute
|
|
827
827
|
|
|
@@ -835,7 +835,7 @@ setAttribute(element, "data-test", "value");
|
|
|
835
835
|
console.log(element.getAttribute("data-test")); // 'value'
|
|
836
836
|
```
|
|
837
837
|
|
|
838
|
-
[View file →](src/libs/set/
|
|
838
|
+
[View file →](src/libs/set/set-attribute.ts)
|
|
839
839
|
|
|
840
840
|
### setScrollPositionToCenter
|
|
841
841
|
|
|
@@ -849,7 +849,7 @@ const targetElement = document.getElementById("target");
|
|
|
849
849
|
setScrollPositionToCenter(rootElement, targetElement);
|
|
850
850
|
```
|
|
851
851
|
|
|
852
|
-
[View file →](src/libs/set/
|
|
852
|
+
[View file →](src/libs/set/set-scroll-position-to-center.ts)
|
|
853
853
|
|
|
854
854
|
### setSessionStorage
|
|
855
855
|
|
|
@@ -864,7 +864,7 @@ setSessionStorage(key, value);
|
|
|
864
864
|
console.log(sessionStorage.getItem(key)); // 'testValue'
|
|
865
865
|
```
|
|
866
866
|
|
|
867
|
-
[View file →](src/libs/set/
|
|
867
|
+
[View file →](src/libs/set/set-session-storage.ts)
|
|
868
868
|
|
|
869
869
|
### setStylePropertyValue
|
|
870
870
|
|
|
@@ -879,7 +879,7 @@ setStylePropertyValue(key, value);
|
|
|
879
879
|
console.log(getComputedStyle(document.documentElement).getPropertyValue(key)); // 'blue'
|
|
880
880
|
```
|
|
881
881
|
|
|
882
|
-
[View file →](src/libs/set/
|
|
882
|
+
[View file →](src/libs/set/set-style-property-value.ts)
|
|
883
883
|
|
|
884
884
|
## To
|
|
885
885
|
|
|
@@ -895,7 +895,7 @@ console.log(toBoolean("false")); // false
|
|
|
895
895
|
console.log(toBoolean("random")); // false
|
|
896
896
|
```
|
|
897
897
|
|
|
898
|
-
[View file →](src/libs/to/
|
|
898
|
+
[View file →](src/libs/to/to-boolean.ts)
|
|
899
899
|
|
|
900
900
|
### toPositiveNumber
|
|
901
901
|
|
|
@@ -911,7 +911,7 @@ console.log(toPositiveNumber(-3.14)); // 3.14
|
|
|
911
911
|
console.log(toPositiveNumber(3.14)); // 3.14
|
|
912
912
|
```
|
|
913
913
|
|
|
914
|
-
[View file →](src/libs/to/
|
|
914
|
+
[View file →](src/libs/to/to-positive-number.ts)
|
|
915
915
|
|
|
916
916
|
## Transform
|
|
917
917
|
|
|
@@ -928,7 +928,7 @@ wrapTextWithSpans(element);
|
|
|
928
928
|
console.log(element.innerHTML); // '<span>h</span><span>e</span><span>l</span><span>l</span><span>o</span>'
|
|
929
929
|
```
|
|
930
930
|
|
|
931
|
-
[View file →](src/libs/transform/
|
|
931
|
+
[View file →](src/libs/transform/wrap-text-with-spans.ts)
|
|
932
932
|
|
|
933
933
|
## Wait
|
|
934
934
|
|
|
@@ -963,7 +963,7 @@ import { waitForAllMediaLoaded } from "umaki";
|
|
|
963
963
|
})();
|
|
964
964
|
```
|
|
965
965
|
|
|
966
|
-
[View file →](src/libs/wait/
|
|
966
|
+
[View file →](src/libs/wait/wait-for-all-media-loaded.ts)
|
|
967
967
|
|
|
968
968
|
## Security
|
|
969
969
|
|
|
@@ -992,7 +992,7 @@ This function uses `isomorphic-dompurify` and has the following features:
|
|
|
992
992
|
- Allows flexible control through custom configuration
|
|
993
993
|
- Can be used on both server-side and client-side
|
|
994
994
|
|
|
995
|
-
[View file →](src/libs/security/
|
|
995
|
+
[View file →](src/libs/security/html-sanitize.ts)
|
|
996
996
|
|
|
997
997
|
## Advanced Usage
|
|
998
998
|
|