@prokodo/ui 0.0.53 → 0.0.55
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.
- package/dist/_virtual/_commonjsHelpers.js +9 -0
- package/dist/_virtual/common.js +7 -0
- package/dist/components/list/List.module.scss.js +0 -1
- package/dist/components/post-item/PostItem.client.js +3 -4
- package/dist/components/post-item/PostItem.server.js +3 -4
- package/dist/components/post-item/PostItem.view.js +2 -2
- package/dist/components/post-teaser/PostTeaser.client.js +5 -6
- package/dist/components/post-teaser/PostTeaser.server.js +3 -4
- package/dist/components/post-teaser/PostTeaser.view.js +4 -4
- package/dist/components/rich-text/RichText.client.js +175 -10
- package/dist/components/rich-text/RichText.module.scss.js +1 -1
- package/dist/components/slider/Slider.view.js +19 -4
- package/dist/constants/project.js +1 -1
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/common.js +5 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/common.js +90 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js +1629 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/bash.js +407 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/c.js +307 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/cpp.js +556 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/csharp.js +413 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/css.js +950 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/diff.js +66 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/go.js +167 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/graphql.js +83 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/ini.js +129 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/java.js +268 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/javascript.js +715 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/json.js +53 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/kotlin.js +268 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/less.js +1031 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/lua.js +74 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/makefile.js +84 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/markdown.js +245 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/objectivec.js +256 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/perl.js +498 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/php-template.js +59 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/php.js +614 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/plaintext.js +25 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/python-repl.js +38 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/python.js +428 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/r.js +223 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/ruby.js +426 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/rust.js +326 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/scss.js +935 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/shell.js +37 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/sql.js +658 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/swift.js +893 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/typescript.js +829 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/vbnet.js +146 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/wasm.js +134 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/xml.js +239 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/yaml.js +214 -0
- package/dist/node_modules/.pnpm/marked-highlight@2.2.2_marked@15.0.12/node_modules/marked-highlight/src/index.js +93 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/post-item/PostItem.model.d.ts +1 -1
- package/dist/types/components/post-teaser/PostTeaser.model.d.ts +1 -1
- package/dist/types/components/rich-text/RichText.client.d.ts +1 -1
- package/dist/types/components/rich-text/RichText.d.ts +5 -0
- package/dist/types/components/rich-text/RichText.lazy.d.ts +5 -0
- package/dist/types/components/rich-text/RichText.model.d.ts +5 -0
- package/dist/ui.css +98 -58
- package/package.json +3 -1
- package/dist/helpers/calculation.js +0 -6
|
@@ -0,0 +1,715 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
var javascript_1;
|
|
4
|
+
var hasRequiredJavascript;
|
|
5
|
+
function requireJavascript() {
|
|
6
|
+
if (hasRequiredJavascript) return javascript_1;
|
|
7
|
+
hasRequiredJavascript = 1;
|
|
8
|
+
const IDENT_RE = "[A-Za-z$_][0-9A-Za-z$_]*";
|
|
9
|
+
const KEYWORDS = [
|
|
10
|
+
"as",
|
|
11
|
+
// for exports
|
|
12
|
+
"in",
|
|
13
|
+
"of",
|
|
14
|
+
"if",
|
|
15
|
+
"for",
|
|
16
|
+
"while",
|
|
17
|
+
"finally",
|
|
18
|
+
"var",
|
|
19
|
+
"new",
|
|
20
|
+
"function",
|
|
21
|
+
"do",
|
|
22
|
+
"return",
|
|
23
|
+
"void",
|
|
24
|
+
"else",
|
|
25
|
+
"break",
|
|
26
|
+
"catch",
|
|
27
|
+
"instanceof",
|
|
28
|
+
"with",
|
|
29
|
+
"throw",
|
|
30
|
+
"case",
|
|
31
|
+
"default",
|
|
32
|
+
"try",
|
|
33
|
+
"switch",
|
|
34
|
+
"continue",
|
|
35
|
+
"typeof",
|
|
36
|
+
"delete",
|
|
37
|
+
"let",
|
|
38
|
+
"yield",
|
|
39
|
+
"const",
|
|
40
|
+
"class",
|
|
41
|
+
// JS handles these with a special rule
|
|
42
|
+
// "get",
|
|
43
|
+
// "set",
|
|
44
|
+
"debugger",
|
|
45
|
+
"async",
|
|
46
|
+
"await",
|
|
47
|
+
"static",
|
|
48
|
+
"import",
|
|
49
|
+
"from",
|
|
50
|
+
"export",
|
|
51
|
+
"extends",
|
|
52
|
+
// It's reached stage 3, which is "recommended for implementation":
|
|
53
|
+
"using"
|
|
54
|
+
];
|
|
55
|
+
const LITERALS = [
|
|
56
|
+
"true",
|
|
57
|
+
"false",
|
|
58
|
+
"null",
|
|
59
|
+
"undefined",
|
|
60
|
+
"NaN",
|
|
61
|
+
"Infinity"
|
|
62
|
+
];
|
|
63
|
+
const TYPES = [
|
|
64
|
+
// Fundamental objects
|
|
65
|
+
"Object",
|
|
66
|
+
"Function",
|
|
67
|
+
"Boolean",
|
|
68
|
+
"Symbol",
|
|
69
|
+
// numbers and dates
|
|
70
|
+
"Math",
|
|
71
|
+
"Date",
|
|
72
|
+
"Number",
|
|
73
|
+
"BigInt",
|
|
74
|
+
// text
|
|
75
|
+
"String",
|
|
76
|
+
"RegExp",
|
|
77
|
+
// Indexed collections
|
|
78
|
+
"Array",
|
|
79
|
+
"Float32Array",
|
|
80
|
+
"Float64Array",
|
|
81
|
+
"Int8Array",
|
|
82
|
+
"Uint8Array",
|
|
83
|
+
"Uint8ClampedArray",
|
|
84
|
+
"Int16Array",
|
|
85
|
+
"Int32Array",
|
|
86
|
+
"Uint16Array",
|
|
87
|
+
"Uint32Array",
|
|
88
|
+
"BigInt64Array",
|
|
89
|
+
"BigUint64Array",
|
|
90
|
+
// Keyed collections
|
|
91
|
+
"Set",
|
|
92
|
+
"Map",
|
|
93
|
+
"WeakSet",
|
|
94
|
+
"WeakMap",
|
|
95
|
+
// Structured data
|
|
96
|
+
"ArrayBuffer",
|
|
97
|
+
"SharedArrayBuffer",
|
|
98
|
+
"Atomics",
|
|
99
|
+
"DataView",
|
|
100
|
+
"JSON",
|
|
101
|
+
// Control abstraction objects
|
|
102
|
+
"Promise",
|
|
103
|
+
"Generator",
|
|
104
|
+
"GeneratorFunction",
|
|
105
|
+
"AsyncFunction",
|
|
106
|
+
// Reflection
|
|
107
|
+
"Reflect",
|
|
108
|
+
"Proxy",
|
|
109
|
+
// Internationalization
|
|
110
|
+
"Intl",
|
|
111
|
+
// WebAssembly
|
|
112
|
+
"WebAssembly"
|
|
113
|
+
];
|
|
114
|
+
const ERROR_TYPES = [
|
|
115
|
+
"Error",
|
|
116
|
+
"EvalError",
|
|
117
|
+
"InternalError",
|
|
118
|
+
"RangeError",
|
|
119
|
+
"ReferenceError",
|
|
120
|
+
"SyntaxError",
|
|
121
|
+
"TypeError",
|
|
122
|
+
"URIError"
|
|
123
|
+
];
|
|
124
|
+
const BUILT_IN_GLOBALS = [
|
|
125
|
+
"setInterval",
|
|
126
|
+
"setTimeout",
|
|
127
|
+
"clearInterval",
|
|
128
|
+
"clearTimeout",
|
|
129
|
+
"require",
|
|
130
|
+
"exports",
|
|
131
|
+
"eval",
|
|
132
|
+
"isFinite",
|
|
133
|
+
"isNaN",
|
|
134
|
+
"parseFloat",
|
|
135
|
+
"parseInt",
|
|
136
|
+
"decodeURI",
|
|
137
|
+
"decodeURIComponent",
|
|
138
|
+
"encodeURI",
|
|
139
|
+
"encodeURIComponent",
|
|
140
|
+
"escape",
|
|
141
|
+
"unescape"
|
|
142
|
+
];
|
|
143
|
+
const BUILT_IN_VARIABLES = [
|
|
144
|
+
"arguments",
|
|
145
|
+
"this",
|
|
146
|
+
"super",
|
|
147
|
+
"console",
|
|
148
|
+
"window",
|
|
149
|
+
"document",
|
|
150
|
+
"localStorage",
|
|
151
|
+
"sessionStorage",
|
|
152
|
+
"module",
|
|
153
|
+
"global"
|
|
154
|
+
// Node.js
|
|
155
|
+
];
|
|
156
|
+
const BUILT_INS = [].concat(
|
|
157
|
+
BUILT_IN_GLOBALS,
|
|
158
|
+
TYPES,
|
|
159
|
+
ERROR_TYPES
|
|
160
|
+
);
|
|
161
|
+
function javascript(hljs) {
|
|
162
|
+
const regex = hljs.regex;
|
|
163
|
+
const hasClosingTag = /* @__PURE__ */ __name((match, { after }) => {
|
|
164
|
+
const tag = "</" + match[0].slice(1);
|
|
165
|
+
const pos = match.input.indexOf(tag, after);
|
|
166
|
+
return pos !== -1;
|
|
167
|
+
}, "hasClosingTag");
|
|
168
|
+
const IDENT_RE$1 = IDENT_RE;
|
|
169
|
+
const FRAGMENT = {
|
|
170
|
+
begin: "<>",
|
|
171
|
+
end: "</>"
|
|
172
|
+
};
|
|
173
|
+
const XML_SELF_CLOSING = /<[A-Za-z0-9\\._:-]+\s*\/>/;
|
|
174
|
+
const XML_TAG = {
|
|
175
|
+
begin: /<[A-Za-z0-9\\._:-]+/,
|
|
176
|
+
end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
|
|
177
|
+
/**
|
|
178
|
+
* @param {RegExpMatchArray} match
|
|
179
|
+
* @param {CallbackResponse} response
|
|
180
|
+
*/
|
|
181
|
+
isTrulyOpeningTag: /* @__PURE__ */ __name((match, response) => {
|
|
182
|
+
const afterMatchIndex = match[0].length + match.index;
|
|
183
|
+
const nextChar = match.input[afterMatchIndex];
|
|
184
|
+
if (
|
|
185
|
+
// HTML should not include another raw `<` inside a tag
|
|
186
|
+
// nested type?
|
|
187
|
+
// `<Array<Array<number>>`, etc.
|
|
188
|
+
nextChar === "<" || // the , gives away that this is not HTML
|
|
189
|
+
// `<T, A extends keyof T, V>`
|
|
190
|
+
nextChar === ","
|
|
191
|
+
) {
|
|
192
|
+
response.ignoreMatch();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (nextChar === ">") {
|
|
196
|
+
if (!hasClosingTag(match, { after: afterMatchIndex })) {
|
|
197
|
+
response.ignoreMatch();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
let m;
|
|
201
|
+
const afterMatch = match.input.substring(afterMatchIndex);
|
|
202
|
+
if (m = afterMatch.match(/^\s*=/)) {
|
|
203
|
+
response.ignoreMatch();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (m = afterMatch.match(/^\s+extends\s+/)) {
|
|
207
|
+
if (m.index === 0) {
|
|
208
|
+
response.ignoreMatch();
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}, "isTrulyOpeningTag")
|
|
213
|
+
};
|
|
214
|
+
const KEYWORDS$1 = {
|
|
215
|
+
$pattern: IDENT_RE,
|
|
216
|
+
keyword: KEYWORDS,
|
|
217
|
+
literal: LITERALS,
|
|
218
|
+
built_in: BUILT_INS,
|
|
219
|
+
"variable.language": BUILT_IN_VARIABLES
|
|
220
|
+
};
|
|
221
|
+
const decimalDigits = "[0-9](_?[0-9])*";
|
|
222
|
+
const frac = `\\.(${decimalDigits})`;
|
|
223
|
+
const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;
|
|
224
|
+
const NUMBER = {
|
|
225
|
+
className: "number",
|
|
226
|
+
variants: [
|
|
227
|
+
// DecimalLiteral
|
|
228
|
+
{ begin: `(\\b(${decimalInteger})((${frac})|\\.)?|(${frac}))[eE][+-]?(${decimalDigits})\\b` },
|
|
229
|
+
{ begin: `\\b(${decimalInteger})\\b((${frac})\\b|\\.)?|(${frac})\\b` },
|
|
230
|
+
// DecimalBigIntegerLiteral
|
|
231
|
+
{ begin: `\\b(0|[1-9](_?[0-9])*)n\\b` },
|
|
232
|
+
// NonDecimalIntegerLiteral
|
|
233
|
+
{ begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
|
|
234
|
+
{ begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
|
|
235
|
+
{ begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
|
|
236
|
+
// LegacyOctalIntegerLiteral (does not include underscore separators)
|
|
237
|
+
// https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
|
|
238
|
+
{ begin: "\\b0[0-7]+n?\\b" }
|
|
239
|
+
],
|
|
240
|
+
relevance: 0
|
|
241
|
+
};
|
|
242
|
+
const SUBST = {
|
|
243
|
+
className: "subst",
|
|
244
|
+
begin: "\\$\\{",
|
|
245
|
+
end: "\\}",
|
|
246
|
+
keywords: KEYWORDS$1,
|
|
247
|
+
contains: []
|
|
248
|
+
// defined later
|
|
249
|
+
};
|
|
250
|
+
const HTML_TEMPLATE = {
|
|
251
|
+
begin: ".?html`",
|
|
252
|
+
end: "",
|
|
253
|
+
starts: {
|
|
254
|
+
end: "`",
|
|
255
|
+
returnEnd: false,
|
|
256
|
+
contains: [
|
|
257
|
+
hljs.BACKSLASH_ESCAPE,
|
|
258
|
+
SUBST
|
|
259
|
+
],
|
|
260
|
+
subLanguage: "xml"
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const CSS_TEMPLATE = {
|
|
264
|
+
begin: ".?css`",
|
|
265
|
+
end: "",
|
|
266
|
+
starts: {
|
|
267
|
+
end: "`",
|
|
268
|
+
returnEnd: false,
|
|
269
|
+
contains: [
|
|
270
|
+
hljs.BACKSLASH_ESCAPE,
|
|
271
|
+
SUBST
|
|
272
|
+
],
|
|
273
|
+
subLanguage: "css"
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const GRAPHQL_TEMPLATE = {
|
|
277
|
+
begin: ".?gql`",
|
|
278
|
+
end: "",
|
|
279
|
+
starts: {
|
|
280
|
+
end: "`",
|
|
281
|
+
returnEnd: false,
|
|
282
|
+
contains: [
|
|
283
|
+
hljs.BACKSLASH_ESCAPE,
|
|
284
|
+
SUBST
|
|
285
|
+
],
|
|
286
|
+
subLanguage: "graphql"
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
const TEMPLATE_STRING = {
|
|
290
|
+
className: "string",
|
|
291
|
+
begin: "`",
|
|
292
|
+
end: "`",
|
|
293
|
+
contains: [
|
|
294
|
+
hljs.BACKSLASH_ESCAPE,
|
|
295
|
+
SUBST
|
|
296
|
+
]
|
|
297
|
+
};
|
|
298
|
+
const JSDOC_COMMENT = hljs.COMMENT(
|
|
299
|
+
/\/\*\*(?!\/)/,
|
|
300
|
+
"\\*/",
|
|
301
|
+
{
|
|
302
|
+
relevance: 0,
|
|
303
|
+
contains: [
|
|
304
|
+
{
|
|
305
|
+
begin: "(?=@[A-Za-z]+)",
|
|
306
|
+
relevance: 0,
|
|
307
|
+
contains: [
|
|
308
|
+
{
|
|
309
|
+
className: "doctag",
|
|
310
|
+
begin: "@[A-Za-z]+"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
className: "type",
|
|
314
|
+
begin: "\\{",
|
|
315
|
+
end: "\\}",
|
|
316
|
+
excludeEnd: true,
|
|
317
|
+
excludeBegin: true,
|
|
318
|
+
relevance: 0
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
className: "variable",
|
|
322
|
+
begin: IDENT_RE$1 + "(?=\\s*(-)|$)",
|
|
323
|
+
endsParent: true,
|
|
324
|
+
relevance: 0
|
|
325
|
+
},
|
|
326
|
+
// eat spaces (not newlines) so we can find
|
|
327
|
+
// types or variables
|
|
328
|
+
{
|
|
329
|
+
begin: /(?=[^\n])\s/,
|
|
330
|
+
relevance: 0
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
const COMMENT = {
|
|
338
|
+
className: "comment",
|
|
339
|
+
variants: [
|
|
340
|
+
JSDOC_COMMENT,
|
|
341
|
+
hljs.C_BLOCK_COMMENT_MODE,
|
|
342
|
+
hljs.C_LINE_COMMENT_MODE
|
|
343
|
+
]
|
|
344
|
+
};
|
|
345
|
+
const SUBST_INTERNALS = [
|
|
346
|
+
hljs.APOS_STRING_MODE,
|
|
347
|
+
hljs.QUOTE_STRING_MODE,
|
|
348
|
+
HTML_TEMPLATE,
|
|
349
|
+
CSS_TEMPLATE,
|
|
350
|
+
GRAPHQL_TEMPLATE,
|
|
351
|
+
TEMPLATE_STRING,
|
|
352
|
+
// Skip numbers when they are part of a variable name
|
|
353
|
+
{ match: /\$\d+/ },
|
|
354
|
+
NUMBER
|
|
355
|
+
// This is intentional:
|
|
356
|
+
// See https://github.com/highlightjs/highlight.js/issues/3288
|
|
357
|
+
// hljs.REGEXP_MODE
|
|
358
|
+
];
|
|
359
|
+
SUBST.contains = SUBST_INTERNALS.concat({
|
|
360
|
+
// we need to pair up {} inside our subst to prevent
|
|
361
|
+
// it from ending too early by matching another }
|
|
362
|
+
begin: /\{/,
|
|
363
|
+
end: /\}/,
|
|
364
|
+
keywords: KEYWORDS$1,
|
|
365
|
+
contains: [
|
|
366
|
+
"self"
|
|
367
|
+
].concat(SUBST_INTERNALS)
|
|
368
|
+
});
|
|
369
|
+
const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);
|
|
370
|
+
const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([
|
|
371
|
+
// eat recursive parens in sub expressions
|
|
372
|
+
{
|
|
373
|
+
begin: /(\s*)\(/,
|
|
374
|
+
end: /\)/,
|
|
375
|
+
keywords: KEYWORDS$1,
|
|
376
|
+
contains: ["self"].concat(SUBST_AND_COMMENTS)
|
|
377
|
+
}
|
|
378
|
+
]);
|
|
379
|
+
const PARAMS = {
|
|
380
|
+
className: "params",
|
|
381
|
+
// convert this to negative lookbehind in v12
|
|
382
|
+
begin: /(\s*)\(/,
|
|
383
|
+
// to match the parms with
|
|
384
|
+
end: /\)/,
|
|
385
|
+
excludeBegin: true,
|
|
386
|
+
excludeEnd: true,
|
|
387
|
+
keywords: KEYWORDS$1,
|
|
388
|
+
contains: PARAMS_CONTAINS
|
|
389
|
+
};
|
|
390
|
+
const CLASS_OR_EXTENDS = {
|
|
391
|
+
variants: [
|
|
392
|
+
// class Car extends vehicle
|
|
393
|
+
{
|
|
394
|
+
match: [
|
|
395
|
+
/class/,
|
|
396
|
+
/\s+/,
|
|
397
|
+
IDENT_RE$1,
|
|
398
|
+
/\s+/,
|
|
399
|
+
/extends/,
|
|
400
|
+
/\s+/,
|
|
401
|
+
regex.concat(IDENT_RE$1, "(", regex.concat(/\./, IDENT_RE$1), ")*")
|
|
402
|
+
],
|
|
403
|
+
scope: {
|
|
404
|
+
1: "keyword",
|
|
405
|
+
3: "title.class",
|
|
406
|
+
5: "keyword",
|
|
407
|
+
7: "title.class.inherited"
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
// class Car
|
|
411
|
+
{
|
|
412
|
+
match: [
|
|
413
|
+
/class/,
|
|
414
|
+
/\s+/,
|
|
415
|
+
IDENT_RE$1
|
|
416
|
+
],
|
|
417
|
+
scope: {
|
|
418
|
+
1: "keyword",
|
|
419
|
+
3: "title.class"
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
]
|
|
423
|
+
};
|
|
424
|
+
const CLASS_REFERENCE = {
|
|
425
|
+
relevance: 0,
|
|
426
|
+
match: regex.either(
|
|
427
|
+
// Hard coded exceptions
|
|
428
|
+
/\bJSON/,
|
|
429
|
+
// Float32Array, OutT
|
|
430
|
+
/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
|
|
431
|
+
// CSSFactory, CSSFactoryT
|
|
432
|
+
/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
|
|
433
|
+
// FPs, FPsT
|
|
434
|
+
/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
|
|
435
|
+
// P
|
|
436
|
+
// single letters are not highlighted
|
|
437
|
+
// BLAH
|
|
438
|
+
// this will be flagged as a UPPER_CASE_CONSTANT instead
|
|
439
|
+
),
|
|
440
|
+
className: "title.class",
|
|
441
|
+
keywords: {
|
|
442
|
+
_: [
|
|
443
|
+
// se we still get relevance credit for JS library classes
|
|
444
|
+
...TYPES,
|
|
445
|
+
...ERROR_TYPES
|
|
446
|
+
]
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
const USE_STRICT = {
|
|
450
|
+
label: "use_strict",
|
|
451
|
+
className: "meta",
|
|
452
|
+
relevance: 10,
|
|
453
|
+
begin: /^\s*['"]use (strict|asm)['"]/
|
|
454
|
+
};
|
|
455
|
+
const FUNCTION_DEFINITION = {
|
|
456
|
+
variants: [
|
|
457
|
+
{
|
|
458
|
+
match: [
|
|
459
|
+
/function/,
|
|
460
|
+
/\s+/,
|
|
461
|
+
IDENT_RE$1,
|
|
462
|
+
/(?=\s*\()/
|
|
463
|
+
]
|
|
464
|
+
},
|
|
465
|
+
// anonymous function
|
|
466
|
+
{
|
|
467
|
+
match: [
|
|
468
|
+
/function/,
|
|
469
|
+
/\s*(?=\()/
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
],
|
|
473
|
+
className: {
|
|
474
|
+
1: "keyword",
|
|
475
|
+
3: "title.function"
|
|
476
|
+
},
|
|
477
|
+
label: "func.def",
|
|
478
|
+
contains: [PARAMS],
|
|
479
|
+
illegal: /%/
|
|
480
|
+
};
|
|
481
|
+
const UPPER_CASE_CONSTANT = {
|
|
482
|
+
relevance: 0,
|
|
483
|
+
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
484
|
+
className: "variable.constant"
|
|
485
|
+
};
|
|
486
|
+
function noneOf(list) {
|
|
487
|
+
return regex.concat("(?!", list.join("|"), ")");
|
|
488
|
+
}
|
|
489
|
+
__name(noneOf, "noneOf");
|
|
490
|
+
const FUNCTION_CALL = {
|
|
491
|
+
match: regex.concat(
|
|
492
|
+
/\b/,
|
|
493
|
+
noneOf([
|
|
494
|
+
...BUILT_IN_GLOBALS,
|
|
495
|
+
"super",
|
|
496
|
+
"import"
|
|
497
|
+
].map((x) => `${x}\\s*\\(`)),
|
|
498
|
+
IDENT_RE$1,
|
|
499
|
+
regex.lookahead(/\s*\(/)
|
|
500
|
+
),
|
|
501
|
+
className: "title.function",
|
|
502
|
+
relevance: 0
|
|
503
|
+
};
|
|
504
|
+
const PROPERTY_ACCESS = {
|
|
505
|
+
begin: regex.concat(/\./, regex.lookahead(
|
|
506
|
+
regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)
|
|
507
|
+
)),
|
|
508
|
+
end: IDENT_RE$1,
|
|
509
|
+
excludeBegin: true,
|
|
510
|
+
keywords: "prototype",
|
|
511
|
+
className: "property",
|
|
512
|
+
relevance: 0
|
|
513
|
+
};
|
|
514
|
+
const GETTER_OR_SETTER = {
|
|
515
|
+
match: [
|
|
516
|
+
/get|set/,
|
|
517
|
+
/\s+/,
|
|
518
|
+
IDENT_RE$1,
|
|
519
|
+
/(?=\()/
|
|
520
|
+
],
|
|
521
|
+
className: {
|
|
522
|
+
1: "keyword",
|
|
523
|
+
3: "title.function"
|
|
524
|
+
},
|
|
525
|
+
contains: [
|
|
526
|
+
{
|
|
527
|
+
// eat to avoid empty params
|
|
528
|
+
begin: /\(\)/
|
|
529
|
+
},
|
|
530
|
+
PARAMS
|
|
531
|
+
]
|
|
532
|
+
};
|
|
533
|
+
const FUNC_LEAD_IN_RE = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + hljs.UNDERSCORE_IDENT_RE + ")\\s*=>";
|
|
534
|
+
const FUNCTION_VARIABLE = {
|
|
535
|
+
match: [
|
|
536
|
+
/const|var|let/,
|
|
537
|
+
/\s+/,
|
|
538
|
+
IDENT_RE$1,
|
|
539
|
+
/\s*/,
|
|
540
|
+
/=\s*/,
|
|
541
|
+
/(async\s*)?/,
|
|
542
|
+
// async is optional
|
|
543
|
+
regex.lookahead(FUNC_LEAD_IN_RE)
|
|
544
|
+
],
|
|
545
|
+
keywords: "async",
|
|
546
|
+
className: {
|
|
547
|
+
1: "keyword",
|
|
548
|
+
3: "title.function"
|
|
549
|
+
},
|
|
550
|
+
contains: [
|
|
551
|
+
PARAMS
|
|
552
|
+
]
|
|
553
|
+
};
|
|
554
|
+
return {
|
|
555
|
+
name: "JavaScript",
|
|
556
|
+
aliases: ["js", "jsx", "mjs", "cjs"],
|
|
557
|
+
keywords: KEYWORDS$1,
|
|
558
|
+
// this will be extended by TypeScript
|
|
559
|
+
exports: { PARAMS_CONTAINS, CLASS_REFERENCE },
|
|
560
|
+
illegal: /#(?![$_A-z])/,
|
|
561
|
+
contains: [
|
|
562
|
+
hljs.SHEBANG({
|
|
563
|
+
label: "shebang",
|
|
564
|
+
binary: "node",
|
|
565
|
+
relevance: 5
|
|
566
|
+
}),
|
|
567
|
+
USE_STRICT,
|
|
568
|
+
hljs.APOS_STRING_MODE,
|
|
569
|
+
hljs.QUOTE_STRING_MODE,
|
|
570
|
+
HTML_TEMPLATE,
|
|
571
|
+
CSS_TEMPLATE,
|
|
572
|
+
GRAPHQL_TEMPLATE,
|
|
573
|
+
TEMPLATE_STRING,
|
|
574
|
+
COMMENT,
|
|
575
|
+
// Skip numbers when they are part of a variable name
|
|
576
|
+
{ match: /\$\d+/ },
|
|
577
|
+
NUMBER,
|
|
578
|
+
CLASS_REFERENCE,
|
|
579
|
+
{
|
|
580
|
+
scope: "attr",
|
|
581
|
+
match: IDENT_RE$1 + regex.lookahead(":"),
|
|
582
|
+
relevance: 0
|
|
583
|
+
},
|
|
584
|
+
FUNCTION_VARIABLE,
|
|
585
|
+
{
|
|
586
|
+
// "value" container
|
|
587
|
+
begin: "(" + hljs.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
|
|
588
|
+
keywords: "return throw case",
|
|
589
|
+
relevance: 0,
|
|
590
|
+
contains: [
|
|
591
|
+
COMMENT,
|
|
592
|
+
hljs.REGEXP_MODE,
|
|
593
|
+
{
|
|
594
|
+
className: "function",
|
|
595
|
+
// we have to count the parens to make sure we actually have the
|
|
596
|
+
// correct bounding ( ) before the =>. There could be any number of
|
|
597
|
+
// sub-expressions inside also surrounded by parens.
|
|
598
|
+
begin: FUNC_LEAD_IN_RE,
|
|
599
|
+
returnBegin: true,
|
|
600
|
+
end: "\\s*=>",
|
|
601
|
+
contains: [
|
|
602
|
+
{
|
|
603
|
+
className: "params",
|
|
604
|
+
variants: [
|
|
605
|
+
{
|
|
606
|
+
begin: hljs.UNDERSCORE_IDENT_RE,
|
|
607
|
+
relevance: 0
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
className: null,
|
|
611
|
+
begin: /\(\s*\)/,
|
|
612
|
+
skip: true
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
begin: /(\s*)\(/,
|
|
616
|
+
end: /\)/,
|
|
617
|
+
excludeBegin: true,
|
|
618
|
+
excludeEnd: true,
|
|
619
|
+
keywords: KEYWORDS$1,
|
|
620
|
+
contains: PARAMS_CONTAINS
|
|
621
|
+
}
|
|
622
|
+
]
|
|
623
|
+
}
|
|
624
|
+
]
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
// could be a comma delimited list of params to a function call
|
|
628
|
+
begin: /,/,
|
|
629
|
+
relevance: 0
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
match: /\s+/,
|
|
633
|
+
relevance: 0
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
// JSX
|
|
637
|
+
variants: [
|
|
638
|
+
{ begin: FRAGMENT.begin, end: FRAGMENT.end },
|
|
639
|
+
{ match: XML_SELF_CLOSING },
|
|
640
|
+
{
|
|
641
|
+
begin: XML_TAG.begin,
|
|
642
|
+
// we carefully check the opening tag to see if it truly
|
|
643
|
+
// is a tag and not a false positive
|
|
644
|
+
"on:begin": XML_TAG.isTrulyOpeningTag,
|
|
645
|
+
end: XML_TAG.end
|
|
646
|
+
}
|
|
647
|
+
],
|
|
648
|
+
subLanguage: "xml",
|
|
649
|
+
contains: [
|
|
650
|
+
{
|
|
651
|
+
begin: XML_TAG.begin,
|
|
652
|
+
end: XML_TAG.end,
|
|
653
|
+
skip: true,
|
|
654
|
+
contains: ["self"]
|
|
655
|
+
}
|
|
656
|
+
]
|
|
657
|
+
}
|
|
658
|
+
]
|
|
659
|
+
},
|
|
660
|
+
FUNCTION_DEFINITION,
|
|
661
|
+
{
|
|
662
|
+
// prevent this from getting swallowed up by function
|
|
663
|
+
// since they appear "function like"
|
|
664
|
+
beginKeywords: "while if switch catch for"
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
// we have to count the parens to make sure we actually have the correct
|
|
668
|
+
// bounding ( ). There could be any number of sub-expressions inside
|
|
669
|
+
// also surrounded by parens.
|
|
670
|
+
begin: "\\b(?!function)" + hljs.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
|
|
671
|
+
// end parens
|
|
672
|
+
returnBegin: true,
|
|
673
|
+
label: "func.def",
|
|
674
|
+
contains: [
|
|
675
|
+
PARAMS,
|
|
676
|
+
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: "title.function" })
|
|
677
|
+
]
|
|
678
|
+
},
|
|
679
|
+
// catch ... so it won't trigger the property rule below
|
|
680
|
+
{
|
|
681
|
+
match: /\.\.\./,
|
|
682
|
+
relevance: 0
|
|
683
|
+
},
|
|
684
|
+
PROPERTY_ACCESS,
|
|
685
|
+
// hack: prevents detection of keywords in some circumstances
|
|
686
|
+
// .keyword()
|
|
687
|
+
// $keyword = x
|
|
688
|
+
{
|
|
689
|
+
match: "\\$" + IDENT_RE$1,
|
|
690
|
+
relevance: 0
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
match: [/\bconstructor(?=\s*\()/],
|
|
694
|
+
className: { 1: "title.function" },
|
|
695
|
+
contains: [PARAMS]
|
|
696
|
+
},
|
|
697
|
+
FUNCTION_CALL,
|
|
698
|
+
UPPER_CASE_CONSTANT,
|
|
699
|
+
CLASS_OR_EXTENDS,
|
|
700
|
+
GETTER_OR_SETTER,
|
|
701
|
+
{
|
|
702
|
+
match: /\$[(.]/
|
|
703
|
+
// relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
|
|
704
|
+
}
|
|
705
|
+
]
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
__name(javascript, "javascript");
|
|
709
|
+
javascript_1 = javascript;
|
|
710
|
+
return javascript_1;
|
|
711
|
+
}
|
|
712
|
+
__name(requireJavascript, "requireJavascript");
|
|
713
|
+
export {
|
|
714
|
+
requireJavascript as __require
|
|
715
|
+
};
|