renusify 1.2.2 → 1.2.4

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.
@@ -61,15 +61,17 @@ export default {
61
61
  }
62
62
  }
63
63
  </script>
64
- <style scoped>
65
- .notify-msg {
66
- display: flex;
67
- justify-content: space-between;
68
- align-items: flex-start;
69
- padding: 10px;
70
- border-radius: 5px;
71
- position: relative;
72
- z-index: 9999;
73
- margin:0.3rem 0;
74
- }
64
+ <style lang="scss">
65
+ @import "renusify/style/_include.scss";
66
+
67
+ .notify-msg {
68
+ display: flex;
69
+ justify-content: space-between;
70
+ align-items: flex-start;
71
+ padding: 10px;
72
+ border-radius: map-get($borders, 'md');
73
+ position: relative;
74
+ z-index: 9999;
75
+ margin: 0.3rem 0;
76
+ }
75
77
  </style>
@@ -1,7 +1,7 @@
1
1
  @import "renusify/style/_include.scss";
2
2
 
3
3
  $btn-active-opacity: 0.18 !default;
4
- $btn-border-radius: 4px !default;
4
+ $btn-border-radius: map-get($borders, 'sm') !default;
5
5
  $btn-focus-opacity: 0.24 !default;
6
6
  $btn-font-size: .875rem !default;
7
7
  $btn-font-weight: 500 !default;
@@ -10,7 +10,7 @@ $btn-letter-spacing: .07em !default;
10
10
  $btn-icon-font-size: 18px !default;
11
11
  $btn-icon-padding: 12px !default;
12
12
  $btn-outline-border-width: thin !default;
13
- $btn-rounded-border-radius: 28px !default;
13
+ $btn-rounded-border-radius: 2rem !default;
14
14
  $btn-sizes: (
15
15
  'x-small': 20,
16
16
  'small': 30,
@@ -73,7 +73,6 @@ $btn-transition: opacity 0.2s map-get($transition, 'ease-in-out') !default;
73
73
 
74
74
  &:not(.btn-text):not(.btn-outlined) {
75
75
  background-color: var(--color-sheet);
76
- color: var(--color-text-primary);
77
76
  }
78
77
 
79
78
  &.btn-outlined.btn-text {
@@ -124,13 +124,13 @@ export default {
124
124
  }
125
125
 
126
126
  .msg-select {
127
- animation: color .7s;
128
- animation-iteration-count: infinite;
129
- border-radius: 4px;
127
+ animation: color .7s;
128
+ animation-iteration-count: infinite;
129
+ border-radius: map-get($borders, 'sm');
130
130
 
131
- .message-text {
132
- opacity: .4;
133
- }
131
+ .message-text {
132
+ opacity: .4;
133
+ }
134
134
  }
135
135
  }
136
136
 
@@ -119,7 +119,7 @@ export default {
119
119
  background: #fff;
120
120
  color: black;
121
121
  padding: 5px 10px;
122
- border-radius: 15px;
122
+ border-radius: map-get($borders, 'lg');
123
123
  max-width: 80%;
124
124
  overflow-wrap: break-word;
125
125
  white-space: pre-wrap;
@@ -146,7 +146,7 @@ export default {
146
146
  .message-text {
147
147
  margin-top: 0px;
148
148
  margin-bottom: 2px;
149
- border-radius: 4px !important;
149
+ border-radius: map-get($borders, 'sm') !important;
150
150
  }
151
151
  }
152
152
 
@@ -7,7 +7,7 @@ $chip-icon-margin-before: -6px !default;
7
7
  $chip-icon-right-margin-after: -4px !default;
8
8
  $chip-icon-right-margin-before: 8px !default;
9
9
  $chip-icon-size: 24px !default;
10
- $chip-label-border-radius: 4px !default;
10
+ $chip-label-border-radius: map-get($borders, 'sm') !default;
11
11
  $chip-link-focus-opacity: 0.32 !default;
12
12
  $chip-pill-avatar-margin-after: 8px !default;
13
13
  $chip-pill-avatar-margin-before: -12px !default;
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div class="code-editor-highlight ltr">
3
+ <textarea
4
+ v-model="d"
5
+ autocapitalize="off"
6
+ autocomplete="off"
7
+ autocorrect="off"
8
+ spellcheck="false"
9
+ ></textarea>
10
+ <div class="text-preview" v-html="build"></div>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ name: "highlight-css",
17
+ props: {
18
+ modelValue: String,
19
+ },
20
+ data() {
21
+ return {
22
+ d: this.modelValue,
23
+ runnable: false,
24
+ code: "",
25
+ };
26
+ },
27
+ watch: {
28
+ modelValue: function () {
29
+ this.d = this.modelValue;
30
+ },
31
+ d: function () {
32
+ this.$emit("update:model-value", this.d);
33
+ },
34
+ },
35
+ computed: {
36
+ build() {
37
+ if (!this.d) {
38
+ return "";
39
+ }
40
+ const data = this.d.split("");
41
+ let res = "";
42
+ let in_quta = false;
43
+ data.forEach((c) => {
44
+ if (["=", "&"].includes(c)) {
45
+ res += '<span class="color-blue code-editor-span">' + c + "</span>";
46
+ } else if ([",", ";", ":"].includes(c)) {
47
+ res += '<span class="color-orange code-editor-span">' + c + "</span>";
48
+ } else if (parseInt(c) > -1) {
49
+ res += '<span class="color-number code-editor-span">' + c + "</span>";
50
+ } else if ((c === '"' || c === "'" || c === "`") && !in_quta) {
51
+ in_quta = c;
52
+ res += '<span class="color-green code-editor-span">' + c;
53
+ } else if (c === in_quta) {
54
+ in_quta = false;
55
+ res += c + "</span>";
56
+ } else {
57
+ res += c;
58
+ }
59
+ });
60
+
61
+ res = this.re_class(res);
62
+ res = this.re_id(res);
63
+ res = this.re_comment(res);
64
+
65
+ return res;
66
+ },
67
+ },
68
+ methods: {
69
+ re_class(res) {
70
+ let regex = /\.-?[_a-zA-Z]+[_a-zA-Z0-9-]*\s*\{/g;
71
+ let matched = res.matchAll(regex);
72
+ for (const match of matched) {
73
+ res = this.$helper.replacer(
74
+ res,
75
+ match[0],
76
+ '<span class="color-func2 code-editor-span">' +
77
+ match[0].slice(0, match[0].indexOf("{")) +
78
+ "</span>{"
79
+ );
80
+ }
81
+ return res;
82
+ },
83
+ re_id(res) {
84
+ let regex = /#-?[_a-zA-Z]+[_a-zA-Z0-9-]*\s*\{/g;
85
+ let matched = res.matchAll(regex);
86
+ for (const match of matched) {
87
+ res = this.$helper.replacer(
88
+ res,
89
+ match[0],
90
+ '<span class="color-func2 code-editor-span">' +
91
+ match[0].slice(0, match[0].indexOf("{")) +
92
+ "</span>{"
93
+ );
94
+ }
95
+ return res;
96
+ },
97
+ re_comment(res) {
98
+ //eslint-disable-next-line
99
+ let regex = /(\/\*[\w\'\s\r\n\*]*\*\/)|(\/\/[\w\s\']*)/g;
100
+ let matched = res.matchAll(regex);
101
+ for (const match of matched) {
102
+ res = this.$helper.replacer(
103
+ res,
104
+ match[0],
105
+ '<span class="color-comment code-editor-span">' + match[0] + "</span>"
106
+ );
107
+ }
108
+ return res;
109
+ },
110
+ },
111
+ };
112
+ </script>
113
+
114
+ <style lang="scss">
115
+ @import "~renusify/style/include";
116
+ </style>
@@ -1,66 +1,167 @@
1
- <template>
2
- <div :class="`${this.$r.prefix}highlight-html`" v-html="build"></div>
3
- </template>
4
- <script>
5
- export default {
6
- name: 'highlightHtml',
7
- props: {
8
- code: String,
9
- runnable: Boolean
10
- },
11
- data() {
12
- return {}
13
- },
14
- computed: {
15
- build() {
16
- let data = this.code.split('')
17
- let res = ''
18
- let in_quta = false
19
- data.forEach((c, i) => {
20
- if (c === '=') {
21
- res += '<span class="color-blue">=</span>'
22
- } else if ((c === '"' || c === "'") && !in_quta) {
23
- in_quta = c
24
- res += '<span class="color-green">' + c
25
- } else if (c === in_quta) {
26
- in_quta = false
27
- res += c + '</span>'
28
- } else {
29
- res += c
30
- }
31
- })
32
-
33
- res = this.$helper.replacer(res, '&lt;', '<span class="color-orange">&lt;')
34
- res = this.$helper.replacer(res, '&gt;', '&gt;</span>')
35
- res = this.$helper.replacer(res, '{{', '<span class="color-blue">{{')
36
- res = this.$helper.replacer(res, '}}', '}}</span>')
37
- res = this.$helper.replacer(res, '$r.', '<span class="color-blue">$r.</span>')
38
- let regex = /\+(.*?)\+/g
39
- let matched = res.matchAll(regex)
40
- for (const match of matched) {
41
- res = this.$helper.replacer(res, match[0], ' <span class="color-blue">' + match[0] + '</span>')
42
- }
43
- return (this.runnable ? '<span class="color-green">&lt;template&gt;</span>' : '') + res + (this.runnable ? '\n<span class="color-green">&lt;/template&gt;</span>' : '')
44
- }
45
- }
46
- }
47
- </script>
48
- <style lang="scss">
49
- @import "../../style/include";
50
-
51
- .#{$prefix}highlight-html {
52
- white-space: break-spaces;
53
-
54
- .color-green {
55
- color: #0cde27;
56
- }
57
-
58
- .color-orange {
59
- color: orange;
60
- }
61
-
62
- .color-blue {
63
- color: #7ad5ff;
64
- }
65
- }
66
- </style>
1
+ <template>
2
+ <div class="code-editor-highlight ltr">
3
+ <textarea
4
+ v-model="d"
5
+ autocapitalize="off"
6
+ autocomplete="off"
7
+ autocorrect="off"
8
+ spellcheck="false"
9
+ ></textarea>
10
+ <div class="text-preview" v-html="build"></div>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ name: "highlight-html",
17
+ props: {
18
+ modelValue: String,
19
+ },
20
+ data() {
21
+ return {
22
+ d: this.modelValue,
23
+ runnable: false,
24
+ code: "",
25
+ };
26
+ },
27
+ watch: {
28
+ modelValue: function () {
29
+ this.d = this.modelValue;
30
+ },
31
+ d: function () {
32
+ this.$emit("update:model-value", this.d);
33
+ },
34
+ },
35
+ computed: {
36
+ build() {
37
+ if (!this.d) {
38
+ return "";
39
+ }
40
+ let data = this.d;
41
+ data = this.$helper.replacer(data, "<", "&lt;");
42
+ data = this.$helper.replacer(data, ">", "&gt;");
43
+ data = data.split("");
44
+ let res = "";
45
+ let in_quta = false;
46
+ data.forEach((c) => {
47
+ if (c === "=") {
48
+ res += '<span class="color-blue">=</span>';
49
+ } else if ((c === '"' || c === "'") && !in_quta) {
50
+ in_quta = c;
51
+ res += '<span class="color-green">' + c;
52
+ } else if (c === in_quta) {
53
+ in_quta = false;
54
+ res += c + "</span>";
55
+ } else {
56
+ res += c;
57
+ }
58
+ });
59
+
60
+ res = this.$helper.replacer(
61
+ res,
62
+ "&lt;",
63
+ '<span class="color-orange code-editor-span">&lt;'
64
+ );
65
+ res = this.$helper.replacer(res, "&gt;", "&gt;</span>");
66
+ res = this.$helper.replacer(
67
+ res,
68
+ "{{",
69
+ '<span class="color-blue code-editor-span">{{'
70
+ );
71
+ res = this.$helper.replacer(res, "}}", "}}</span>");
72
+
73
+ let regex = /\+(.*?)\+/g;
74
+ let matched = res.matchAll(regex);
75
+ for (const match of matched) {
76
+ res = this.$helper.replacer(
77
+ res,
78
+ match[0],
79
+ '<span class="color-blue code-editor-span">' + match[0] + "</span>"
80
+ );
81
+ }
82
+ res = this.re_words(res);
83
+ res = this.re_comment(res);
84
+ res = this.re_func(res);
85
+ return res;
86
+ },
87
+ },
88
+ methods: {
89
+ re_words(res) {
90
+ res = this.$helper.replacer(
91
+ res,
92
+ " window.",
93
+ ' <span class="color-orange code-editor-span">window</span>.'
94
+ );
95
+ res = this.$helper.replacer(
96
+ res,
97
+ " new ",
98
+ ' <span class="color-orange code-editor-span">new</span> '
99
+ );
100
+ res = this.$helper.replacer(
101
+ res,
102
+ " true",
103
+ ' <span class="color-orange code-editor-span">true</span>'
104
+ );
105
+ res = this.$helper.replacer(
106
+ res,
107
+ " false",
108
+ ' <span class="color-orange code-editor-span">false</span>'
109
+ );
110
+
111
+ return res;
112
+ },
113
+ re_comment(res) {
114
+ let regex = /&lt;!--(.*?)--&gt;/g;
115
+ let matched = res.matchAll(regex);
116
+ for (const match of matched) {
117
+ res = this.$helper.replacer(
118
+ res,
119
+ match[0],
120
+ '<span class="color-comment code-editor-span">' + match[0] + "</span>"
121
+ );
122
+ }
123
+ return res;
124
+ },
125
+ re_func(res) {
126
+ //function like Date()
127
+ let regex = /([a-zA-Z_{1}][a-zA-Z0-9_]+)[ ]{0,1}(?=\()/g;
128
+ let matched = res.matchAll(regex);
129
+ for (const match of matched) {
130
+ res = this.$helper.replacer(
131
+ res,
132
+ match[0],
133
+ '<span class="color-func2 code-editor-span">' + match[0] + "</span>"
134
+ );
135
+ }
136
+
137
+ //function like $r $d()
138
+ regex = /(\$([a-zA-z0-9]*)[.|(])/g;
139
+ matched = res.matchAll(regex);
140
+ for (const match of matched) {
141
+ res = this.$helper.replacer(
142
+ res,
143
+ match[0].substr(0, match[0].length - 1),
144
+ '<span class="color-func code-editor-span">' +
145
+ match[0].substr(0, match[0].length - 1) +
146
+ "</span>"
147
+ );
148
+ }
149
+ res = this.$helper.replacer(
150
+ res,
151
+ "(",
152
+ '<span class="color-func2 code-editor-span">(</span>'
153
+ );
154
+ res = this.$helper.replacer(
155
+ res,
156
+ ")",
157
+ '<span class="color-func2 code-editor-span">)</span>'
158
+ );
159
+ return res;
160
+ },
161
+ },
162
+ };
163
+ </script>
164
+
165
+ <style lang="scss">
166
+ @import "~renusify/style/include";
167
+ </style>