@e1011/es-kit 1.1.86 → 1.2.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 (38) hide show
  1. package/dist/hooks/esm/index.css +233 -233
  2. package/dist/hooks/esm/src/core/hooks/index.js +1 -1
  3. package/dist/hooks/esm/src/core/hooks/useThemePreference.js +1 -1
  4. package/dist/hooks/esm/src/core/hooks/useThemePreference.js.map +1 -1
  5. package/dist/hooks/esm/src/core/utils/helpers/ui.js +1 -1
  6. package/dist/hooks/esm/src/core/utils/helpers/ui.js.map +1 -1
  7. package/dist/hooks/index.css +233 -233
  8. package/dist/hooks/src/core/hooks/index.js +1 -1
  9. package/dist/hooks/src/core/hooks/useThemePreference.js +1 -1
  10. package/dist/hooks/src/core/hooks/useThemePreference.js.map +1 -1
  11. package/dist/hooks/src/core/utils/helpers/ui.js +1 -1
  12. package/dist/hooks/src/core/utils/helpers/ui.js.map +1 -1
  13. package/dist/lib/cjs/src/core/hooks/useThemePreference.js +1 -1
  14. package/dist/lib/cjs/src/core/hooks/useThemePreference.js.map +1 -1
  15. package/dist/lib/cjs/src/core/utils/helpers/ui.js +1 -1
  16. package/dist/lib/cjs/src/core/utils/helpers/ui.js.map +1 -1
  17. package/dist/lib/cjs/src/index.js +1 -1
  18. package/dist/lib/esm/src/core/hooks/useThemePreference.js +1 -1
  19. package/dist/lib/esm/src/core/hooks/useThemePreference.js.map +1 -1
  20. package/dist/lib/esm/src/core/utils/helpers/ui.js +1 -1
  21. package/dist/lib/esm/src/core/utils/helpers/ui.js.map +1 -1
  22. package/dist/lib/esm/src/index.js +1 -1
  23. package/dist/lib/tsconfig.tsbuildinfo +1 -1
  24. package/dist/types/src/core/hooks/useThemePreference.d.ts +0 -41
  25. package/dist/types/src/core/hooks/useThemePreference.d.ts.map +1 -1
  26. package/dist/types/src/core/utils/helpers/ui.d.ts +40 -0
  27. package/dist/types/src/core/utils/helpers/ui.d.ts.map +1 -1
  28. package/dist/ui/esm/src/core/utils/helpers/ui.js.map +1 -1
  29. package/dist/ui/src/core/utils/helpers/ui.js.map +1 -1
  30. package/dist/utils/esm/index.css +233 -233
  31. package/dist/utils/esm/src/core/utils/helpers/ui.js +1 -1
  32. package/dist/utils/esm/src/core/utils/helpers/ui.js.map +1 -1
  33. package/dist/utils/esm/src/core/utils/index.js +1 -1
  34. package/dist/utils/index.css +233 -233
  35. package/dist/utils/src/core/utils/helpers/ui.js +1 -1
  36. package/dist/utils/src/core/utils/helpers/ui.js.map +1 -1
  37. package/dist/utils/src/core/utils/index.js +1 -1
  38. package/package.json +4 -3
@@ -1,3 +1,12 @@
1
+ .errorBoundary-module_errorBoundary__gk9ps {
2
+ background: #EFEFEF;
3
+ width: 100%;
4
+ height: 100%;
5
+ }
6
+
7
+ .errorBoundary-module_StyledIcon__IYHiU {
8
+ margin-right: 10px;
9
+ }
1
10
  .icon-module_icon-base-parent__nOMvW {
2
11
  line-height: 1px !important;
3
12
  }
@@ -28,15 +37,6 @@
28
37
  width: var(--height);
29
38
  height: var(--width);
30
39
  }
31
- .errorBoundary-module_errorBoundary__gk9ps {
32
- background: #EFEFEF;
33
- width: 100%;
34
- height: 100%;
35
- }
36
-
37
- .errorBoundary-module_StyledIcon__IYHiU {
38
- margin-right: 10px;
39
- }
40
40
  .CollapsibleContainer-module_collapsible-container__u0Jmm {
41
41
  transform-origin: 0% 0%;
42
42
  opacity: 0;
@@ -70,6 +70,25 @@
70
70
  max-width: var(--prop-value);
71
71
  opacity: 1;
72
72
  }
73
+ .divider-module_divider-line__6CesR {
74
+ position: relative;
75
+ display: block;
76
+ transition: opacity, width, height 250ms ease-in-out;
77
+ background-color: var(--color);
78
+ opacity: var(--opacity);
79
+ }
80
+ .divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
81
+ height: var(--length);
82
+ left: var(--left);
83
+ width: var(--width);
84
+ margin: var(--margin);
85
+ }
86
+ .divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
87
+ width: var(--length);
88
+ left: var(--left);
89
+ height: var(--height);
90
+ margin: var(--margin);
91
+ }
73
92
  .field-module_field__UfKm3 {
74
93
  opacity: 1;
75
94
  pointer-events: auto;
@@ -144,25 +163,6 @@
144
163
  .field-module_field__UfKm3 label {
145
164
  text-align: left;
146
165
  }
147
- .divider-module_divider-line__6CesR {
148
- position: relative;
149
- display: block;
150
- transition: opacity, width, height 250ms ease-in-out;
151
- background-color: var(--color);
152
- opacity: var(--opacity);
153
- }
154
- .divider-module_divider-line__6CesR.divider-module_vertical__qSVWD {
155
- height: var(--length);
156
- left: var(--left);
157
- width: var(--width);
158
- margin: var(--margin);
159
- }
160
- .divider-module_divider-line__6CesR.divider-module_horizontal__Gz-Oj {
161
- width: var(--length);
162
- left: var(--left);
163
- height: var(--height);
164
- margin: var(--margin);
165
- }
166
166
  .layoutBox-module_layout-box__ZIID8 {
167
167
  display: flex;
168
168
  position: relative;
@@ -230,6 +230,42 @@
230
230
  stroke-dashoffset: -124;
231
231
  }
232
232
  }
233
+ .flowLayout-module_flowLayout__VHpnY {
234
+ overflow: auto;
235
+ }
236
+ .flowLayout-module_flowLayout__VHpnY .flowLayout-module_beforeContent__rY-mW {
237
+ display: flex;
238
+ width: 100%;
239
+ min-width: 0;
240
+ }
241
+ .flowLayout-module_flowLayout__VHpnY .flowLayout-module_afterContent__Hlh8v {
242
+ display: flex;
243
+ width: 100%;
244
+ min-width: 0;
245
+ }
246
+ .popup-overlay-module_popup-modal-overlay__dlJqM {
247
+ z-index: 1;
248
+ position: fixed;
249
+ width: 100%;
250
+ height: 100%;
251
+ top: 0;
252
+ left: 0;
253
+ background: rgba(40, 80, 120, 0.8) !important;
254
+ pointer-events: all;
255
+ user-select: none;
256
+ will-change: opacity;
257
+ transition: opacity 450ms ease-in-out;
258
+ opacity: 0;
259
+ visibility: hidden;
260
+ }
261
+ .popup-overlay-module_popup-modal-overlay__dlJqM[data-show] {
262
+ opacity: 1;
263
+ visibility: visible;
264
+ }
265
+ .popup-overlay-module_popup-modal-overlay__dlJqM[data-show=false] {
266
+ opacity: 0;
267
+ visibility: hidden;
268
+ }
233
269
  :root {
234
270
  --divider-line: #4a4b4b;
235
271
  }
@@ -444,6 +480,72 @@
444
480
  --divider-line: #4a4b4b;
445
481
  }
446
482
 
483
+ .typography-module_overflow-hidden__UmQ-v, .typography-module_text-truncate__8MgV9 {
484
+ overflow: hidden !important;
485
+ }
486
+
487
+ .typography-module_text-nowrap__dt3uu, .typography-module_text-truncate__8MgV9 {
488
+ white-space: nowrap !important;
489
+ }
490
+
491
+ .typography-module_text-ellipsis__iyHeZ, .typography-module_text-truncate__8MgV9 {
492
+ text-overflow: ellipsis !important;
493
+ }
494
+
495
+ .typography-module_headline__b0XlP {
496
+ font-size: 28px;
497
+ line-height: 32px;
498
+ }
499
+
500
+ .typography-module_headlineSecondary__IDnhT {
501
+ font-size: 24px;
502
+ line-height: 28px;
503
+ }
504
+
505
+ .typography-module_headlineTertiary__mlG-v {
506
+ font-size: 18px;
507
+ line-height: 24x;
508
+ }
509
+
510
+ .typography-module_paragraph__tgBAx, .typography-module_paragraphBold__PmcZU, .typography-module_paragraphBoldSmall__qExmY, .typography-module_paragraphSmall__vTMiI {
511
+ font-size: 14px;
512
+ line-height: 18px;
513
+ font-weight: 300;
514
+ }
515
+
516
+ .typography-module_paragraphSmall__vTMiI, .typography-module_paragraphBoldSmall__qExmY {
517
+ font-size: 12px;
518
+ }
519
+
520
+ .typography-module_paragraphBold__PmcZU, .typography-module_paragraphBoldSmall__qExmY {
521
+ font-weight: 600;
522
+ }
523
+
524
+ .typography-module_link__DWurf {
525
+ overflow: hidden !important;
526
+ white-space: nowrap !important;
527
+ text-overflow: ellipsis !important;
528
+ text-decoration: none;
529
+ color: #65C5F6;
530
+ display: inline;
531
+ gap: 4px;
532
+ flex-grow: 0;
533
+ max-width: 400px;
534
+ position: relative;
535
+ vertical-align: center;
536
+ }
537
+ .typography-module_link__DWurf:hover:not(.typography-module_disabled__hjK8C) {
538
+ text-decoration: underline;
539
+ color: #65C5F6;
540
+ }
541
+ .typography-module_link__DWurf.typography-module_disabled__hjK8C {
542
+ pointer-events: none;
543
+ opacity: 0.6;
544
+ }
545
+ :root {
546
+ --divider-line: #4a4b4b;
547
+ }
548
+
447
549
  .button-module_overflow-hidden__Vc5AU, .button-module_text-truncate__a89Bp {
448
550
  overflow: hidden !important;
449
551
  }
@@ -570,41 +672,117 @@
570
672
  .cui-theme-light .button-module_button__NDMQS {
571
673
  color: #090A0A;
572
674
  }
573
- .flowLayout-module_flowLayout__VHpnY {
574
- overflow: auto;
675
+ .textAndContent-module_textAndContent__X5P1n {
676
+ align-items: baseline;
677
+ flex-shrink: 1;
678
+ gap: 8px;
575
679
  }
576
- .flowLayout-module_flowLayout__VHpnY .flowLayout-module_beforeContent__rY-mW {
577
- display: flex;
578
- width: 100%;
579
- min-width: 0;
680
+ :root {
681
+ --divider-line: #4a4b4b;
580
682
  }
581
- .flowLayout-module_flowLayout__VHpnY .flowLayout-module_afterContent__Hlh8v {
582
- display: flex;
583
- width: 100%;
584
- min-width: 0;
683
+
684
+ .toggle-module_overflow-hidden__NxfFx, .toggle-module_text-truncate__Wg-Jx {
685
+ overflow: hidden !important;
585
686
  }
586
- .popup-overlay-module_popup-modal-overlay__dlJqM {
587
- z-index: 1;
588
- position: fixed;
589
- width: 100%;
687
+
688
+ .toggle-module_text-nowrap__F9ld6, .toggle-module_text-truncate__Wg-Jx {
689
+ white-space: nowrap !important;
690
+ }
691
+
692
+ .toggle-module_text-ellipsis__ftYlg, .toggle-module_text-truncate__Wg-Jx {
693
+ text-overflow: ellipsis !important;
694
+ }
695
+
696
+ .toggle-module_toggle__p1Ep4 {
697
+ display: inline-block;
698
+ position: relative;
699
+ max-width: 48px;
700
+ max-height: 24px;
701
+ width: 48px;
702
+ height: 24px;
703
+ border-radius: 16px !important;
704
+ }
705
+ .toggle-module_toggle__p1Ep4 input {
706
+ opacity: 0;
707
+ width: 0;
708
+ height: 0;
709
+ }
710
+ .toggle-module_toggle__p1Ep4 .toggle-module_slider__2IVaG {
711
+ box-sizing: border-box;
712
+ position: absolute;
713
+ cursor: pointer;
714
+ width: 48px;
715
+ height: 24px;
716
+ top: 0;
717
+ left: 0;
718
+ right: 0;
719
+ bottom: 0;
720
+ background-color: transparent;
721
+ border: 1px solid #F4F4F4;
722
+ transition: transform, background-color 0.4s ease;
723
+ border-radius: 16px;
724
+ }
725
+ .toggle-module_toggle__p1Ep4 .toggle-module_slider__2IVaG:before {
726
+ position: absolute;
727
+ content: "";
728
+ height: 20px;
729
+ width: 20px;
730
+ left: 1px;
731
+ bottom: 1px;
732
+ background-color: #F4F4F4;
733
+ transition: transform 0.4s ease;
734
+ border-radius: 50%;
735
+ }
736
+ .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG {
737
+ background-color: #282A2A;
738
+ border-color: #282A2A;
739
+ }
740
+ .toggle-module_toggle__p1Ep4 input:focus + .toggle-module_slider__2IVaG {
741
+ box-shadow: 0 0 1px 1px #282A2A;
742
+ }
743
+ .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:before {
744
+ transform: translateX(24px);
745
+ }
746
+ .toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH {
747
+ opacity: 0.65;
748
+ }
749
+ .toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH input {
750
+ pointer-events: none;
751
+ }
752
+ .toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH .toggle-module_slider__2IVaG {
753
+ cursor: not-allowed;
754
+ }
755
+ .toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH .toggle-module_slider__2IVaG:after {
756
+ content: " ";
757
+ z-index: -1;
758
+ display: block;
759
+ position: absolute;
590
760
  height: 100%;
591
761
  top: 0;
592
762
  left: 0;
593
- background: rgba(40, 80, 120, 0.8) !important;
594
- pointer-events: all;
595
- user-select: none;
596
- will-change: opacity;
597
- transition: opacity 450ms ease-in-out;
598
- opacity: 0;
599
- visibility: hidden;
763
+ right: 0;
600
764
  }
601
- .popup-overlay-module_popup-modal-overlay__dlJqM[data-show] {
602
- opacity: 1;
603
- visibility: visible;
765
+
766
+ .cui-theme-dark .toggle-module_toggle__p1Ep4 input:enabled + .toggle-module_slider__2IVaG:hover {
767
+ background-color: #003A4C;
604
768
  }
605
- .popup-overlay-module_popup-modal-overlay__dlJqM[data-show=false] {
606
- opacity: 0;
607
- visibility: hidden;
769
+ .cui-theme-dark .toggle-module_toggle__p1Ep4 input:checked:enabled + .toggle-module_slider__2IVaG:hover {
770
+ background-color: rgb(38.0475, 39.8525, 39.8525);
771
+ }
772
+ .cui-theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG {
773
+ border-color: rgb(32.4, 41.4, 41.4);
774
+ }
775
+ .cui-theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG:hover {
776
+ background-color: rgba(40, 42, 42, 0.05);
777
+ }
778
+ .cui-theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG:before {
779
+ background-color: #282A2A;
780
+ }
781
+ .cui-theme-light .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:before {
782
+ background-color: #F4F4F4;
783
+ }
784
+ .cui-theme-light .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:hover {
785
+ background-color: rgb(54.7902439024, 70.0097560976, 70.0097560976);
608
786
  }
609
787
  :root {
610
788
  --divider-line: #4a4b4b;
@@ -770,184 +948,6 @@
770
948
  border-color: #FD8F3E;
771
949
  color: #632E03;
772
950
  }
773
- .textAndContent-module_textAndContent__X5P1n {
774
- align-items: baseline;
775
- flex-shrink: 1;
776
- gap: 8px;
777
- }
778
- :root {
779
- --divider-line: #4a4b4b;
780
- }
781
-
782
- .typography-module_overflow-hidden__UmQ-v, .typography-module_text-truncate__8MgV9 {
783
- overflow: hidden !important;
784
- }
785
-
786
- .typography-module_text-nowrap__dt3uu, .typography-module_text-truncate__8MgV9 {
787
- white-space: nowrap !important;
788
- }
789
-
790
- .typography-module_text-ellipsis__iyHeZ, .typography-module_text-truncate__8MgV9 {
791
- text-overflow: ellipsis !important;
792
- }
793
-
794
- .typography-module_headline__b0XlP {
795
- font-size: 28px;
796
- line-height: 32px;
797
- }
798
-
799
- .typography-module_headlineSecondary__IDnhT {
800
- font-size: 24px;
801
- line-height: 28px;
802
- }
803
-
804
- .typography-module_headlineTertiary__mlG-v {
805
- font-size: 18px;
806
- line-height: 24x;
807
- }
808
-
809
- .typography-module_paragraph__tgBAx, .typography-module_paragraphBold__PmcZU, .typography-module_paragraphBoldSmall__qExmY, .typography-module_paragraphSmall__vTMiI {
810
- font-size: 14px;
811
- line-height: 18px;
812
- font-weight: 300;
813
- }
814
-
815
- .typography-module_paragraphSmall__vTMiI, .typography-module_paragraphBoldSmall__qExmY {
816
- font-size: 12px;
817
- }
818
-
819
- .typography-module_paragraphBold__PmcZU, .typography-module_paragraphBoldSmall__qExmY {
820
- font-weight: 600;
821
- }
822
-
823
- .typography-module_link__DWurf {
824
- overflow: hidden !important;
825
- white-space: nowrap !important;
826
- text-overflow: ellipsis !important;
827
- text-decoration: none;
828
- color: #65C5F6;
829
- display: inline;
830
- gap: 4px;
831
- flex-grow: 0;
832
- max-width: 400px;
833
- position: relative;
834
- vertical-align: center;
835
- }
836
- .typography-module_link__DWurf:hover:not(.typography-module_disabled__hjK8C) {
837
- text-decoration: underline;
838
- color: #65C5F6;
839
- }
840
- .typography-module_link__DWurf.typography-module_disabled__hjK8C {
841
- pointer-events: none;
842
- opacity: 0.6;
843
- }
844
- :root {
845
- --divider-line: #4a4b4b;
846
- }
847
-
848
- .toggle-module_overflow-hidden__NxfFx, .toggle-module_text-truncate__Wg-Jx {
849
- overflow: hidden !important;
850
- }
851
-
852
- .toggle-module_text-nowrap__F9ld6, .toggle-module_text-truncate__Wg-Jx {
853
- white-space: nowrap !important;
854
- }
855
-
856
- .toggle-module_text-ellipsis__ftYlg, .toggle-module_text-truncate__Wg-Jx {
857
- text-overflow: ellipsis !important;
858
- }
859
-
860
- .toggle-module_toggle__p1Ep4 {
861
- display: inline-block;
862
- position: relative;
863
- max-width: 48px;
864
- max-height: 24px;
865
- width: 48px;
866
- height: 24px;
867
- border-radius: 16px !important;
868
- }
869
- .toggle-module_toggle__p1Ep4 input {
870
- opacity: 0;
871
- width: 0;
872
- height: 0;
873
- }
874
- .toggle-module_toggle__p1Ep4 .toggle-module_slider__2IVaG {
875
- box-sizing: border-box;
876
- position: absolute;
877
- cursor: pointer;
878
- width: 48px;
879
- height: 24px;
880
- top: 0;
881
- left: 0;
882
- right: 0;
883
- bottom: 0;
884
- background-color: transparent;
885
- border: 1px solid #F4F4F4;
886
- transition: transform, background-color 0.4s ease;
887
- border-radius: 16px;
888
- }
889
- .toggle-module_toggle__p1Ep4 .toggle-module_slider__2IVaG:before {
890
- position: absolute;
891
- content: "";
892
- height: 20px;
893
- width: 20px;
894
- left: 1px;
895
- bottom: 1px;
896
- background-color: #F4F4F4;
897
- transition: transform 0.4s ease;
898
- border-radius: 50%;
899
- }
900
- .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG {
901
- background-color: #282A2A;
902
- border-color: #282A2A;
903
- }
904
- .toggle-module_toggle__p1Ep4 input:focus + .toggle-module_slider__2IVaG {
905
- box-shadow: 0 0 1px 1px #282A2A;
906
- }
907
- .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:before {
908
- transform: translateX(24px);
909
- }
910
- .toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH {
911
- opacity: 0.65;
912
- }
913
- .toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH input {
914
- pointer-events: none;
915
- }
916
- .toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH .toggle-module_slider__2IVaG {
917
- cursor: not-allowed;
918
- }
919
- .toggle-module_toggle__p1Ep4.toggle-module_disabled__0nElH .toggle-module_slider__2IVaG:after {
920
- content: " ";
921
- z-index: -1;
922
- display: block;
923
- position: absolute;
924
- height: 100%;
925
- top: 0;
926
- left: 0;
927
- right: 0;
928
- }
929
-
930
- .cui-theme-dark .toggle-module_toggle__p1Ep4 input:enabled + .toggle-module_slider__2IVaG:hover {
931
- background-color: #003A4C;
932
- }
933
- .cui-theme-dark .toggle-module_toggle__p1Ep4 input:checked:enabled + .toggle-module_slider__2IVaG:hover {
934
- background-color: rgb(38.0475, 39.8525, 39.8525);
935
- }
936
- .cui-theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG {
937
- border-color: rgb(32.4, 41.4, 41.4);
938
- }
939
- .cui-theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG:hover {
940
- background-color: rgba(40, 42, 42, 0.05);
941
- }
942
- .cui-theme-light .toggle-module_toggle__p1Ep4 input + .toggle-module_slider__2IVaG:before {
943
- background-color: #282A2A;
944
- }
945
- .cui-theme-light .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:before {
946
- background-color: #F4F4F4;
947
- }
948
- .cui-theme-light .toggle-module_toggle__p1Ep4 input:checked + .toggle-module_slider__2IVaG:hover {
949
- background-color: rgb(54.7902439024, 70.0097560976, 70.0097560976);
950
- }
951
951
  :root {
952
952
  --divider-line: #4a4b4b;
953
953
  }
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./useApi.js"),s=require("./useToggle.js"),r=require("./useToggle2.js"),u=require("./useOutsideClick.js"),o=require("./useResize.js"),t=require("./useClassNames.js"),i=require("./useParseProps.js"),p=require("./useThemePreference.js"),m=require("./useAnimation.js"),a=require("./useIntersectionObserver.js"),l=require("./useSetTimeout.js");exports.useApi=e.useApi,exports.useToggle=s.useToggle,exports.useToggle2=r.useToggle2,exports.outsideClickHandler=u.outsideClickHandler,exports.useOutsideClick=u.useOutsideClick,exports.useResize=o.useResize,exports.useClassNames=t.useClassNames,exports.useParseProps=i.useParseProps,exports.getBaseThemes=p.getBaseThemes,exports.observeThemePreference=p.observeThemePreference,exports.setThemeClassNames=p.setThemeClassNames,exports.switchColorTheme=p.switchColorTheme,exports.updateColorTheme=p.updateColorTheme,exports.useThemePreference=p.useThemePreference,exports.useAnimation=m.useAnimation,exports.useIntersectionObserver=a.useIntersectionObserver,exports.useTimeoutFn=l.useTimeoutFn;
1
+ "use strict";var e=require("./useApi.js"),s=require("./useToggle.js"),r=require("./useToggle2.js"),u=require("./useOutsideClick.js"),i=require("./useResize.js"),o=require("./useClassNames.js"),t=require("./useParseProps.js"),n=require("./useThemePreference.js"),p=require("./useAnimation.js"),l=require("./useIntersectionObserver.js"),a=require("./useSetTimeout.js");exports.useApi=e.useApi,exports.useToggle=s.useToggle,exports.useToggle2=r.useToggle2,exports.outsideClickHandler=u.outsideClickHandler,exports.useOutsideClick=u.useOutsideClick,exports.useResize=i.useResize,exports.useClassNames=o.useClassNames,exports.useParseProps=t.useParseProps,exports.useThemePreference=n.useThemePreference,exports.useAnimation=p.useAnimation,exports.useIntersectionObserver=l.useIntersectionObserver,exports.useTimeoutFn=a.useTimeoutFn;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react");const o="change",t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const s=o=>{const s=e();null==c||c(o,s),null==t||t(o)},r=e=>{s(e.matches)},d=e=>{s(!e.matches)},l=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,d)}catch(e){}return s(null==l?void 0:l.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").addEventListener(o,d),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,d)}};let s={dark:"theme-dark",light:"theme-light"};const c=function(e,o){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const c=e?s.light:s.dark,r=e?s.dark:s.light;o&&(o.classList.remove(c),o.classList.remove(r),o.classList.add(r)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(c)).forEach((e=>{e.classList.add(".".concat(r)),e.classList.remove(".".concat(c))})),t&&(document.querySelectorAll(".shadow-div").forEach((e=>{var o,t;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(r),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var o,t,s;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(r),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c);const d=null===(s=e.shadowRoot)||void 0===s?void 0:s.childNodes[0];d&&(d.classList.add(r),d.classList.remove(c))}))))};exports.getBaseThemes=()=>s,exports.observeThemePreference=t,exports.setThemeClassNames=e=>{s=e},exports.switchColorTheme=c,exports.updateColorTheme=(e,o)=>{let t=e||!1;"undefined"!=typeof document&&void 0===e&&(t=document.body.classList.contains(s.dark)),c(t,o||document.body)},exports.useThemePreference=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e.useEffect((()=>t(o,s)),[o,s])};
1
+ "use strict";var e=require("react"),r=require("../utils/helpers/ui.js");exports.useThemePreference=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e.useEffect((()=>r.observeThemePreference(t,s)),[t,s])};
2
2
  //# sourceMappingURL=useThemePreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useThemePreference.js","sources":["../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\ntype ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n"],"names":["windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","switchColorThemeHandler","htmlElement","switchColorTheme","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","baseThemes","dark","light","getBaseThemes","findShadows","oldClass","newClass","classList","remove","add","querySelectorAll","concat","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","themes","updateColorTheme","resolvedIsDark","contains","useEffect"],"mappings":"oCAGA,MAAMA,EAAkC,SAQ3BC,EAAyB,WAGrB,IAFfC,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1E,MAAMC,EAA2BD,IAC/B,MAAME,EAAcT,IAEpBU,SAAAA,EAAmBH,EAAQE,GAC3BH,SAAA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["import { useEffect } from 'react'\n\nimport { observeThemePreference } from '../utils/helpers/ui'\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n"],"names":["getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","useEffect","observeThemePreference"],"mappings":"mGASkC,WAGvB,IAFTA,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EC,EAASA,WAAC,IAAMC,EAAAA,uBAAuBT,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F"}
@@ -1,2 +1,2 @@
1
- "use strict";require("../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");exports.classNames=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter((r=>"string"==typeof r&&null!=r)).filter(Boolean).join(" ")},exports.parseProps=r=>{const e={},t={};return Object.entries(r).forEach((r=>{let[s,o]=r;"data-"===s.substr(0,5)||"data"===s.substr(0,4)?e[s]=o:t[s]=o})),{dataProps:e,restProps:t}};
1
+ "use strict";require("../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");let e="theme-dark",o="theme-light";const t=function(t,r){let s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const c=t?o:e,l=t?e:o;r&&(r.classList.remove(c),r.classList.remove(l),r.classList.add(l)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(c)).forEach((e=>{e.classList.add(".".concat(l)),e.classList.remove(".".concat(c))})),s&&(document.querySelectorAll(".shadow-div").forEach((e=>{var o,t;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(l),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var o,t,r;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(l),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c);const s=null===(r=e.shadowRoot)||void 0===r?void 0:r.childNodes[0];s&&(s.classList.add(l),s.classList.remove(c))}))))},r="change";exports.classNames=function(){for(var e=arguments.length,o=new Array(e),t=0;t<e;t++)o[t]=arguments[t];return o.filter((e=>"string"==typeof e&&null!=e)).filter(Boolean).join(" ")},exports.observeThemePreference=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const s=r=>{const s=e();null==t||t(r,s),null==o||o(r)},c=e=>{s(e.matches)},l=e=>{s(!e.matches)},a=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(r,c),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(r,l)}catch(e){}return s(null==a?void 0:a.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(r,c),window.matchMedia("(prefers-color-scheme: light)").addEventListener(r,l),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(r,c),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(r,l)}},exports.parseProps=e=>{const o={},t={};return Object.entries(e).forEach((e=>{let[r,s]=e;"data-"===r.substr(0,5)||"data"===r.substr(0,4)?o[r]=s:t[r]=s})),{dataProps:o,restProps:t}},exports.switchColorTheme=t;
2
2
  //# sourceMappingURL=ui.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sources":["../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n"],"names":["_len","arguments","length","classes","Array","_key","filter","className","Boolean","join","props","dataProps","restProps","Object","entries","forEach","_ref","key","value","substr"],"mappings":"oHAY0B,WAAA,IAAA,IAAAA,EAAAC,UAAAC,OAAIC,EAAOC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAPF,EAAOE,GAAAJ,UAAAI,GAAA,OAA2BF,EAC7DG,QAAQC,GAAgD,iBAAdA,GAAP,MAAiCA,IACpED,OAAOE,SAASC,KAAK,IAAI,qBAQDC,IACzB,MAAMC,EAAqC,CAAE,EACvCC,EAAqC,CAAE,EAS7C,OAPAC,OAAOC,QAAQJ,GAAOK,SAAQC,IAAkB,IAAhBC,EAAKC,GAAMF,EAChB,UAArBC,EAAIE,OAAO,EAAG,IAAuC,SAArBF,EAAIE,OAAO,EAAG,GAChDR,EAAUM,GAAOC,EAEjBN,EAAUK,GAAOC,CACnB,IAEK,CAAEP,YAAWC,YAAW"}
1
+ {"version":3,"file":"ui.js","sources":["../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\nexport type ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n"],"names":["baseThemes","switchColorTheme","isDark","htmlElement","findShadows","arguments","length","undefined","oldClass","newClass","classList","remove","add","document","querySelectorAll","concat","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","windowMatchMediaChangeEventType","_len","classes","Array","_key","filter","className","Boolean","join","getHtmlElement","body","switchCallback","switchColorThemeHandler","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","props","dataProps","restProps","Object","entries","_ref","key","value","substr"],"mappings":"iGAsHA,IAAIA,EACI,aADJA,EAEK,cAuBF,MAAMC,EAAmB,SAACC,EAAiBC,GAAwD,IAA7BC,IAAWC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACtF,MAAMG,EAAWN,EAASF,EAAmBA,EACvCS,EAAWP,EAASF,EAAkBA,EAExCG,IACFA,EAAYO,UAAUC,OAAOH,GAC7BL,EAAYO,UAAUC,OAAOF,GAC7BN,EAAYO,UAAUE,IAAIH,IAGJ,oBAAbI,WACTA,SAASC,iBAAgBC,IAAAA,OAAKP,IAAYQ,SAASC,IACjDA,EAAQP,UAAUE,QAAGG,OAAKN,IAC1BQ,EAA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mBQ,SAASwB,KAChEC,EAAyCjC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIH,GAAAA,GAA6BA,EAE1E,MAAMqC,EAA2BrC,IAC/B,MAAMC,EAAciC,IAEpBnC,SAAAA,EAAmBC,EAAQC,GAC3BmC,SAAAA,EAAiBpC,EAAO,EAGpBsC,EAA+BC,IACnCF,EAAwBE,EAAMC,QAAQ,EAGlCC,EAAgCF,IACpCF,GAAyBE,EAAMC,QAAQ,EAGnCxC,EAAS0C,OAAOC,WAAW,gCAEjC,IACED,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAEpC,CAAC,MAAOI,GAAO,CAYhB,OARAR,EAAwBrC,eAAAA,EAAQwC,SAChCE,OAAOC,WAAW,gCAAgCG,iBAChDrB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCG,iBACjDrB,EAAiCgB,GAG5B,KACLC,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAClC,CAEL,qBApO2BM,IACzB,MAAMC,EAAqC,CAAE,EACvCC,EAAqC,CAAE,EAS7C,OAPAC,OAAOC,QAAQJ,GAAOjC,SAAQsC,IAAkB,IAAhBC,EAAKC,GAAMF,EAChB,UAArBC,EAAIE,OAAO,EAAG,IAAuC,SAArBF,EAAIE,OAAO,EAAG,GAChDP,EAAUK,GAAOC,EAEjBL,EAAUI,GAAOC,CACnB,IAEK,CAAEN,YAAWC,YAAW"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react");const o="change",t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const s=o=>{const s=e();null==c||c(o,s),null==t||t(o)},r=e=>{s(e.matches)},d=e=>{s(!e.matches)},l=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,d)}catch(e){}return s(null==l?void 0:l.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").addEventListener(o,d),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,d)}};let s={dark:"theme-dark",light:"theme-light"};const c=function(e,o){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const c=e?s.light:s.dark,r=e?s.dark:s.light;o&&(o.classList.remove(c),o.classList.remove(r),o.classList.add(r)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(c)).forEach((e=>{e.classList.add(".".concat(r)),e.classList.remove(".".concat(c))})),t&&(document.querySelectorAll(".shadow-div").forEach((e=>{var o,t;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(r),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var o,t,s;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(r),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c);const d=null===(s=e.shadowRoot)||void 0===s?void 0:s.childNodes[0];d&&(d.classList.add(r),d.classList.remove(c))}))))};exports.getBaseThemes=()=>s,exports.observeThemePreference=t,exports.setThemeClassNames=e=>{s=e},exports.switchColorTheme=c,exports.updateColorTheme=(e,o)=>{let t=e||!1;"undefined"!=typeof document&&void 0===e&&(t=document.body.classList.contains(s.dark)),c(t,o||document.body)},exports.useThemePreference=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e.useEffect((()=>t(o,s)),[o,s])};
1
+ "use strict";var e=require("react"),r=require("../utils/helpers/ui.js");exports.useThemePreference=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e.useEffect((()=>r.observeThemePreference(t,s)),[t,s])};
2
2
  //# sourceMappingURL=useThemePreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\ntype ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n"],"names":["windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","switchColorThemeHandler","htmlElement","switchColorTheme","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","baseThemes","dark","light","getBaseThemes","findShadows","oldClass","newClass","classList","remove","add","querySelectorAll","concat","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","themes","updateColorTheme","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3F9B,WAGvB,IAFTL,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EwC,EAASA,WAAC,IAAMhD,EAAuBC,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F"}
1
+ {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\nimport { observeThemePreference } from '../utils/helpers/ui'\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n"],"names":["getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","useEffect","observeThemePreference"],"mappings":"mGASkC,WAGvB,IAFTA,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EC,EAASA,WAAC,IAAMC,EAAAA,uBAAuBT,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F"}