renusify 1.4.2 → 1.4.3

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.
@@ -1,23 +1,23 @@
1
1
  <template>
2
2
  <div ref="world" :class="`${$r.prefix}world-map`">
3
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 1000">
4
- <g>
3
+ <r-float>
4
+ <svg viewBox="0 0 2000 1000" xmlns="http://www.w3.org/2000/svg">
5
5
  <path
6
- ref="country"
7
- class="country"
8
- :data-id="i"
9
- v-for="(path, i) in paths"
10
- :key="i"
11
- :d="path.d"
12
- :fill="lazyColors[i] || defaultColor"
13
- @click.prevent="$emit('select', i)"
6
+ v-for="(path, i) in paths"
7
+ :key="i"
8
+ ref="country"
9
+ :d="path.d"
10
+ :data-id="i"
11
+ :fill="lazyColors[i] || defaultColor"
12
+ class="country"
13
+ @click.prevent="$emit('select', i)"
14
14
  ></path>
15
- </g>
16
- </svg>
15
+ </svg>
16
+ </r-float>
17
17
  <div
18
- class="map-tooltip"
19
- v-if="!disableTooltip && tooltip"
20
- :style="{ left: tooltipPosition.x, top: tooltipPosition.y }"
18
+ v-if="!disableTooltip && tooltip"
19
+ :style="{ left: tooltipPosition.x, top: tooltipPosition.y }"
20
+ class="map-tooltip"
21
21
  >
22
22
  <slot :tooltip="tooltip">
23
23
  <div class="pa-3 sheet">
@@ -32,16 +32,16 @@
32
32
  export default {
33
33
  name: "r-world-map",
34
34
  props: {
35
- maxColor: { type: String, default: "#8a0000" },
36
- minColor: { type: String, default: "#f7a0a0" },
37
- defaultColor: { type: String, default: "#aaaaaa" },
35
+ maxColor: {type: String, default: "#760101"},
36
+ minColor: {type: String, default: "#f8c6c6"},
37
+ defaultColor: {type: String, default: "#aaaaaa"},
38
38
  Crimea: String,
39
39
  Western_Sahara_is_country: Boolean,
40
40
  disableTooltip: Boolean,
41
41
  colors: Object,
42
- hitColors: Object,
42
+ heatValues: Object,
43
43
  },
44
- emits:['select','hover'],
44
+ emits: ['select', 'hover'],
45
45
  data() {
46
46
  return {
47
47
  mapPaths: {
@@ -701,8 +701,255 @@ export default {
701
701
  },
702
702
  },
703
703
  tooltip: null,
704
- tooltipPosition: { x: 0, y: 0 },
705
- worldPosition: { x: 0, y: 0 },
704
+ tooltipPosition: {x: 0, y: 0},
705
+ worldPosition: {x: 0, y: 0},
706
+ countries: {
707
+ AF: 'Afghanistan',
708
+ AX: 'Åland Islands',
709
+ AL: 'Albania',
710
+ DZ: 'Algeria',
711
+ AS: 'American Samoa',
712
+ AD: 'Andorra',
713
+ AO: 'Angola',
714
+ AI: 'Anguilla',
715
+ AQ: 'Antarctica',
716
+ AG: 'Antigua and Barbuda',
717
+ AR: 'Argentina',
718
+ AM: 'Armenia',
719
+ AW: 'Aruba',
720
+ AU: 'Australia',
721
+ AT: 'Austria',
722
+ AZ: 'Azerbaijan',
723
+ BS: 'Bahamas',
724
+ BH: 'Bahrain',
725
+ BD: 'Bangladesh',
726
+ BB: 'Barbados',
727
+ BY: 'Belarus',
728
+ BE: 'Belgium',
729
+ BZ: 'Belize',
730
+ BJ: 'Benin',
731
+ BM: 'Bermuda',
732
+ BT: 'Bhutan',
733
+ BO: 'Bolivia',
734
+ BA: 'Bosnia and Herzegovina',
735
+ BW: 'Botswana',
736
+ BR: 'Brazil',
737
+ IO: 'British Indian Ocean Territory',
738
+ VG: 'British Virgin Islands',
739
+ BN: 'Brunei Darussalam',
740
+ BG: 'Bulgaria',
741
+ BF: 'Burkina Faso',
742
+ BI: 'Burundi',
743
+ KH: 'Cambodia',
744
+ CM: 'Cameroon',
745
+ CA: 'Canada',
746
+ CV: 'Cape Verde',
747
+ BQ: 'Caribbean Netherlands',
748
+ KY: 'Cayman Islands',
749
+ CF: 'Central African Republic',
750
+ TD: 'Chad',
751
+ CL: 'Chile',
752
+ CN: 'China',
753
+ CX: 'Christmas Island',
754
+ CC: 'Cocos Islands',
755
+ CO: 'Colombia',
756
+ KM: 'Comoros',
757
+ CG: 'Congo',
758
+ CK: 'Cook Islands',
759
+ CR: 'Costa Rica',
760
+ HR: 'Croatia',
761
+ CU: 'Cuba',
762
+ CW: 'Curaçao',
763
+ CY: 'Cyprus',
764
+ CZ: 'Czech Republic',
765
+ CD: 'Democratic Republic of the Congo',
766
+ DK: 'Denmark',
767
+ DJ: 'Djibouti',
768
+ DM: 'Dominica',
769
+ DO: 'Dominican Republic',
770
+ EC: 'Ecuador',
771
+ EG: 'Egypt',
772
+ SV: 'El Salvador',
773
+ GQ: 'Equatorial Guinea',
774
+ ER: 'Eritrea',
775
+ EE: 'Estonia',
776
+ ET: 'Ethiopia',
777
+ FK: 'Falkland Islands',
778
+ FO: 'Faroe Islands',
779
+ FM: 'Federated States of Micronesia',
780
+ FJ: 'Fiji',
781
+ FI: 'Finland',
782
+ FR: 'France',
783
+ GF: 'French Guiana',
784
+ PF: 'French Polynesia',
785
+ TF: 'French Southern Territories',
786
+ GA: 'Gabon',
787
+ GM: 'Gambia',
788
+ GE: 'Georgia',
789
+ DE: 'Germany',
790
+ GH: 'Ghana',
791
+ GI: 'Gibraltar',
792
+ GR: 'Greece',
793
+ GL: 'Greenland',
794
+ GD: 'Grenada',
795
+ GP: 'Guadeloupe',
796
+ GU: 'Guam',
797
+ GT: 'Guatemala',
798
+ GN: 'Guinea',
799
+ GW: 'Guinea-Bissau',
800
+ GY: 'Guyana',
801
+ HT: 'Haiti',
802
+ HN: 'Honduras',
803
+ HK: 'Hong Kong',
804
+ HU: 'Hungary',
805
+ IS: 'Iceland',
806
+ IN: 'India',
807
+ ID: 'Indonesia',
808
+ IR: 'Iran',
809
+ IQ: 'Iraq',
810
+ IE: 'Ireland',
811
+ IM: 'Isle of Man',
812
+ IL: 'Israel',
813
+ IT: 'Italy',
814
+ CI: 'Ivory Coast',
815
+ JM: 'Jamaica',
816
+ JP: 'Japan',
817
+ JE: 'Jersey',
818
+ JO: 'Jordan',
819
+ KZ: 'Kazakhstan',
820
+ KE: 'Kenya',
821
+ KI: 'Kiribati',
822
+ XK: 'Kosovo',
823
+ KW: 'Kuwait',
824
+ KG: 'Kyrgyzstan',
825
+ LA: 'Laos',
826
+ LV: 'Latvia',
827
+ LB: 'Lebanon',
828
+ LS: 'Lesotho',
829
+ LR: 'Liberia',
830
+ LY: 'Libya',
831
+ LI: 'Liechtenstein',
832
+ LT: 'Lithuania',
833
+ LU: 'Luxembourg',
834
+ MO: 'Macau',
835
+ MK: 'Macedonia',
836
+ MG: 'Madagascar',
837
+ MW: 'Malawi',
838
+ MY: 'Malaysia',
839
+ MV: 'Maldives',
840
+ ML: 'Mali',
841
+ MT: 'Malta',
842
+ MH: 'Marshall Islands',
843
+ MQ: 'Martinique',
844
+ MR: 'Mauritania',
845
+ MU: 'Mauritius',
846
+ YT: 'Mayotte',
847
+ MX: 'Mexico',
848
+ MD: 'Moldova',
849
+ MC: 'Monaco',
850
+ MN: 'Mongolia',
851
+ ME: 'Montenegro',
852
+ MS: 'Montserrat',
853
+ MA: 'Morocco',
854
+ MZ: 'Mozambique',
855
+ MM: 'Myanmar',
856
+ NA: 'Namibia',
857
+ NR: 'Nauru',
858
+ NP: 'Nepal',
859
+ NL: 'Netherlands',
860
+ NC: 'New Caledonia',
861
+ NZ: 'New Zealand',
862
+ NI: 'Nicaragua',
863
+ NE: 'Niger',
864
+ NG: 'Nigeria',
865
+ NU: 'Niue',
866
+ NF: 'Norfolk Island',
867
+ KP: 'North Korea',
868
+ MP: 'Northern Mariana Islands',
869
+ NO: 'Norway',
870
+ OM: 'Oman',
871
+ PK: 'Pakistan',
872
+ PW: 'Palau',
873
+ PS: 'Palestine',
874
+ PA: 'Panama',
875
+ PG: 'Papua New Guinea',
876
+ PY: 'Paraguay',
877
+ PE: 'Peru',
878
+ PH: 'Philippines',
879
+ PN: 'Pitcairn Islands',
880
+ PL: 'Poland',
881
+ PT: 'Portugal',
882
+ PR: 'Puerto Rico',
883
+ QA: 'Qatar',
884
+ RE: 'Reunion',
885
+ RO: 'Romania',
886
+ RU: 'Russia',
887
+ RW: 'Rwanda',
888
+ SH: 'Saint Helena',
889
+ KN: 'Saint Kitts and Nevis',
890
+ LC: 'Saint Lucia',
891
+ PM: 'Saint Pierre and Miquelon',
892
+ VC: 'Saint Vincent and the Grenadines',
893
+ WS: 'Samoa',
894
+ SM: 'San Marino',
895
+ ST: 'São Tomé and Príncipe',
896
+ SA: 'Saudi Arabia',
897
+ SN: 'Senegal',
898
+ RS: 'Serbia',
899
+ SC: 'Seychelles',
900
+ SL: 'Sierra Leone',
901
+ SG: 'Singapore',
902
+ SX: 'Sint Maarten',
903
+ SK: 'Slovakia',
904
+ SI: 'Slovenia',
905
+ SB: 'Solomon Islands',
906
+ SO: 'Somalia',
907
+ ZA: 'South Africa',
908
+ GS: 'South Georgia and the South Sandwich Islands',
909
+ KR: 'South Korea',
910
+ SS: 'South Sudan',
911
+ ES: 'Spain',
912
+ LK: 'Sri Lanka',
913
+ SD: 'Sudan',
914
+ SR: 'Suriname',
915
+ SJ: 'Svalbard and Jan Mayen',
916
+ SZ: 'Eswatini',
917
+ SE: 'Sweden',
918
+ CH: 'Switzerland',
919
+ SY: 'Syria',
920
+ TW: 'Taiwan',
921
+ TJ: 'Tajikistan',
922
+ TZ: 'Tanzania',
923
+ TH: 'Thailand',
924
+ TL: 'Timor-Leste',
925
+ TG: 'Togo',
926
+ TK: 'Tokelau',
927
+ TO: 'Tonga',
928
+ TT: 'Trinidad and Tobago',
929
+ TN: 'Tunisia',
930
+ TR: 'Turkey',
931
+ TM: 'Turkmenistan',
932
+ TC: 'Turks and Caicos Islands',
933
+ TV: 'Tuvalu',
934
+ UG: 'Uganda',
935
+ UA: 'Ukraine',
936
+ AE: 'United Arab Emirates',
937
+ GB: 'United Kingdom',
938
+ US: 'United States',
939
+ UM: 'United States Minor Outlying Islands',
940
+ VI: 'United States Virgin Islands',
941
+ UY: 'Uruguay',
942
+ UZ: 'Uzbekistan',
943
+ VU: 'Vanuatu',
944
+ VA: 'Vatican City',
945
+ VE: 'Venezuela',
946
+ VN: 'Vietnam',
947
+ WF: 'Wallis and Futuna',
948
+ EH: 'Western Sahara',
949
+ YE: 'Yemen',
950
+ ZM: 'Zambia',
951
+ ZW: 'Zimbabwe'
952
+ }
706
953
  };
707
954
  },
708
955
  mounted() {
@@ -712,19 +959,19 @@ export default {
712
959
  computed: {
713
960
  lazyColors() {
714
961
  let r = {};
715
- if (this.hitColors) {
962
+ if (this.heatValues) {
716
963
  let min = 0;
717
964
  let max = 0;
718
- for (let c in this.hitColors) {
719
- const value = this.hitColors[c];
965
+ for (let c in this.heatValues) {
966
+ const value = this.heatValues[c];
720
967
  if (value > max) {
721
968
  max = value;
722
969
  } else if (value < min) {
723
970
  min = value;
724
971
  }
725
972
  }
726
- for (let c in this.hitColors) {
727
- let a = this.hitColors[c] / (max - min);
973
+ for (let c in this.heatValues) {
974
+ let a = this.heatValues[c] / (max - min);
728
975
  r[c] = this.getColor(a);
729
976
  }
730
977
  } else if (this.colors) {
@@ -752,8 +999,8 @@ export default {
752
999
  },
753
1000
  methods: {
754
1001
  getColor(ratio) {
755
- let color1 = { r: 0, g: 0, b: 0 };
756
- let color2 = { r: 0, g: 0, b: 0 };
1002
+ let color1 = {r: 0, g: 0, b: 0};
1003
+ let color2 = {r: 0, g: 0, b: 0};
757
1004
  if (/#/.test(this.maxColor)) {
758
1005
  const c = this.maxColor.slice(-6);
759
1006
  color1.r = parseInt(c.substring(0, 2), 16);
@@ -798,6 +1045,7 @@ export default {
798
1045
  };
799
1046
  },
800
1047
  enter(country, e) {
1048
+ this.worldPosition = this.$refs.world.getBoundingClientRect();
801
1049
  let x = e.clientX - this.worldPosition.x;
802
1050
  let y = e.clientY - this.worldPosition.y;
803
1051
  if (x < 20) {
@@ -810,12 +1058,12 @@ export default {
810
1058
  x: x + "px",
811
1059
  y: y + 10 + "px",
812
1060
  };
813
- this.tooltip = { country: country };
814
- this.$emit('hover',country)
1061
+ this.tooltip = {id: country, country: this.countries[country]};
1062
+ this.$emit('hover', country)
815
1063
  },
816
1064
  leave() {
817
1065
  this.tooltip = null;
818
- this.$emit('hover',null)
1066
+ this.$emit('hover', null)
819
1067
  },
820
1068
  bindEvent() {
821
1069
  if (this.$refs.country) {
@@ -839,10 +1087,21 @@ export default {
839
1087
  .#{$prefix}world-map {
840
1088
  position: relative;
841
1089
  background-color: #e7f2fe;
1090
+
1091
+ .country {
1092
+ stroke: #e7f2fe;
1093
+ stroke-width: 1px;
1094
+ stroke-linejoin: round;
1095
+ transition: 0.3s all ease;
1096
+ cursor: pointer;
1097
+ outline: 0
1098
+ }
1099
+
842
1100
  .country:hover {
843
- stroke: #333;
844
- stroke-width: 1.5;
1101
+ fill: var(--color-one);
1102
+ opacity: 0.3;
845
1103
  }
1104
+
846
1105
  .map-tooltip {
847
1106
  position: absolute;
848
1107
  z-index: 1;
@@ -13,11 +13,14 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
+ import mixin from './mixin'
17
+
16
18
  export default {
17
19
  name: "highlight-css",
18
20
  props: {
19
21
  modelValue: String,
20
22
  },
23
+ mixins: [mixin],
21
24
  data() {
22
25
  return {
23
26
  d: this.modelValue,
@@ -38,128 +41,23 @@ export default {
38
41
  if (!this.d) {
39
42
  return "";
40
43
  }
41
- const data = this.d.split("");
42
- let res = "";
43
- let in_quta = false;
44
- data.forEach((c) => {
45
- if (["=", "&"].includes(c)) {
46
- res += '<span class="color-blue code-editor-span">' + c + "</span>";
47
- } else if ([",", ";", ":"].includes(c)) {
48
- res += '<span class="color-orange code-editor-span">' + c + "</span>";
49
- } else if (parseInt(c) > -1) {
50
- res += '<span class="color-number code-editor-span">' + c + "</span>";
51
- } else if ((c === '"' || c === "'" || c === "`") && !in_quta) {
52
- in_quta = c;
53
- res += '<span class="color-green code-editor-span">' + c;
54
- } else if (c === in_quta) {
55
- in_quta = false;
56
- res += c + "</span>";
57
- } else {
58
- res += c;
59
- }
60
- });
61
-
44
+ let res = this.d
45
+ res = this.re_quote(res);
46
+ res = this.re_func(res);
62
47
  res = this.re_class(res);
63
48
  res = this.re_id(res);
64
49
  res = this.re_comment(res);
65
-
50
+ res = this.re_special(res, /([{};,:])/g, 'color-func2');
66
51
  return res;
67
52
  },
68
53
  },
69
54
  methods: {
70
- setTab(event) {
71
- if (event.key === "'" || event.key === '"') {
72
- const end = event.target.selectionEnd;
73
- event.preventDefault()
74
- document.execCommand('insertText', false, event.key.repeat(2));
75
- event.target.selectionEnd = end + 1;
76
- return false;
77
- }
78
- if (event.key === "{") {
79
- const end = event.target.selectionEnd;
80
- event.preventDefault()
81
- document.execCommand('insertText', false, '{}');
82
- event.target.selectionEnd = end + 1;
83
- return false;
84
- }
85
- if (event.key === "(") {
86
- const end = event.target.selectionEnd;
87
- event.preventDefault()
88
- document.execCommand('insertText', false, '()');
89
- event.target.selectionEnd = end + 1;
90
- return false;
91
- }
92
- if (event.key === "[") {
93
- const end = event.target.selectionEnd;
94
- event.preventDefault()
95
- document.execCommand('insertText', false, '[]');
96
- event.target.selectionEnd = end + 1;
97
- return false;
98
- }
99
- if (event.keyCode === 9) {
100
- event.preventDefault()
101
- document.execCommand('insertText', false, ' '.repeat(4));
102
- return false;
103
- }
104
- if (event.keyCode === 13) {
105
- event.preventDefault()
106
- let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
107
- n = n[n.length - 1].split('')
108
- let w = ''
109
- for (let i = 0; i < n.length; i++) {
110
- if (n[i] === ' ') {
111
- w += ' '
112
- } else {
113
- break
114
- }
115
- }
116
-
117
- document.execCommand('insertText', false, '\n' + w);
118
- return false;
119
- }
120
- return true
121
- },
122
55
  re_class(res) {
123
- let regex = /\.-?[_a-zA-Z]+[_a-zA-Z0-9-]*\s*\{/g;
124
- let matched = res.matchAll(regex);
125
- for (const match of matched) {
126
- res = this.$helper.replacer(
127
- res,
128
- match[0],
129
- '<span class="color-func2 code-editor-span">' +
130
- match[0].slice(0, match[0].indexOf("{")) +
131
- "</span>{"
132
- );
133
- }
134
- return res;
56
+ return res = res.replace(/(\.+[_a-zA-Z0-9-:#{}$].*)\{/g, '<span class="color-func2 code-editor-span">$1</span>{')
135
57
  },
136
58
  re_id(res) {
137
- let regex = /#-?[_a-zA-Z]+[_a-zA-Z0-9-]*\s*\{/g;
138
- let matched = res.matchAll(regex);
139
- for (const match of matched) {
140
- res = this.$helper.replacer(
141
- res,
142
- match[0],
143
- '<span class="color-func2 code-editor-span">' +
144
- match[0].slice(0, match[0].indexOf("{")) +
145
- "</span>{"
146
- );
147
- }
148
- return res;
149
- },
150
- re_comment(res) {
151
- //eslint-disable-next-line
152
- let regex = /(\/\*[\w\'\s\r\n\*]*\*\/)|(\/\/[\w\s\']*)/g;
153
- let matched = res.matchAll(regex);
154
- for (const match of matched) {
155
- res = this.$helper.replacer(
156
- res,
157
- match[0],
158
- '<span class="color-comment code-editor-span">' + match[0] + "</span>"
159
- );
160
- }
161
- return res;
162
- },
59
+ return res = res.replace(/(#+[_a-zA-Z0-9-:#{}$].*)\{/g, '<span class="color-func2 code-editor-span">$1</span>{')
60
+ }
163
61
  },
164
62
  };
165
63
  </script>