@splunk/react-ui 4.24.0 → 4.26.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.
- package/Breadcrumbs.js +65 -42
- package/Button.js +8 -7
- package/ButtonSimple.js +40 -39
- package/CHANGELOG.md +30 -1
- package/Code.js +193 -100
- package/Color.js +18 -15
- package/JSONTree.js +1 -1
- package/MIGRATION.mdx +48 -0
- package/Modal.js +69 -58
- package/RadioList.js +12 -11
- package/Table.js +2330 -2543
- package/TextArea.js +298 -302
- package/cypress/README.md +11 -0
- package/cypress/support/commands.ts +1 -0
- package/cypress/support/component.ts +0 -1
- package/cypress/tsconfig.cypress.json +14 -0
- package/package.json +13 -13
- package/types/src/Breadcrumbs/Breadcrumbs.d.ts +18 -2
- package/types/src/Breadcrumbs/Item.d.ts +7 -1
- package/types/src/Breadcrumbs/docs/examples/CustomizedClick.d.ts +2 -0
- package/types/src/Button/Button.d.ts +4 -2
- package/types/src/Button/docs/examples/Block.d.ts +2 -2
- package/types/src/Button/docs/examples/Dimmed.d.ts +2 -0
- package/types/src/Button/docs/examples/Disabled.d.ts +2 -2
- package/types/src/Button/docs/examples/Icons.d.ts +2 -2
- package/types/src/Button/docs/examples/Menus.d.ts +2 -2
- package/types/src/Button/docs/examples/To.d.ts +2 -2
- package/types/src/Button/docs/examples/Truncated.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Basic.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Block.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Dimmed.d.ts +2 -0
- package/types/src/Button/docs/examples/prisma/Disabled.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Menus.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/To.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Truncated.d.ts +2 -2
- package/types/src/ButtonSimple/ButtonSimple.d.ts +4 -2
- package/types/src/Color/Color.d.ts +5 -3
- package/types/src/JSONTree/JSONTree.d.ts +1 -1
- package/types/src/Modal/Header.d.ts +6 -7
- package/types/src/Modal/Modal.d.ts +10 -2
- package/types/src/Modal/ModalContext.d.ts +1 -0
- package/types/src/RadioList/RadioList.d.ts +27 -27
- package/types/src/RadioList/RadioListContext.d.ts +5 -4
- package/types/src/Table/Body.d.ts +26 -22
- package/types/src/Table/Row.d.ts +47 -16
- package/types/src/Table/RowDragCell.d.ts +23 -42
- package/types/src/Table/Table.d.ts +28 -78
- package/types/src/TextArea/TextArea.d.ts +1 -0
- package/types/unit-test-setup-testing-library.d.ts +1 -0
- package/types/src/Modal/docs/examples/prisma/TypicalUsage.d.ts +0 -2
package/Code.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* @public
|
|
18
18
|
*/ var r = function(e) {
|
|
19
19
|
// Private helper vars
|
|
20
|
-
var a =
|
|
20
|
+
var a = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
|
|
21
21
|
var n = 0;
|
|
22
22
|
// The grammar object for plaintext
|
|
23
23
|
var r = {};
|
|
@@ -44,6 +44,27 @@
|
|
|
44
44
|
* @public
|
|
45
45
|
*/
|
|
46
46
|
manual: e.Prism && e.Prism.manual,
|
|
47
|
+
/**
|
|
48
|
+
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
|
49
|
+
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
|
50
|
+
* own worker, you don't want it to do this.
|
|
51
|
+
*
|
|
52
|
+
* By setting this value to `true`, Prism will not add its own listeners to the worker.
|
|
53
|
+
*
|
|
54
|
+
* You obviously have to change this value before Prism executes. To do this, you can add an
|
|
55
|
+
* empty Prism object into the global scope before loading the Prism script like this:
|
|
56
|
+
*
|
|
57
|
+
* ```js
|
|
58
|
+
* window.Prism = window.Prism || {};
|
|
59
|
+
* Prism.disableWorkerMessageHandler = true;
|
|
60
|
+
* // Load Prism's script
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
* @type {boolean}
|
|
65
|
+
* @memberof Prism
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
47
68
|
disableWorkerMessageHandler: e.Prism && e.Prism.disableWorkerMessageHandler,
|
|
48
69
|
/**
|
|
49
70
|
* A namespace for utility methods.
|
|
@@ -153,15 +174,31 @@
|
|
|
153
174
|
* @returns {string}
|
|
154
175
|
*/
|
|
155
176
|
getLanguage: function(e) {
|
|
156
|
-
while (e
|
|
177
|
+
while (e) {
|
|
178
|
+
var t = a.exec(e.className);
|
|
179
|
+
if (t) {
|
|
180
|
+
return t[1].toLowerCase();
|
|
181
|
+
}
|
|
157
182
|
e = e.parentElement;
|
|
158
183
|
}
|
|
159
|
-
if (e) {
|
|
160
|
-
return (e.className.match(a) || [ , "none" ])[1].toLowerCase();
|
|
161
|
-
}
|
|
162
184
|
return "none";
|
|
163
185
|
},
|
|
164
186
|
/**
|
|
187
|
+
* Sets the Prism `language-xxxx` class of the given element.
|
|
188
|
+
*
|
|
189
|
+
* @param {Element} element
|
|
190
|
+
* @param {string} language
|
|
191
|
+
* @returns {void}
|
|
192
|
+
*/
|
|
193
|
+
setLanguage: function(e, t) {
|
|
194
|
+
// remove all `language-xxxx` classes
|
|
195
|
+
// (this might leave behind a leading space)
|
|
196
|
+
e.className = e.className.replace(RegExp(a, "gi"), "");
|
|
197
|
+
// add the new `language-xxxx` class
|
|
198
|
+
// (using `classList` will automatically clean up spaces for us)
|
|
199
|
+
e.classList.add("language-" + t);
|
|
200
|
+
},
|
|
201
|
+
/**
|
|
165
202
|
* Returns the script element that is currently executing.
|
|
166
203
|
*
|
|
167
204
|
* This does __not__ work for line script element.
|
|
@@ -479,60 +516,60 @@
|
|
|
479
516
|
* @memberof Prism
|
|
480
517
|
* @public
|
|
481
518
|
*/
|
|
482
|
-
highlightElement: function(t,
|
|
519
|
+
highlightElement: function(t, a, n) {
|
|
483
520
|
// Find language
|
|
484
|
-
var
|
|
485
|
-
var
|
|
521
|
+
var r = s.util.getLanguage(t);
|
|
522
|
+
var i = s.languages[r];
|
|
486
523
|
// Set language on the element, if not present
|
|
487
|
-
|
|
524
|
+
s.util.setLanguage(t, r);
|
|
488
525
|
// Set language on the parent, for styling
|
|
489
|
-
var
|
|
490
|
-
if (
|
|
491
|
-
|
|
526
|
+
var o = t.parentElement;
|
|
527
|
+
if (o && o.nodeName.toLowerCase() === "pre") {
|
|
528
|
+
s.util.setLanguage(o, r);
|
|
492
529
|
}
|
|
493
|
-
var
|
|
494
|
-
var
|
|
530
|
+
var l = t.textContent;
|
|
531
|
+
var u = {
|
|
495
532
|
element: t,
|
|
496
|
-
language:
|
|
497
|
-
grammar:
|
|
498
|
-
code:
|
|
533
|
+
language: r,
|
|
534
|
+
grammar: i,
|
|
535
|
+
code: l
|
|
499
536
|
};
|
|
500
|
-
function
|
|
501
|
-
|
|
502
|
-
s.hooks.run("before-insert",
|
|
503
|
-
|
|
504
|
-
s.hooks.run("after-highlight",
|
|
505
|
-
s.hooks.run("complete",
|
|
506
|
-
|
|
537
|
+
function c(e) {
|
|
538
|
+
u.highlightedCode = e;
|
|
539
|
+
s.hooks.run("before-insert", u);
|
|
540
|
+
u.element.innerHTML = u.highlightedCode;
|
|
541
|
+
s.hooks.run("after-highlight", u);
|
|
542
|
+
s.hooks.run("complete", u);
|
|
543
|
+
n && n.call(u.element);
|
|
507
544
|
}
|
|
508
|
-
s.hooks.run("before-sanity-check",
|
|
545
|
+
s.hooks.run("before-sanity-check", u);
|
|
509
546
|
// plugins may change/add the parent/element
|
|
510
|
-
|
|
511
|
-
if (
|
|
512
|
-
|
|
547
|
+
o = u.element.parentElement;
|
|
548
|
+
if (o && o.nodeName.toLowerCase() === "pre" && !o.hasAttribute("tabindex")) {
|
|
549
|
+
o.setAttribute("tabindex", "0");
|
|
513
550
|
}
|
|
514
|
-
if (!
|
|
515
|
-
s.hooks.run("complete",
|
|
516
|
-
|
|
551
|
+
if (!u.code) {
|
|
552
|
+
s.hooks.run("complete", u);
|
|
553
|
+
n && n.call(u.element);
|
|
517
554
|
return;
|
|
518
555
|
}
|
|
519
|
-
s.hooks.run("before-highlight",
|
|
520
|
-
if (!
|
|
521
|
-
|
|
556
|
+
s.hooks.run("before-highlight", u);
|
|
557
|
+
if (!u.grammar) {
|
|
558
|
+
c(s.util.encode(u.code));
|
|
522
559
|
return;
|
|
523
560
|
}
|
|
524
|
-
if (
|
|
525
|
-
var
|
|
526
|
-
|
|
527
|
-
|
|
561
|
+
if (a && e.Worker) {
|
|
562
|
+
var p = new Worker(s.filename);
|
|
563
|
+
p.onmessage = function(e) {
|
|
564
|
+
c(e.data);
|
|
528
565
|
};
|
|
529
|
-
|
|
530
|
-
language:
|
|
531
|
-
code:
|
|
566
|
+
p.postMessage(JSON.stringify({
|
|
567
|
+
language: u.language,
|
|
568
|
+
code: u.code,
|
|
532
569
|
immediateClose: true
|
|
533
570
|
}));
|
|
534
571
|
} else {
|
|
535
|
-
|
|
572
|
+
c(s.highlight(u.code, u.grammar, u.language));
|
|
536
573
|
}
|
|
537
574
|
},
|
|
538
575
|
/**
|
|
@@ -562,6 +599,9 @@
|
|
|
562
599
|
language: a
|
|
563
600
|
};
|
|
564
601
|
s.hooks.run("before-tokenize", n);
|
|
602
|
+
if (!n.grammar) {
|
|
603
|
+
throw new Error('The language "' + n.language + '" has no grammar.');
|
|
604
|
+
}
|
|
565
605
|
n.tokens = s.tokenize(n.code, n.grammar);
|
|
566
606
|
s.hooks.run("after-tokenize", n);
|
|
567
607
|
return i.stringify(s.util.encode(n.tokens), n.language);
|
|
@@ -822,7 +862,7 @@
|
|
|
822
862
|
var E;
|
|
823
863
|
if (b) {
|
|
824
864
|
E = o(x, A, e, v);
|
|
825
|
-
if (!E) {
|
|
865
|
+
if (!E || E.index >= e.length) {
|
|
826
866
|
break;
|
|
827
867
|
}
|
|
828
868
|
var _ = E.index;
|
|
@@ -842,9 +882,9 @@
|
|
|
842
882
|
continue;
|
|
843
883
|
}
|
|
844
884
|
// find the last node which is affected by this match
|
|
845
|
-
for (var
|
|
885
|
+
for (var $ = S; $ !== t.tail && (T < O || typeof $.value === "string"); $ = $.next) {
|
|
846
886
|
w++;
|
|
847
|
-
T +=
|
|
887
|
+
T += $.value.length;
|
|
848
888
|
}
|
|
849
889
|
w--;
|
|
850
890
|
// replace with the new match
|
|
@@ -858,20 +898,20 @@
|
|
|
858
898
|
}
|
|
859
899
|
// eslint-disable-next-line no-redeclare
|
|
860
900
|
var _ = E.index;
|
|
861
|
-
var
|
|
862
|
-
var
|
|
863
|
-
var P = F.slice(_ +
|
|
864
|
-
var
|
|
865
|
-
if (u &&
|
|
866
|
-
u.reach =
|
|
901
|
+
var I = E[0];
|
|
902
|
+
var R = F.slice(0, _);
|
|
903
|
+
var P = F.slice(_ + I.length);
|
|
904
|
+
var N = A + F.length;
|
|
905
|
+
if (u && N > u.reach) {
|
|
906
|
+
u.reach = N;
|
|
867
907
|
}
|
|
868
908
|
var C = S.prev;
|
|
869
|
-
if (
|
|
870
|
-
C = c(t, C,
|
|
871
|
-
A +=
|
|
909
|
+
if (R) {
|
|
910
|
+
C = c(t, C, R);
|
|
911
|
+
A += R.length;
|
|
872
912
|
}
|
|
873
913
|
p(t, C, w);
|
|
874
|
-
var D = new i(d, h ? s.tokenize(
|
|
914
|
+
var D = new i(d, h ? s.tokenize(I, h) : I, y, I);
|
|
875
915
|
S = c(t, C, D);
|
|
876
916
|
if (P) {
|
|
877
917
|
c(t, S, P);
|
|
@@ -880,14 +920,14 @@
|
|
|
880
920
|
// at least one Token object was removed, so we have to do some rematching
|
|
881
921
|
// this can only happen if the current pattern is greedy
|
|
882
922
|
/** @type {RematchOptions} */
|
|
883
|
-
var
|
|
923
|
+
var L = {
|
|
884
924
|
cause: d + "," + f,
|
|
885
|
-
reach:
|
|
925
|
+
reach: N
|
|
886
926
|
};
|
|
887
|
-
l(e, t, a, S.prev, A,
|
|
927
|
+
l(e, t, a, S.prev, A, L);
|
|
888
928
|
// the reach might have been extended because of the rematching
|
|
889
|
-
if (u &&
|
|
890
|
-
u.reach =
|
|
929
|
+
if (u && L.reach > u.reach) {
|
|
930
|
+
u.reach = L.reach;
|
|
891
931
|
}
|
|
892
932
|
}
|
|
893
933
|
}
|
|
@@ -1095,7 +1135,7 @@
|
|
|
1095
1135
|
number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
1096
1136
|
punctuation: /[{}[\],]/,
|
|
1097
1137
|
operator: /:/,
|
|
1098
|
-
boolean: /\b(?:true
|
|
1138
|
+
boolean: /\b(?:false|true)\b/,
|
|
1099
1139
|
null: {
|
|
1100
1140
|
pattern: /\bnull\b/,
|
|
1101
1141
|
alias: "keyword"
|
|
@@ -1153,7 +1193,10 @@
|
|
|
1153
1193
|
punctuation: [ {
|
|
1154
1194
|
pattern: /^=/,
|
|
1155
1195
|
alias: "attr-equals"
|
|
1156
|
-
},
|
|
1196
|
+
}, {
|
|
1197
|
+
pattern: /^(\s*)["']|["']$/,
|
|
1198
|
+
lookbehind: true
|
|
1199
|
+
} ]
|
|
1157
1200
|
}
|
|
1158
1201
|
},
|
|
1159
1202
|
punctuation: /\/?>/,
|
|
@@ -1279,14 +1322,14 @@
|
|
|
1279
1322
|
greedy: true
|
|
1280
1323
|
},
|
|
1281
1324
|
"class-name": {
|
|
1282
|
-
pattern: /(\b(?:class|
|
|
1325
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
1283
1326
|
lookbehind: true,
|
|
1284
1327
|
inside: {
|
|
1285
1328
|
punctuation: /[.\\]/
|
|
1286
1329
|
}
|
|
1287
1330
|
},
|
|
1288
|
-
keyword: /\b(?:
|
|
1289
|
-
boolean: /\b(?:true
|
|
1331
|
+
keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
1332
|
+
boolean: /\b(?:false|true)\b/,
|
|
1290
1333
|
function: /\b\w+(?=\()/,
|
|
1291
1334
|
number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
1292
1335
|
operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
@@ -1294,7 +1337,7 @@
|
|
|
1294
1337
|
};
|
|
1295
1338
|
r.languages.javascript = r.languages.extend("clike", {
|
|
1296
1339
|
"class-name": [ r.languages.clike["class-name"], {
|
|
1297
|
-
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype
|
|
1340
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
1298
1341
|
lookbehind: true
|
|
1299
1342
|
} ],
|
|
1300
1343
|
keyword: [ {
|
|
@@ -1306,14 +1349,40 @@
|
|
|
1306
1349
|
} ],
|
|
1307
1350
|
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
1308
1351
|
function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
1309
|
-
number:
|
|
1352
|
+
number: {
|
|
1353
|
+
pattern: RegExp(/(^|[^\w$])/.source + "(?:" + (
|
|
1354
|
+
// constant
|
|
1355
|
+
/NaN|Infinity/.source + "|" +
|
|
1356
|
+
// binary integer
|
|
1357
|
+
/0[bB][01]+(?:_[01]+)*n?/.source + "|" +
|
|
1358
|
+
// octal integer
|
|
1359
|
+
/0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" +
|
|
1360
|
+
// hexadecimal integer
|
|
1361
|
+
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" +
|
|
1362
|
+
// decimal bigint
|
|
1363
|
+
/\d+(?:_\d+)*n/.source + "|" +
|
|
1364
|
+
// decimal number (integer or float) but no bigint
|
|
1365
|
+
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source),
|
|
1366
|
+
lookbehind: true
|
|
1367
|
+
},
|
|
1310
1368
|
operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
1311
1369
|
});
|
|
1312
|
-
r.languages.javascript["class-name"][0].pattern = /(\b(?:class|
|
|
1370
|
+
r.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
|
1313
1371
|
r.languages.insertBefore("javascript", "keyword", {
|
|
1314
1372
|
regex: {
|
|
1373
|
+
pattern: RegExp(
|
|
1374
|
+
// lookbehind
|
|
1315
1375
|
// eslint-disable-next-line regexp/no-dupe-characters-character-class
|
|
1316
|
-
|
|
1376
|
+
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
|
|
1377
|
+
// Regex pattern:
|
|
1378
|
+
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
|
1379
|
+
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
|
1380
|
+
// with the only syntax, so we have to define 2 different regex patterns.
|
|
1381
|
+
/\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" +
|
|
1382
|
+
// `v` flag syntax. This supports 3 levels of nested character classes.
|
|
1383
|
+
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" +
|
|
1384
|
+
// lookahead
|
|
1385
|
+
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),
|
|
1317
1386
|
lookbehind: true,
|
|
1318
1387
|
greedy: true,
|
|
1319
1388
|
inside: {
|
|
@@ -1378,6 +1447,19 @@
|
|
|
1378
1447
|
},
|
|
1379
1448
|
string: /[\s\S]+/
|
|
1380
1449
|
}
|
|
1450
|
+
},
|
|
1451
|
+
"string-property": {
|
|
1452
|
+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
1453
|
+
lookbehind: true,
|
|
1454
|
+
greedy: true,
|
|
1455
|
+
alias: "property"
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
r.languages.insertBefore("javascript", "operator", {
|
|
1459
|
+
"literal-property": {
|
|
1460
|
+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
1461
|
+
lookbehind: true,
|
|
1462
|
+
alias: "property"
|
|
1381
1463
|
}
|
|
1382
1464
|
});
|
|
1383
1465
|
if (r.languages.markup) {
|
|
@@ -1408,8 +1490,8 @@
|
|
|
1408
1490
|
r = s(r).source;
|
|
1409
1491
|
e.languages.jsx = e.languages.extend("markup", t);
|
|
1410
1492
|
e.languages.jsx.tag.pattern = s(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source);
|
|
1411
|
-
e.languages.jsx.tag.inside["tag"].pattern = /^<\/?[^\s>\/]
|
|
1412
|
-
e.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)
|
|
1493
|
+
e.languages.jsx.tag.inside["tag"].pattern = /^<\/?[^\s>\/]*/;
|
|
1494
|
+
e.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/;
|
|
1413
1495
|
e.languages.jsx.tag.inside["tag"].inside["class-name"] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
|
|
1414
1496
|
e.languages.jsx.tag.inside["comment"] = t["comment"];
|
|
1415
1497
|
e.languages.insertBefore("inside", "attr-name", {
|
|
@@ -1422,14 +1504,14 @@
|
|
|
1422
1504
|
script: {
|
|
1423
1505
|
// Allow for two levels of nesting
|
|
1424
1506
|
pattern: s(/=<BRACES>/.source),
|
|
1507
|
+
alias: "language-javascript",
|
|
1425
1508
|
inside: {
|
|
1426
1509
|
"script-punctuation": {
|
|
1427
1510
|
pattern: /^=(?=\{)/,
|
|
1428
1511
|
alias: "punctuation"
|
|
1429
1512
|
},
|
|
1430
1513
|
rest: e.languages.jsx
|
|
1431
|
-
}
|
|
1432
|
-
alias: "language-javascript"
|
|
1514
|
+
}
|
|
1433
1515
|
}
|
|
1434
1516
|
}, e.languages.jsx.tag);
|
|
1435
1517
|
// The following will handle plain text inside tags
|
|
@@ -1518,16 +1600,17 @@
|
|
|
1518
1600
|
greedy: true,
|
|
1519
1601
|
inside: null
|
|
1520
1602
|
},
|
|
1521
|
-
builtin: /\b(?:
|
|
1603
|
+
builtin: /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/
|
|
1522
1604
|
});
|
|
1523
1605
|
// The keywords TypeScript adds to JavaScript
|
|
1524
|
-
e.languages.typescript.keyword.push(/\b(?:abstract|
|
|
1606
|
+
e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,
|
|
1525
1607
|
// keywords that have to be followed by an identifier
|
|
1526
1608
|
/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
|
|
1527
1609
|
// This is for `import type *, {}`
|
|
1528
1610
|
/\btype\b(?=\s*(?:[\{*]|$))/);
|
|
1529
1611
|
// doesn't work with TS because TS is too complex
|
|
1530
1612
|
delete e.languages.typescript["parameter"];
|
|
1613
|
+
delete e.languages.typescript["literal-property"];
|
|
1531
1614
|
// a version of typescript specifically for highlighting types
|
|
1532
1615
|
var t = e.languages.extend("typescript", {});
|
|
1533
1616
|
delete t["class-name"];
|
|
@@ -1563,6 +1646,9 @@
|
|
|
1563
1646
|
(function(e) {
|
|
1564
1647
|
var t = e.util.clone(e.languages.typescript);
|
|
1565
1648
|
e.languages.tsx = e.languages.extend("jsx", t);
|
|
1649
|
+
// doesn't work with TS because TS is too complex
|
|
1650
|
+
delete e.languages.tsx["parameter"];
|
|
1651
|
+
delete e.languages.tsx["literal-property"];
|
|
1566
1652
|
// This will prevent collisions between TSX tags and TS generic types.
|
|
1567
1653
|
// Idea by https://github.com/karlhorky
|
|
1568
1654
|
// Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
|
|
@@ -1575,7 +1661,7 @@
|
|
|
1575
1661
|
e.languages.css = {
|
|
1576
1662
|
comment: /\/\*[\s\S]*?\*\//,
|
|
1577
1663
|
atrule: {
|
|
1578
|
-
pattern:
|
|
1664
|
+
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + t.source + ")*?" + /(?:;|(?=\s*\{))/.source),
|
|
1579
1665
|
inside: {
|
|
1580
1666
|
rule: /^@[\w-]+/,
|
|
1581
1667
|
"selector-function-argument": {
|
|
@@ -1688,7 +1774,7 @@
|
|
|
1688
1774
|
}
|
|
1689
1775
|
}, /\$(?:\w+|[#?*!@$])/ ],
|
|
1690
1776
|
// Escape sequences from echo and printf's manuals, and escaped quotes.
|
|
1691
|
-
entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|
|
|
1777
|
+
entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
|
1692
1778
|
};
|
|
1693
1779
|
e.languages.bash = {
|
|
1694
1780
|
shebang: {
|
|
@@ -1723,7 +1809,7 @@
|
|
|
1723
1809
|
// Highlight variable names as variables in the left-hand part
|
|
1724
1810
|
// of assignments (“=” and “+=”).
|
|
1725
1811
|
"assign-left": {
|
|
1726
|
-
pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
|
|
1812
|
+
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
1727
1813
|
inside: {
|
|
1728
1814
|
environment: {
|
|
1729
1815
|
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + t),
|
|
@@ -1734,6 +1820,12 @@
|
|
|
1734
1820
|
alias: "variable",
|
|
1735
1821
|
lookbehind: true
|
|
1736
1822
|
},
|
|
1823
|
+
// Highlight parameter names as variables
|
|
1824
|
+
parameter: {
|
|
1825
|
+
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
|
|
1826
|
+
alias: "variable",
|
|
1827
|
+
lookbehind: true
|
|
1828
|
+
},
|
|
1737
1829
|
string: [
|
|
1738
1830
|
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
|
|
1739
1831
|
{
|
|
@@ -1778,22 +1870,22 @@
|
|
|
1778
1870
|
},
|
|
1779
1871
|
variable: n.variable,
|
|
1780
1872
|
function: {
|
|
1781
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|
|
|
1873
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
|
|
1782
1874
|
lookbehind: true
|
|
1783
1875
|
},
|
|
1784
1876
|
keyword: {
|
|
1785
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:
|
|
1877
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
|
1786
1878
|
lookbehind: true
|
|
1787
1879
|
},
|
|
1788
1880
|
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
|
1789
1881
|
builtin: {
|
|
1790
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|
|
|
1882
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
|
|
1791
1883
|
lookbehind: true,
|
|
1792
1884
|
// Alias added to make those easier to distinguish from strings.
|
|
1793
1885
|
alias: "class-name"
|
|
1794
1886
|
},
|
|
1795
1887
|
boolean: {
|
|
1796
|
-
pattern: /(^|[\s;|&]|[<>]\()(?:true
|
|
1888
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
|
1797
1889
|
lookbehind: true
|
|
1798
1890
|
},
|
|
1799
1891
|
"file-descriptor": {
|
|
@@ -1817,11 +1909,12 @@
|
|
|
1817
1909
|
}
|
|
1818
1910
|
};
|
|
1819
1911
|
a.inside = e.languages.bash;
|
|
1820
|
-
/* Patterns in command substitution. */ var r = [ "comment", "function-name", "for-or-select", "assign-left", "string", "environment", "function", "keyword", "builtin", "boolean", "file-descriptor", "operator", "punctuation", "number" ];
|
|
1912
|
+
/* Patterns in command substitution. */ var r = [ "comment", "function-name", "for-or-select", "assign-left", "parameter", "string", "environment", "function", "keyword", "builtin", "boolean", "file-descriptor", "operator", "punctuation", "number" ];
|
|
1821
1913
|
var s = n.variable[1].inside;
|
|
1822
1914
|
for (var i = 0; i < r.length; i++) {
|
|
1823
1915
|
s[r[i]] = e.languages.bash[r[i]];
|
|
1824
1916
|
}
|
|
1917
|
+
e.languages.sh = e.languages.bash;
|
|
1825
1918
|
e.languages.shell = e.languages.bash;
|
|
1826
1919
|
})(r);
|
|
1827
1920
|
(function(e) {
|
|
@@ -1884,7 +1977,7 @@
|
|
|
1884
1977
|
alias: "number"
|
|
1885
1978
|
},
|
|
1886
1979
|
boolean: {
|
|
1887
|
-
pattern: i(/true
|
|
1980
|
+
pattern: i(/false|true/.source, "i"),
|
|
1888
1981
|
lookbehind: true,
|
|
1889
1982
|
alias: "important"
|
|
1890
1983
|
},
|
|
@@ -2021,7 +2114,7 @@
|
|
|
2021
2114
|
a.r(n);
|
|
2022
2115
|
// EXPORTS
|
|
2023
2116
|
a.d(n, {
|
|
2024
|
-
default: () => /* reexport */
|
|
2117
|
+
default: () => /* reexport */ j
|
|
2025
2118
|
});
|
|
2026
2119
|
// CONCATENATED MODULE: external "react"
|
|
2027
2120
|
const e = require("react");
|
|
@@ -2139,7 +2232,7 @@
|
|
|
2139
2232
|
important: k.variables.syntaxOrange,
|
|
2140
2233
|
variable: k.variables.syntaxOrange
|
|
2141
2234
|
};
|
|
2142
|
-
var
|
|
2235
|
+
var $ = y().span.withConfig({
|
|
2143
2236
|
displayName: "CodeStyles__StyledToken",
|
|
2144
2237
|
componentId: "sc-1eq4k68-3"
|
|
2145
2238
|
})([ "color:", ";cursor:", ";opacity:", ";font-style:", ";font-weight:", ";" ], (function(e) {
|
|
@@ -2159,8 +2252,8 @@
|
|
|
2159
2252
|
return t === "important" || t === "bold" ? "bold" : null;
|
|
2160
2253
|
}));
|
|
2161
2254
|
// CONCATENATED MODULE: ./src/Code/Code.tsx
|
|
2162
|
-
function
|
|
2163
|
-
|
|
2255
|
+
function I() {
|
|
2256
|
+
I = Object.assign || function(e) {
|
|
2164
2257
|
for (var t = 1; t < arguments.length; t++) {
|
|
2165
2258
|
var a = arguments[t];
|
|
2166
2259
|
for (var n in a) {
|
|
@@ -2171,9 +2264,9 @@
|
|
|
2171
2264
|
}
|
|
2172
2265
|
return e;
|
|
2173
2266
|
};
|
|
2174
|
-
return
|
|
2267
|
+
return I.apply(this, arguments);
|
|
2175
2268
|
}
|
|
2176
|
-
function
|
|
2269
|
+
function R(e, t) {
|
|
2177
2270
|
if (e == null) return {};
|
|
2178
2271
|
var a = P(e, t);
|
|
2179
2272
|
var n, r;
|
|
@@ -2204,20 +2297,20 @@
|
|
|
2204
2297
|
// auto formatting. The import below points to an empty file which is replaced at build
|
|
2205
2298
|
// time, see ./prism/build-isolated-prism.js for details.
|
|
2206
2299
|
// typed as 'prismjs'
|
|
2207
|
-
var
|
|
2300
|
+
var N = [ "bash", "clike", "css", "html", "json", "javascript", "js", "jsx", "typescript", "ts", "tsx", "markup", "mathml", "splunk-spl", "svg", "xml", "yaml", "yml" ];
|
|
2208
2301
|
function C(e, t) {
|
|
2209
2302
|
return v().tokenize(e, v().languages[t]);
|
|
2210
2303
|
}
|
|
2211
2304
|
var D = {
|
|
2212
2305
|
elementRef: s().oneOfType([ s().func, s().object ]),
|
|
2213
2306
|
indentChars: s().number,
|
|
2214
|
-
language: s().oneOf(
|
|
2215
|
-
languageFallback: s().oneOf(
|
|
2307
|
+
language: s().oneOf(N),
|
|
2308
|
+
languageFallback: s().oneOf(N),
|
|
2216
2309
|
showIndentGuide: s().bool,
|
|
2217
2310
|
value: s().string
|
|
2218
2311
|
};
|
|
2219
|
-
function
|
|
2220
|
-
var a = e.elementRef, n = e.indentChars, r = n === void 0 ? 4 : n, s = e.language, i = e.languageFallback, l = i === void 0 ? "javascript" : i, c = e.showIndentGuide, d = c === void 0 ? true : c, f = e.value, h = f === void 0 ? "" : f, v =
|
|
2312
|
+
function L(e) {
|
|
2313
|
+
var a = e.elementRef, n = e.indentChars, r = n === void 0 ? 4 : n, s = e.language, i = e.languageFallback, l = i === void 0 ? "javascript" : i, c = e.showIndentGuide, d = c === void 0 ? true : c, f = e.value, h = f === void 0 ? "" : f, v = R(e, [ "elementRef", "indentChars", "language", "languageFallback", "showIndentGuide", "value" ]);
|
|
2221
2314
|
// @docs-props-type CodePropsBase
|
|
2222
2315
|
var b = g()(" ", r);
|
|
2223
2316
|
var y = function e(a) {
|
|
@@ -2235,7 +2328,7 @@
|
|
|
2235
2328
|
return i;
|
|
2236
2329
|
};
|
|
2237
2330
|
// a fix for SUI-5425, where the Markdown component doesn't pass a valid language in some circumstances
|
|
2238
|
-
var k = p()(
|
|
2331
|
+
var k = p()(N, s) > -1;
|
|
2239
2332
|
if (false) {}
|
|
2240
2333
|
var F = k && s ? s : l;
|
|
2241
2334
|
var w = C(h, F);
|
|
@@ -2264,7 +2357,7 @@
|
|
|
2264
2357
|
}
|
|
2265
2358
|
var s = typeof a.content === "string" ? a.content : e(a.content);
|
|
2266
2359
|
|
|
2267
|
-
return t().createElement(
|
|
2360
|
+
return t().createElement($, {
|
|
2268
2361
|
"data-part-type": a.type,
|
|
2269
2362
|
partType: a.type,
|
|
2270
2363
|
key: n.toString()
|
|
@@ -2273,7 +2366,7 @@
|
|
|
2273
2366
|
};
|
|
2274
2367
|
var _ = E(w);
|
|
2275
2368
|
|
|
2276
|
-
return t().createElement(x,
|
|
2369
|
+
return t().createElement(x, I({
|
|
2277
2370
|
"data-test": "code",
|
|
2278
2371
|
ref: a,
|
|
2279
2372
|
tabIndex: 0
|
|
@@ -2281,8 +2374,8 @@
|
|
|
2281
2374
|
className: "language-".concat(F)
|
|
2282
2375
|
}, _));
|
|
2283
2376
|
}
|
|
2284
|
-
|
|
2285
|
-
/* harmony default export */ const
|
|
2377
|
+
L.propTypes = D;
|
|
2378
|
+
/* harmony default export */ const j = L;
|
|
2286
2379
|
}) // CONCATENATED MODULE: ./src/Code/index.ts
|
|
2287
2380
|
();
|
|
2288
2381
|
module.exports = n;
|