@splunk/react-ui 5.2.0 → 5.4.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/Accordion.js +31 -31
- package/Avatar.js +64 -59
- package/Box.js +2 -1
- package/Breadcrumbs.js +66 -63
- package/ButtonSimple.js +52 -52
- package/CHANGELOG.md +47 -0
- package/Calendar.js +8 -4
- package/CardLayout.js +39 -36
- package/Checkbox.d.ts +2 -0
- package/Checkbox.js +350 -0
- package/Clickable.js +5 -6
- package/Code.js +451 -536
- package/CollapsiblePanel.js +184 -210
- package/Color.js +903 -1023
- package/ControlGroup.js +2 -1
- package/Date.js +123 -119
- package/DefinitionList.js +100 -77
- package/Dropdown.js +2 -2
- package/DualListbox.js +409 -353
- package/File.js +102 -99
- package/FormRows.js +13 -11
- package/JSONTree.js +679 -1391
- package/Link.js +7 -7
- package/MIGRATION.md +27 -0
- package/Markdown.js +171 -156
- package/Menu.js +107 -100
- package/Modal.js +3 -3
- package/Multiselect.js +2698 -2767
- package/Paginator.js +2 -1
- package/Popover.js +201 -196
- package/Resize.js +11 -8
- package/ResultsMenu.js +913 -1029
- package/ScreenReaderContent.js +86 -130
- package/Scroll.js +366 -424
- package/Search.js +131 -127
- package/Select.js +1741 -1831
- package/Slider.js +1 -1
- package/SlidingPanels.js +129 -127
- package/StepBar.js +123 -97
- package/Switch.js +214 -242
- package/TabBar.js +10 -10
- package/Table.js +1255 -1248
- package/Text.js +180 -206
- package/TextArea.js +596 -675
- package/Tooltip.js +144 -139
- package/Tree.js +638 -682
- package/package.json +15 -16
- package/tsconfig.check-docs.json +8 -0
- package/types/src/Avatar/docs/examples/Basic.d.ts +1 -1
- package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
- package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
- package/types/src/Breadcrumbs/Item.d.ts +1 -1
- package/types/src/ButtonSimple/mixin.d.ts +1 -1
- package/types/src/Checkbox/Checkbox.d.ts +90 -0
- package/types/src/Checkbox/docs/examples/Basic.d.ts +7 -0
- package/types/src/Checkbox/docs/examples/Disabled.d.ts +6 -0
- package/types/src/Checkbox/docs/examples/Error.d.ts +6 -0
- package/types/src/Checkbox/docs/examples/Uncontrolled.d.ts +7 -0
- package/types/src/Checkbox/index.d.ts +2 -0
- package/types/src/Code/Code.d.ts +4 -1
- package/types/src/Code/LineHighlights.d.ts +1 -0
- package/types/src/Code/LineNumbers.d.ts +2 -1
- package/types/src/Code/docs/examples/CustomizeContainer.d.ts +7 -0
- package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +3 -3
- package/types/src/Date/Date.d.ts +7 -1
- package/types/src/DefinitionList/DefinitionList.d.ts +7 -2
- package/types/src/DefinitionList/DefinitionListContext.d.ts +1 -1
- package/types/src/DefinitionList/docs/examples/StackedLayout.d.ts +6 -0
- package/types/src/DualListbox/DualListbox.d.ts +1 -1
- package/types/src/DualListbox/Label.d.ts +7 -7
- package/types/src/DualListbox/Listbox.d.ts +2 -2
- package/types/src/DualListbox/ListboxContext.d.ts +1 -1
- package/types/src/File/File.d.ts +7 -1
- package/types/src/JSONTree/JSONTreeItem.d.ts +5 -3
- package/types/src/JSONTree/renderTreeItems.d.ts +3 -2
- package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +2 -1
- package/types/src/Menu/docs/examples/Dimmed.d.ts +1 -1
- package/types/src/Menu/docs/examples/Disabled.d.ts +1 -0
- package/types/src/Modal/ModalContext.d.ts +1 -1
- package/types/src/Multiselect/Compact.d.ts +9 -3
- package/types/src/Multiselect/Multiselect.d.ts +7 -1
- package/types/src/Multiselect/Normal.d.ts +9 -3
- package/types/src/Number/utils.d.ts +1 -1
- package/types/src/Popover/getPlacement.d.ts +1 -1
- package/types/src/RadioList/Option.d.ts +1 -1
- package/types/src/RadioList/RadioListContext.d.ts +1 -1
- package/types/src/Search/Search.d.ts +5 -1
- package/types/src/StepBar/StepBar.d.ts +4 -1
- package/types/src/StepBar/StepBarContext.d.ts +1 -0
- package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
- package/types/src/Switch/Switch.d.ts +13 -1
- package/types/src/Switch/docs/examples/Basic.d.ts +2 -10
- package/types/src/Switch/docs/examples/Disabled.d.ts +2 -9
- package/types/src/TabBar/Tab.d.ts +3 -1
- package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
- package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
- package/types/src/TabLayout/Panel.d.ts +2 -0
- package/types/src/Table/ExpandButton.d.ts +1 -1
- package/types/src/Table/Head.d.ts +1 -1
- package/types/src/Table/Row.d.ts +1 -1
- package/types/src/Table/Table.d.ts +1 -0
- package/types/src/Tooltip/Tooltip.d.ts +14 -1
- package/types/src/Tree/TreeContext.d.ts +1 -1
- package/useControlled.js +61 -97
- package/usePrevious.js +30 -62
- package/useResizeObserver.js +95 -127
- package/NonInteractiveCheckbox.js +0 -101
- package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +0 -12
- package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +0 -22
- package/types/src/NonInteractiveCheckbox/index.d.ts +0 -1
- package/types/src/Switch/docs/examples/Error.d.ts +0 -6
- package/types/src/Text/IconOutlinedHide.d.ts +0 -3
- package/types/src/Text/IconOutlinedView.d.ts +0 -3
- /package/cypress/{tsconfig.cypress.json → tsconfig.check-cypress.json} +0 -0
package/Code.js
CHANGED
|
@@ -1,113 +1,13 @@
|
|
|
1
1
|
/******/ (() => {
|
|
2
2
|
// webpackBootstrap
|
|
3
3
|
/******/ var e = {
|
|
4
|
-
/***/ 6283:
|
|
5
|
-
/***/ (e, t, n) => {
|
|
6
|
-
"use strict";
|
|
7
|
-
// EXPORTS
|
|
8
|
-
n.d(t, {
|
|
9
|
-
default: () => /* reexport */ p
|
|
10
|
-
});
|
|
11
|
-
// EXTERNAL MODULE: external "react"
|
|
12
|
-
var r = n(9497);
|
|
13
|
-
// CONCATENATED MODULE: ./src/useResizeObserver/useResizeObserver.ts
|
|
14
|
-
function a(e, t) {
|
|
15
|
-
return u(e) || l(e, t) || s(e, t) || i();
|
|
16
|
-
}
|
|
17
|
-
function i() {
|
|
18
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
19
|
-
}
|
|
20
|
-
function s(e, t) {
|
|
21
|
-
if (e) {
|
|
22
|
-
if ("string" == typeof e) return o(e, t);
|
|
23
|
-
var n = {}.toString.call(e).slice(8, -1);
|
|
24
|
-
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? o(e, t) : void 0;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function o(e, t) {
|
|
28
|
-
(null == t || t > e.length) && (t = e.length);
|
|
29
|
-
for (var n = 0, r = Array(t); n < t; n++) {
|
|
30
|
-
r[n] = e[n];
|
|
31
|
-
}
|
|
32
|
-
return r;
|
|
33
|
-
}
|
|
34
|
-
function l(e, t) {
|
|
35
|
-
var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
36
|
-
if (null != n) {
|
|
37
|
-
var r, a, i, s, o = [], l = !0, u = !1;
|
|
38
|
-
try {
|
|
39
|
-
if (i = (n = n.call(e)).next, 0 === t) {
|
|
40
|
-
if (Object(n) !== n) return;
|
|
41
|
-
l = !1;
|
|
42
|
-
} else for (;!(l = (r = i.call(n)).done) && (o.push(r.value), o.length !== t); l = !0) {
|
|
43
|
-
}
|
|
44
|
-
} catch (e) {
|
|
45
|
-
u = !0, a = e;
|
|
46
|
-
} finally {
|
|
47
|
-
try {
|
|
48
|
-
if (!l && null != n["return"] && (s = n["return"](), Object(s) !== s)) return;
|
|
49
|
-
} finally {
|
|
50
|
-
if (u) throw a;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return o;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function u(e) {
|
|
57
|
-
if (Array.isArray(e)) return e;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Watches a React ref element for changes in size.
|
|
61
|
-
*
|
|
62
|
-
* @param ref - The React ref to observe size changes on
|
|
63
|
-
*/ var c = function e(t, n) {
|
|
64
|
-
var i = (0, r.useState)({
|
|
65
|
-
width: 0,
|
|
66
|
-
height: 0
|
|
67
|
-
}), s = a(i, 2), o = s[0], l = s[1];
|
|
68
|
-
(0, r.useEffect)((function() {
|
|
69
|
-
var e = t.current;
|
|
70
|
-
if (typeof window !== "undefined" && window.ResizeObserver) {
|
|
71
|
-
var r = new ResizeObserver((function(e) {
|
|
72
|
-
if (e[0]) {
|
|
73
|
-
var r, a;
|
|
74
|
-
var i = {
|
|
75
|
-
width: (t === null || t === void 0 ? void 0 : (r = t.current) === null || r === void 0 ? void 0 : r.getBoundingClientRect().width) || 0,
|
|
76
|
-
height: (t === null || t === void 0 ? void 0 : (a = t.current) === null || a === void 0 ? void 0 : a.getBoundingClientRect().height) || 0
|
|
77
|
-
};
|
|
78
|
-
l((function(e) {
|
|
79
|
-
if (e.height !== i.height || e.width !== i.width) {
|
|
80
|
-
n === null || n === void 0 ? void 0 : n(i);
|
|
81
|
-
return i;
|
|
82
|
-
}
|
|
83
|
-
return e;
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
}));
|
|
87
|
-
if (e) {
|
|
88
|
-
r.observe(e);
|
|
89
|
-
}
|
|
90
|
-
return function() {
|
|
91
|
-
if (e) {
|
|
92
|
-
r.unobserve(e);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
// Return a no-op function to satisfy consistent-return rule
|
|
97
|
-
return function() {};
|
|
98
|
-
}), [ n, t ]);
|
|
99
|
-
return o;
|
|
100
|
-
};
|
|
101
|
-
/* harmony default export */ const p = c;
|
|
102
|
-
} // CONCATENATED MODULE: ./src/useResizeObserver/index.ts
|
|
103
|
-
/***/ ,
|
|
104
4
|
/***/ 74:
|
|
105
5
|
/***/ e => {
|
|
106
6
|
(function() {
|
|
107
7
|
var t = undefined;
|
|
108
8
|
var n = undefined;
|
|
109
9
|
/// <reference lib="WebWorker"/>
|
|
110
|
-
var
|
|
10
|
+
var a = typeof t !== "undefined" ? t : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
|
|
111
11
|
/**
|
|
112
12
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
113
13
|
*
|
|
@@ -115,12 +15,12 @@
|
|
|
115
15
|
* @author Lea Verou <https://lea.verou.me>
|
|
116
16
|
* @namespace
|
|
117
17
|
* @public
|
|
118
|
-
*/ var
|
|
18
|
+
*/ var r = function(e) {
|
|
119
19
|
// Private helper vars
|
|
120
20
|
var n = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
|
|
121
|
-
var
|
|
21
|
+
var a = 0;
|
|
122
22
|
// The grammar object for plaintext
|
|
123
|
-
var
|
|
23
|
+
var r = {};
|
|
124
24
|
var i = {
|
|
125
25
|
/**
|
|
126
26
|
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
@@ -213,7 +113,7 @@
|
|
|
213
113
|
objId: function(e) {
|
|
214
114
|
if (!e["__id"]) {
|
|
215
115
|
Object.defineProperty(e, "__id", {
|
|
216
|
-
value: ++
|
|
116
|
+
value: ++a
|
|
217
117
|
});
|
|
218
118
|
}
|
|
219
119
|
return e["__id"];
|
|
@@ -230,36 +130,36 @@
|
|
|
230
130
|
*/
|
|
231
131
|
clone: function e(t, n) {
|
|
232
132
|
n = n || {};
|
|
233
|
-
var r;
|
|
234
133
|
var a;
|
|
134
|
+
var r;
|
|
235
135
|
switch (i.util.type(t)) {
|
|
236
136
|
case "Object":
|
|
237
|
-
|
|
238
|
-
if (n[
|
|
239
|
-
return n[
|
|
137
|
+
r = i.util.objId(t);
|
|
138
|
+
if (n[r]) {
|
|
139
|
+
return n[r];
|
|
240
140
|
}
|
|
241
|
-
|
|
242
|
-
n[
|
|
141
|
+
a = /** @type {Record<string, any>} */ {};
|
|
142
|
+
n[r] = a;
|
|
243
143
|
for (var s in t) {
|
|
244
144
|
if (t.hasOwnProperty(s)) {
|
|
245
|
-
|
|
145
|
+
a[s] = e(t[s], n);
|
|
246
146
|
}
|
|
247
147
|
}
|
|
248
148
|
/** @type {any} */
|
|
249
|
-
return
|
|
149
|
+
return a;
|
|
250
150
|
|
|
251
151
|
case "Array":
|
|
252
|
-
|
|
253
|
-
if (n[
|
|
254
|
-
return n[
|
|
152
|
+
r = i.util.objId(t);
|
|
153
|
+
if (n[r]) {
|
|
154
|
+
return n[r];
|
|
255
155
|
}
|
|
256
|
-
|
|
257
|
-
n[
|
|
258
|
-
/** @type {Array} */ /** @type {any} */ t.forEach((function(t,
|
|
259
|
-
r
|
|
156
|
+
a = [];
|
|
157
|
+
n[r] = a;
|
|
158
|
+
/** @type {Array} */ /** @type {any} */ t.forEach((function(t, r) {
|
|
159
|
+
a[r] = e(t, n);
|
|
260
160
|
}));
|
|
261
161
|
/** @type {any} */
|
|
262
|
-
return
|
|
162
|
+
return a;
|
|
263
163
|
|
|
264
164
|
default:
|
|
265
165
|
return t;
|
|
@@ -318,13 +218,13 @@
|
|
|
318
218
|
// this will not work for inline scripts
|
|
319
219
|
try {
|
|
320
220
|
throw new Error;
|
|
321
|
-
} catch (
|
|
221
|
+
} catch (a) {
|
|
322
222
|
// Get file src url from stack. Specifically works with the format of stack traces in IE.
|
|
323
223
|
// A stack will look like this:
|
|
324
224
|
// Error
|
|
325
225
|
// at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
|
|
326
226
|
// at Global code (http://localhost/components/prism-core.js:606:1)
|
|
327
|
-
var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(
|
|
227
|
+
var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(a.stack) || [])[1];
|
|
328
228
|
if (e) {
|
|
329
229
|
var t = document.getElementsByTagName("script");
|
|
330
230
|
for (var n in t) {
|
|
@@ -356,13 +256,13 @@
|
|
|
356
256
|
* @returns {boolean}
|
|
357
257
|
*/
|
|
358
258
|
isActive: function(e, t, n) {
|
|
359
|
-
var
|
|
259
|
+
var a = "no-" + t;
|
|
360
260
|
while (e) {
|
|
361
|
-
var
|
|
362
|
-
if (
|
|
261
|
+
var r = e.classList;
|
|
262
|
+
if (r.contains(t)) {
|
|
363
263
|
return true;
|
|
364
264
|
}
|
|
365
|
-
if (
|
|
265
|
+
if (r.contains(a)) {
|
|
366
266
|
return false;
|
|
367
267
|
}
|
|
368
268
|
e = e.parentElement;
|
|
@@ -381,10 +281,10 @@
|
|
|
381
281
|
/**
|
|
382
282
|
* The grammar for plain, unformatted text.
|
|
383
283
|
*/
|
|
384
|
-
plain:
|
|
385
|
-
plaintext:
|
|
386
|
-
text:
|
|
387
|
-
txt:
|
|
284
|
+
plain: r,
|
|
285
|
+
plaintext: r,
|
|
286
|
+
text: r,
|
|
287
|
+
txt: r,
|
|
388
288
|
/**
|
|
389
289
|
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
390
290
|
*
|
|
@@ -415,8 +315,8 @@
|
|
|
415
315
|
*/
|
|
416
316
|
extend: function(e, t) {
|
|
417
317
|
var n = i.util.clone(i.languages[e]);
|
|
418
|
-
for (var
|
|
419
|
-
n[
|
|
318
|
+
for (var a in t) {
|
|
319
|
+
n[a] = t[a];
|
|
420
320
|
}
|
|
421
321
|
return n;
|
|
422
322
|
},
|
|
@@ -495,12 +395,12 @@
|
|
|
495
395
|
* @returns {Grammar} The new grammar object.
|
|
496
396
|
* @public
|
|
497
397
|
*/
|
|
498
|
-
insertBefore: function(e, t, n,
|
|
499
|
-
|
|
500
|
-
var
|
|
398
|
+
insertBefore: function(e, t, n, a) {
|
|
399
|
+
a = a || /** @type {any} */ i.languages;
|
|
400
|
+
var r = a[e];
|
|
501
401
|
/** @type {Grammar} */ var s = {};
|
|
502
|
-
for (var o in
|
|
503
|
-
if (
|
|
402
|
+
for (var o in r) {
|
|
403
|
+
if (r.hasOwnProperty(o)) {
|
|
504
404
|
if (o == t) {
|
|
505
405
|
for (var l in n) {
|
|
506
406
|
if (n.hasOwnProperty(l)) {
|
|
@@ -510,12 +410,12 @@
|
|
|
510
410
|
}
|
|
511
411
|
// Do not insert token which also occur in insert. See #1525
|
|
512
412
|
if (!n.hasOwnProperty(o)) {
|
|
513
|
-
s[o] =
|
|
413
|
+
s[o] = r[o];
|
|
514
414
|
}
|
|
515
415
|
}
|
|
516
416
|
}
|
|
517
|
-
var u =
|
|
518
|
-
|
|
417
|
+
var u = a[e];
|
|
418
|
+
a[e] = s;
|
|
519
419
|
// Update references in other language definitions
|
|
520
420
|
i.languages.DFS(i.languages, (function(t, n) {
|
|
521
421
|
if (n === u && t != e) {
|
|
@@ -525,20 +425,20 @@
|
|
|
525
425
|
return s;
|
|
526
426
|
},
|
|
527
427
|
// Traverse a language definition with Depth First Search
|
|
528
|
-
DFS: function e(t, n,
|
|
529
|
-
|
|
428
|
+
DFS: function e(t, n, a, r) {
|
|
429
|
+
r = r || {};
|
|
530
430
|
var s = i.util.objId;
|
|
531
431
|
for (var o in t) {
|
|
532
432
|
if (t.hasOwnProperty(o)) {
|
|
533
|
-
n.call(t, o, t[o],
|
|
433
|
+
n.call(t, o, t[o], a || o);
|
|
534
434
|
var l = t[o];
|
|
535
435
|
var u = i.util.type(l);
|
|
536
|
-
if (u === "Object" && !
|
|
537
|
-
|
|
538
|
-
e(l, n, null,
|
|
539
|
-
} else if (u === "Array" && !
|
|
540
|
-
|
|
541
|
-
e(l, n, o,
|
|
436
|
+
if (u === "Object" && !r[s(l)]) {
|
|
437
|
+
r[s(l)] = true;
|
|
438
|
+
e(l, n, null, r);
|
|
439
|
+
} else if (u === "Array" && !r[s(l)]) {
|
|
440
|
+
r[s(l)] = true;
|
|
441
|
+
e(l, n, o, r);
|
|
542
442
|
}
|
|
543
443
|
}
|
|
544
444
|
}
|
|
@@ -576,16 +476,16 @@
|
|
|
576
476
|
* @public
|
|
577
477
|
*/
|
|
578
478
|
highlightAllUnder: function(e, t, n) {
|
|
579
|
-
var
|
|
479
|
+
var a = {
|
|
580
480
|
callback: n,
|
|
581
481
|
container: e,
|
|
582
482
|
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
583
483
|
};
|
|
584
|
-
i.hooks.run("before-highlightall",
|
|
585
|
-
|
|
586
|
-
i.hooks.run("before-all-elements-highlight",
|
|
587
|
-
for (var
|
|
588
|
-
i.highlightElement(s, t === true,
|
|
484
|
+
i.hooks.run("before-highlightall", a);
|
|
485
|
+
a.elements = Array.prototype.slice.apply(a.container.querySelectorAll(a.selector));
|
|
486
|
+
i.hooks.run("before-all-elements-highlight", a);
|
|
487
|
+
for (var r = 0, s; s = a.elements[r++]; ) {
|
|
488
|
+
i.highlightElement(s, t === true, a.callback);
|
|
589
489
|
}
|
|
590
490
|
},
|
|
591
491
|
/**
|
|
@@ -616,21 +516,21 @@
|
|
|
616
516
|
* @memberof Prism
|
|
617
517
|
* @public
|
|
618
518
|
*/
|
|
619
|
-
highlightElement: function(t, n,
|
|
519
|
+
highlightElement: function(t, n, a) {
|
|
620
520
|
// Find language
|
|
621
|
-
var
|
|
622
|
-
var s = i.languages[
|
|
521
|
+
var r = i.util.getLanguage(t);
|
|
522
|
+
var s = i.languages[r];
|
|
623
523
|
// Set language on the element, if not present
|
|
624
|
-
i.util.setLanguage(t,
|
|
524
|
+
i.util.setLanguage(t, r);
|
|
625
525
|
// Set language on the parent, for styling
|
|
626
526
|
var o = t.parentElement;
|
|
627
527
|
if (o && o.nodeName.toLowerCase() === "pre") {
|
|
628
|
-
i.util.setLanguage(o,
|
|
528
|
+
i.util.setLanguage(o, r);
|
|
629
529
|
}
|
|
630
530
|
var l = t.textContent;
|
|
631
531
|
var u = {
|
|
632
532
|
element: t,
|
|
633
|
-
language:
|
|
533
|
+
language: r,
|
|
634
534
|
grammar: s,
|
|
635
535
|
code: l
|
|
636
536
|
};
|
|
@@ -640,7 +540,7 @@
|
|
|
640
540
|
u.element.innerHTML = u.highlightedCode;
|
|
641
541
|
i.hooks.run("after-highlight", u);
|
|
642
542
|
i.hooks.run("complete", u);
|
|
643
|
-
|
|
543
|
+
a && a.call(u.element);
|
|
644
544
|
}
|
|
645
545
|
i.hooks.run("before-sanity-check", u);
|
|
646
546
|
// plugins may change/add the parent/element
|
|
@@ -650,7 +550,7 @@
|
|
|
650
550
|
}
|
|
651
551
|
if (!u.code) {
|
|
652
552
|
i.hooks.run("complete", u);
|
|
653
|
-
|
|
553
|
+
a && a.call(u.element);
|
|
654
554
|
return;
|
|
655
555
|
}
|
|
656
556
|
i.hooks.run("before-highlight", u);
|
|
@@ -693,18 +593,18 @@
|
|
|
693
593
|
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
694
594
|
*/
|
|
695
595
|
highlight: function(e, t, n) {
|
|
696
|
-
var
|
|
596
|
+
var a = {
|
|
697
597
|
code: e,
|
|
698
598
|
grammar: t,
|
|
699
599
|
language: n
|
|
700
600
|
};
|
|
701
|
-
i.hooks.run("before-tokenize",
|
|
702
|
-
if (!
|
|
703
|
-
throw new Error('The language "' +
|
|
601
|
+
i.hooks.run("before-tokenize", a);
|
|
602
|
+
if (!a.grammar) {
|
|
603
|
+
throw new Error('The language "' + a.language + '" has no grammar.');
|
|
704
604
|
}
|
|
705
|
-
|
|
706
|
-
i.hooks.run("after-tokenize",
|
|
707
|
-
return s.stringify(i.util.encode(
|
|
605
|
+
a.tokens = i.tokenize(a.code, a.grammar);
|
|
606
|
+
i.hooks.run("after-tokenize", a);
|
|
607
|
+
return s.stringify(i.util.encode(a.tokens), a.language);
|
|
708
608
|
},
|
|
709
609
|
/**
|
|
710
610
|
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
@@ -733,15 +633,15 @@
|
|
|
733
633
|
tokenize: function(e, t) {
|
|
734
634
|
var n = t.rest;
|
|
735
635
|
if (n) {
|
|
736
|
-
for (var
|
|
737
|
-
t[
|
|
636
|
+
for (var a in n) {
|
|
637
|
+
t[a] = n[a];
|
|
738
638
|
}
|
|
739
639
|
delete t.rest;
|
|
740
640
|
}
|
|
741
|
-
var
|
|
742
|
-
c(
|
|
743
|
-
l(e,
|
|
744
|
-
return d(
|
|
641
|
+
var r = new u;
|
|
642
|
+
c(r, r.head, e);
|
|
643
|
+
l(e, r, t, r.head, 0);
|
|
644
|
+
return d(r);
|
|
745
645
|
},
|
|
746
646
|
/**
|
|
747
647
|
* @namespace
|
|
@@ -781,8 +681,8 @@
|
|
|
781
681
|
if (!n || !n.length) {
|
|
782
682
|
return;
|
|
783
683
|
}
|
|
784
|
-
for (var
|
|
785
|
-
|
|
684
|
+
for (var a = 0, r; r = n[a++]; ) {
|
|
685
|
+
r(t);
|
|
786
686
|
}
|
|
787
687
|
}
|
|
788
688
|
},
|
|
@@ -803,7 +703,7 @@
|
|
|
803
703
|
* @class
|
|
804
704
|
* @global
|
|
805
705
|
* @public
|
|
806
|
-
*/ function s(e, t, n,
|
|
706
|
+
*/ function s(e, t, n, a) {
|
|
807
707
|
/**
|
|
808
708
|
* The type of the token.
|
|
809
709
|
*
|
|
@@ -830,7 +730,7 @@
|
|
|
830
730
|
* @public
|
|
831
731
|
*/ this.alias = n;
|
|
832
732
|
// Copy of the full string this token was created from
|
|
833
|
-
this.length = (
|
|
733
|
+
this.length = (a || "").length | 0;
|
|
834
734
|
}
|
|
835
735
|
/**
|
|
836
736
|
* A token stream is an array of strings and {@link Token Token} objects.
|
|
@@ -863,13 +763,13 @@
|
|
|
863
763
|
return t;
|
|
864
764
|
}
|
|
865
765
|
if (Array.isArray(t)) {
|
|
866
|
-
var
|
|
766
|
+
var a = "";
|
|
867
767
|
t.forEach((function(t) {
|
|
868
|
-
|
|
768
|
+
a += e(t, n);
|
|
869
769
|
}));
|
|
870
|
-
return
|
|
770
|
+
return a;
|
|
871
771
|
}
|
|
872
|
-
var
|
|
772
|
+
var r = {
|
|
873
773
|
type: t.type,
|
|
874
774
|
content: e(t.content, n),
|
|
875
775
|
tag: "span",
|
|
@@ -880,17 +780,17 @@
|
|
|
880
780
|
var s = t.alias;
|
|
881
781
|
if (s) {
|
|
882
782
|
if (Array.isArray(s)) {
|
|
883
|
-
Array.prototype.push.apply(
|
|
783
|
+
Array.prototype.push.apply(r.classes, s);
|
|
884
784
|
} else {
|
|
885
|
-
|
|
785
|
+
r.classes.push(s);
|
|
886
786
|
}
|
|
887
787
|
}
|
|
888
|
-
i.hooks.run("wrap",
|
|
788
|
+
i.hooks.run("wrap", r);
|
|
889
789
|
var o = "";
|
|
890
|
-
for (var l in
|
|
891
|
-
o += " " + l + '="' + (
|
|
790
|
+
for (var l in r.attributes) {
|
|
791
|
+
o += " " + l + '="' + (r.attributes[l] || "").replace(/"/g, """) + '"';
|
|
892
792
|
}
|
|
893
|
-
return "<" +
|
|
793
|
+
return "<" + r.tag + ' class="' + r.classes.join(" ") + '"' + o + ">" + r.content + "</" + r.tag + ">";
|
|
894
794
|
};
|
|
895
795
|
/**
|
|
896
796
|
* @param {RegExp} pattern
|
|
@@ -898,16 +798,16 @@
|
|
|
898
798
|
* @param {string} text
|
|
899
799
|
* @param {boolean} lookbehind
|
|
900
800
|
* @returns {RegExpExecArray | null}
|
|
901
|
-
*/ function o(e, t, n,
|
|
801
|
+
*/ function o(e, t, n, a) {
|
|
902
802
|
e.lastIndex = t;
|
|
903
|
-
var
|
|
904
|
-
if (
|
|
803
|
+
var r = e.exec(n);
|
|
804
|
+
if (r && a && r[1]) {
|
|
905
805
|
// change the match to remove the text matched by the Prism lookbehind group
|
|
906
|
-
var i =
|
|
907
|
-
|
|
908
|
-
|
|
806
|
+
var i = r[1].length;
|
|
807
|
+
r.index += i;
|
|
808
|
+
r[0] = r[0].slice(i);
|
|
909
809
|
}
|
|
910
|
-
return
|
|
810
|
+
return r;
|
|
911
811
|
}
|
|
912
812
|
/**
|
|
913
813
|
* @param {string} text
|
|
@@ -922,7 +822,7 @@
|
|
|
922
822
|
* @typedef RematchOptions
|
|
923
823
|
* @property {string} cause
|
|
924
824
|
* @property {number} reach
|
|
925
|
-
*/ function l(e, t, n,
|
|
825
|
+
*/ function l(e, t, n, a, r, u) {
|
|
926
826
|
for (var d in n) {
|
|
927
827
|
if (!n.hasOwnProperty(d) || !n[d]) {
|
|
928
828
|
continue;
|
|
@@ -934,18 +834,18 @@
|
|
|
934
834
|
return;
|
|
935
835
|
}
|
|
936
836
|
var m = g[f];
|
|
937
|
-
var
|
|
837
|
+
var E = m.inside;
|
|
938
838
|
var v = !!m.lookbehind;
|
|
939
|
-
var
|
|
839
|
+
var h = !!m.greedy;
|
|
940
840
|
var b = m.alias;
|
|
941
|
-
if (
|
|
841
|
+
if (h && !m.pattern.global) {
|
|
942
842
|
// Without the global flag, lastIndex won't work
|
|
943
843
|
var y = m.pattern.toString().match(/[imsuy]*$/)[0];
|
|
944
844
|
m.pattern = RegExp(m.pattern.source, y + "g");
|
|
945
845
|
}
|
|
946
846
|
/** @type {RegExp} */ var S = m.pattern || m;
|
|
947
847
|
for (// iterate the token list and keep track of the current token/string position
|
|
948
|
-
var A =
|
|
848
|
+
var A = a.next, T = r; A !== t.tail; T += A.value.length, A = A.next) {
|
|
949
849
|
if (u && T >= u.reach) {
|
|
950
850
|
break;
|
|
951
851
|
}
|
|
@@ -960,7 +860,7 @@
|
|
|
960
860
|
var O = 1;
|
|
961
861
|
// this is the to parameter of removeBetween
|
|
962
862
|
var N;
|
|
963
|
-
if (
|
|
863
|
+
if (h) {
|
|
964
864
|
N = o(S, T, e, v);
|
|
965
865
|
if (!N || N.index >= e.length) {
|
|
966
866
|
break;
|
|
@@ -1011,7 +911,7 @@
|
|
|
1011
911
|
T += w.length;
|
|
1012
912
|
}
|
|
1013
913
|
p(t, P, O);
|
|
1014
|
-
var _ = new s(d,
|
|
914
|
+
var _ = new s(d, E ? i.tokenize(F, E) : F, b, F);
|
|
1015
915
|
A = c(t, P, _);
|
|
1016
916
|
if (C) {
|
|
1017
917
|
c(t, A, C);
|
|
@@ -1072,16 +972,16 @@
|
|
|
1072
972
|
* @template T
|
|
1073
973
|
*/ function c(e, t, n) {
|
|
1074
974
|
// assumes that node != list.tail && values.length >= 0
|
|
1075
|
-
var
|
|
1076
|
-
var
|
|
975
|
+
var a = t.next;
|
|
976
|
+
var r = {
|
|
1077
977
|
value: n,
|
|
1078
978
|
prev: t,
|
|
1079
|
-
next:
|
|
979
|
+
next: a
|
|
1080
980
|
};
|
|
1081
|
-
t.next =
|
|
1082
|
-
|
|
981
|
+
t.next = r;
|
|
982
|
+
a.prev = r;
|
|
1083
983
|
e.length++;
|
|
1084
|
-
return
|
|
984
|
+
return r;
|
|
1085
985
|
}
|
|
1086
986
|
/**
|
|
1087
987
|
* Removes `count` nodes after the given node. The given node will not be removed.
|
|
@@ -1091,13 +991,13 @@
|
|
|
1091
991
|
* @param {number} count
|
|
1092
992
|
* @template T
|
|
1093
993
|
*/ function p(e, t, n) {
|
|
1094
|
-
var
|
|
1095
|
-
for (var
|
|
1096
|
-
|
|
994
|
+
var a = t.next;
|
|
995
|
+
for (var r = 0; r < n && a !== e.tail; r++) {
|
|
996
|
+
a = a.next;
|
|
1097
997
|
}
|
|
1098
|
-
t.next =
|
|
1099
|
-
|
|
1100
|
-
e.length -=
|
|
998
|
+
t.next = a;
|
|
999
|
+
a.prev = t;
|
|
1000
|
+
e.length -= r;
|
|
1101
1001
|
}
|
|
1102
1002
|
/**
|
|
1103
1003
|
* @param {LinkedList<T>} list
|
|
@@ -1121,10 +1021,10 @@
|
|
|
1121
1021
|
// In worker
|
|
1122
1022
|
e.addEventListener("message", (function(t) {
|
|
1123
1023
|
var n = JSON.parse(t.data);
|
|
1124
|
-
var
|
|
1125
|
-
var
|
|
1024
|
+
var a = n.language;
|
|
1025
|
+
var r = n.code;
|
|
1126
1026
|
var s = n.immediateClose;
|
|
1127
|
-
e.postMessage(i.highlight(
|
|
1027
|
+
e.postMessage(i.highlight(r, i.languages[a], a));
|
|
1128
1028
|
if (s) {
|
|
1129
1029
|
e.close();
|
|
1130
1030
|
}
|
|
@@ -1164,13 +1064,13 @@
|
|
|
1164
1064
|
}
|
|
1165
1065
|
}
|
|
1166
1066
|
return i;
|
|
1167
|
-
}(
|
|
1067
|
+
}(a);
|
|
1168
1068
|
if (true && e.exports) {
|
|
1169
|
-
e.exports =
|
|
1069
|
+
e.exports = r;
|
|
1170
1070
|
}
|
|
1171
1071
|
// hack for components to work correctly in node.js
|
|
1172
1072
|
if (typeof n !== "undefined") {
|
|
1173
|
-
n.Prism =
|
|
1073
|
+
n.Prism = r;
|
|
1174
1074
|
}
|
|
1175
1075
|
// some additional documentation/types
|
|
1176
1076
|
/**
|
|
@@ -1217,7 +1117,7 @@
|
|
|
1217
1117
|
* @public
|
|
1218
1118
|
*/
|
|
1219
1119
|
// https://www.json.org/json-en.html
|
|
1220
|
-
|
|
1120
|
+
r.languages.json = {
|
|
1221
1121
|
property: {
|
|
1222
1122
|
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
|
|
1223
1123
|
lookbehind: true,
|
|
@@ -1241,8 +1141,8 @@
|
|
|
1241
1141
|
alias: "keyword"
|
|
1242
1142
|
}
|
|
1243
1143
|
};
|
|
1244
|
-
|
|
1245
|
-
|
|
1144
|
+
r.languages.webmanifest = r.languages.json;
|
|
1145
|
+
r.languages.markup = {
|
|
1246
1146
|
comment: {
|
|
1247
1147
|
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
1248
1148
|
greedy: true
|
|
@@ -1313,15 +1213,15 @@
|
|
|
1313
1213
|
alias: "named-entity"
|
|
1314
1214
|
}, /&#x?[\da-f]{1,8};/i ]
|
|
1315
1215
|
};
|
|
1316
|
-
|
|
1317
|
-
|
|
1216
|
+
r.languages.markup["tag"].inside["attr-value"].inside["entity"] = r.languages.markup["entity"];
|
|
1217
|
+
r.languages.markup["doctype"].inside["internal-subset"].inside = r.languages.markup;
|
|
1318
1218
|
// Plugin to make entity title show the real entity, idea by Roman Komarov
|
|
1319
|
-
|
|
1219
|
+
r.hooks.add("wrap", (function(e) {
|
|
1320
1220
|
if (e.type === "entity") {
|
|
1321
1221
|
e.attributes["title"] = e.content.replace(/&/, "&");
|
|
1322
1222
|
}
|
|
1323
1223
|
}));
|
|
1324
|
-
Object.defineProperty(
|
|
1224
|
+
Object.defineProperty(r.languages.markup.tag, "addInlined", {
|
|
1325
1225
|
/**
|
|
1326
1226
|
* Adds an inlined language to markup.
|
|
1327
1227
|
*
|
|
@@ -1334,22 +1234,22 @@
|
|
|
1334
1234
|
* addInlined('style', 'css');
|
|
1335
1235
|
*/
|
|
1336
1236
|
value: function e(t, n) {
|
|
1337
|
-
var
|
|
1338
|
-
|
|
1237
|
+
var a = {};
|
|
1238
|
+
a["language-" + n] = {
|
|
1339
1239
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1340
1240
|
lookbehind: true,
|
|
1341
|
-
inside:
|
|
1241
|
+
inside: r.languages[n]
|
|
1342
1242
|
};
|
|
1343
|
-
|
|
1243
|
+
a["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
|
|
1344
1244
|
var i = {
|
|
1345
1245
|
"included-cdata": {
|
|
1346
1246
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1347
|
-
inside:
|
|
1247
|
+
inside: a
|
|
1348
1248
|
}
|
|
1349
1249
|
};
|
|
1350
1250
|
i["language-" + n] = {
|
|
1351
1251
|
pattern: /[\s\S]+/,
|
|
1352
|
-
inside:
|
|
1252
|
+
inside: r.languages[n]
|
|
1353
1253
|
};
|
|
1354
1254
|
var s = {};
|
|
1355
1255
|
s[t] = {
|
|
@@ -1360,10 +1260,10 @@
|
|
|
1360
1260
|
greedy: true,
|
|
1361
1261
|
inside: i
|
|
1362
1262
|
};
|
|
1363
|
-
|
|
1263
|
+
r.languages.insertBefore("markup", "cdata", s);
|
|
1364
1264
|
}
|
|
1365
1265
|
});
|
|
1366
|
-
Object.defineProperty(
|
|
1266
|
+
Object.defineProperty(r.languages.markup.tag, "addAttribute", {
|
|
1367
1267
|
/**
|
|
1368
1268
|
* Adds an pattern to highlight languages embedded in HTML attributes.
|
|
1369
1269
|
*
|
|
@@ -1376,7 +1276,7 @@
|
|
|
1376
1276
|
* addAttribute('style', 'css');
|
|
1377
1277
|
*/
|
|
1378
1278
|
value: function(e, t) {
|
|
1379
|
-
|
|
1279
|
+
r.languages.markup.tag.inside["special-attr"].push({
|
|
1380
1280
|
pattern: RegExp(/(^|["'\s])/.source + "(?:" + e + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, "i"),
|
|
1381
1281
|
lookbehind: true,
|
|
1382
1282
|
inside: {
|
|
@@ -1388,7 +1288,7 @@
|
|
|
1388
1288
|
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
1389
1289
|
lookbehind: true,
|
|
1390
1290
|
alias: [ t, "language-" + t ],
|
|
1391
|
-
inside:
|
|
1291
|
+
inside: r.languages[t]
|
|
1392
1292
|
},
|
|
1393
1293
|
punctuation: [ {
|
|
1394
1294
|
pattern: /^=/,
|
|
@@ -1400,14 +1300,14 @@
|
|
|
1400
1300
|
});
|
|
1401
1301
|
}
|
|
1402
1302
|
});
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1303
|
+
r.languages.html = r.languages.markup;
|
|
1304
|
+
r.languages.mathml = r.languages.markup;
|
|
1305
|
+
r.languages.svg = r.languages.markup;
|
|
1306
|
+
r.languages.xml = r.languages.extend("markup", {});
|
|
1307
|
+
r.languages.ssml = r.languages.xml;
|
|
1308
|
+
r.languages.atom = r.languages.xml;
|
|
1309
|
+
r.languages.rss = r.languages.xml;
|
|
1310
|
+
r.languages.clike = {
|
|
1411
1311
|
comment: [ {
|
|
1412
1312
|
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
1413
1313
|
lookbehind: true,
|
|
@@ -1435,8 +1335,8 @@
|
|
|
1435
1335
|
operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
1436
1336
|
punctuation: /[{}[\];(),.:]/
|
|
1437
1337
|
};
|
|
1438
|
-
|
|
1439
|
-
"class-name": [
|
|
1338
|
+
r.languages.javascript = r.languages.extend("clike", {
|
|
1339
|
+
"class-name": [ r.languages.clike["class-name"], {
|
|
1440
1340
|
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
1441
1341
|
lookbehind: true
|
|
1442
1342
|
} ],
|
|
@@ -1467,8 +1367,8 @@
|
|
|
1467
1367
|
},
|
|
1468
1368
|
operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
1469
1369
|
});
|
|
1470
|
-
|
|
1471
|
-
|
|
1370
|
+
r.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
|
1371
|
+
r.languages.insertBefore("javascript", "keyword", {
|
|
1472
1372
|
regex: {
|
|
1473
1373
|
pattern: RegExp(
|
|
1474
1374
|
// lookbehind
|
|
@@ -1490,7 +1390,7 @@
|
|
|
1490
1390
|
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
1491
1391
|
lookbehind: true,
|
|
1492
1392
|
alias: "language-regex",
|
|
1493
|
-
inside:
|
|
1393
|
+
inside: r.languages.regex
|
|
1494
1394
|
},
|
|
1495
1395
|
"regex-delimiter": /^\/|\/$/,
|
|
1496
1396
|
"regex-flags": /^[a-z]+$/
|
|
@@ -1504,23 +1404,23 @@
|
|
|
1504
1404
|
parameter: [ {
|
|
1505
1405
|
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
1506
1406
|
lookbehind: true,
|
|
1507
|
-
inside:
|
|
1407
|
+
inside: r.languages.javascript
|
|
1508
1408
|
}, {
|
|
1509
1409
|
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
1510
1410
|
lookbehind: true,
|
|
1511
|
-
inside:
|
|
1411
|
+
inside: r.languages.javascript
|
|
1512
1412
|
}, {
|
|
1513
1413
|
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
1514
1414
|
lookbehind: true,
|
|
1515
|
-
inside:
|
|
1415
|
+
inside: r.languages.javascript
|
|
1516
1416
|
}, {
|
|
1517
1417
|
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
1518
1418
|
lookbehind: true,
|
|
1519
|
-
inside:
|
|
1419
|
+
inside: r.languages.javascript
|
|
1520
1420
|
} ],
|
|
1521
1421
|
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
1522
1422
|
});
|
|
1523
|
-
|
|
1423
|
+
r.languages.insertBefore("javascript", "string", {
|
|
1524
1424
|
hashbang: {
|
|
1525
1425
|
pattern: /^#!.*/,
|
|
1526
1426
|
greedy: true,
|
|
@@ -1542,7 +1442,7 @@
|
|
|
1542
1442
|
pattern: /^\$\{|\}$/,
|
|
1543
1443
|
alias: "punctuation"
|
|
1544
1444
|
},
|
|
1545
|
-
rest:
|
|
1445
|
+
rest: r.languages.javascript
|
|
1546
1446
|
}
|
|
1547
1447
|
},
|
|
1548
1448
|
string: /[\s\S]+/
|
|
@@ -1555,25 +1455,25 @@
|
|
|
1555
1455
|
alias: "property"
|
|
1556
1456
|
}
|
|
1557
1457
|
});
|
|
1558
|
-
|
|
1458
|
+
r.languages.insertBefore("javascript", "operator", {
|
|
1559
1459
|
"literal-property": {
|
|
1560
1460
|
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
1561
1461
|
lookbehind: true,
|
|
1562
1462
|
alias: "property"
|
|
1563
1463
|
}
|
|
1564
1464
|
});
|
|
1565
|
-
if (
|
|
1566
|
-
|
|
1465
|
+
if (r.languages.markup) {
|
|
1466
|
+
r.languages.markup.tag.addInlined("script", "javascript");
|
|
1567
1467
|
// add attribute support for all DOM events.
|
|
1568
1468
|
// https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
|
|
1569
|
-
|
|
1469
|
+
r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source, "javascript");
|
|
1570
1470
|
}
|
|
1571
|
-
|
|
1471
|
+
r.languages.js = r.languages.javascript;
|
|
1572
1472
|
(function(e) {
|
|
1573
1473
|
var t = e.util.clone(e.languages.javascript);
|
|
1574
1474
|
var n = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
|
|
1575
|
-
var
|
|
1576
|
-
var
|
|
1475
|
+
var a = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
|
|
1476
|
+
var r = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
|
|
1577
1477
|
/**
|
|
1578
1478
|
* @param {string} source
|
|
1579
1479
|
* @param {string} [flags]
|
|
@@ -1581,13 +1481,13 @@
|
|
|
1581
1481
|
e = e.replace(/<S>/g, (function() {
|
|
1582
1482
|
return n;
|
|
1583
1483
|
})).replace(/<BRACES>/g, (function() {
|
|
1584
|
-
return r;
|
|
1585
|
-
})).replace(/<SPREAD>/g, (function() {
|
|
1586
1484
|
return a;
|
|
1485
|
+
})).replace(/<SPREAD>/g, (function() {
|
|
1486
|
+
return r;
|
|
1587
1487
|
}));
|
|
1588
1488
|
return RegExp(e, t);
|
|
1589
1489
|
}
|
|
1590
|
-
|
|
1490
|
+
r = i(r).source;
|
|
1591
1491
|
e.languages.jsx = e.languages.extend("markup", t);
|
|
1592
1492
|
e.languages.jsx.tag.pattern = i(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source);
|
|
1593
1493
|
e.languages.jsx.tag.inside["tag"].pattern = /^<\/?[^\s>\/]*/;
|
|
@@ -1629,59 +1529,59 @@
|
|
|
1629
1529
|
};
|
|
1630
1530
|
var o = function(t) {
|
|
1631
1531
|
var n = [];
|
|
1632
|
-
for (var
|
|
1633
|
-
var
|
|
1532
|
+
for (var a = 0; a < t.length; a++) {
|
|
1533
|
+
var r = t[a];
|
|
1634
1534
|
var i = false;
|
|
1635
|
-
if (typeof
|
|
1636
|
-
if (
|
|
1535
|
+
if (typeof r !== "string") {
|
|
1536
|
+
if (r.type === "tag" && r.content[0] && r.content[0].type === "tag") {
|
|
1637
1537
|
// We found a tag, now find its kind
|
|
1638
|
-
if (
|
|
1538
|
+
if (r.content[0].content[0].content === "</") {
|
|
1639
1539
|
// Closing tag
|
|
1640
|
-
if (n.length > 0 && n[n.length - 1].tagName === s(
|
|
1540
|
+
if (n.length > 0 && n[n.length - 1].tagName === s(r.content[0].content[1])) {
|
|
1641
1541
|
// Pop matching opening tag
|
|
1642
1542
|
n.pop();
|
|
1643
1543
|
}
|
|
1644
1544
|
} else {
|
|
1645
|
-
if (
|
|
1545
|
+
if (r.content[r.content.length - 1].content === "/>") {
|
|
1646
1546
|
// Autoclosed tag, ignore
|
|
1647
1547
|
} else {
|
|
1648
1548
|
// Opening tag
|
|
1649
1549
|
n.push({
|
|
1650
|
-
tagName: s(
|
|
1550
|
+
tagName: s(r.content[0].content[1]),
|
|
1651
1551
|
openedBraces: 0
|
|
1652
1552
|
});
|
|
1653
1553
|
}
|
|
1654
1554
|
}
|
|
1655
|
-
} else if (n.length > 0 &&
|
|
1555
|
+
} else if (n.length > 0 && r.type === "punctuation" && r.content === "{") {
|
|
1656
1556
|
// Here we might have entered a JSX context inside a tag
|
|
1657
1557
|
n[n.length - 1].openedBraces++;
|
|
1658
|
-
} else if (n.length > 0 && n[n.length - 1].openedBraces > 0 &&
|
|
1558
|
+
} else if (n.length > 0 && n[n.length - 1].openedBraces > 0 && r.type === "punctuation" && r.content === "}") {
|
|
1659
1559
|
// Here we might have left a JSX context inside a tag
|
|
1660
1560
|
n[n.length - 1].openedBraces--;
|
|
1661
1561
|
} else {
|
|
1662
1562
|
i = true;
|
|
1663
1563
|
}
|
|
1664
1564
|
}
|
|
1665
|
-
if (i || typeof
|
|
1565
|
+
if (i || typeof r === "string") {
|
|
1666
1566
|
if (n.length > 0 && n[n.length - 1].openedBraces === 0) {
|
|
1667
1567
|
// Here we are inside a tag, and not inside a JSX context.
|
|
1668
1568
|
// That's plain text: drop any tokens matched.
|
|
1669
|
-
var l = s(
|
|
1569
|
+
var l = s(r);
|
|
1670
1570
|
// And merge text with adjacent text
|
|
1671
|
-
if (
|
|
1672
|
-
l += s(t[
|
|
1673
|
-
t.splice(
|
|
1571
|
+
if (a < t.length - 1 && (typeof t[a + 1] === "string" || t[a + 1].type === "plain-text")) {
|
|
1572
|
+
l += s(t[a + 1]);
|
|
1573
|
+
t.splice(a + 1, 1);
|
|
1674
1574
|
}
|
|
1675
|
-
if (
|
|
1676
|
-
l = s(t[
|
|
1677
|
-
t.splice(
|
|
1678
|
-
|
|
1575
|
+
if (a > 0 && (typeof t[a - 1] === "string" || t[a - 1].type === "plain-text")) {
|
|
1576
|
+
l = s(t[a - 1]) + l;
|
|
1577
|
+
t.splice(a - 1, 1);
|
|
1578
|
+
a--;
|
|
1679
1579
|
}
|
|
1680
|
-
t[
|
|
1580
|
+
t[a] = new e.Token("plain-text", l, null, l);
|
|
1681
1581
|
}
|
|
1682
1582
|
}
|
|
1683
|
-
if (
|
|
1684
|
-
o(
|
|
1583
|
+
if (r.content && typeof r.content !== "string") {
|
|
1584
|
+
o(r.content);
|
|
1685
1585
|
}
|
|
1686
1586
|
}
|
|
1687
1587
|
};
|
|
@@ -1691,7 +1591,7 @@
|
|
|
1691
1591
|
}
|
|
1692
1592
|
o(e.tokens);
|
|
1693
1593
|
}));
|
|
1694
|
-
})(
|
|
1594
|
+
})(r);
|
|
1695
1595
|
(function(e) {
|
|
1696
1596
|
e.languages.typescript = e.languages.extend("javascript", {
|
|
1697
1597
|
"class-name": {
|
|
@@ -1742,7 +1642,7 @@
|
|
|
1742
1642
|
}
|
|
1743
1643
|
});
|
|
1744
1644
|
e.languages.ts = e.languages.typescript;
|
|
1745
|
-
})(
|
|
1645
|
+
})(r);
|
|
1746
1646
|
(function(e) {
|
|
1747
1647
|
var t = e.util.clone(e.languages.typescript);
|
|
1748
1648
|
e.languages.tsx = e.languages.extend("jsx", t);
|
|
@@ -1755,7 +1655,7 @@
|
|
|
1755
1655
|
var n = e.languages.tsx.tag;
|
|
1756
1656
|
n.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + "(?:" + n.pattern.source + ")", n.pattern.flags);
|
|
1757
1657
|
n.lookbehind = true;
|
|
1758
|
-
})(
|
|
1658
|
+
})(r);
|
|
1759
1659
|
(function(e) {
|
|
1760
1660
|
var t = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1761
1661
|
e.languages.css = {
|
|
@@ -1813,7 +1713,7 @@
|
|
|
1813
1713
|
n.tag.addInlined("style", "css");
|
|
1814
1714
|
n.tag.addAttribute("style", "css");
|
|
1815
1715
|
}
|
|
1816
|
-
})(
|
|
1716
|
+
})(r);
|
|
1817
1717
|
(function(e) {
|
|
1818
1718
|
// $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
|
|
1819
1719
|
// + LC_ALL, RANDOM, REPLY, SECONDS.
|
|
@@ -1827,7 +1727,7 @@
|
|
|
1827
1727
|
// this looks reasonably well in all themes
|
|
1828
1728
|
inside: null
|
|
1829
1729
|
};
|
|
1830
|
-
var
|
|
1730
|
+
var a = {
|
|
1831
1731
|
bash: n,
|
|
1832
1732
|
environment: {
|
|
1833
1733
|
pattern: RegExp("\\$" + t),
|
|
@@ -1932,7 +1832,7 @@
|
|
|
1932
1832
|
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
|
1933
1833
|
lookbehind: true,
|
|
1934
1834
|
greedy: true,
|
|
1935
|
-
inside:
|
|
1835
|
+
inside: a
|
|
1936
1836
|
},
|
|
1937
1837
|
// Here-document with quotes around the tag
|
|
1938
1838
|
// → No expansion (so no “inside”).
|
|
@@ -1950,7 +1850,7 @@
|
|
|
1950
1850
|
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
1951
1851
|
lookbehind: true,
|
|
1952
1852
|
greedy: true,
|
|
1953
|
-
inside:
|
|
1853
|
+
inside: a
|
|
1954
1854
|
}, {
|
|
1955
1855
|
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
|
|
1956
1856
|
pattern: /(^|[^$\\])'[^']*'/,
|
|
@@ -1961,14 +1861,14 @@
|
|
|
1961
1861
|
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
1962
1862
|
greedy: true,
|
|
1963
1863
|
inside: {
|
|
1964
|
-
entity:
|
|
1864
|
+
entity: a.entity
|
|
1965
1865
|
}
|
|
1966
1866
|
} ],
|
|
1967
1867
|
environment: {
|
|
1968
1868
|
pattern: RegExp("\\$?" + t),
|
|
1969
1869
|
alias: "constant"
|
|
1970
1870
|
},
|
|
1971
|
-
variable:
|
|
1871
|
+
variable: a.variable,
|
|
1972
1872
|
function: {
|
|
1973
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;|&])/,
|
|
1974
1874
|
lookbehind: true
|
|
@@ -2009,14 +1909,14 @@
|
|
|
2009
1909
|
}
|
|
2010
1910
|
};
|
|
2011
1911
|
n.inside = e.languages.bash;
|
|
2012
|
-
/* Patterns in command substitution. */ var
|
|
2013
|
-
var i =
|
|
2014
|
-
for (var s = 0; s <
|
|
2015
|
-
i[
|
|
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" ];
|
|
1913
|
+
var i = a.variable[1].inside;
|
|
1914
|
+
for (var s = 0; s < r.length; s++) {
|
|
1915
|
+
i[r[s]] = e.languages.bash[r[s]];
|
|
2016
1916
|
}
|
|
2017
1917
|
e.languages.sh = e.languages.bash;
|
|
2018
1918
|
e.languages.shell = e.languages.bash;
|
|
2019
|
-
})(
|
|
1919
|
+
})(r);
|
|
2020
1920
|
(function(e) {
|
|
2021
1921
|
// https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
|
|
2022
1922
|
// https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
|
|
@@ -2024,11 +1924,11 @@
|
|
|
2024
1924
|
// https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
|
|
2025
1925
|
var n = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
|
|
2026
1926
|
// https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
|
|
2027
|
-
var
|
|
1927
|
+
var a = "(?:" + n.source + "(?:[ \t]+" + t.source + ")?|" + t.source + "(?:[ \t]+" + n.source + ")?)";
|
|
2028
1928
|
// https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
|
|
2029
1929
|
// This is a simplified version that doesn't support "#" and multiline keys
|
|
2030
1930
|
// All these long scarry character classes are simplified versions of YAML's characters
|
|
2031
|
-
var
|
|
1931
|
+
var r = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, (function() {
|
|
2032
1932
|
return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
|
|
2033
1933
|
}));
|
|
2034
1934
|
var i = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
|
|
@@ -2041,7 +1941,7 @@
|
|
|
2041
1941
|
t = (t || "").replace(/m/g, "") + "m";
|
|
2042
1942
|
// add m flag
|
|
2043
1943
|
var n = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, (function() {
|
|
2044
|
-
return
|
|
1944
|
+
return a;
|
|
2045
1945
|
})).replace(/<<value>>/g, (function() {
|
|
2046
1946
|
return e;
|
|
2047
1947
|
}));
|
|
@@ -2050,7 +1950,7 @@
|
|
|
2050
1950
|
e.languages.yaml = {
|
|
2051
1951
|
scalar: {
|
|
2052
1952
|
pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, (function() {
|
|
2053
|
-
return
|
|
1953
|
+
return a;
|
|
2054
1954
|
}))),
|
|
2055
1955
|
lookbehind: true,
|
|
2056
1956
|
alias: "string"
|
|
@@ -2058,9 +1958,9 @@
|
|
|
2058
1958
|
comment: /#.*/,
|
|
2059
1959
|
key: {
|
|
2060
1960
|
pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, (function() {
|
|
2061
|
-
return
|
|
1961
|
+
return a;
|
|
2062
1962
|
})).replace(/<<key>>/g, (function() {
|
|
2063
|
-
return "(?:" +
|
|
1963
|
+
return "(?:" + r + "|" + i + ")";
|
|
2064
1964
|
}))),
|
|
2065
1965
|
lookbehind: true,
|
|
2066
1966
|
greedy: true,
|
|
@@ -2100,8 +2000,8 @@
|
|
|
2100
2000
|
punctuation: /---|[:[\]{}\-,|>?]|\.\.\./
|
|
2101
2001
|
};
|
|
2102
2002
|
e.languages.yml = e.languages.yaml;
|
|
2103
|
-
})(
|
|
2104
|
-
|
|
2003
|
+
})(r);
|
|
2004
|
+
r.languages["splunk-spl"] = {
|
|
2105
2005
|
comment: /`comment\("(?:\\.|[^\\"])*"\)`/,
|
|
2106
2006
|
string: {
|
|
2107
2007
|
pattern: /"(?:\\.|[^\\"])*"/,
|
|
@@ -2125,7 +2025,7 @@
|
|
|
2125
2025
|
operator: /[<>=]=?|[-+*/%|]/,
|
|
2126
2026
|
punctuation: /[()[\],]/
|
|
2127
2027
|
};
|
|
2128
|
-
|
|
2028
|
+
r.languages.sql = {
|
|
2129
2029
|
comment: {
|
|
2130
2030
|
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
|
|
2131
2031
|
lookbehind: true
|
|
@@ -2156,11 +2056,6 @@
|
|
|
2156
2056
|
punctuation: /[;[\]()`,.]/
|
|
2157
2057
|
};
|
|
2158
2058
|
})();
|
|
2159
|
-
/***/ },
|
|
2160
|
-
/***/ 9497:
|
|
2161
|
-
/***/ e => {
|
|
2162
|
-
"use strict";
|
|
2163
|
-
e.exports = require("react");
|
|
2164
2059
|
/***/
|
|
2165
2060
|
/******/ }
|
|
2166
2061
|
};
|
|
@@ -2169,21 +2064,21 @@
|
|
|
2169
2064
|
/******/ var t = {};
|
|
2170
2065
|
/******/
|
|
2171
2066
|
/******/ // The require function
|
|
2172
|
-
/******/ function n(
|
|
2067
|
+
/******/ function n(a) {
|
|
2173
2068
|
/******/ // Check if module is in cache
|
|
2174
|
-
/******/ var
|
|
2175
|
-
/******/ if (
|
|
2176
|
-
/******/ return
|
|
2069
|
+
/******/ var r = t[a];
|
|
2070
|
+
/******/ if (r !== undefined) {
|
|
2071
|
+
/******/ return r.exports;
|
|
2177
2072
|
/******/ }
|
|
2178
2073
|
/******/ // Create a new module (and put it into the cache)
|
|
2179
|
-
/******/ var i = t[
|
|
2074
|
+
/******/ var i = t[a] = {
|
|
2180
2075
|
/******/ // no module.id needed
|
|
2181
2076
|
/******/ // no module.loaded needed
|
|
2182
2077
|
/******/ exports: {}
|
|
2183
2078
|
/******/ };
|
|
2184
2079
|
/******/
|
|
2185
2080
|
/******/ // Execute the module function
|
|
2186
|
-
/******/ e[
|
|
2081
|
+
/******/ e[a](i, i.exports, n);
|
|
2187
2082
|
/******/
|
|
2188
2083
|
/******/ // Return the exports of the module
|
|
2189
2084
|
/******/ return i.exports;
|
|
@@ -2209,11 +2104,11 @@
|
|
|
2209
2104
|
/******/ (() => {
|
|
2210
2105
|
/******/ // define getter functions for harmony exports
|
|
2211
2106
|
/******/ n.d = (e, t) => {
|
|
2212
|
-
/******/ for (var
|
|
2213
|
-
/******/ if (n.o(t,
|
|
2214
|
-
/******/ Object.defineProperty(e,
|
|
2107
|
+
/******/ for (var a in t) {
|
|
2108
|
+
/******/ if (n.o(t, a) && !n.o(e, a)) {
|
|
2109
|
+
/******/ Object.defineProperty(e, a, {
|
|
2215
2110
|
enumerable: true,
|
|
2216
|
-
get: t[
|
|
2111
|
+
get: t[a]
|
|
2217
2112
|
});
|
|
2218
2113
|
/******/ }
|
|
2219
2114
|
/******/ }
|
|
@@ -2241,22 +2136,22 @@
|
|
|
2241
2136
|
/******/ };
|
|
2242
2137
|
/******/ })();
|
|
2243
2138
|
/******/
|
|
2244
|
-
/************************************************************************/ var
|
|
2139
|
+
/************************************************************************/ var a = {};
|
|
2245
2140
|
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
2246
2141
|
(() => {
|
|
2247
2142
|
"use strict";
|
|
2248
2143
|
// ESM COMPAT FLAG
|
|
2249
|
-
n.r(
|
|
2144
|
+
n.r(a);
|
|
2250
2145
|
// EXPORTS
|
|
2251
|
-
n.d(
|
|
2252
|
-
default: () => /* reexport */
|
|
2146
|
+
n.d(a, {
|
|
2147
|
+
default: () => /* reexport */ ie
|
|
2253
2148
|
});
|
|
2254
|
-
//
|
|
2255
|
-
|
|
2149
|
+
// CONCATENATED MODULE: external "react"
|
|
2150
|
+
const e = require("react");
|
|
2256
2151
|
var t = n.n(e);
|
|
2257
2152
|
// CONCATENATED MODULE: external "lodash/castArray"
|
|
2258
|
-
const
|
|
2259
|
-
var i = n.n(
|
|
2153
|
+
const r = require("lodash/castArray");
|
|
2154
|
+
var i = n.n(r);
|
|
2260
2155
|
// CONCATENATED MODULE: external "lodash/flatten"
|
|
2261
2156
|
const s = require("lodash/flatten");
|
|
2262
2157
|
var o = n.n(s);
|
|
@@ -2272,68 +2167,76 @@
|
|
|
2272
2167
|
// CONCATENATED MODULE: external "prop-types"
|
|
2273
2168
|
const f = require("prop-types");
|
|
2274
2169
|
var m = n.n(f);
|
|
2170
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/useResizeObserver"
|
|
2171
|
+
const E = require("@splunk/react-ui/useResizeObserver");
|
|
2172
|
+
var v = n.n(E);
|
|
2275
2173
|
// CONCATENATED MODULE: external "styled-components"
|
|
2276
2174
|
const h = require("styled-components");
|
|
2277
|
-
var
|
|
2175
|
+
var b = n.n(h);
|
|
2278
2176
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
2279
|
-
const
|
|
2177
|
+
const y = require("@splunk/themes");
|
|
2280
2178
|
// CONCATENATED MODULE: ./src/Code/CodeStyles.ts
|
|
2281
|
-
var
|
|
2282
|
-
var
|
|
2283
|
-
|
|
2179
|
+
var S = "lineHeightSpacious";
|
|
2180
|
+
var A = "spacingLarge";
|
|
2181
|
+
var T = b().code.withConfig({
|
|
2182
|
+
displayName: "CodeStyles__StyledCode",
|
|
2284
2183
|
componentId: "sc-1eq4k68-0"
|
|
2285
|
-
})([ "
|
|
2286
|
-
var t = e.$
|
|
2287
|
-
return t && (0, h.css)([ "
|
|
2184
|
+
})([ "font-family:", ";position:relative;z-index:1;", ";" ], y.variables.monoFontFamily, (function(e) {
|
|
2185
|
+
var t = e.$isPlaintext;
|
|
2186
|
+
return !t && (0, h.css)([ "color:", ";" ], y.variables.syntaxTeal);
|
|
2288
2187
|
}));
|
|
2289
|
-
var
|
|
2290
|
-
displayName: "
|
|
2188
|
+
var I = b().pre.withConfig({
|
|
2189
|
+
displayName: "CodeStyles__StyledPre",
|
|
2291
2190
|
componentId: "sc-1eq4k68-1"
|
|
2292
|
-
})([ "
|
|
2293
|
-
var t = e.$
|
|
2294
|
-
return
|
|
2191
|
+
})([ "", ";", ";line-height:", ";position:relative;text-align:left;tab-size:4;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;hyphens:none;overflow-x:auto;&:focus-visible{box-shadow:", ";}", " ", ";" ], y.mixins.reset("grid"), y.mixins.typography("monoBody"), y.variables[S], y.variables.focusShadow, (function(e) {
|
|
2192
|
+
var t = e.$showLineNumbers, n = e.$counterReset;
|
|
2193
|
+
return t && (0, h.css)([ "grid-template-columns:min-content auto;counter-reset:linenumber ", ";" ], n);
|
|
2194
|
+
}), (function(e) {
|
|
2195
|
+
var t = e.$containerAppearance;
|
|
2196
|
+
return t === "none" ? (0, h.css)([ "gap:", ";" ], y.variables.spacingMedium) : (0,
|
|
2197
|
+
h.css)([ "background-color:", ";border-radius:", ";", "{margin:", ";}" ], y.variables.neutral50, y.variables.borderRadius, /* sc-sel */ T, y.variables[A]);
|
|
2295
2198
|
}));
|
|
2296
|
-
var
|
|
2199
|
+
var O = b().span.withConfig({
|
|
2297
2200
|
displayName: "CodeStyles__StyledIndent",
|
|
2298
2201
|
componentId: "sc-1eq4k68-2"
|
|
2299
|
-
})([ "&:not(:last-child){background-image:linear-gradient( to left,", " 1px,transparent 1px,transparent );}" ],
|
|
2300
|
-
var
|
|
2301
|
-
comment:
|
|
2302
|
-
prolog:
|
|
2303
|
-
doctype:
|
|
2304
|
-
cdata:
|
|
2305
|
-
punctuation:
|
|
2306
|
-
property:
|
|
2307
|
-
tag:
|
|
2308
|
-
boolean:
|
|
2309
|
-
number:
|
|
2310
|
-
constant:
|
|
2311
|
-
symbol:
|
|
2312
|
-
deleted:
|
|
2313
|
-
key:
|
|
2314
|
-
selector:
|
|
2315
|
-
"attr-name":
|
|
2316
|
-
string:
|
|
2317
|
-
char:
|
|
2318
|
-
builtin:
|
|
2319
|
-
inserted:
|
|
2320
|
-
operator:
|
|
2321
|
-
entity:
|
|
2322
|
-
url:
|
|
2323
|
-
atrule:
|
|
2324
|
-
"attr-value":
|
|
2325
|
-
keyword:
|
|
2326
|
-
function:
|
|
2327
|
-
regex:
|
|
2328
|
-
important:
|
|
2329
|
-
variable:
|
|
2202
|
+
})([ "&:not(:last-child){background-image:linear-gradient( to left,", " 1px,transparent 1px,transparent );}" ], y.variables.syntaxGray);
|
|
2203
|
+
var N = {
|
|
2204
|
+
comment: y.variables.syntaxGray,
|
|
2205
|
+
prolog: y.variables.syntaxGray,
|
|
2206
|
+
doctype: y.variables.syntaxGray,
|
|
2207
|
+
cdata: y.variables.syntaxGray,
|
|
2208
|
+
punctuation: y.variables.syntaxGray,
|
|
2209
|
+
property: y.variables.syntaxPurple,
|
|
2210
|
+
tag: y.variables.syntaxPurple,
|
|
2211
|
+
boolean: y.variables.syntaxPurple,
|
|
2212
|
+
number: y.variables.syntaxPurple,
|
|
2213
|
+
constant: y.variables.syntaxPurple,
|
|
2214
|
+
symbol: y.variables.syntaxPurple,
|
|
2215
|
+
deleted: y.variables.syntaxPurple,
|
|
2216
|
+
key: y.variables.syntaxPurple,
|
|
2217
|
+
selector: y.variables.syntaxGreen,
|
|
2218
|
+
"attr-name": y.variables.syntaxGreen,
|
|
2219
|
+
string: y.variables.syntaxGreen,
|
|
2220
|
+
char: y.variables.syntaxGreen,
|
|
2221
|
+
builtin: y.variables.syntaxGreen,
|
|
2222
|
+
inserted: y.variables.syntaxGreen,
|
|
2223
|
+
operator: y.variables.syntaxBrown,
|
|
2224
|
+
entity: y.variables.syntaxBrown,
|
|
2225
|
+
url: y.variables.syntaxBrown,
|
|
2226
|
+
atrule: y.variables.syntaxBlue,
|
|
2227
|
+
"attr-value": y.variables.syntaxBlue,
|
|
2228
|
+
keyword: y.variables.syntaxBlue,
|
|
2229
|
+
function: y.variables.syntaxRed,
|
|
2230
|
+
regex: y.variables.syntaxOrange,
|
|
2231
|
+
important: y.variables.syntaxOrange,
|
|
2232
|
+
variable: y.variables.syntaxOrange
|
|
2330
2233
|
};
|
|
2331
|
-
var
|
|
2234
|
+
var x = b().span.withConfig({
|
|
2332
2235
|
displayName: "CodeStyles__StyledToken",
|
|
2333
2236
|
componentId: "sc-1eq4k68-3"
|
|
2334
2237
|
})([ "color:", ";cursor:", ";opacity:", ";font-style:", ";font-weight:", ";" ], (function(e) {
|
|
2335
2238
|
var t = e.partType;
|
|
2336
|
-
return
|
|
2239
|
+
return N[t];
|
|
2337
2240
|
}), (function(e) {
|
|
2338
2241
|
var t = e.partType;
|
|
2339
2242
|
return t === "entity" ? "help" : null;
|
|
@@ -2345,79 +2248,80 @@
|
|
|
2345
2248
|
return t === "italic" ? "italic" : null;
|
|
2346
2249
|
}), (function(e) {
|
|
2347
2250
|
var t = e.partType;
|
|
2348
|
-
return t === "important" || t === "bold" ?
|
|
2251
|
+
return t === "important" || t === "bold" ? y.variables.fontWeightBold : null;
|
|
2349
2252
|
}));
|
|
2350
2253
|
// CONCATENATED MODULE: ./src/Code/LineHighlightsStyles.ts
|
|
2351
|
-
var
|
|
2254
|
+
var R = b().div.withConfig({
|
|
2352
2255
|
displayName: "LineHighlightsStyles__StyledLineHighlight",
|
|
2353
2256
|
componentId: "sc-1x2b02z-0"
|
|
2354
|
-
})([ "position:absolute;left:0;height:1lh;background:", ";border-left:2px solid ", ";pointer-events:none;line-height:inherit;
|
|
2355
|
-
var t = e.$lineNum;
|
|
2356
|
-
return "calc(".concat(t - 1, " * ").concat(b, ")");
|
|
2357
|
-
}), (function(e) {
|
|
2257
|
+
})([ "position:absolute;left:0;height:1lh;background:", ";border-left:2px solid ", ";pointer-events:none;line-height:inherit;width:", "px;", ";" ], y.variables.notificationColorInfoWeak, y.variables.notificationColorInfo, (function(e) {
|
|
2358
2258
|
var t = e.$width;
|
|
2359
2259
|
return t;
|
|
2260
|
+
}), (function(e) {
|
|
2261
|
+
var t = e.$containerAppearance, n = e.$lineNum;
|
|
2262
|
+
return t === "none" ? (0, h.css)([ "top:calc(", " * ", "em);" ], n - 1, y.variables[S]) : (0,
|
|
2263
|
+
h.css)([ "top:calc( ", " * ", "em + ", " );" ], n - 1, y.variables[S], y.variables[A]);
|
|
2360
2264
|
}));
|
|
2361
2265
|
// CONCATENATED MODULE: ./src/Code/LineHighlights.tsx
|
|
2362
|
-
function
|
|
2363
|
-
return
|
|
2266
|
+
function k(e, t) {
|
|
2267
|
+
return D(e) || C(e, t) || F(e, t) || L();
|
|
2364
2268
|
}
|
|
2365
|
-
function
|
|
2269
|
+
function L() {
|
|
2366
2270
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2367
2271
|
}
|
|
2368
|
-
function
|
|
2272
|
+
function F(e, t) {
|
|
2369
2273
|
if (e) {
|
|
2370
|
-
if ("string" == typeof e) return
|
|
2274
|
+
if ("string" == typeof e) return w(e, t);
|
|
2371
2275
|
var n = {}.toString.call(e).slice(8, -1);
|
|
2372
|
-
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ?
|
|
2276
|
+
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? w(e, t) : void 0;
|
|
2373
2277
|
}
|
|
2374
2278
|
}
|
|
2375
|
-
function
|
|
2279
|
+
function w(e, t) {
|
|
2376
2280
|
(null == t || t > e.length) && (t = e.length);
|
|
2377
|
-
for (var n = 0,
|
|
2378
|
-
|
|
2281
|
+
for (var n = 0, a = Array(t); n < t; n++) {
|
|
2282
|
+
a[n] = e[n];
|
|
2379
2283
|
}
|
|
2380
|
-
return
|
|
2284
|
+
return a;
|
|
2381
2285
|
}
|
|
2382
|
-
function
|
|
2286
|
+
function C(e, t) {
|
|
2383
2287
|
var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
2384
2288
|
if (null != n) {
|
|
2385
|
-
var
|
|
2289
|
+
var a, r, i, s, o = [], l = !0, u = !1;
|
|
2386
2290
|
try {
|
|
2387
2291
|
if (i = (n = n.call(e)).next, 0 === t) {
|
|
2388
2292
|
if (Object(n) !== n) return;
|
|
2389
2293
|
l = !1;
|
|
2390
|
-
} else for (;!(l = (
|
|
2294
|
+
} else for (;!(l = (a = i.call(n)).done) && (o.push(a.value), o.length !== t); l = !0) {
|
|
2391
2295
|
}
|
|
2392
2296
|
} catch (e) {
|
|
2393
|
-
u = !0,
|
|
2297
|
+
u = !0, r = e;
|
|
2394
2298
|
} finally {
|
|
2395
2299
|
try {
|
|
2396
2300
|
if (!l && null != n["return"] && (s = n["return"](), Object(s) !== s)) return;
|
|
2397
2301
|
} finally {
|
|
2398
|
-
if (u) throw
|
|
2302
|
+
if (u) throw r;
|
|
2399
2303
|
}
|
|
2400
2304
|
}
|
|
2401
2305
|
return o;
|
|
2402
2306
|
}
|
|
2403
2307
|
}
|
|
2404
|
-
function
|
|
2308
|
+
function D(e) {
|
|
2405
2309
|
if (Array.isArray(e)) return e;
|
|
2406
2310
|
}
|
|
2407
2311
|
// parseHighlightLines will turn a string like "2,4-5" into an array of ranges like [[2, 2], [4, 5]]
|
|
2408
|
-
var
|
|
2312
|
+
var P = function e(t) {
|
|
2409
2313
|
return t.replace(/\s+/g, "").split(",").filter(Boolean).map((function(e) {
|
|
2410
|
-
var t = e.split("-").map(Number), n =
|
|
2411
|
-
return [
|
|
2314
|
+
var t = e.split("-").map(Number), n = k(t, 2), a = n[0], r = n[1];
|
|
2315
|
+
return [ a, r || a ];
|
|
2412
2316
|
}));
|
|
2413
2317
|
};
|
|
2414
2318
|
// Flatten the array of ranges into a single array of line numbers
|
|
2415
2319
|
// example: [[2, 2], [4, 5]] will become [2, 4, 5]
|
|
2416
|
-
var
|
|
2320
|
+
var _ = function e(t) {
|
|
2417
2321
|
var n = t.map((function(e) {
|
|
2418
|
-
var t =
|
|
2322
|
+
var t = k(e, 2), n = t[0], a = t[1];
|
|
2419
2323
|
return Array.from({
|
|
2420
|
-
length:
|
|
2324
|
+
length: a - n + 1
|
|
2421
2325
|
}, (function(e, t) {
|
|
2422
2326
|
return n + t;
|
|
2423
2327
|
}));
|
|
@@ -2427,37 +2331,45 @@
|
|
|
2427
2331
|
return Array.from(new Set(n));
|
|
2428
2332
|
// Remove duplicates
|
|
2429
2333
|
};
|
|
2430
|
-
var
|
|
2431
|
-
var r = n.highlight,
|
|
2432
|
-
var
|
|
2433
|
-
var
|
|
2334
|
+
var $ = function e(n) {
|
|
2335
|
+
var a = n.containerAppearance, r = n.highlight, i = n.width;
|
|
2336
|
+
var s = P(r);
|
|
2337
|
+
var o = _(s);
|
|
2434
2338
|
|
|
2435
|
-
return t().createElement(t().Fragment, null,
|
|
2339
|
+
return t().createElement(t().Fragment, null, o.map((function(e) {
|
|
2436
2340
|
|
|
2437
|
-
return t().createElement(
|
|
2341
|
+
return t().createElement(R, {
|
|
2438
2342
|
key: e,
|
|
2439
2343
|
className: "line-highlight",
|
|
2440
2344
|
"aria-hidden": "true",
|
|
2345
|
+
$containerAppearance: a,
|
|
2441
2346
|
$lineNum: e,
|
|
2442
|
-
$width:
|
|
2347
|
+
$width: i
|
|
2443
2348
|
});
|
|
2444
2349
|
})));
|
|
2445
2350
|
};
|
|
2446
|
-
/* harmony default export */ const
|
|
2351
|
+
/* harmony default export */ const U = $;
|
|
2447
2352
|
// CONCATENATED MODULE: ./src/Code/LineNumbersStyles.ts
|
|
2448
|
-
var
|
|
2353
|
+
var M = b().span.withConfig({
|
|
2449
2354
|
displayName: "LineNumbersStyles__StyledLineNumberRows",
|
|
2450
2355
|
componentId: "sc-1h4k3dh-0"
|
|
2451
|
-
})([ "pointer-events:none;user-select:none;
|
|
2356
|
+
})([ "pointer-events:none;user-select:none;", ";& > span{display:block;counter-increment:linenumber;position:relative;z-index:1;&::before{display:block;content:counter(linenumber);color:", ";text-align:right;", "}}" ], (function(e) {
|
|
2357
|
+
var t = e.$containerAppearance;
|
|
2358
|
+
return t === "none" ? (0, h.css)([ "border-right:1px solid ", ";z-index:1;" ], y.variables.borderColor) : (0,
|
|
2359
|
+
h.css)([ "padding:", ";background-color:", ";" ], y.variables[A], y.variables.neutral200);
|
|
2360
|
+
}), y.variables.contentColorDefault, (function(e) {
|
|
2361
|
+
var t = e.$containerAppearance;
|
|
2362
|
+
return t === "none" && (0, h.css)([ "padding-inline-end:", ";" ], y.variables.spacingSmall);
|
|
2363
|
+
}));
|
|
2452
2364
|
// CONCATENATED MODULE: ./src/Code/LineNumbers.tsx
|
|
2453
|
-
function
|
|
2454
|
-
var n = e.
|
|
2365
|
+
function B(e) {
|
|
2366
|
+
var n = e.containerAppearance, a = n === void 0 ? "none" : n, r = e.value, i = r === void 0 ? "" : r;
|
|
2455
2367
|
// Use a regex to see how many lines there are in the value, then output an
|
|
2456
2368
|
// empty span for each line. The numbers themselves are handled by the CSS counter.
|
|
2457
|
-
var
|
|
2458
|
-
var
|
|
2459
|
-
var
|
|
2460
|
-
length:
|
|
2369
|
+
var s = i.match(/\n(?!$)/g);
|
|
2370
|
+
var o = s ? s.length + 1 : 1;
|
|
2371
|
+
var l = Array.from({
|
|
2372
|
+
length: o
|
|
2461
2373
|
}, (function(e, n) {
|
|
2462
2374
|
|
|
2463
2375
|
return t().createElement("span", {
|
|
@@ -2465,16 +2377,15 @@
|
|
|
2465
2377
|
});
|
|
2466
2378
|
}));
|
|
2467
2379
|
|
|
2468
|
-
return t().createElement(
|
|
2380
|
+
return t().createElement(M, {
|
|
2381
|
+
$containerAppearance: a,
|
|
2469
2382
|
"aria-hidden": true
|
|
2470
|
-
},
|
|
2383
|
+
}, l);
|
|
2471
2384
|
}
|
|
2472
|
-
/* harmony default export */ const
|
|
2473
|
-
// EXTERNAL MODULE: ./src/useResizeObserver/index.ts + 1 modules
|
|
2474
|
-
var M = n(6283);
|
|
2385
|
+
/* harmony default export */ const G = B;
|
|
2475
2386
|
// EXTERNAL MODULE: ./src/Code/prism/prism.empty
|
|
2476
|
-
var
|
|
2477
|
-
var
|
|
2387
|
+
var H = n(74);
|
|
2388
|
+
var j = n.n(H);
|
|
2478
2389
|
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
2479
2390
|
/**
|
|
2480
2391
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
@@ -2482,7 +2393,7 @@
|
|
|
2482
2393
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
2483
2394
|
* @param current - The new value of the ref.
|
|
2484
2395
|
*/
|
|
2485
|
-
function
|
|
2396
|
+
function z(e, t) {
|
|
2486
2397
|
if (e) {
|
|
2487
2398
|
if (typeof e === "function") {
|
|
2488
2399
|
e(t);
|
|
@@ -2495,80 +2406,80 @@
|
|
|
2495
2406
|
}
|
|
2496
2407
|
}
|
|
2497
2408
|
// CONCATENATED MODULE: ./src/Code/Code.tsx
|
|
2498
|
-
function
|
|
2499
|
-
return
|
|
2409
|
+
function Y() {
|
|
2410
|
+
return Y = Object.assign ? Object.assign.bind() : function(e) {
|
|
2500
2411
|
for (var t = 1; t < arguments.length; t++) {
|
|
2501
2412
|
var n = arguments[t];
|
|
2502
|
-
for (var
|
|
2503
|
-
({}).hasOwnProperty.call(n,
|
|
2413
|
+
for (var a in n) {
|
|
2414
|
+
({}).hasOwnProperty.call(n, a) && (e[a] = n[a]);
|
|
2504
2415
|
}
|
|
2505
2416
|
}
|
|
2506
2417
|
return e;
|
|
2507
|
-
},
|
|
2418
|
+
}, Y.apply(null, arguments);
|
|
2508
2419
|
}
|
|
2509
|
-
function
|
|
2510
|
-
return
|
|
2420
|
+
function X(e, t) {
|
|
2421
|
+
return Z(e) || V(e, t) || q(e, t) || W();
|
|
2511
2422
|
}
|
|
2512
|
-
function
|
|
2423
|
+
function W() {
|
|
2513
2424
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2514
2425
|
}
|
|
2515
|
-
function
|
|
2426
|
+
function q(e, t) {
|
|
2516
2427
|
if (e) {
|
|
2517
|
-
if ("string" == typeof e) return
|
|
2428
|
+
if ("string" == typeof e) return K(e, t);
|
|
2518
2429
|
var n = {}.toString.call(e).slice(8, -1);
|
|
2519
|
-
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ?
|
|
2430
|
+
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? K(e, t) : void 0;
|
|
2520
2431
|
}
|
|
2521
2432
|
}
|
|
2522
|
-
function
|
|
2433
|
+
function K(e, t) {
|
|
2523
2434
|
(null == t || t > e.length) && (t = e.length);
|
|
2524
|
-
for (var n = 0,
|
|
2525
|
-
|
|
2435
|
+
for (var n = 0, a = Array(t); n < t; n++) {
|
|
2436
|
+
a[n] = e[n];
|
|
2526
2437
|
}
|
|
2527
|
-
return
|
|
2438
|
+
return a;
|
|
2528
2439
|
}
|
|
2529
|
-
function
|
|
2440
|
+
function V(e, t) {
|
|
2530
2441
|
var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
2531
2442
|
if (null != n) {
|
|
2532
|
-
var
|
|
2443
|
+
var a, r, i, s, o = [], l = !0, u = !1;
|
|
2533
2444
|
try {
|
|
2534
2445
|
if (i = (n = n.call(e)).next, 0 === t) {
|
|
2535
2446
|
if (Object(n) !== n) return;
|
|
2536
2447
|
l = !1;
|
|
2537
|
-
} else for (;!(l = (
|
|
2448
|
+
} else for (;!(l = (a = i.call(n)).done) && (o.push(a.value), o.length !== t); l = !0) {
|
|
2538
2449
|
}
|
|
2539
2450
|
} catch (e) {
|
|
2540
|
-
u = !0,
|
|
2451
|
+
u = !0, r = e;
|
|
2541
2452
|
} finally {
|
|
2542
2453
|
try {
|
|
2543
2454
|
if (!l && null != n["return"] && (s = n["return"](), Object(s) !== s)) return;
|
|
2544
2455
|
} finally {
|
|
2545
|
-
if (u) throw
|
|
2456
|
+
if (u) throw r;
|
|
2546
2457
|
}
|
|
2547
2458
|
}
|
|
2548
2459
|
return o;
|
|
2549
2460
|
}
|
|
2550
2461
|
}
|
|
2551
|
-
function
|
|
2462
|
+
function Z(e) {
|
|
2552
2463
|
if (Array.isArray(e)) return e;
|
|
2553
2464
|
}
|
|
2554
|
-
function
|
|
2465
|
+
function Q(e, t) {
|
|
2555
2466
|
if (null == e) return {};
|
|
2556
|
-
var n,
|
|
2467
|
+
var n, a, r = J(e, t);
|
|
2557
2468
|
if (Object.getOwnPropertySymbols) {
|
|
2558
2469
|
var i = Object.getOwnPropertySymbols(e);
|
|
2559
|
-
for (
|
|
2560
|
-
n = i[
|
|
2470
|
+
for (a = 0; a < i.length; a++) {
|
|
2471
|
+
n = i[a], -1 === t.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
|
|
2561
2472
|
}
|
|
2562
2473
|
}
|
|
2563
|
-
return
|
|
2474
|
+
return r;
|
|
2564
2475
|
}
|
|
2565
|
-
function
|
|
2476
|
+
function J(e, t) {
|
|
2566
2477
|
if (null == e) return {};
|
|
2567
2478
|
var n = {};
|
|
2568
|
-
for (var
|
|
2569
|
-
if ({}.hasOwnProperty.call(e,
|
|
2570
|
-
if (-1 !== t.indexOf(
|
|
2571
|
-
n[
|
|
2479
|
+
for (var a in e) {
|
|
2480
|
+
if ({}.hasOwnProperty.call(e, a)) {
|
|
2481
|
+
if (-1 !== t.indexOf(a)) continue;
|
|
2482
|
+
n[a] = e[a];
|
|
2572
2483
|
}
|
|
2573
2484
|
}
|
|
2574
2485
|
return n;
|
|
@@ -2577,123 +2488,127 @@
|
|
|
2577
2488
|
// auto formatting. The import below points to an empty file which is replaced at build
|
|
2578
2489
|
// time, see ./prism/build-isolated-prism.js for details.
|
|
2579
2490
|
// typed as 'prismjs'
|
|
2580
|
-
var
|
|
2581
|
-
function
|
|
2491
|
+
var ee = [ "bash", "clike", "css", "html", "json", "javascript", "js", "jsx", "typescript", "ts", "tsx", "markup", "mathml", "plain", "plaintext", "splunk-spl", "sql", "svg", "text", "txt", "xml", "yaml", "yml" ];
|
|
2492
|
+
function te(e) {
|
|
2582
2493
|
return [ "plain", "plaintext", "text", "txt" ].includes(e);
|
|
2583
2494
|
}
|
|
2584
|
-
function
|
|
2585
|
-
if (
|
|
2586
|
-
return
|
|
2495
|
+
function ne(e, t) {
|
|
2496
|
+
if (te(t)) {
|
|
2497
|
+
return j().tokenize(e, {});
|
|
2587
2498
|
}
|
|
2588
|
-
return
|
|
2499
|
+
return j().tokenize(e, j().languages[t]);
|
|
2589
2500
|
}
|
|
2590
|
-
var
|
|
2501
|
+
var ae = {
|
|
2502
|
+
containerAppearance: m().oneOf([ "none", "section" ]),
|
|
2591
2503
|
elementRef: m().oneOfType([ m().func, m().object ]),
|
|
2592
2504
|
indentChars: m().number,
|
|
2593
|
-
language: m().oneOf(
|
|
2594
|
-
languageFallback: m().oneOf(
|
|
2505
|
+
language: m().oneOf(ee),
|
|
2506
|
+
languageFallback: m().oneOf(ee),
|
|
2595
2507
|
lineHighlights: m().string,
|
|
2596
2508
|
lineNumberStart: m().number,
|
|
2597
2509
|
showIndentGuide: m().bool,
|
|
2598
2510
|
showLineNumbers: m().bool,
|
|
2599
2511
|
value: m().string
|
|
2600
2512
|
};
|
|
2601
|
-
function
|
|
2602
|
-
var r = n.elementRef,
|
|
2513
|
+
function re(n) {
|
|
2514
|
+
var a = n.containerAppearance, r = a === void 0 ? "none" : a, s = n.elementRef, l = n.indentChars, c = l === void 0 ? 4 : l, d = n.language, f = n.languageFallback, m = f === void 0 ? "javascript" : f, E = n.lineHighlights, h = n.lineNumberStart, b = n.showIndentGuide, y = b === void 0 ? true : b, S = n.showLineNumbers, A = n.value, N = A === void 0 ? "" : A, R = Q(n, [ "containerAppearance", "elementRef", "indentChars", "language", "languageFallback", "lineHighlights", "lineNumberStart", "showIndentGuide", "showLineNumbers", "value" ]);
|
|
2603
2515
|
// @docs-props-type CodePropsBase
|
|
2604
|
-
var
|
|
2605
|
-
var
|
|
2606
|
-
var
|
|
2607
|
-
var
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
}), [
|
|
2516
|
+
var k = (0, e.useRef)(null);
|
|
2517
|
+
var L = (0, e.useState)(undefined), F = X(L, 2), w = F[0], C = F[1];
|
|
2518
|
+
var D = v()(k), P = D.width, _ = D.height;
|
|
2519
|
+
var $ = (0, e.useCallback)((function(e) {
|
|
2520
|
+
z(k, e);
|
|
2521
|
+
z(s, e);
|
|
2522
|
+
}), [ s ]);
|
|
2611
2523
|
(0, e.useEffect)((function() {
|
|
2612
|
-
var e =
|
|
2524
|
+
var e = k.current;
|
|
2613
2525
|
if (e) {
|
|
2614
|
-
var t = e.scrollHeight > Math.round(
|
|
2615
|
-
var n = e.scrollWidth > Math.round(
|
|
2616
|
-
var
|
|
2617
|
-
|
|
2526
|
+
var t = e.scrollHeight > Math.round(_);
|
|
2527
|
+
var n = e.scrollWidth > Math.round(P);
|
|
2528
|
+
var a = t || n;
|
|
2529
|
+
C(a ? 0 : undefined);
|
|
2618
2530
|
}
|
|
2619
|
-
}), [
|
|
2620
|
-
var
|
|
2621
|
-
var
|
|
2622
|
-
var
|
|
2623
|
-
var
|
|
2624
|
-
var i = g()(
|
|
2531
|
+
}), [ k, P, _ ]);
|
|
2532
|
+
var M = p()(" ", c);
|
|
2533
|
+
var B = function e(n) {
|
|
2534
|
+
var a = Math.floor(n / c);
|
|
2535
|
+
var r = n % c;
|
|
2536
|
+
var i = g()(a, (function(e) {
|
|
2625
2537
|
|
|
2626
|
-
return t().createElement(
|
|
2538
|
+
return t().createElement(O, {
|
|
2627
2539
|
key: e.toString()
|
|
2628
|
-
},
|
|
2540
|
+
}, M);
|
|
2629
2541
|
}));
|
|
2630
|
-
if (
|
|
2631
|
-
i.push(p()(" ",
|
|
2542
|
+
if (r) {
|
|
2543
|
+
i.push(p()(" ", r));
|
|
2632
2544
|
}
|
|
2633
2545
|
return i;
|
|
2634
2546
|
};
|
|
2635
|
-
var
|
|
2547
|
+
var H = u()(ee, d) > -1;
|
|
2636
2548
|
(0, e.useEffect)((function() {
|
|
2637
2549
|
// a fix for SUI-5425, where the Markdown component doesn't pass a valid language in some circumstances
|
|
2638
2550
|
if (false) {}
|
|
2639
|
-
}), [
|
|
2640
|
-
var
|
|
2641
|
-
var
|
|
2642
|
-
var
|
|
2643
|
-
var
|
|
2644
|
-
return i()(n).map((function(n,
|
|
2551
|
+
}), [ H, d, m ]);
|
|
2552
|
+
var j = H && d ? d : m;
|
|
2553
|
+
var W = ne(N, j);
|
|
2554
|
+
var q = te(j);
|
|
2555
|
+
var K = function e(n) {
|
|
2556
|
+
return i()(n).map((function(n, a) {
|
|
2645
2557
|
if (typeof n === "string") {
|
|
2646
|
-
if (!
|
|
2558
|
+
if (!y) {
|
|
2647
2559
|
return n;
|
|
2648
2560
|
}
|
|
2649
|
-
var
|
|
2650
|
-
if (
|
|
2561
|
+
var r = n.split("\n");
|
|
2562
|
+
if (r.length === 1) {
|
|
2651
2563
|
return n;
|
|
2652
2564
|
}
|
|
2653
|
-
return o()(
|
|
2654
|
-
var
|
|
2565
|
+
return o()(r.map((function(e, n) {
|
|
2566
|
+
var r = n === 0 ? [] : [ "\n" ];
|
|
2655
2567
|
var i = e.match(/^(\s+)(.*)/);
|
|
2656
2568
|
if (!i) {
|
|
2657
|
-
|
|
2569
|
+
r.push(e);
|
|
2658
2570
|
} else {
|
|
2659
|
-
|
|
2660
|
-
key: "".concat(
|
|
2661
|
-
},
|
|
2571
|
+
r.push( t().createElement("span", {
|
|
2572
|
+
key: "".concat(a.toString(), ":").concat(n.toString())
|
|
2573
|
+
}, B(i[1].length)), i[2]);
|
|
2662
2574
|
}
|
|
2663
|
-
return
|
|
2575
|
+
return r;
|
|
2664
2576
|
})));
|
|
2665
2577
|
}
|
|
2666
2578
|
var i = typeof n.content === "string" ? n.content : e(n.content);
|
|
2667
2579
|
|
|
2668
2580
|
// eslint-disable-next-line react/no-array-index-key
|
|
2669
|
-
return t().createElement(
|
|
2581
|
+
return t().createElement(x, {
|
|
2670
2582
|
"data-part-type": n.type,
|
|
2671
2583
|
partType: n.type,
|
|
2672
|
-
key:
|
|
2584
|
+
key: a.toString()
|
|
2673
2585
|
}, i);
|
|
2674
2586
|
}));
|
|
2675
2587
|
};
|
|
2676
|
-
var
|
|
2588
|
+
var V = K(W);
|
|
2677
2589
|
|
|
2678
|
-
return t().createElement(
|
|
2590
|
+
return t().createElement(I, Y({
|
|
2679
2591
|
"data-test": "code",
|
|
2680
|
-
ref:
|
|
2681
|
-
tabIndex:
|
|
2682
|
-
$
|
|
2683
|
-
$
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2592
|
+
ref: $,
|
|
2593
|
+
tabIndex: w,
|
|
2594
|
+
$containerAppearance: r,
|
|
2595
|
+
$showLineNumbers: S,
|
|
2596
|
+
$counterReset: h && h - 1
|
|
2597
|
+
}, R), S && t().createElement(G, {
|
|
2598
|
+
containerAppearance: r,
|
|
2599
|
+
value: N
|
|
2600
|
+
}), t().createElement(T, {
|
|
2601
|
+
className: "language-".concat(j),
|
|
2602
|
+
$isPlaintext: q
|
|
2603
|
+
}, V), E && t().createElement(U, {
|
|
2604
|
+
containerAppearance: r,
|
|
2605
|
+
width: P,
|
|
2606
|
+
highlight: E
|
|
2692
2607
|
}));
|
|
2693
2608
|
}
|
|
2694
|
-
|
|
2695
|
-
/* harmony default export */ const
|
|
2609
|
+
re.propTypes = ae;
|
|
2610
|
+
/* harmony default export */ const ie = re;
|
|
2696
2611
|
}) // CONCATENATED MODULE: ./src/Code/index.ts
|
|
2697
2612
|
();
|
|
2698
|
-
module.exports =
|
|
2613
|
+
module.exports = a;
|
|
2699
2614
|
/******/})();
|