@atlaskit/code 14.6.8 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/bidi-warning/bidi-warning-decorator.js +1 -2
- package/dist/cjs/code-block.js +3 -6
- package/dist/cjs/code.js +2 -7
- package/dist/cjs/constants.js +2 -3
- package/dist/cjs/internal/hooks/use-highlight.js +2 -3
- package/dist/cjs/internal/theme/constants.js +8 -16
- package/dist/cjs/internal/theme/get-theme.js +54 -217
- package/dist/cjs/internal/theme/styles.js +26 -34
- package/dist/cjs/internal/utils/get-normalized-language.js +2 -3
- package/dist/cjs/syntax-highlighter/async.js +2 -3
- package/dist/cjs/syntax-highlighter/index.js +1 -2
- package/dist/cjs/syntax-highlighter/lib/highlight.js +1 -2
- package/dist/cjs/syntax-highlighter/lib/process/create-line.js +1 -2
- package/dist/cjs/syntax-highlighter/lib/process/index.js +2 -3
- package/dist/cjs/syntax-highlighter/types.js +2 -3
- package/dist/es2019/code-block.js +1 -3
- package/dist/es2019/code.js +2 -4
- package/dist/es2019/internal/theme/get-theme.js +54 -213
- package/dist/es2019/internal/theme/styles.js +6 -9
- package/dist/esm/code-block.js +2 -4
- package/dist/esm/code.js +2 -6
- package/dist/esm/internal/theme/get-theme.js +53 -212
- package/dist/esm/internal/theme/styles.js +5 -8
- package/dist/esm/syntax-highlighter/lib/process/index.js +2 -3
- package/dist/types/internal/theme/get-theme.d.ts +3 -4
- package/dist/types/internal/theme/styles.d.ts +3 -6
- package/dist/types-ts4.5/internal/theme/get-theme.d.ts +3 -4
- package/dist/types-ts4.5/internal/theme/styles.d.ts +3 -6
- package/package.json +3 -3
- package/report.api.md +1 -8
- package/tmp/api-report-tmp.d.ts +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/code
|
|
2
2
|
|
|
3
|
+
## 15.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#41498](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41498) [`73adf14896c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/73adf14896c) - Remove usage of legacy theming from the Code component and refactor where necessary to accomodate the updated API.
|
|
8
|
+
|
|
9
|
+
## 14.6.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 14.6.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
-
var bidiCharacterRegex = /[\u202A-\u202E\u2066-\u2069]/g;
|
|
13
|
+
var bidiCharacterRegex = exports.bidiCharacterRegex = /[\u202A-\u202E\u2066-\u2069]/g;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* __Code Bidi Warning Decorator__
|
|
@@ -19,7 +19,6 @@ var bidiCharacterRegex = /[\u202A-\u202E\u2066-\u2069]/g;
|
|
|
19
19
|
* In case if bidi characters found - returns children with decorated
|
|
20
20
|
* bidi characters. If no bidi characters found - original text returned.
|
|
21
21
|
*/
|
|
22
|
-
exports.bidiCharacterRegex = bidiCharacterRegex;
|
|
23
22
|
function codeBidiWarningDecorator(originalText, decorate) {
|
|
24
23
|
var matches = (0, _toConsumableArray2.default)(originalText.matchAll(bidiCharacterRegex));
|
|
25
24
|
if (matches.length === 0) {
|
package/dist/cjs/code-block.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _react2 = require("@emotion/react");
|
|
10
|
-
var _components = require("@atlaskit/theme/components");
|
|
11
10
|
var _useHighlight = require("./internal/hooks/use-highlight");
|
|
12
11
|
var _styles = require("./internal/theme/styles");
|
|
13
12
|
var _getNormalizedLanguage = require("./internal/utils/get-normalized-language");
|
|
@@ -44,10 +43,9 @@ var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
|
|
|
44
43
|
_ref$shouldWrapLongLi = _ref.shouldWrapLongLines,
|
|
45
44
|
shouldWrapLongLines = _ref$shouldWrapLongLi === void 0 ? false : _ref$shouldWrapLongLi;
|
|
46
45
|
var numLines = (text || '').split('\n').length;
|
|
47
|
-
var globalTheme = (0, _components.useGlobalTheme)();
|
|
48
46
|
var theme = (0, _react.useMemo)(function () {
|
|
49
|
-
return (0, _styles.getCodeBlockTheme)(
|
|
50
|
-
}, [
|
|
47
|
+
return (0, _styles.getCodeBlockTheme)(numLines);
|
|
48
|
+
}, [numLines]);
|
|
51
49
|
var getStyles = (0, _react.useMemo)(function () {
|
|
52
50
|
return (0, _styles.getCodeBlockStyles)(theme);
|
|
53
51
|
}, [theme]);
|
|
@@ -90,5 +88,4 @@ var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
|
|
|
90
88
|
});
|
|
91
89
|
});
|
|
92
90
|
CodeBlock.displayName = 'CodeBlock';
|
|
93
|
-
var _default = CodeBlock;
|
|
94
|
-
exports.default = _default;
|
|
91
|
+
var _default = exports.default = CodeBlock;
|
package/dist/cjs/code.js
CHANGED
|
@@ -16,7 +16,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
16
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
17
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _components = require("@atlaskit/theme/components");
|
|
20
19
|
var _bidiWarning = _interopRequireDefault(require("./bidi-warning"));
|
|
21
20
|
var _bidiWarningDecorator = _interopRequireDefault(require("./bidi-warning/bidi-warning-decorator"));
|
|
22
21
|
var _styles = require("./internal/theme/styles");
|
|
@@ -37,10 +36,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
37
36
|
var Code = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Code(_ref, ref) {
|
|
38
37
|
var testId = _ref.testId,
|
|
39
38
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
40
|
-
var
|
|
41
|
-
var styles = (0, _react.useMemo)(function () {
|
|
42
|
-
return (0, _react2.css)((0, _styles.getCodeStyles)(theme));
|
|
43
|
-
}, [theme]);
|
|
39
|
+
var styles = (0, _react2.css)((0, _styles.getCodeStyles)());
|
|
44
40
|
var children = props.children,
|
|
45
41
|
_props$codeBidiWarnin = props.codeBidiWarnings,
|
|
46
42
|
codeBidiWarnings = _props$codeBidiWarnin === void 0 ? true : _props$codeBidiWarnin,
|
|
@@ -94,5 +90,4 @@ function isReactElement(child) {
|
|
|
94
90
|
return !!child.type;
|
|
95
91
|
}
|
|
96
92
|
Code.displayName = 'Code';
|
|
97
|
-
var _default = Code;
|
|
98
|
-
exports.default = _default;
|
|
93
|
+
var _default = exports.default = Code;
|
package/dist/cjs/constants.js
CHANGED
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "CODE_BLOCK_SELECTOR", {
|
|
|
11
11
|
});
|
|
12
12
|
exports.SUPPORTED_LANGUAGES = void 0;
|
|
13
13
|
var _constants = require("./internal/theme/constants");
|
|
14
|
-
var SUPPORTED_LANGUAGES = [{
|
|
14
|
+
var SUPPORTED_LANGUAGES = exports.SUPPORTED_LANGUAGES = [{
|
|
15
15
|
name: 'PHP',
|
|
16
16
|
alias: ['php', 'php3', 'php4', 'php5'],
|
|
17
17
|
value: 'php'
|
|
@@ -319,5 +319,4 @@ var SUPPORTED_LANGUAGES = [{
|
|
|
319
319
|
name: 'SplunkSPL',
|
|
320
320
|
alias: ['splunk-spl'],
|
|
321
321
|
value: 'splunk-spl'
|
|
322
|
-
}];
|
|
323
|
-
exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
|
|
322
|
+
}];
|
|
@@ -18,7 +18,7 @@ var getLineStyleObject = function getLineStyleObject(lineNumber, testId) {
|
|
|
18
18
|
'data-testid': "".concat(testId, "-line-").concat(lineNumber)
|
|
19
19
|
}, DEFAULT_LINE_EL_ATTR_OBJ) : DEFAULT_LINE_EL_ATTR_OBJ;
|
|
20
20
|
};
|
|
21
|
-
var useHighlightLines = function useHighlightLines(_ref) {
|
|
21
|
+
var useHighlightLines = exports.useHighlightLines = function useHighlightLines(_ref) {
|
|
22
22
|
var _ref$highlight = _ref.highlight,
|
|
23
23
|
highlight = _ref$highlight === void 0 ? '' : _ref$highlight,
|
|
24
24
|
testId = _ref.testId;
|
|
@@ -62,5 +62,4 @@ var useHighlightLines = function useHighlightLines(_ref) {
|
|
|
62
62
|
getHighlightStyles: getHighlightStyles,
|
|
63
63
|
highlightedLines: highlightedLines
|
|
64
64
|
};
|
|
65
|
-
};
|
|
66
|
-
exports.useHighlightLines = useHighlightLines;
|
|
65
|
+
};
|
|
@@ -7,21 +7,13 @@ exports.VAR_CODE_LINE_NUMBER_BG_COLOR = exports.VAR_CODE_BG_COLOR = exports.SPAC
|
|
|
7
7
|
var _constants = require("@atlaskit/theme/constants");
|
|
8
8
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
9
9
|
|
|
10
|
-
var CODE_FONT_SIZE = 12;
|
|
11
|
-
exports.
|
|
12
|
-
var
|
|
13
|
-
exports.
|
|
14
|
-
var
|
|
15
|
-
exports.
|
|
16
|
-
var
|
|
17
|
-
exports.SPACING = SPACING;
|
|
18
|
-
var LINE_NUMBER_GUTTER = SPACING * 2;
|
|
19
|
-
exports.LINE_NUMBER_GUTTER = LINE_NUMBER_GUTTER;
|
|
20
|
-
var VAR_CODE_LINE_NUMBER_BG_COLOR = '--ds--code--line-number-bg-color';
|
|
21
|
-
exports.VAR_CODE_LINE_NUMBER_BG_COLOR = VAR_CODE_LINE_NUMBER_BG_COLOR;
|
|
22
|
-
var VAR_CODE_BG_COLOR = '--ds--code--bg-color';
|
|
10
|
+
var CODE_FONT_SIZE = exports.CODE_FONT_SIZE = 12;
|
|
11
|
+
var CODE_LINE_HEIGHT = exports.CODE_LINE_HEIGHT = '20px';
|
|
12
|
+
var HIGHLIGHT_BORDER_WIDTH = exports.HIGHLIGHT_BORDER_WIDTH = '4px';
|
|
13
|
+
var SPACING = exports.SPACING = (0, _constants.gridSize)();
|
|
14
|
+
var LINE_NUMBER_GUTTER = exports.LINE_NUMBER_GUTTER = SPACING * 2;
|
|
15
|
+
var VAR_CODE_LINE_NUMBER_BG_COLOR = exports.VAR_CODE_LINE_NUMBER_BG_COLOR = '--ds--code--line-number-bg-color';
|
|
16
|
+
var VAR_CODE_BG_COLOR = exports.VAR_CODE_BG_COLOR = '--ds--code--bg-color';
|
|
23
17
|
|
|
24
18
|
// selector for codeblock
|
|
25
|
-
exports.
|
|
26
|
-
var CODE_BLOCK_SELECTOR = "data-ds--code--code-block";
|
|
27
|
-
exports.CODE_BLOCK_SELECTOR = CODE_BLOCK_SELECTOR;
|
|
19
|
+
var CODE_BLOCK_SELECTOR = exports.CODE_BLOCK_SELECTOR = "data-ds--code--code-block";
|
|
@@ -9,7 +9,6 @@ exports.getColorPalette = exports.getBaseTheme = exports.defaultBaseTheme = expo
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
11
11
|
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
12
|
-
var _components = require("@atlaskit/theme/components");
|
|
13
12
|
var _constants = require("@atlaskit/theme/constants");
|
|
14
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -19,228 +18,66 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
18
|
// accessible color options for Teal and Yellow and +20A
|
|
20
19
|
var T800 = '#067384';
|
|
21
20
|
var Y1100 = '#7A5D1A';
|
|
22
|
-
var
|
|
23
|
-
var getBaseTheme = function getBaseTheme(theme) {
|
|
21
|
+
var getBaseTheme = exports.getBaseTheme = function getBaseTheme() {
|
|
24
22
|
return {
|
|
25
23
|
fontFamily: (0, _constants.codeFontFamily)(),
|
|
26
24
|
fontFamilyItalic: "SFMono-MediumItalic, ".concat((0, _constants.codeFontFamily)()),
|
|
27
|
-
backgroundColor: (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
theme: theme
|
|
32
|
-
}),
|
|
33
|
-
textColor: (0, _components.themed)({
|
|
34
|
-
light: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
35
|
-
dark: "var(--ds-text, ".concat(colors.DN800, ")")
|
|
36
|
-
})({
|
|
37
|
-
theme: theme
|
|
38
|
-
}),
|
|
39
|
-
lineNumberColor: (0, _components.themed)({
|
|
40
|
-
light: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
41
|
-
dark: "var(--ds-text-subtlest, ".concat(colors.DN400, ")")
|
|
42
|
-
})({
|
|
43
|
-
theme: theme
|
|
44
|
-
}),
|
|
45
|
-
lineNumberBgColor: (0, _components.themed)({
|
|
46
|
-
light: "var(--ds-background-neutral, ".concat(colors.N30, ")"),
|
|
47
|
-
dark: "var(--ds-background-neutral, ".concat(colors.DN20, ")")
|
|
48
|
-
})({
|
|
49
|
-
theme: theme
|
|
50
|
-
})
|
|
25
|
+
backgroundColor: "var(--ds-background-neutral, ".concat(colors.N20, ")"),
|
|
26
|
+
textColor: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
27
|
+
lineNumberColor: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
28
|
+
lineNumberBgColor: "var(--ds-background-neutral, ".concat(colors.N30, ")")
|
|
51
29
|
};
|
|
52
30
|
};
|
|
53
|
-
exports.
|
|
54
|
-
var
|
|
55
|
-
mode: 'light'
|
|
56
|
-
});
|
|
57
|
-
exports.defaultBaseTheme = defaultBaseTheme;
|
|
58
|
-
var getColorPalette = (0, _memoizeOne.default)(function (theme) {
|
|
59
|
-
var akTheme = {
|
|
60
|
-
theme: theme
|
|
61
|
-
};
|
|
31
|
+
var defaultBaseTheme = exports.defaultBaseTheme = getBaseTheme();
|
|
32
|
+
var getColorPalette = exports.getColorPalette = (0, _memoizeOne.default)(function () {
|
|
62
33
|
return {
|
|
63
|
-
highlightedLineBgColor: (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
codeColor: (0, _components.themed)({
|
|
108
|
-
light: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
109
|
-
dark: "var(--ds-text-accent-blue, ".concat(colors.B75, ")")
|
|
110
|
-
})(akTheme),
|
|
111
|
-
regexpColor: (0, _components.themed)({
|
|
112
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
113
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T200, ")")
|
|
114
|
-
})(akTheme),
|
|
115
|
-
symbolColor: (0, _components.themed)({
|
|
116
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
117
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T200, ")")
|
|
118
|
-
})(akTheme),
|
|
119
|
-
variableColor: (0, _components.themed)({
|
|
120
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
121
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T200, ")")
|
|
122
|
-
})(akTheme),
|
|
123
|
-
templateVariableColor: (0, _components.themed)({
|
|
124
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
125
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T200, ")")
|
|
126
|
-
})(akTheme),
|
|
127
|
-
linkColor: (0, _components.themed)({
|
|
128
|
-
light: "var(--ds-text-accent-purple, ".concat(colors.P300, ")"),
|
|
129
|
-
dark: "var(--ds-text-accent-purple, ".concat(colors.P75, ")")
|
|
130
|
-
})(akTheme),
|
|
131
|
-
selectorAttributeColor: (0, _components.themed)({
|
|
132
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
133
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T200, ")")
|
|
134
|
-
})(akTheme),
|
|
135
|
-
selectorPseudoColor: (0, _components.themed)({
|
|
136
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
137
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T200, ")")
|
|
138
|
-
})(akTheme),
|
|
139
|
-
typeColor: (0, _components.themed)({
|
|
140
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
141
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T100, ")")
|
|
142
|
-
})(akTheme),
|
|
143
|
-
stringColor: (0, _components.themed)({
|
|
144
|
-
light: "var(--ds-text-accent-green, ".concat(colors.G500, ")"),
|
|
145
|
-
dark: "var(--ds-text-accent-green, ".concat(colors.G200, ")")
|
|
146
|
-
})(akTheme),
|
|
147
|
-
selectorIdColor: (0, _components.themed)({
|
|
148
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
149
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T100, ")")
|
|
150
|
-
})(akTheme),
|
|
151
|
-
selectorClassColor: (0, _components.themed)({
|
|
152
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
153
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T100, ")")
|
|
154
|
-
})(akTheme),
|
|
155
|
-
quoteColor: (0, _components.themed)({
|
|
156
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
157
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T100, ")")
|
|
158
|
-
})(akTheme),
|
|
159
|
-
templateTagColor: (0, _components.themed)({
|
|
160
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
161
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T100, ")")
|
|
162
|
-
})(akTheme),
|
|
163
|
-
titleColor: (0, _components.themed)({
|
|
164
|
-
light: "var(--ds-text-accent-purple, ".concat(colors.P300, ")"),
|
|
165
|
-
dark: "var(--ds-text-accent-purple, ".concat(colors.P75, ")")
|
|
166
|
-
})(akTheme),
|
|
167
|
-
sectionColor: (0, _components.themed)({
|
|
168
|
-
light: "var(--ds-text-accent-purple, ".concat(colors.P300, ")"),
|
|
169
|
-
dark: "var(--ds-text-accent-purple, ".concat(colors.P75, ")")
|
|
170
|
-
})(akTheme),
|
|
171
|
-
commentColor: (0, _components.themed)({
|
|
172
|
-
light: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
173
|
-
dark: "var(--ds-text-subtlest, ".concat(colors.DN400, ")")
|
|
174
|
-
})(akTheme),
|
|
175
|
-
metaKeywordColor: (0, _components.themed)({
|
|
176
|
-
light: "var(--ds-text-accent-green, ".concat(colors.G500, ")"),
|
|
177
|
-
dark: "var(--ds-text-accent-green, ".concat(colors.G200, ")")
|
|
178
|
-
})(akTheme),
|
|
179
|
-
metaColor: (0, _components.themed)({
|
|
180
|
-
light: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
181
|
-
dark: "var(--ds-text-subtlest, ".concat(colors.DN400, ")")
|
|
182
|
-
})(akTheme),
|
|
183
|
-
functionColor: (0, _components.themed)({
|
|
184
|
-
light: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
185
|
-
dark: "var(--ds-text, ".concat(colors.DN800, ")")
|
|
186
|
-
})(akTheme),
|
|
187
|
-
numberColor: (0, _components.themed)({
|
|
188
|
-
light: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
189
|
-
dark: "var(--ds-text-accent-blue, ".concat(colors.B75, ")")
|
|
190
|
-
})(akTheme),
|
|
191
|
-
prologColor: (0, _components.themed)({
|
|
192
|
-
light: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
193
|
-
dark: "var(--ds-text-accent-blue, ".concat(colors.B75, ")")
|
|
194
|
-
})(akTheme),
|
|
195
|
-
cdataColor: (0, _components.themed)({
|
|
196
|
-
light: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
197
|
-
dark: "var(--ds-text-subtlest, ".concat(colors.B75, ")")
|
|
198
|
-
})(akTheme),
|
|
199
|
-
punctuationColor: (0, _components.themed)({
|
|
200
|
-
light: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
201
|
-
dark: "var(--ds-text, ".concat(colors.DN800, ")")
|
|
202
|
-
})(akTheme),
|
|
203
|
-
propertyColor: (0, _components.themed)({
|
|
204
|
-
light: "var(--ds-text-accent-purple, ".concat(colors.P300, ")"),
|
|
205
|
-
dark: "var(--ds-text-accent-purple, ".concat(colors.P75, ")")
|
|
206
|
-
})(akTheme),
|
|
207
|
-
constantColor: (0, _components.themed)({
|
|
208
|
-
light: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
209
|
-
dark: "var(--ds-text-accent-teal, ".concat(colors.T100, ")")
|
|
210
|
-
})(akTheme),
|
|
211
|
-
booleanColor: (0, _components.themed)({
|
|
212
|
-
light: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
213
|
-
dark: "var(--ds-text-accent-blue, ".concat(colors.B75, ")")
|
|
214
|
-
})(akTheme),
|
|
215
|
-
charColor: (0, _components.themed)({
|
|
216
|
-
light: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
217
|
-
dark: "var(--ds-text, ".concat(colors.DN800, ")")
|
|
218
|
-
})(akTheme),
|
|
219
|
-
insertedColor: (0, _components.themed)({
|
|
220
|
-
light: "var(--ds-text-accent-green, ".concat(colors.G500, ")"),
|
|
221
|
-
dark: "var(--ds-text-accent-green, ".concat(colors.B75, ")")
|
|
222
|
-
})(akTheme),
|
|
223
|
-
deletedColor: (0, _components.themed)({
|
|
224
|
-
light: "var(--ds-text-accent-red, ".concat(colors.R500, ")"),
|
|
225
|
-
dark: "var(--ds-text-accent-red, ".concat(colors.B75, ")")
|
|
226
|
-
})(akTheme),
|
|
227
|
-
operatorColor: (0, _components.themed)({
|
|
228
|
-
light: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
229
|
-
dark: "var(--ds-text, ".concat(colors.B75, ")")
|
|
230
|
-
})(akTheme),
|
|
231
|
-
atruleColor: (0, _components.themed)({
|
|
232
|
-
light: "var(--ds-text-accent-green, ".concat(colors.G500, ")"),
|
|
233
|
-
dark: "var(--ds-text-accent-green, ".concat(colors.G200, ")")
|
|
234
|
-
})(akTheme),
|
|
235
|
-
importantColor: (0, _components.themed)({
|
|
236
|
-
light: "var(--ds-text-accent-yellow, ".concat(Y1100, ")"),
|
|
237
|
-
dark: "var(--ds-text-accent-yellow, ".concat(colors.Y300, ")")
|
|
238
|
-
})(akTheme)
|
|
34
|
+
highlightedLineBgColor: "var(--ds-background-neutral, ".concat(colors.N30, ")"),
|
|
35
|
+
highlightedLineBorderColor: "var(--ds-border-focused, ".concat(colors.B200, ")"),
|
|
36
|
+
substringColor: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
37
|
+
keywordColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
38
|
+
attributeColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
39
|
+
selectorTagColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
40
|
+
docTagColor: "var(--ds-text-accent-yellow, ".concat(Y1100, ")"),
|
|
41
|
+
nameColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
42
|
+
builtInColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
43
|
+
literalColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
44
|
+
bulletColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
45
|
+
codeColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
46
|
+
regexpColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
47
|
+
symbolColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
48
|
+
variableColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
49
|
+
templateVariableColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
50
|
+
linkColor: "var(--ds-text-accent-purple, ".concat(colors.P300, ")"),
|
|
51
|
+
selectorAttributeColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
52
|
+
selectorPseudoColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
53
|
+
typeColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
54
|
+
stringColor: "var(--ds-text-accent-green, ".concat(colors.G500, ")"),
|
|
55
|
+
selectorIdColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
56
|
+
selectorClassColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
57
|
+
quoteColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
58
|
+
templateTagColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
59
|
+
titleColor: "var(--ds-text-accent-purple, ".concat(colors.P300, ")"),
|
|
60
|
+
sectionColor: "var(--ds-text-accent-purple, ".concat(colors.P300, ")"),
|
|
61
|
+
commentColor: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
62
|
+
metaKeywordColor: "var(--ds-text-accent-green, ".concat(colors.G500, ")"),
|
|
63
|
+
metaColor: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
64
|
+
functionColor: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
65
|
+
numberColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
66
|
+
prologColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
67
|
+
cdataColor: "var(--ds-text-subtlest, ".concat(colors.N400, ")"),
|
|
68
|
+
punctuationColor: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
69
|
+
propertyColor: "var(--ds-text-accent-purple, ".concat(colors.P300, ")"),
|
|
70
|
+
constantColor: "var(--ds-text-accent-teal, ".concat(T800, ")"),
|
|
71
|
+
booleanColor: "var(--ds-text-accent-blue, ".concat(colors.B400, ")"),
|
|
72
|
+
charColor: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
73
|
+
insertedColor: "var(--ds-text-accent-green, ".concat(colors.G500, ")"),
|
|
74
|
+
deletedColor: "var(--ds-text-accent-red, ".concat(colors.R500, ")"),
|
|
75
|
+
operatorColor: "var(--ds-text, ".concat(colors.N800, ")"),
|
|
76
|
+
atruleColor: "var(--ds-text-accent-green, ".concat(colors.G500, ")"),
|
|
77
|
+
importantColor: "var(--ds-text-accent-yellow, ".concat(Y1100, ")")
|
|
239
78
|
};
|
|
240
79
|
});
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
return _objectSpread(_objectSpread({}, getBaseTheme(theme)), getColorPalette(theme));
|
|
80
|
+
var getTheme = function getTheme() {
|
|
81
|
+
return _objectSpread(_objectSpread({}, getBaseTheme()), getColorPalette());
|
|
244
82
|
};
|
|
245
|
-
var _default = getTheme;
|
|
246
|
-
exports.default = _default;
|
|
83
|
+
var _default = exports.default = getTheme;
|
|
@@ -6,22 +6,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getLineNumWidth = exports.getCodeStyles = exports.getCodeBlockTheme = exports.getCodeBlockStyles = exports.getBaseCodeStyles = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _constants = require("
|
|
10
|
-
var _constants2 = require("./constants");
|
|
9
|
+
var _constants = require("./constants");
|
|
11
10
|
var _getTheme = require("./get-theme");
|
|
12
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
var getLineNumWidth = function getLineNumWidth(numLines) {
|
|
13
|
+
var getLineNumWidth = exports.getLineNumWidth = function getLineNumWidth(numLines) {
|
|
15
14
|
if (!numLines) {
|
|
16
15
|
return '1ch';
|
|
17
16
|
}
|
|
18
17
|
return "".concat(numLines.toFixed(0).length, "ch");
|
|
19
18
|
};
|
|
20
|
-
exports.getLineNumWidth = getLineNumWidth;
|
|
21
19
|
var lineNumberStyle = function lineNumberStyle(theme) {
|
|
22
20
|
return {
|
|
23
21
|
// width of the line number gutter
|
|
24
|
-
minWidth: "calc(".concat(theme.lineNumberWidth, " + ").concat(
|
|
22
|
+
minWidth: "calc(".concat(theme.lineNumberWidth, " + ").concat(_constants.LINE_NUMBER_GUTTER, "px) !important"),
|
|
25
23
|
// this needs to be important or it gets overwritten by inline styles
|
|
26
24
|
fontStyle: 'normal !important',
|
|
27
25
|
// this needs to be important or it gets overwritten by inline styles
|
|
@@ -29,9 +27,9 @@ var lineNumberStyle = function lineNumberStyle(theme) {
|
|
|
29
27
|
flexShrink: 0,
|
|
30
28
|
// needed to replicate existing design spec
|
|
31
29
|
boxSizing: 'border-box',
|
|
32
|
-
paddingRight: "".concat(
|
|
33
|
-
paddingLeft:
|
|
34
|
-
marginRight:
|
|
30
|
+
paddingRight: "".concat(_constants.SPACING, "px !important"),
|
|
31
|
+
paddingLeft: _constants.SPACING,
|
|
32
|
+
marginRight: _constants.SPACING,
|
|
35
33
|
textAlign: 'right',
|
|
36
34
|
userSelect: 'none',
|
|
37
35
|
// this is to fix SSR spacing issue
|
|
@@ -197,15 +195,15 @@ var syntaxKeywordColors = function syntaxKeywordColors(theme) {
|
|
|
197
195
|
/**
|
|
198
196
|
* Styles applied at the root element level, common across code/codeblock
|
|
199
197
|
*/
|
|
200
|
-
var getBaseCodeStyles = function getBaseCodeStyles(theme) {
|
|
198
|
+
var getBaseCodeStyles = exports.getBaseCodeStyles = function getBaseCodeStyles(theme) {
|
|
201
199
|
return {
|
|
202
|
-
fontSize:
|
|
200
|
+
fontSize: _constants.CODE_FONT_SIZE,
|
|
203
201
|
fontFamily: theme.fontFamily,
|
|
204
202
|
fontWeight: 'normal',
|
|
205
|
-
backgroundColor: "var(".concat(
|
|
203
|
+
backgroundColor: "var(".concat(_constants.VAR_CODE_BG_COLOR, ",").concat(theme.backgroundColor, ")"),
|
|
206
204
|
color: theme.textColor,
|
|
207
205
|
borderStyle: 'none',
|
|
208
|
-
borderRadius: "
|
|
206
|
+
borderRadius: "var(--ds-border-radius, 3px)"
|
|
209
207
|
};
|
|
210
208
|
};
|
|
211
209
|
|
|
@@ -215,17 +213,16 @@ var getBaseCodeStyles = function getBaseCodeStyles(theme) {
|
|
|
215
213
|
*
|
|
216
214
|
* @param theme
|
|
217
215
|
*/
|
|
218
|
-
exports.
|
|
219
|
-
var getCodeBlockStyles = function getCodeBlockStyles(theme) {
|
|
216
|
+
var getCodeBlockStyles = exports.getCodeBlockStyles = function getCodeBlockStyles(theme) {
|
|
220
217
|
return function (highlightedStartText, highlightedEndText, showLineNumbers, shouldWrapLongLines) {
|
|
221
218
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
222
219
|
// this is required to account for prismjs styles leaking into the codeblock
|
|
223
220
|
'code[class*="language-"], pre[class*="language-"], code': {
|
|
224
221
|
all: 'unset',
|
|
225
|
-
padding: showLineNumbers ? "".concat(
|
|
222
|
+
padding: showLineNumbers ? "".concat(_constants.SPACING, "px 0") : _constants.SPACING
|
|
226
223
|
},
|
|
227
224
|
display: 'flex',
|
|
228
|
-
lineHeight:
|
|
225
|
+
lineHeight: _constants.CODE_LINE_HEIGHT,
|
|
229
226
|
overflowX: 'auto',
|
|
230
227
|
whiteSpace: 'pre',
|
|
231
228
|
direction: 'ltr'
|
|
@@ -239,8 +236,8 @@ var getCodeBlockStyles = function getCodeBlockStyles(theme) {
|
|
|
239
236
|
// these styles are for line highlighting
|
|
240
237
|
'& [data-ds--code--row]': {
|
|
241
238
|
display: showLineNumbers ? 'flex' : 'block',
|
|
242
|
-
paddingRight: "".concat(
|
|
243
|
-
marginRight: "-".concat(
|
|
239
|
+
paddingRight: "".concat(_constants.SPACING, "px !important"),
|
|
240
|
+
marginRight: "-".concat(_constants.SPACING, "px")
|
|
244
241
|
},
|
|
245
242
|
'& [data-ds--code--row--highlight]': {
|
|
246
243
|
background: "".concat(theme.highlightedLineBgColor),
|
|
@@ -263,17 +260,17 @@ var getCodeBlockStyles = function getCodeBlockStyles(theme) {
|
|
|
263
260
|
}
|
|
264
261
|
},
|
|
265
262
|
'& [data-ds--code--row--highlight] .linenumber': {
|
|
266
|
-
borderLeft: "".concat(
|
|
267
|
-
paddingLeft: "".concat(
|
|
263
|
+
borderLeft: "".concat(_constants.HIGHLIGHT_BORDER_WIDTH, " solid ").concat(theme.highlightedLineBorderColor),
|
|
264
|
+
paddingLeft: "".concat(_constants.SPACING / 2, "px !important"),
|
|
268
265
|
position: 'relative'
|
|
269
266
|
},
|
|
270
267
|
// fill in space caused by parent border top
|
|
271
268
|
'& [data-ds--code--row--highlight] .linenumber::before': {
|
|
272
269
|
content: '""',
|
|
273
270
|
position: 'absolute',
|
|
274
|
-
width:
|
|
271
|
+
width: _constants.HIGHLIGHT_BORDER_WIDTH,
|
|
275
272
|
top: '-1px',
|
|
276
|
-
left: "-".concat(
|
|
273
|
+
left: "-".concat(_constants.HIGHLIGHT_BORDER_WIDTH),
|
|
277
274
|
borderTop: "1px solid ".concat(theme.highlightedLineBorderColor)
|
|
278
275
|
},
|
|
279
276
|
'[data-ds--code--row--highlight] + [data-ds--code--row]:not([data-ds--code--row--highlight]), [data-ds--code--row]:not([data-ds--code--row--highlight]) + [data-ds--code--row--highlight]': {
|
|
@@ -284,13 +281,13 @@ var getCodeBlockStyles = function getCodeBlockStyles(theme) {
|
|
|
284
281
|
},
|
|
285
282
|
'& code:first-of-type': {
|
|
286
283
|
paddingRight: "0px !important",
|
|
287
|
-
backgroundImage: showLineNumbers ? "linear-gradient(to right, var(".concat(
|
|
284
|
+
backgroundImage: showLineNumbers ? "linear-gradient(to right, var(".concat(_constants.VAR_CODE_LINE_NUMBER_BG_COLOR, ",").concat(theme.lineNumberBgColor, "), var(").concat(_constants.VAR_CODE_LINE_NUMBER_BG_COLOR, ",").concat(theme.lineNumberBgColor, ")\n calc(").concat(theme.lineNumberWidth, " + ").concat(_constants.LINE_NUMBER_GUTTER, "px), transparent calc(").concat(theme.lineNumberWidth, " + ").concat(_constants.LINE_NUMBER_GUTTER, "px), transparent)") : undefined
|
|
288
285
|
},
|
|
289
286
|
// we need to use last-of-type because when Code is SSR'd
|
|
290
287
|
// 2 <code> elements are created and we don't want this style
|
|
291
288
|
// applied to the first one
|
|
292
289
|
'& code:last-of-type': {
|
|
293
|
-
paddingRight: "".concat(
|
|
290
|
+
paddingRight: "".concat(_constants.SPACING, "px !important"),
|
|
294
291
|
flexBasis: 'auto',
|
|
295
292
|
flexGrow: 1,
|
|
296
293
|
// Needed for the highlight line to extend full-width
|
|
@@ -304,11 +301,8 @@ var getCodeBlockStyles = function getCodeBlockStyles(theme) {
|
|
|
304
301
|
});
|
|
305
302
|
};
|
|
306
303
|
};
|
|
307
|
-
exports.
|
|
308
|
-
var
|
|
309
|
-
// Required to have proper compatibility with styled components interpolations
|
|
310
|
-
var akTheme = 'theme' in globalTheme ? globalTheme.theme : globalTheme;
|
|
311
|
-
var theme = (0, _getTheme.getBaseTheme)(akTheme);
|
|
304
|
+
var getCodeStyles = exports.getCodeStyles = function getCodeStyles() {
|
|
305
|
+
var theme = (0, _getTheme.getBaseTheme)();
|
|
312
306
|
var baseStyles = getBaseCodeStyles(theme);
|
|
313
307
|
return _objectSpread(_objectSpread({}, baseStyles), {}, {
|
|
314
308
|
display: 'inline',
|
|
@@ -320,10 +314,8 @@ var getCodeStyles = function getCodeStyles(globalTheme) {
|
|
|
320
314
|
whiteSpace: 'pre-wrap'
|
|
321
315
|
});
|
|
322
316
|
};
|
|
323
|
-
exports.
|
|
324
|
-
|
|
325
|
-
return _objectSpread(_objectSpread(_objectSpread({}, (0, _getTheme.getBaseTheme)(globalTheme)), (0, _getTheme.getColorPalette)(globalTheme)), {}, {
|
|
317
|
+
var getCodeBlockTheme = exports.getCodeBlockTheme = function getCodeBlockTheme(maxLines) {
|
|
318
|
+
return _objectSpread(_objectSpread(_objectSpread({}, (0, _getTheme.getBaseTheme)()), (0, _getTheme.getColorPalette)()), {}, {
|
|
326
319
|
lineNumberWidth: maxLines ? getLineNumWidth(maxLines) : undefined
|
|
327
320
|
});
|
|
328
|
-
};
|
|
329
|
-
exports.getCodeBlockTheme = getCodeBlockTheme;
|
|
321
|
+
};
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.normalizeLanguage = void 0;
|
|
8
8
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
9
9
|
var _constants = require("../../constants");
|
|
10
|
-
var normalizeLanguage = (0, _memoizeOne.default)(function (language) {
|
|
10
|
+
var normalizeLanguage = exports.normalizeLanguage = (0, _memoizeOne.default)(function (language) {
|
|
11
11
|
if (!language) {
|
|
12
12
|
return '';
|
|
13
13
|
}
|
|
@@ -16,5 +16,4 @@ var normalizeLanguage = (0, _memoizeOne.default)(function (language) {
|
|
|
16
16
|
});
|
|
17
17
|
// Fallback to plain monospaced text if language passed but not supported
|
|
18
18
|
return match ? match.value : 'text';
|
|
19
|
-
});
|
|
20
|
-
exports.normalizeLanguage = normalizeLanguage;
|
|
19
|
+
});
|