@threadlabs/looma 0.18.5 → 0.19.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 (215) hide show
  1. package/components/ui-editor-table-overlay/ui-editor-table-overlay.html +34 -3
  2. package/components/ui-editor-table-overlay/ui-editor-table-overlay.js +55 -0
  3. package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.html +7 -2
  4. package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.js +29 -0
  5. package/dist/index.js +1 -1
  6. package/editor/chunks/extensions.js +39 -3
  7. package/editor/extensions/preset.d.ts +2 -0
  8. package/editor/extensions/table-commands.d.ts +1 -1
  9. package/editor/table-overlay.d.ts +8 -3
  10. package/package.json +2 -1
  11. package/styles/ui-editor-table-overlay.css +30 -0
  12. package/styles/ui-editor-table-toolbar.css +7 -2
  13. package/vanilla/UiEditorTableOverlay.d.ts +1 -1
  14. package/vanilla/UiEditorTableOverlay.js +9 -3
  15. package/vue/UiEditorTableOverlay.d.ts +8 -0
  16. package/vue/UiEditorTableOverlay.vue +45 -2
  17. package/vue/UiEditorTableToolbar.vue +7 -2
  18. package/vue/chunks/1c.js +106 -0
  19. package/vue/chunks/UiEditorTableOverlay.js +14 -4
  20. package/vue/chunks/UiEditorTableToolbar.js +1 -1
  21. package/vue/chunks/abnf.js +61 -0
  22. package/vue/chunks/accesslog.js +72 -0
  23. package/vue/chunks/actionscript.js +139 -0
  24. package/vue/chunks/ada.js +183 -0
  25. package/vue/chunks/angelscript.js +141 -0
  26. package/vue/chunks/apache.js +88 -0
  27. package/vue/chunks/applescript.js +99 -0
  28. package/vue/chunks/arcade.js +405 -0
  29. package/vue/chunks/arduino.js +871 -0
  30. package/vue/chunks/armasm.js +65 -0
  31. package/vue/chunks/asciidoc.js +181 -0
  32. package/vue/chunks/aspectj.js +202 -0
  33. package/vue/chunks/autohotkey.js +54 -0
  34. package/vue/chunks/autoit.js +132 -0
  35. package/vue/chunks/avrasm.js +46 -0
  36. package/vue/chunks/awk.js +58 -0
  37. package/vue/chunks/axapta.js +167 -0
  38. package/vue/chunks/bash.js +358 -0
  39. package/vue/chunks/basic.js +221 -0
  40. package/vue/chunks/bnf.js +27 -0
  41. package/vue/chunks/brainfuck.js +40 -0
  42. package/vue/chunks/c.js +265 -0
  43. package/vue/chunks/cal.js +136 -0
  44. package/vue/chunks/capnproto.js +86 -0
  45. package/vue/chunks/ceylon.js +125 -0
  46. package/vue/chunks/clean.js +54 -0
  47. package/vue/chunks/clojure-repl.js +17 -0
  48. package/vue/chunks/clojure.js +133 -0
  49. package/vue/chunks/cmake.js +23 -0
  50. package/vue/chunks/coffeescript.js +291 -0
  51. package/vue/chunks/coq.js +436 -0
  52. package/vue/chunks/cos.js +77 -0
  53. package/vue/chunks/cpp.js +492 -0
  54. package/vue/chunks/crmsh.js +80 -0
  55. package/vue/chunks/crystal.js +260 -0
  56. package/vue/chunks/csharp.js +376 -0
  57. package/vue/chunks/csp.js +52 -0
  58. package/vue/chunks/css.js +890 -0
  59. package/vue/chunks/d.js +184 -0
  60. package/vue/chunks/dart.js +226 -0
  61. package/vue/chunks/delphi.js +227 -0
  62. package/vue/chunks/diff.js +40 -0
  63. package/vue/chunks/django.js +43 -0
  64. package/vue/chunks/dns.js +66 -0
  65. package/vue/chunks/dockerfile.js +35 -0
  66. package/vue/chunks/dos.js +147 -0
  67. package/vue/chunks/dsconfig.js +55 -0
  68. package/vue/chunks/dts.js +119 -0
  69. package/vue/chunks/dust.js +33 -0
  70. package/vue/chunks/ebnf.js +40 -0
  71. package/vue/chunks/elixir.js +241 -0
  72. package/vue/chunks/elm.js +103 -0
  73. package/vue/chunks/erb.js +17 -0
  74. package/vue/chunks/erlang-repl.js +41 -0
  75. package/vue/chunks/erlang.js +236 -0
  76. package/vue/chunks/excel.js +562 -0
  77. package/vue/chunks/fix.js +30 -0
  78. package/vue/chunks/flix.js +60 -0
  79. package/vue/chunks/fortran.js +543 -0
  80. package/vue/chunks/fsharp.js +440 -0
  81. package/vue/chunks/gams.js +134 -0
  82. package/vue/chunks/gauss.js +167 -0
  83. package/vue/chunks/gcode.js +131 -0
  84. package/vue/chunks/gherkin.js +41 -0
  85. package/vue/chunks/glsl.js +25 -0
  86. package/vue/chunks/gml.js +3119 -0
  87. package/vue/chunks/go.js +140 -0
  88. package/vue/chunks/golo.js +72 -0
  89. package/vue/chunks/gradle.js +181 -0
  90. package/vue/chunks/graphql.js +68 -0
  91. package/vue/chunks/groovy.js +159 -0
  92. package/vue/chunks/haml.js +96 -0
  93. package/vue/chunks/handlebars.js +191 -0
  94. package/vue/chunks/haskell.js +149 -0
  95. package/vue/chunks/haxe.js +142 -0
  96. package/vue/chunks/hsp.js +45 -0
  97. package/vue/chunks/http.js +77 -0
  98. package/vue/chunks/hy.js +92 -0
  99. package/vue/chunks/inform7.js +45 -0
  100. package/vue/chunks/ini.js +94 -0
  101. package/vue/chunks/irpf90.js +52 -0
  102. package/vue/chunks/isbl.js +112 -0
  103. package/vue/chunks/java.js +237 -0
  104. package/vue/chunks/javascript.js +570 -0
  105. package/vue/chunks/jboss-cli.js +46 -0
  106. package/vue/chunks/json.js +45 -0
  107. package/vue/chunks/julia-repl.js +18 -0
  108. package/vue/chunks/julia.js +353 -0
  109. package/vue/chunks/kotlin.js +216 -0
  110. package/vue/chunks/lasso.js +127 -0
  111. package/vue/chunks/latex.js +206 -0
  112. package/vue/chunks/ldif.js +25 -0
  113. package/vue/chunks/leaf.js +72 -0
  114. package/vue/chunks/less.js +953 -0
  115. package/vue/chunks/lisp.js +119 -0
  116. package/vue/chunks/livecodeserver.js +86 -0
  117. package/vue/chunks/livescript.js +309 -0
  118. package/vue/chunks/llvm.js +77 -0
  119. package/vue/chunks/lsl.js +55 -0
  120. package/vue/chunks/lua.js +49 -0
  121. package/vue/chunks/makefile.js +62 -0
  122. package/vue/chunks/markdown.js +194 -0
  123. package/vue/chunks/mathematica.js +7317 -0
  124. package/vue/chunks/matlab.js +70 -0
  125. package/vue/chunks/maxima.js +38 -0
  126. package/vue/chunks/mel.js +24 -0
  127. package/vue/chunks/mercury.js +62 -0
  128. package/vue/chunks/mipsasm.js +53 -0
  129. package/vue/chunks/mizar.js +10 -0
  130. package/vue/chunks/mojolicious.js +27 -0
  131. package/vue/chunks/monkey.js +158 -0
  132. package/vue/chunks/moonscript.js +102 -0
  133. package/vue/chunks/n1ql.js +346 -0
  134. package/vue/chunks/nestedtext.js +66 -0
  135. package/vue/chunks/nginx.js +127 -0
  136. package/vue/chunks/nim.js +174 -0
  137. package/vue/chunks/nix.js +334 -0
  138. package/vue/chunks/node-repl.js +20 -0
  139. package/vue/chunks/nsis.js +515 -0
  140. package/vue/chunks/objectivec.js +235 -0
  141. package/vue/chunks/ocaml.js +52 -0
  142. package/vue/chunks/openscad.js +66 -0
  143. package/vue/chunks/oxygene.js +58 -0
  144. package/vue/chunks/parser3.js +40 -0
  145. package/vue/chunks/perl.js +454 -0
  146. package/vue/chunks/pf.js +30 -0
  147. package/vue/chunks/pgsql.js +196 -0
  148. package/vue/chunks/php-template.js +43 -0
  149. package/vue/chunks/php.js +527 -0
  150. package/vue/chunks/plaintext.js +10 -0
  151. package/vue/chunks/pony.js +60 -0
  152. package/vue/chunks/powershell.js +208 -0
  153. package/vue/chunks/processing.js +407 -0
  154. package/vue/chunks/profile.js +38 -0
  155. package/vue/chunks/prolog.js +62 -0
  156. package/vue/chunks/properties.js +45 -0
  157. package/vue/chunks/protobuf.js +63 -0
  158. package/vue/chunks/puppet.js +87 -0
  159. package/vue/chunks/purebasic.js +42 -0
  160. package/vue/chunks/python-repl.js +19 -0
  161. package/vue/chunks/python.js +357 -0
  162. package/vue/chunks/q.js +21 -0
  163. package/vue/chunks/qml.js +134 -0
  164. package/vue/chunks/r.js +145 -0
  165. package/vue/chunks/reasonml.js +134 -0
  166. package/vue/chunks/rib.js +16 -0
  167. package/vue/chunks/roboconf.js +54 -0
  168. package/vue/chunks/routeros.js +109 -0
  169. package/vue/chunks/rsl.js +138 -0
  170. package/vue/chunks/ruby.js +322 -0
  171. package/vue/chunks/ruleslanguage.js +26 -0
  172. package/vue/chunks/rust.js +296 -0
  173. package/vue/chunks/sas.js +533 -0
  174. package/vue/chunks/scala.js +173 -0
  175. package/vue/chunks/scheme.js +118 -0
  176. package/vue/chunks/scilab.js +45 -0
  177. package/vue/chunks/scss.js +900 -0
  178. package/vue/chunks/shell.js +18 -0
  179. package/vue/chunks/smali.js +113 -0
  180. package/vue/chunks/smalltalk.js +59 -0
  181. package/vue/chunks/sml.js +49 -0
  182. package/vue/chunks/sqf.js +2599 -0
  183. package/vue/chunks/sql.js +624 -0
  184. package/vue/chunks/stan.js +471 -0
  185. package/vue/chunks/stata.js +33 -0
  186. package/vue/chunks/step21.js +53 -0
  187. package/vue/chunks/stylus.js +925 -0
  188. package/vue/chunks/subunit.js +34 -0
  189. package/vue/chunks/swift.js +699 -0
  190. package/vue/chunks/taggerscript.js +37 -0
  191. package/vue/chunks/tap.js +30 -0
  192. package/vue/chunks/tcl.js +165 -0
  193. package/vue/chunks/thrift.js +65 -0
  194. package/vue/chunks/tp.js +155 -0
  195. package/vue/chunks/twig.js +232 -0
  196. package/vue/chunks/typescript.js +672 -0
  197. package/vue/chunks/vala.js +39 -0
  198. package/vue/chunks/vbnet.js +86 -0
  199. package/vue/chunks/vbscript-html.js +14 -0
  200. package/vue/chunks/vbscript.js +200 -0
  201. package/vue/chunks/verilog.js +534 -0
  202. package/vue/chunks/vhdl.js +190 -0
  203. package/vue/chunks/vim.js +54 -0
  204. package/vue/chunks/wasm.js +111 -0
  205. package/vue/chunks/wren.js +229 -0
  206. package/vue/chunks/x86asm.js +64 -0
  207. package/vue/chunks/xl.js +192 -0
  208. package/vue/chunks/xml.js +175 -0
  209. package/vue/chunks/xquery.js +303 -0
  210. package/vue/chunks/yaml.js +159 -0
  211. package/vue/chunks/zephir.js +74 -0
  212. package/vue/components.css +119 -85
  213. package/vue/editor/LoomaEditor.d.ts +7 -7
  214. package/vue/editor/code-language-catalog.d.ts +196 -0
  215. package/vue/editor/index.js +290 -20
@@ -0,0 +1,34 @@
1
+ //#region ../../node_modules/.pnpm/highlight.js@11.11.2/node_modules/highlight.js/es/languages/subunit.js
2
+ function subunit(hljs) {
3
+ return {
4
+ name: "SubUnit",
5
+ case_insensitive: true,
6
+ contains: [
7
+ {
8
+ className: "string",
9
+ begin: "\\[\n(multipart)?",
10
+ end: "\\]\n"
11
+ },
12
+ {
13
+ className: "string",
14
+ begin: "\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z"
15
+ },
16
+ {
17
+ className: "string",
18
+ begin: "(\\+|-)\\d+"
19
+ },
20
+ {
21
+ className: "keyword",
22
+ relevance: 10,
23
+ variants: [
24
+ { begin: "^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?" },
25
+ { begin: "^progress(:?)(\\s+)?(pop|push)?" },
26
+ { begin: "^tags:" },
27
+ { begin: "^time:" }
28
+ ]
29
+ }
30
+ ]
31
+ };
32
+ }
33
+ //#endregion
34
+ export { subunit as default };
@@ -0,0 +1,699 @@
1
+ //#region ../../node_modules/.pnpm/highlight.js@11.11.2/node_modules/highlight.js/es/languages/swift.js
2
+ /**
3
+ * @param {string} value
4
+ * @returns {RegExp}
5
+ * */
6
+ /**
7
+ * @param {RegExp | string } re
8
+ * @returns {string}
9
+ */
10
+ function source(re) {
11
+ if (!re) return null;
12
+ if (typeof re === "string") return re;
13
+ return re.source;
14
+ }
15
+ /**
16
+ * @param {RegExp | string } re
17
+ * @returns {string}
18
+ */
19
+ function lookahead(re) {
20
+ return concat("(?=", re, ")");
21
+ }
22
+ /**
23
+ * @param {...(RegExp | string) } args
24
+ * @returns {string}
25
+ */
26
+ function concat(...args) {
27
+ return args.map((x) => source(x)).join("");
28
+ }
29
+ /**
30
+ * @param { Array<string | RegExp | Object> } args
31
+ * @returns {object}
32
+ */
33
+ function stripOptionsFromArgs(args) {
34
+ const opts = args[args.length - 1];
35
+ if (typeof opts === "object" && opts.constructor === Object) {
36
+ args.splice(args.length - 1, 1);
37
+ return opts;
38
+ } else return {};
39
+ }
40
+ /** @typedef { {capture?: boolean} } RegexEitherOptions */
41
+ /**
42
+ * Any of the passed expresssions may match
43
+ *
44
+ * Creates a huge this | this | that | that match
45
+ * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args
46
+ * @returns {string}
47
+ */
48
+ function either(...args) {
49
+ return "(" + (stripOptionsFromArgs(args).capture ? "" : "?:") + args.map((x) => source(x)).join("|") + ")";
50
+ }
51
+ var keywordWrapper = (keyword) => concat(/\b/, keyword, /\w$/.test(keyword) ? /\b/ : /\B/);
52
+ var dotKeywords = ["Protocol", "Type"].map(keywordWrapper);
53
+ var optionalDotKeywords = ["init", "self"].map(keywordWrapper);
54
+ var keywordTypes = ["Any", "Self"];
55
+ var keywords = [
56
+ "actor",
57
+ "any",
58
+ "associatedtype",
59
+ "async",
60
+ "await",
61
+ /as\?/,
62
+ /as!/,
63
+ "as",
64
+ "borrowing",
65
+ "break",
66
+ "case",
67
+ "catch",
68
+ "class",
69
+ "consume",
70
+ "consuming",
71
+ "continue",
72
+ "convenience",
73
+ "copy",
74
+ "default",
75
+ "defer",
76
+ "deinit",
77
+ "didSet",
78
+ "distributed",
79
+ "do",
80
+ "dynamic",
81
+ "each",
82
+ "else",
83
+ "enum",
84
+ "extension",
85
+ "fallthrough",
86
+ /fileprivate\(set\)/,
87
+ "fileprivate",
88
+ "final",
89
+ "for",
90
+ "func",
91
+ "get",
92
+ "guard",
93
+ "if",
94
+ "import",
95
+ "indirect",
96
+ "infix",
97
+ /init\?/,
98
+ /init!/,
99
+ "inout",
100
+ /internal\(set\)/,
101
+ "internal",
102
+ "in",
103
+ "is",
104
+ "isolated",
105
+ "nonisolated",
106
+ "lazy",
107
+ "let",
108
+ "macro",
109
+ "mutating",
110
+ "nonmutating",
111
+ /open\(set\)/,
112
+ "open",
113
+ "operator",
114
+ "optional",
115
+ "override",
116
+ "package",
117
+ "postfix",
118
+ "precedencegroup",
119
+ "prefix",
120
+ /private\(set\)/,
121
+ "private",
122
+ "protocol",
123
+ /public\(set\)/,
124
+ "public",
125
+ "repeat",
126
+ "required",
127
+ "rethrows",
128
+ "return",
129
+ "set",
130
+ "some",
131
+ "static",
132
+ "struct",
133
+ "subscript",
134
+ "super",
135
+ "switch",
136
+ "throws",
137
+ "throw",
138
+ /try\?/,
139
+ /try!/,
140
+ "try",
141
+ "typealias",
142
+ /unowned\(safe\)/,
143
+ /unowned\(unsafe\)/,
144
+ "unowned",
145
+ "var",
146
+ "weak",
147
+ "where",
148
+ "while",
149
+ "willSet"
150
+ ];
151
+ var literals = [
152
+ "false",
153
+ "nil",
154
+ "true"
155
+ ];
156
+ var precedencegroupKeywords = [
157
+ "assignment",
158
+ "associativity",
159
+ "higherThan",
160
+ "left",
161
+ "lowerThan",
162
+ "none",
163
+ "right"
164
+ ];
165
+ var numberSignKeywords = [
166
+ "#colorLiteral",
167
+ "#column",
168
+ "#dsohandle",
169
+ "#else",
170
+ "#elseif",
171
+ "#endif",
172
+ "#error",
173
+ "#file",
174
+ "#fileID",
175
+ "#fileLiteral",
176
+ "#filePath",
177
+ "#function",
178
+ "#if",
179
+ "#imageLiteral",
180
+ "#keyPath",
181
+ "#line",
182
+ "#selector",
183
+ "#sourceLocation",
184
+ "#warning"
185
+ ];
186
+ var builtIns = [
187
+ "abs",
188
+ "all",
189
+ "any",
190
+ "assert",
191
+ "assertionFailure",
192
+ "debugPrint",
193
+ "dump",
194
+ "fatalError",
195
+ "getVaList",
196
+ "isKnownUniquelyReferenced",
197
+ "max",
198
+ "min",
199
+ "numericCast",
200
+ "pointwiseMax",
201
+ "pointwiseMin",
202
+ "precondition",
203
+ "preconditionFailure",
204
+ "print",
205
+ "readLine",
206
+ "repeatElement",
207
+ "sequence",
208
+ "stride",
209
+ "swap",
210
+ "swift_unboxFromSwiftValueWithType",
211
+ "transcode",
212
+ "type",
213
+ "unsafeBitCast",
214
+ "unsafeDowncast",
215
+ "withExtendedLifetime",
216
+ "withUnsafeMutablePointer",
217
+ "withUnsafePointer",
218
+ "withVaList",
219
+ "withoutActuallyEscaping",
220
+ "zip"
221
+ ];
222
+ var operatorHead = either(/[/=\-+!*%<>&|^~?]/, /[\u00A1-\u00A7]/, /[\u00A9\u00AB]/, /[\u00AC\u00AE]/, /[\u00B0\u00B1]/, /[\u00B6\u00BB\u00BF\u00D7\u00F7]/, /[\u2016-\u2017]/, /[\u2020-\u2027]/, /[\u2030-\u203E]/, /[\u2041-\u2053]/, /[\u2055-\u205E]/, /[\u2190-\u23FF]/, /[\u2500-\u2775]/, /[\u2794-\u2BFF]/, /[\u2E00-\u2E7F]/, /[\u3001-\u3003]/, /[\u3008-\u3020]/, /[\u3030]/);
223
+ var operatorCharacter = either(operatorHead, /[\u0300-\u036F]/, /[\u1DC0-\u1DFF]/, /[\u20D0-\u20FF]/, /[\uFE00-\uFE0F]/, /[\uFE20-\uFE2F]/);
224
+ var operator = concat(operatorHead, operatorCharacter, "*");
225
+ var identifierHead = either(/[a-zA-Z_]/, /[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/, /[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/, /[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/, /[\u1E00-\u1FFF]/, /[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/, /[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/, /[\u2C00-\u2DFF\u2E80-\u2FFF]/, /[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/, /[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/, /[\uFE47-\uFEFE\uFF00-\uFFFD]/);
226
+ var identifierCharacter = either(identifierHead, /\d/, /[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/);
227
+ var identifier = concat(identifierHead, identifierCharacter, "*");
228
+ var typeIdentifier = concat(/[A-Z]/, identifierCharacter, "*");
229
+ var keywordAttributes = [
230
+ "attached",
231
+ "autoclosure",
232
+ concat(/convention\(/, either("swift", "block", "c"), /\)/),
233
+ "discardableResult",
234
+ "dynamicCallable",
235
+ "dynamicMemberLookup",
236
+ "escaping",
237
+ "freestanding",
238
+ "frozen",
239
+ "GKInspectable",
240
+ "IBAction",
241
+ "IBDesignable",
242
+ "IBInspectable",
243
+ "IBOutlet",
244
+ "IBSegueAction",
245
+ "inlinable",
246
+ "main",
247
+ "nonobjc",
248
+ "NSApplicationMain",
249
+ "NSCopying",
250
+ "NSManaged",
251
+ concat(/objc\(/, identifier, /\)/),
252
+ "objc",
253
+ "objcMembers",
254
+ "propertyWrapper",
255
+ "requires_stored_property_inits",
256
+ "resultBuilder",
257
+ "Sendable",
258
+ "testable",
259
+ "UIApplicationMain",
260
+ "unchecked",
261
+ "unknown",
262
+ "usableFromInline",
263
+ "warn_unqualified_access"
264
+ ];
265
+ var availabilityKeywords = [
266
+ "iOS",
267
+ "iOSApplicationExtension",
268
+ "macOS",
269
+ "macOSApplicationExtension",
270
+ "macCatalyst",
271
+ "macCatalystApplicationExtension",
272
+ "watchOS",
273
+ "watchOSApplicationExtension",
274
+ "tvOS",
275
+ "tvOSApplicationExtension",
276
+ "swift"
277
+ ];
278
+ /** @type LanguageFn */
279
+ function swift(hljs) {
280
+ const WHITESPACE = {
281
+ match: /\s+/,
282
+ relevance: 0
283
+ };
284
+ const BLOCK_COMMENT = hljs.COMMENT("/\\*", "\\*/", { contains: ["self"] });
285
+ const COMMENTS = [hljs.C_LINE_COMMENT_MODE, BLOCK_COMMENT];
286
+ const DOT_KEYWORD = {
287
+ match: [/\./, either(...dotKeywords, ...optionalDotKeywords)],
288
+ className: { 2: "keyword" }
289
+ };
290
+ const KEYWORD_GUARD = {
291
+ match: concat(/\./, either(...keywords)),
292
+ relevance: 0
293
+ };
294
+ const PLAIN_KEYWORDS = keywords.filter((kw) => typeof kw === "string").concat(["_|0"]);
295
+ const KEYWORD = { variants: [{
296
+ className: "keyword",
297
+ match: either(...keywords.filter((kw) => typeof kw !== "string").concat(keywordTypes).map(keywordWrapper), ...optionalDotKeywords)
298
+ }] };
299
+ const KEYWORDS = {
300
+ $pattern: either(/\b\w+/, /#\w+/),
301
+ keyword: PLAIN_KEYWORDS.concat(numberSignKeywords),
302
+ literal: literals
303
+ };
304
+ const KEYWORD_MODES = [
305
+ DOT_KEYWORD,
306
+ KEYWORD_GUARD,
307
+ KEYWORD
308
+ ];
309
+ const BUILT_INS = [{
310
+ match: concat(/\./, either(...builtIns)),
311
+ relevance: 0
312
+ }, {
313
+ className: "built_in",
314
+ match: concat(/\b/, either(...builtIns), /(?=\()/)
315
+ }];
316
+ const OPERATOR_GUARD = {
317
+ match: /->/,
318
+ relevance: 0
319
+ };
320
+ const OPERATORS = [OPERATOR_GUARD, {
321
+ className: "operator",
322
+ relevance: 0,
323
+ variants: [{ match: operator }, { match: `\\.(\\.|${operatorCharacter})+` }]
324
+ }];
325
+ const decimalDigits = "([0-9]_*)+";
326
+ const hexDigits = "([0-9a-fA-F]_*)+";
327
+ const NUMBER = {
328
+ className: "number",
329
+ relevance: 0,
330
+ variants: [
331
+ { match: `\\b(${decimalDigits})(\\.(${decimalDigits}))?([eE][+-]?(${decimalDigits}))?\\b` },
332
+ { match: `\\b0x(${hexDigits})(\\.(${hexDigits}))?([pP][+-]?(${decimalDigits}))?\\b` },
333
+ { match: /\b0o([0-7]_*)+\b/ },
334
+ { match: /\b0b([01]_*)+\b/ }
335
+ ]
336
+ };
337
+ const ESCAPED_CHARACTER = (rawDelimiter = "") => ({
338
+ className: "subst",
339
+ variants: [{ match: concat(/\\/, rawDelimiter, /[0\\tnr"']/) }, { match: concat(/\\/, rawDelimiter, /u\{[0-9a-fA-F]{1,8}\}/) }]
340
+ });
341
+ const ESCAPED_NEWLINE = (rawDelimiter = "") => ({
342
+ className: "subst",
343
+ match: concat(/\\/, rawDelimiter, /[\t ]*(?:[\r\n]|\r\n)/)
344
+ });
345
+ const INTERPOLATION = (rawDelimiter = "") => ({
346
+ className: "subst",
347
+ label: "interpol",
348
+ begin: concat(/\\/, rawDelimiter, /\(/),
349
+ end: /\)/
350
+ });
351
+ const MULTILINE_STRING = (rawDelimiter = "") => ({
352
+ begin: concat(rawDelimiter, /"""/),
353
+ end: concat(/"""/, rawDelimiter),
354
+ contains: [
355
+ ESCAPED_CHARACTER(rawDelimiter),
356
+ ESCAPED_NEWLINE(rawDelimiter),
357
+ INTERPOLATION(rawDelimiter)
358
+ ]
359
+ });
360
+ const SINGLE_LINE_STRING = (rawDelimiter = "") => ({
361
+ begin: concat(rawDelimiter, /"/),
362
+ end: concat(/"/, rawDelimiter),
363
+ contains: [ESCAPED_CHARACTER(rawDelimiter), INTERPOLATION(rawDelimiter)]
364
+ });
365
+ const STRING = {
366
+ className: "string",
367
+ variants: [
368
+ MULTILINE_STRING(),
369
+ MULTILINE_STRING("#"),
370
+ MULTILINE_STRING("##"),
371
+ MULTILINE_STRING("###"),
372
+ SINGLE_LINE_STRING(),
373
+ SINGLE_LINE_STRING("#"),
374
+ SINGLE_LINE_STRING("##"),
375
+ SINGLE_LINE_STRING("###")
376
+ ]
377
+ };
378
+ const REGEXP_CONTENTS = [hljs.BACKSLASH_ESCAPE, {
379
+ begin: /\[/,
380
+ end: /\]/,
381
+ relevance: 0,
382
+ contains: [hljs.BACKSLASH_ESCAPE]
383
+ }];
384
+ const BARE_REGEXP_LITERAL = {
385
+ begin: /\/[^\s](?=[^/\n]*\/)/,
386
+ end: /\//,
387
+ contains: REGEXP_CONTENTS
388
+ };
389
+ const EXTENDED_REGEXP_LITERAL = (rawDelimiter) => {
390
+ const begin = concat(rawDelimiter, /\//);
391
+ const end = concat(/\//, rawDelimiter);
392
+ return {
393
+ begin,
394
+ end,
395
+ contains: [...REGEXP_CONTENTS, {
396
+ scope: "comment",
397
+ begin: `#(?!.*${end})`,
398
+ end: /$/
399
+ }]
400
+ };
401
+ };
402
+ const REGEXP = {
403
+ scope: "regexp",
404
+ variants: [
405
+ EXTENDED_REGEXP_LITERAL("###"),
406
+ EXTENDED_REGEXP_LITERAL("##"),
407
+ EXTENDED_REGEXP_LITERAL("#"),
408
+ BARE_REGEXP_LITERAL
409
+ ]
410
+ };
411
+ const QUOTED_IDENTIFIER = { match: concat(/`/, identifier, /`/) };
412
+ const IDENTIFIERS = [
413
+ QUOTED_IDENTIFIER,
414
+ {
415
+ className: "variable",
416
+ match: /\$\d+/
417
+ },
418
+ {
419
+ className: "variable",
420
+ match: `\\$${identifierCharacter}+`
421
+ }
422
+ ];
423
+ const ATTRIBUTES = [
424
+ {
425
+ match: /(@|#(un)?)available/,
426
+ scope: "keyword",
427
+ starts: { contains: [{
428
+ begin: /\(/,
429
+ end: /\)/,
430
+ keywords: availabilityKeywords,
431
+ contains: [
432
+ ...OPERATORS,
433
+ NUMBER,
434
+ STRING
435
+ ]
436
+ }] }
437
+ },
438
+ {
439
+ scope: "keyword",
440
+ match: concat(/@/, either(...keywordAttributes), lookahead(either(/\(/, /\s+/)))
441
+ },
442
+ {
443
+ scope: "meta",
444
+ match: concat(/@/, identifier)
445
+ }
446
+ ];
447
+ const TYPE = {
448
+ match: lookahead(/\b[A-Z]/),
449
+ relevance: 0,
450
+ contains: [
451
+ {
452
+ className: "type",
453
+ match: concat(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/, identifierCharacter, "+")
454
+ },
455
+ {
456
+ className: "type",
457
+ match: typeIdentifier,
458
+ relevance: 0
459
+ },
460
+ {
461
+ match: /[?!]+/,
462
+ relevance: 0
463
+ },
464
+ {
465
+ match: /\.\.\./,
466
+ relevance: 0
467
+ },
468
+ {
469
+ match: concat(/\s+&\s+/, lookahead(typeIdentifier)),
470
+ relevance: 0
471
+ }
472
+ ]
473
+ };
474
+ const GENERIC_ARGUMENTS = {
475
+ begin: /</,
476
+ end: />/,
477
+ keywords: KEYWORDS,
478
+ contains: [
479
+ ...COMMENTS,
480
+ ...KEYWORD_MODES,
481
+ ...ATTRIBUTES,
482
+ OPERATOR_GUARD,
483
+ TYPE
484
+ ]
485
+ };
486
+ TYPE.contains.push(GENERIC_ARGUMENTS);
487
+ const TUPLE = {
488
+ begin: /\(/,
489
+ end: /\)/,
490
+ relevance: 0,
491
+ keywords: KEYWORDS,
492
+ contains: [
493
+ "self",
494
+ {
495
+ match: concat(identifier, /\s*:/),
496
+ keywords: "_|0",
497
+ relevance: 0
498
+ },
499
+ ...COMMENTS,
500
+ REGEXP,
501
+ ...KEYWORD_MODES,
502
+ ...BUILT_INS,
503
+ ...OPERATORS,
504
+ NUMBER,
505
+ STRING,
506
+ ...IDENTIFIERS,
507
+ ...ATTRIBUTES,
508
+ TYPE
509
+ ]
510
+ };
511
+ const GENERIC_PARAMETERS = {
512
+ begin: /</,
513
+ end: />/,
514
+ keywords: "repeat each",
515
+ contains: [...COMMENTS, TYPE]
516
+ };
517
+ const FUNCTION_PARAMETERS = {
518
+ begin: /\(/,
519
+ end: /\)/,
520
+ keywords: KEYWORDS,
521
+ contains: [
522
+ {
523
+ begin: either(lookahead(concat(identifier, /\s*:/)), lookahead(concat(identifier, /\s+/, identifier, /\s*:/))),
524
+ end: /:/,
525
+ relevance: 0,
526
+ contains: [{
527
+ className: "keyword",
528
+ match: /\b_\b/
529
+ }, {
530
+ className: "params",
531
+ match: identifier
532
+ }]
533
+ },
534
+ ...COMMENTS,
535
+ ...KEYWORD_MODES,
536
+ ...OPERATORS,
537
+ NUMBER,
538
+ STRING,
539
+ ...ATTRIBUTES,
540
+ TYPE,
541
+ TUPLE
542
+ ],
543
+ endsParent: true,
544
+ illegal: /["']/
545
+ };
546
+ const FUNCTION_OR_MACRO = {
547
+ match: [
548
+ /(func|macro)/,
549
+ /\s+/,
550
+ either(QUOTED_IDENTIFIER.match, identifier, operator)
551
+ ],
552
+ className: {
553
+ 1: "keyword",
554
+ 3: "title.function"
555
+ },
556
+ contains: [
557
+ GENERIC_PARAMETERS,
558
+ FUNCTION_PARAMETERS,
559
+ WHITESPACE
560
+ ],
561
+ illegal: [/\[/, /%/]
562
+ };
563
+ const INIT_SUBSCRIPT = {
564
+ match: [/\b(?:subscript|init[?!]?)/, /\s*(?=[<(])/],
565
+ className: { 1: "keyword" },
566
+ contains: [
567
+ GENERIC_PARAMETERS,
568
+ FUNCTION_PARAMETERS,
569
+ WHITESPACE
570
+ ],
571
+ illegal: /\[|%/
572
+ };
573
+ const OPERATOR_DECLARATION = {
574
+ match: [
575
+ /operator/,
576
+ /\s+/,
577
+ operator
578
+ ],
579
+ className: {
580
+ 1: "keyword",
581
+ 3: "title"
582
+ }
583
+ };
584
+ const PRECEDENCEGROUP = {
585
+ begin: [
586
+ /precedencegroup/,
587
+ /\s+/,
588
+ typeIdentifier
589
+ ],
590
+ className: {
591
+ 1: "keyword",
592
+ 3: "title"
593
+ },
594
+ contains: [TYPE],
595
+ keywords: [...precedencegroupKeywords, ...literals],
596
+ end: /}/
597
+ };
598
+ const CLASS_FUNC_DECLARATION = {
599
+ match: [
600
+ /class\b/,
601
+ /\s+/,
602
+ /func\b/,
603
+ /\s+/,
604
+ /\b[A-Za-z_][A-Za-z0-9_]*\b/
605
+ ],
606
+ scope: {
607
+ 1: "keyword",
608
+ 3: "keyword",
609
+ 5: "title.function"
610
+ }
611
+ };
612
+ const CLASS_VAR_DECLARATION = {
613
+ match: [
614
+ /class\b/,
615
+ /\s+/,
616
+ /var\b/
617
+ ],
618
+ scope: {
619
+ 1: "keyword",
620
+ 3: "keyword"
621
+ }
622
+ };
623
+ const TYPE_DECLARATION = {
624
+ begin: [
625
+ /(struct|protocol|class|extension|enum|actor)/,
626
+ /\s+/,
627
+ identifier,
628
+ /\s*/
629
+ ],
630
+ beginScope: {
631
+ 1: "keyword",
632
+ 3: "title.class"
633
+ },
634
+ keywords: KEYWORDS,
635
+ contains: [
636
+ GENERIC_PARAMETERS,
637
+ ...KEYWORD_MODES,
638
+ {
639
+ begin: /:/,
640
+ end: /\{/,
641
+ keywords: KEYWORDS,
642
+ contains: [{
643
+ scope: "title.class.inherited",
644
+ match: typeIdentifier
645
+ }, ...KEYWORD_MODES],
646
+ relevance: 0
647
+ }
648
+ ]
649
+ };
650
+ for (const variant of STRING.variants) {
651
+ const interpolation = variant.contains.find((mode) => mode.label === "interpol");
652
+ interpolation.keywords = KEYWORDS;
653
+ const submodes = [
654
+ ...KEYWORD_MODES,
655
+ ...BUILT_INS,
656
+ ...OPERATORS,
657
+ NUMBER,
658
+ STRING,
659
+ ...IDENTIFIERS
660
+ ];
661
+ interpolation.contains = [...submodes, {
662
+ begin: /\(/,
663
+ end: /\)/,
664
+ contains: ["self", ...submodes]
665
+ }];
666
+ }
667
+ return {
668
+ name: "Swift",
669
+ keywords: KEYWORDS,
670
+ contains: [
671
+ ...COMMENTS,
672
+ FUNCTION_OR_MACRO,
673
+ INIT_SUBSCRIPT,
674
+ CLASS_FUNC_DECLARATION,
675
+ CLASS_VAR_DECLARATION,
676
+ TYPE_DECLARATION,
677
+ OPERATOR_DECLARATION,
678
+ PRECEDENCEGROUP,
679
+ {
680
+ beginKeywords: "import",
681
+ end: /$/,
682
+ contains: [...COMMENTS],
683
+ relevance: 0
684
+ },
685
+ REGEXP,
686
+ ...KEYWORD_MODES,
687
+ ...BUILT_INS,
688
+ ...OPERATORS,
689
+ NUMBER,
690
+ STRING,
691
+ ...IDENTIFIERS,
692
+ ...ATTRIBUTES,
693
+ TYPE,
694
+ TUPLE
695
+ ]
696
+ };
697
+ }
698
+ //#endregion
699
+ export { swift as default };