renusify 2.5.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/components/app/index.vue +74 -22
  2. package/components/app/toast/index.vue +76 -71
  3. package/components/app/toast/toast.vue +62 -44
  4. package/components/avatar/index.vue +208 -84
  5. package/components/button/buttonConfirm.vue +53 -26
  6. package/components/button/buttonGroup.js +0 -2
  7. package/components/button/buttonGroup.vue +310 -62
  8. package/components/button/index.vue +584 -100
  9. package/components/calendar/index.js +0 -2
  10. package/components/calendar/index.vue +326 -262
  11. package/components/calendar/month.vue +64 -55
  12. package/components/calendar/year.vue +30 -25
  13. package/components/card/index.vue +139 -59
  14. package/components/codeEditor/highlightCss.vue +38 -39
  15. package/components/codeEditor/highlightHtml.vue +64 -64
  16. package/components/codeEditor/highlightJs.vue +37 -38
  17. package/components/codeEditor/index.vue +129 -79
  18. package/components/codeEditor/run.vue +225 -39
  19. package/components/codeEditor/useCodeFormatter.js +150 -0
  20. package/components/confirm/index.vue +140 -81
  21. package/components/container/col.vue +5 -4
  22. package/components/container/divider.vue +28 -19
  23. package/components/container/index.vue +34 -15
  24. package/components/container/row.vue +26 -9
  25. package/components/container/spacer.vue +2 -4
  26. package/components/container/style.scss +3 -0
  27. package/components/content/index.vue +49 -32
  28. package/components/cropper/index.vue +401 -244
  29. package/components/float/index.vue +542 -415
  30. package/components/form/addressInput/index.vue +184 -109
  31. package/components/form/camInput/index.vue +370 -244
  32. package/components/form/checkInput/index.vue +138 -71
  33. package/components/form/checkboxInput/index.vue +87 -47
  34. package/components/form/colorInput/Alpha.vue +81 -83
  35. package/components/form/colorInput/Hue.vue +91 -68
  36. package/components/form/colorInput/Preview.vue +43 -47
  37. package/components/form/colorInput/Saturation.vue +101 -86
  38. package/components/form/colorInput/index.vue +72 -40
  39. package/components/form/colorInput/picker.vue +111 -106
  40. package/components/form/colorInput/useColor.js +153 -0
  41. package/components/form/dateInput/index.vue +691 -356
  42. package/components/form/dateInput/month.vue +63 -54
  43. package/components/form/dateInput/year.vue +35 -25
  44. package/components/form/fileInput/index.js +0 -1
  45. package/components/form/fileInput/index.vue +263 -106
  46. package/components/form/fileInput/single.vue +323 -164
  47. package/components/form/groupInput/index.vue +199 -101
  48. package/components/form/index.vue +189 -83
  49. package/components/form/input/index.vue +416 -377
  50. package/components/form/jsonInput/JsonView.vue +54 -56
  51. package/components/form/jsonInput/index.vue +247 -165
  52. package/components/form/maskInput/index.vue +252 -132
  53. package/components/form/numberInput/index.js +0 -1
  54. package/components/form/numberInput/index.vue +226 -117
  55. package/components/form/passwordInput/index.js +2 -1
  56. package/components/form/passwordInput/index.vue +269 -102
  57. package/components/form/radioInput/index.vue +143 -72
  58. package/components/form/rangeInput/index.vue +280 -167
  59. package/components/form/ratingInput/index.vue +57 -57
  60. package/components/form/selectInput/index.js +1 -3
  61. package/components/form/selectInput/index.vue +584 -296
  62. package/components/form/switchInput/index.vue +73 -59
  63. package/components/form/telInput/index.js +0 -1
  64. package/components/form/telInput/index.vue +238 -135
  65. package/components/form/textArea/index.vue +72 -35
  66. package/components/form/textEditor/index.vue +739 -0
  67. package/components/form/{text-editor → textEditor}/style.scss +8 -16
  68. package/components/form/textInput/index.vue +54 -32
  69. package/components/form/timeInput/index.vue +83 -56
  70. package/components/form/timeInput/range.vue +116 -95
  71. package/components/form/timeInput/timepicker.vue +382 -449
  72. package/components/form/uniqueInput/index.vue +105 -48
  73. package/components/form/unitInput/index.vue +139 -84
  74. package/components/formCreator/index.js +0 -1
  75. package/components/formCreator/index.vue +314 -148
  76. package/components/highlight/index.vue +41 -25
  77. package/components/highlight/style.scss +2 -2
  78. package/components/highlight/{mixin.js → useHighlight.js} +181 -160
  79. package/components/icon/index.vue +79 -33
  80. package/components/img/index.vue +249 -147
  81. package/components/img/preview.vue +180 -198
  82. package/components/img/svgImg.vue +42 -39
  83. package/components/index.js +5 -20
  84. package/components/infinite/index.js +1 -2
  85. package/components/infinite/index.vue +248 -66
  86. package/components/map/index.vue +428 -261
  87. package/components/map/route.vue +794 -487
  88. package/components/map/select.vue +118 -58
  89. package/components/menu/index.vue +201 -91
  90. package/components/meta/meta.js +26 -3
  91. package/components/modal/index.vue +383 -158
  92. package/components/notify/index.vue +204 -86
  93. package/components/notify/notification.vue +38 -55
  94. package/components/progress/circle.vue +189 -70
  95. package/components/progress/line.vue +266 -46
  96. package/components/searchBox/index.js +1 -3
  97. package/components/searchBox/index.vue +194 -101
  98. package/components/skeleton/index.vue +45 -20
  99. package/components/slider/index.vue +318 -156
  100. package/components/swiper/index.vue +254 -106
  101. package/components/table/crud/footer.vue +77 -53
  102. package/components/table/crud/header.vue +71 -72
  103. package/components/table/crud/index.vue +631 -401
  104. package/components/table/index.vue +721 -278
  105. package/components/timeAgo/index.vue +145 -96
  106. package/components/tour/index.vue +338 -235
  107. package/components/tree/index.vue +235 -89
  108. package/components/tree/tree-element.vue +107 -106
  109. package/directive/animate/index.js +77 -0
  110. package/directive/clickOutSide/index.js +98 -0
  111. package/directive/drag/index.js +153 -0
  112. package/directive/index.js +11 -13
  113. package/directive/intersect/index.js +263 -0
  114. package/directive/mask/index.js +67 -0
  115. package/directive/parallax/index.js +78 -0
  116. package/directive/ripple/index.js +14 -0
  117. package/directive/scroll/index.js +244 -0
  118. package/directive/sortable/index.js +274 -0
  119. package/directive/title/index.js +75 -0
  120. package/directive/touch/index.js +268 -0
  121. package/index.js +10 -8
  122. package/package.json +5 -2
  123. package/plugins/validation/Validate.js +88 -79
  124. package/scripts/generate-docs.mjs +226 -0
  125. package/scripts/menu.mjs +240 -0
  126. package/scripts/parser.mjs +1086 -0
  127. package/style/_index.scss +7 -0
  128. package/style/app.scss +13 -65
  129. package/style/colors.scss +5 -22
  130. package/style/functions/index.scss +8 -0
  131. package/style/mixins/index.scss +17 -5
  132. package/style/variables/base.scss +154 -175
  133. package/style/variables/color.scss +0 -12
  134. package/style/variables/utilities.scss +0 -180
  135. package/tools/helper.js +0 -8
  136. package/tools/icons.js +6 -1
  137. package/tools/root.js +71 -0
  138. package/components/app/style.scss +0 -41
  139. package/components/app/toast/style.scss +0 -20
  140. package/components/avatar/style.scss +0 -32
  141. package/components/bar/bottomNav.js +0 -1
  142. package/components/bar/bottomNav.vue +0 -28
  143. package/components/bar/bottomNavigationCircle.js +0 -2
  144. package/components/bar/bottomNavigationCircle.vue +0 -99
  145. package/components/bar/scss/bottomNav.scss +0 -67
  146. package/components/bar/scss/toolbar.scss +0 -174
  147. package/components/bar/toolbar/index.js +0 -8
  148. package/components/bar/toolbar/index.vue +0 -35
  149. package/components/bar/toolbar/laptop.vue +0 -33
  150. package/components/bar/toolbar/menuChilds.vue +0 -41
  151. package/components/bar/toolbar/menuLaptop.vue +0 -41
  152. package/components/bar/toolbar/menuMob.vue +0 -39
  153. package/components/bar/toolbar/mixin.js +0 -43
  154. package/components/bar/toolbar/mobile.vue +0 -34
  155. package/components/breadcrumb/bredcrumbItem.vue +0 -39
  156. package/components/breadcrumb/index.js +0 -3
  157. package/components/breadcrumb/index.vue +0 -71
  158. package/components/breadcrumb/style.scss +0 -51
  159. package/components/button/style.scss +0 -411
  160. package/components/card/style.scss +0 -86
  161. package/components/chart/chart.js +0 -1
  162. package/components/chart/chart.vue +0 -69
  163. package/components/chart/worldMap.js +0 -2
  164. package/components/chart/worldMap.vue +0 -1112
  165. package/components/chat/MessageList.vue +0 -163
  166. package/components/chat/chatInput.vue +0 -150
  167. package/components/chat/chatMsg.vue +0 -276
  168. package/components/chat/index.js +0 -11
  169. package/components/chat/index.vue +0 -113
  170. package/components/chip/index.js +0 -3
  171. package/components/chip/index.vue +0 -77
  172. package/components/chip/style.scss +0 -199
  173. package/components/codeEditor/mixin.js +0 -145
  174. package/components/countdown/index.js +0 -1
  175. package/components/countdown/index.vue +0 -105
  176. package/components/form/colorInput/mixin.js +0 -132
  177. package/components/form/fileInput/file.js +0 -148
  178. package/components/form/telInput/assets/flags.png +0 -0
  179. package/components/form/telInput/assets/flags@2x.png +0 -0
  180. package/components/form/text-editor/index.vue +0 -710
  181. package/components/icon/style.scss +0 -17
  182. package/components/infinite/div.js +0 -6
  183. package/components/infinite/div.vue +0 -193
  184. package/components/infinite/page.js +0 -3
  185. package/components/infinite/page.vue +0 -105
  186. package/components/list/index.js +0 -3
  187. package/components/list/index.vue +0 -122
  188. package/components/list/style.scss +0 -66
  189. package/components/message/index.js +0 -4
  190. package/components/message/index.vue +0 -40
  191. package/components/modal/style.scss +0 -146
  192. package/components/nestable/NestableItem.vue +0 -307
  193. package/components/nestable/editable.js +0 -44
  194. package/components/nestable/index.js +0 -1
  195. package/components/nestable/index.vue +0 -226
  196. package/components/nestable/methods.js +0 -416
  197. package/components/progress/style.scss +0 -229
  198. package/components/table/style.scss +0 -338
  199. package/components/tabs/index.js +0 -3
  200. package/components/tabs/index.vue +0 -151
  201. package/components/timeline/index.js +0 -6
  202. package/components/timeline/index.vue +0 -76
  203. package/directive/resize/index.js +0 -30
  204. package/directive/skeleton/index.js +0 -27
  205. package/directive/skeleton/style.scss +0 -37
  206. package/plugins/request/Request.js +0 -68
  207. package/style/animation.scss +0 -94
  208. package/style/style.scss +0 -8
  209. package/tools/rootable.js +0 -75
  210. /package/components/form/{text-editor → textEditor}/index.js +0 -0
  211. /package/components/form/{text-editor → textEditor}/preview.js +0 -0
  212. /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
@@ -1,26 +1,25 @@
1
- //forked from https://github.com/speed-highlight/core
2
- export default {
3
- data() {
4
- return {
5
- expandData: {
6
- num: {
7
- type: 'num',
8
- match: /(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g
9
- },
10
- str: {
11
- type: 'str',
12
- match: /(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g
13
- },
14
- strDouble: {
15
- type: 'str',
16
- match: /"((?!")[^\r\n\\]|\\[^])*"?/g
17
- }
18
- },
19
- languages: {}
1
+ import {ref} from 'vue'
2
+
3
+ export function useHighlight() {
4
+ const expandData = {
5
+ num: {
6
+ type: 'num',
7
+ match: /(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g
8
+ },
9
+ str: {
10
+ type: 'str',
11
+ match: /(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g
12
+ },
13
+ strDouble: {
14
+ type: 'str',
15
+ match: /"((?!")[^\r\n\\]|\\[^])*"?/g
20
16
  }
21
- },
22
- created() {
23
- this.languages.asm = {
17
+ }
18
+
19
+ const languages = ref({})
20
+
21
+ const initLanguages = () => {
22
+ languages.value.asm = {
24
23
  default: [
25
24
  {
26
25
  type: 'cmnt',
@@ -33,24 +32,20 @@ export default {
33
32
  expand: 'num'
34
33
  },
35
34
  {
36
- // value (ex: "$0x1")
37
35
  type: 'num',
38
36
  match: /\$[\da-fA-F]*\b/g
39
37
  },
40
38
  {
41
39
  type: 'kwd',
42
- // ex: "section .data"
43
40
  match: /^[a-z]+\s+[a-z.]+\b/gm,
44
41
  sub: [
45
42
  {
46
- // keyword (ex: "section")
47
43
  type: 'func',
48
44
  match: /^[a-z]+/g
49
45
  }
50
46
  ]
51
47
  },
52
48
  {
53
- // instruction (ex: "mov")
54
49
  type: 'kwd',
55
50
  match: /^\t*[a-z][a-z\d]*\b/gm
56
51
  },
@@ -60,7 +55,7 @@ export default {
60
55
  }
61
56
  ]
62
57
  }
63
- this.languages.bash = {
58
+ languages.value.bash = {
64
59
  default: [
65
60
  {
66
61
  sub: 'todo',
@@ -75,7 +70,6 @@ export default {
75
70
  }]
76
71
  },
77
72
  {
78
- // relative or absolute path
79
73
  type: 'oper',
80
74
  match: /(?<=\s|^)\.*\/[a-z/_.-]+/gi
81
75
  },
@@ -87,7 +81,6 @@ export default {
87
81
  expand: 'num'
88
82
  },
89
83
  {
90
- // command
91
84
  type: 'func',
92
85
  match: /(?<=(^|\||\&\&|\;)\s*)[a-z_.-]+(?=\s|$)/gmi
93
86
  },
@@ -109,7 +102,7 @@ export default {
109
102
  }
110
103
  ]
111
104
  }
112
- this.languages.bf = {
105
+ languages.value.bf = {
113
106
  default: [
114
107
  {
115
108
  match: /[^\[\->+.<\]\s].*/g,
@@ -129,7 +122,7 @@ export default {
129
122
  }
130
123
  ]
131
124
  }
132
- this.languages.c = {
125
+ languages.value.c = {
133
126
  default: [
134
127
  {
135
128
  match: /\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,
@@ -159,7 +152,6 @@ export default {
159
152
  match: /^asm/g
160
153
  },
161
154
  {
162
- //type: 'str',
163
155
  match: /[^{}]*(?=}$)/g,
164
156
  sub: 'asm'
165
157
  }
@@ -183,7 +175,7 @@ export default {
183
175
  }
184
176
  ]
185
177
  }
186
- this.languages.css = {
178
+ languages.value.css = {
187
179
  default: [
188
180
  {
189
181
  match: /\/\*((?!\*\/)[^])*(\*\/)?/g,
@@ -241,7 +233,7 @@ export default {
241
233
  }
242
234
  ]
243
235
  }
244
- this.languages.csv = {
236
+ languages.value.csv = {
245
237
  default: [
246
238
  {
247
239
  expand: 'strDouble'
@@ -252,7 +244,7 @@ export default {
252
244
  }
253
245
  ]
254
246
  }
255
- this.languages.diff = {
247
+ languages.value.diff = {
256
248
  default: [
257
249
  {
258
250
  type: 'deleted',
@@ -272,16 +264,16 @@ export default {
272
264
  }
273
265
  ]
274
266
  }
275
- this.languages.docker = {
267
+ languages.value.docker = {
276
268
  default: [
277
269
  {
278
270
  type: 'kwd',
279
271
  match: /^(FROM|RUN|CMD|LABEL|MAINTAINER|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL)\b/gmi
280
272
  },
281
- ...this.languages.bash.default
273
+ ...languages.value.bash.default
282
274
  ]
283
275
  }
284
- this.languages.git = {
276
+ languages.value.git = {
285
277
  default: [
286
278
  {
287
279
  match: /^#.*/gm,
@@ -290,7 +282,7 @@ export default {
290
282
  {
291
283
  expand: 'str'
292
284
  },
293
- ...this.languages.diff.default,
285
+ ...languages.value.diff.default,
294
286
  {
295
287
  type: 'func',
296
288
  match: /^(\$ )?git(\s.*)?$/gm
@@ -301,7 +293,7 @@ export default {
301
293
  }
302
294
  ]
303
295
  }
304
- this.languages.go = {
296
+ languages.value.go = {
305
297
  default: [
306
298
  {
307
299
  match: /\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,
@@ -331,42 +323,44 @@ export default {
331
323
  }
332
324
  ]
333
325
  }
334
- let name = `[:A-Z_a-z@#\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}][:A-Z_a-z@#\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\\-\\.0-9\u{B7}\u{0300}-\u{036F}\u{203F}-\u{2040}]*`,
335
- properties = `\\s*(\\s+${name}\\s*(=\\s*([^"']\\S*|("|')(\\\\[^]|(?!\\4)[^])*\\4?)?)?\\s*)*`,
336
- xmlElement = {
337
- match: RegExp(`<[\/!?]?${name}${properties}[\/!?]?>`, 'g'),
338
- sub: [
339
- {
340
- type: 'var',
341
- match: RegExp(`^<[\/!?]?${name}`, 'g'),
342
- sub: [
343
- {
344
- type: 'oper',
345
- match: /^<[\/!?]?/g
346
- }
347
- ]
348
- },
349
- {
350
- type: 'str',
351
- match: /=\s*([^"']\S*|("|')(\\[^]|(?!\2)[^])*\2?)/g,
352
- sub: [
353
- {
354
- type: 'oper',
355
- match: /^=/g
356
- }
357
- ]
358
- },
359
- {
360
- type: 'oper',
361
- match: /[\/!?]?>/g
362
- },
363
- {
364
- type: 'class',
365
- match: RegExp(name, 'g')
366
- }
367
- ]
368
- };
369
- this.languages.xml = {
326
+
327
+ const name = `[:A-Z_a-z@#\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}][:A-Z_a-z@#\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\\-\\.0-9\u{B7}\u{0300}-\u{036F}\u{203F}-\u{2040}]*`
328
+ const properties = `\\s*(\\s+${name}\\s*(=\\s*([^"']\\S*|("|')(\\\\[^]|(?!\\4)[^])*\\4?)?)?\\s*)*`
329
+ const xmlElement = {
330
+ match: RegExp(`<[\/!?]?${name}${properties}[\/!?]?>`, 'g'),
331
+ sub: [
332
+ {
333
+ type: 'var',
334
+ match: RegExp(`^<[\/!?]?${name}`, 'g'),
335
+ sub: [
336
+ {
337
+ type: 'oper',
338
+ match: /^<[\/!?]?/g
339
+ }
340
+ ]
341
+ },
342
+ {
343
+ type: 'str',
344
+ match: /=\s*([^"']\S*|("|')(\\[^]|(?!\2)[^])*\2?)/g,
345
+ sub: [
346
+ {
347
+ type: 'oper',
348
+ match: /^=/g
349
+ }
350
+ ]
351
+ },
352
+ {
353
+ type: 'oper',
354
+ match: /[\/!?]?>/g
355
+ },
356
+ {
357
+ type: 'class',
358
+ match: RegExp(name, 'g')
359
+ }
360
+ ]
361
+ }
362
+
363
+ languages.value.xml = {
370
364
  default: [
371
365
  {
372
366
  match: /<!--((?!-->)[^])*-->/g,
@@ -403,7 +397,7 @@ export default {
403
397
  }
404
398
  ]
405
399
  }
406
- this.languages.html = {
400
+ languages.value.html = {
407
401
  default: [
408
402
  {
409
403
  type: 'class',
@@ -451,10 +445,10 @@ export default {
451
445
  xmlElement
452
446
  ]
453
447
  },
454
- ...this.languages.xml.default
448
+ ...languages.value.xml.default
455
449
  ]
456
450
  }
457
- this.languages.ini = {
451
+ languages.value.ini = {
458
452
  default: [
459
453
  {
460
454
  match: /(^[ \f\t\v]*)[#;].*/gm,
@@ -478,7 +472,7 @@ export default {
478
472
  }
479
473
  ]
480
474
  }
481
- this.languages.todo = {
475
+ languages.value.todo = {
482
476
  type: 'cmnt', default: [
483
477
  {
484
478
  type: 'err',
@@ -498,7 +492,7 @@ export default {
498
492
  }
499
493
  ]
500
494
  }
501
- this.languages.java = {
495
+ languages.value.java = {
502
496
  default: [
503
497
  {
504
498
  match: /\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,
@@ -528,7 +522,8 @@ export default {
528
522
  }
529
523
  ]
530
524
  }
531
- this.languages.js_template_literals = {
525
+
526
+ languages.value.js_template_literals = {
532
527
  type: 'str', default: [
533
528
  {
534
529
  match: new class {
@@ -563,7 +558,8 @@ export default {
563
558
  }
564
559
  ]
565
560
  }
566
- this.languages.js = {
561
+
562
+ languages.value.js = {
567
563
  default: [
568
564
  {
569
565
  match: /\/\*\*((?!\*\/)[^])*(\*\/)?/g,
@@ -613,7 +609,8 @@ export default {
613
609
  }
614
610
  ]
615
611
  }
616
- this.languages.jsdoc = {
612
+
613
+ languages.value.jsdoc = {
617
614
  type: 'cmnt', default: [
618
615
  {
619
616
  type: 'kwd',
@@ -627,10 +624,11 @@ export default {
627
624
  type: 'var',
628
625
  match: /\[[\w\s="']+\]/g
629
626
  },
630
- ...this.languages.todo.default
627
+ ...languages.value.todo.default
631
628
  ]
632
629
  }
633
- this.languages.json = {
630
+
631
+ languages.value.json = {
634
632
  default: [
635
633
  {
636
634
  type: 'var',
@@ -652,7 +650,8 @@ export default {
652
650
  }
653
651
  ]
654
652
  }
655
- this.languages.log = {
653
+
654
+ languages.value.log = {
656
655
  default: [
657
656
  {
658
657
  type: 'cmnt',
@@ -682,7 +681,8 @@ export default {
682
681
  }
683
682
  ]
684
683
  }
685
- this.languages.lua = {
684
+
685
+ languages.value.lua = {
686
686
  default: [
687
687
  {
688
688
  match: /^#!.*|--(\[(=*)\[((?!--\]\2\])[^])*--\]\2\]|.*)/g,
@@ -712,7 +712,8 @@ export default {
712
712
  }
713
713
  ]
714
714
  }
715
- this.languages.make = {
715
+
716
+ languages.value.make = {
716
717
  default: [
717
718
  {
718
719
  match: /^\s*#.*/gm,
@@ -750,7 +751,8 @@ export default {
750
751
  }
751
752
  ]
752
753
  }
753
- this.languages.pl = {
754
+
755
+ languages.value.pl = {
754
756
  default: [
755
757
  {
756
758
  match: /#.*/g,
@@ -777,14 +779,16 @@ export default {
777
779
  }
778
780
  ]
779
781
  }
780
- this.languages.plain = {
782
+
783
+ languages.value.plain = {
781
784
  default: [
782
785
  {
783
786
  expand: 'strDouble'
784
787
  }
785
788
  ]
786
789
  }
787
- this.languages.py = {
790
+
791
+ languages.value.py = {
788
792
  default: [
789
793
  {
790
794
  match: /#.*/g,
@@ -838,7 +842,8 @@ export default {
838
842
  }
839
843
  ]
840
844
  }
841
- this.languages.regex = {
845
+
846
+ languages.value.regex = {
842
847
  type: 'oper', default: [
843
848
  {
844
849
  match: /^(?!\/).*/gm,
@@ -858,7 +863,8 @@ export default {
858
863
  }
859
864
  ]
860
865
  }
861
- this.languages.rs = {
866
+
867
+ languages.value.rs = {
862
868
  default: [
863
869
  {
864
870
  match: /\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,
@@ -888,7 +894,8 @@ export default {
888
894
  }
889
895
  ]
890
896
  }
891
- this.languages.sql = {
897
+
898
+ languages.value.sql = {
892
899
  default: [
893
900
  {
894
901
  match: /--.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,
@@ -923,7 +930,8 @@ export default {
923
930
  }
924
931
  ]
925
932
  }
926
- this.languages.toml = {
933
+
934
+ languages.value.toml = {
927
935
  default: [
928
936
  {
929
937
  match: /#.*/g,
@@ -961,7 +969,8 @@ export default {
961
969
  }
962
970
  ]
963
971
  }
964
- this.languages.ts = {
972
+
973
+ languages.value.ts = {
965
974
  default: [
966
975
  {
967
976
  type: 'type',
@@ -971,10 +980,11 @@ export default {
971
980
  type: 'kwd',
972
981
  match: /\b(type|namespace|typedef|interface|public|private|protected|implements|declare|abstract|readonly)\b/g
973
982
  },
974
- ...this.languages.js.default
983
+ ...languages.value.js.default
975
984
  ]
976
985
  }
977
- this.languages.uri = {
986
+
987
+ languages.value.uri = {
978
988
  default: [
979
989
  {
980
990
  match: /^#.*/gm,
@@ -1002,7 +1012,8 @@ export default {
1002
1012
  }
1003
1013
  ]
1004
1014
  }
1005
- this.languages.yaml = {
1015
+
1016
+ languages.value.yaml = {
1006
1017
  default: [
1007
1018
  {
1008
1019
  match: /#.*/g,
@@ -1036,7 +1047,8 @@ export default {
1036
1047
  }
1037
1048
  ]
1038
1049
  }
1039
- this.languages.http = {
1050
+
1051
+ languages.value.http = {
1040
1052
  default: [
1041
1053
  {
1042
1054
  type: 'kwd',
@@ -1062,71 +1074,80 @@ export default {
1062
1074
  }
1063
1075
  ]
1064
1076
  }
1065
- },
1066
- methods: {
1067
- async highlight(code, lang, hideLineNumbers) {
1068
- let tmp = ''
1069
- await this.tokenize(code, lang, (str, type) => tmp += this.toSpan(this.sanitize(str), type))
1077
+ }
1070
1078
 
1071
- return `<div><div class="highlight-numbers">${'<div></div>'.repeat(!hideLineNumbers && code.split('\n').length)}</div><div>${tmp}</div></div>`
1079
+ const highlight = async (code, lang, hideLineNumbers) => {
1080
+ let tmp = ''
1081
+ await tokenize(code, lang, (str, type) => tmp += toSpan(sanitize(str), type))
1072
1082
 
1073
- },
1074
- async tokenize(src, lang, token) {
1075
- try {
1076
- let m,
1077
- part,
1078
- first = {},
1079
- match,
1080
- cache = [],
1081
- i = 0,
1082
- data = typeof lang === 'string' ? this.languages[lang] : lang,
1083
- arr = [...typeof lang === 'string' ? data.default : lang.sub]
1083
+ return `<div><div class="highlight-numbers">${'<div></div>'.repeat(!hideLineNumbers && code.split('\n').length)}</div><div>${tmp}</div></div>`
1084
+ }
1084
1085
 
1085
- while (i < src.length) {
1086
- first.index = null
1087
- for (m = arr.length; m-- > 0;) {
1088
- part = arr[m].expand ? this.expandData[arr[m].expand] : arr[m]
1089
- // do not call again exec if the previous result is sufficient
1090
- if (cache[m] === undefined || cache[m].match.index < i) {
1091
- part.match.lastIndex = i
1092
- match = part.match.exec(src)
1093
- if (match === null) {
1094
- // no more match with this regex can be disposed
1095
- arr.splice(m, 1)
1096
- cache.splice(m, 1)
1097
- continue
1098
- }
1099
- // save match for later use to decrease performance cost
1100
- cache[m] = {match, lastIndex: part.match.lastIndex}
1086
+ const tokenize = async (src, lang, token) => {
1087
+ try {
1088
+ let m,
1089
+ part,
1090
+ first = {},
1091
+ match,
1092
+ cache = [],
1093
+ i = 0,
1094
+ data = typeof lang === 'string' ? languages.value[lang] : lang,
1095
+ arr = [...typeof lang === 'string' ? data.default : lang.sub]
1096
+
1097
+ while (i < src.length) {
1098
+ first.index = null
1099
+ for (m = arr.length; m-- > 0;) {
1100
+ part = arr[m].expand ? expandData[arr[m].expand] : arr[m]
1101
+ if (cache[m] === undefined || cache[m].match.index < i) {
1102
+ part.match.lastIndex = i
1103
+ match = part.match.exec(src)
1104
+ if (match === null) {
1105
+ arr.splice(m, 1)
1106
+ cache.splice(m, 1)
1107
+ continue
1101
1108
  }
1102
- // check if it the first match in the string
1103
- if (cache[m].match[0] && (cache[m].match.index <= first.index || first.index === null))
1104
- first = {
1105
- part: part,
1106
- index: cache[m].match.index,
1107
- match: cache[m].match[0],
1108
- end: cache[m].lastIndex
1109
- }
1109
+ cache[m] = {match, lastIndex: part.match.lastIndex}
1110
1110
  }
1111
- if (first.index === null)
1112
- break
1113
- token(src.slice(i, first.index), data.type)
1114
- i = first.end
1115
- if (first.part.sub)
1116
- await this.tokenize(first.match, typeof first.part.sub === 'string' ? first.part.sub : (typeof first.part.sub === 'function' ? first.part.sub(first.match) : first.part), token)
1117
- else
1118
- token(first.match, first.part.type)
1111
+ if (cache[m].match[0] && (cache[m].match.index <= first.index || first.index === null))
1112
+ first = {
1113
+ part: part,
1114
+ index: cache[m].match.index,
1115
+ match: cache[m].match[0],
1116
+ end: cache[m].lastIndex
1117
+ }
1119
1118
  }
1120
- token(src.slice(i, src.length), data.type)
1121
- } catch {
1122
- token(src)
1119
+ if (first.index === null)
1120
+ break
1121
+ token(src.slice(i, first.index), data.type)
1122
+ i = first.end
1123
+ if (first.part.sub)
1124
+ await tokenize(first.match, typeof first.part.sub === 'string' ? first.part.sub : (typeof first.part.sub === 'function' ? first.part.sub(first.match) : first.part), token)
1125
+ else
1126
+ token(first.match, first.part.type)
1123
1127
  }
1124
- },
1125
- toSpan(str, token) {
1126
- return token ? `<span class="highlight-syn-${token}">${str}</span>` : str
1127
- },
1128
- sanitize(str = '') {
1129
- return str.replaceAll('&', '&#38;').replaceAll?.('<', '&lt;').replaceAll?.('>', '&gt;')
1128
+ token(src.slice(i, src.length), data.type)
1129
+ } catch {
1130
+ token(src)
1130
1131
  }
1131
1132
  }
1132
- }
1133
+
1134
+ const toSpan = (str, token) => {
1135
+ return token ? `<span class="highlight-syn-${token}">${str}</span>` : str
1136
+ }
1137
+
1138
+ const sanitize = (str = '') => {
1139
+ return str.replaceAll('&', '&#38;').replaceAll?.('<', '&lt;').replaceAll?.('>', '&gt;')
1140
+ }
1141
+
1142
+ initLanguages()
1143
+
1144
+ return {
1145
+ expandData,
1146
+ languages,
1147
+ highlight,
1148
+ tokenize,
1149
+ toSpan,
1150
+ sanitize,
1151
+ initLanguages
1152
+ }
1153
+ }