@looker/code-editor 0.1.26 → 0.1.28
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 +23 -0
- package/lib/CodeCopy/CodeCopy.d.ts +2 -2
- package/lib/CodeCopy/CodeCopy.js +1 -7
- package/lib/CodeCopy/CodeCopy.js.map +1 -1
- package/lib/CodeCopy/index.js +0 -2
- package/lib/CodeCopy/index.js.map +1 -1
- package/lib/CodeDisplay/CodeDisplay.js +4 -24
- package/lib/CodeDisplay/CodeDisplay.js.map +1 -1
- package/lib/CodeDisplay/CodeWrapper.js +0 -7
- package/lib/CodeDisplay/CodeWrapper.js.map +1 -1
- package/lib/CodeDisplay/LineItem.js +1 -8
- package/lib/CodeDisplay/LineItem.js.map +1 -1
- package/lib/CodeDisplay/index.js +0 -1
- package/lib/CodeDisplay/index.js.map +1 -1
- package/lib/CodeDisplay/types.js +1 -1
- package/lib/CodeDisplay/types.js.map +1 -1
- package/lib/CodeEditor/CodeEditor.js +0 -6
- package/lib/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/CodeEditor/index.js +0 -1
- package/lib/CodeEditor/index.js.map +1 -1
- package/lib/Markdown/Markdown.d.ts +2 -2
- package/lib/Markdown/Markdown.js +0 -24
- package/lib/Markdown/Markdown.js.map +1 -1
- package/lib/Markdown/TableCell.js +4 -11
- package/lib/Markdown/TableCell.js.map +1 -1
- package/lib/Markdown/common.d.ts +2 -2
- package/lib/Markdown/common.js +11 -24
- package/lib/Markdown/common.js.map +1 -1
- package/lib/Markdown/index.js +0 -2
- package/lib/Markdown/index.js.map +1 -1
- package/lib/Markdown/utils.js +1 -31
- package/lib/Markdown/utils.js.map +1 -1
- package/lib/esm/CodeCopy/CodeCopy.js +16 -8
- package/lib/esm/CodeCopy/CodeCopy.js.map +1 -1
- package/lib/esm/CodeCopy/index.js +16 -1
- package/lib/esm/CodeCopy/index.js.map +1 -1
- package/lib/esm/CodeDisplay/CodeDisplay.js +32 -29
- package/lib/esm/CodeDisplay/CodeDisplay.js.map +1 -1
- package/lib/esm/CodeDisplay/CodeWrapper.js +14 -6
- package/lib/esm/CodeDisplay/CodeWrapper.js.map +1 -1
- package/lib/esm/CodeDisplay/LineItem.js +11 -6
- package/lib/esm/CodeDisplay/LineItem.js.map +1 -1
- package/lib/esm/CodeDisplay/index.js +12 -1
- package/lib/esm/CodeDisplay/index.js.map +1 -1
- package/lib/esm/CodeDisplay/types.js.map +1 -1
- package/lib/esm/CodeEditor/CodeEditor.js +14 -6
- package/lib/esm/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/esm/CodeEditor/index.js +12 -1
- package/lib/esm/CodeEditor/index.js.map +1 -1
- package/lib/esm/Markdown/Markdown.js +40 -42
- package/lib/esm/Markdown/Markdown.js.map +1 -1
- package/lib/esm/Markdown/TableCell.js +16 -10
- package/lib/esm/Markdown/TableCell.js.map +1 -1
- package/lib/esm/Markdown/common.js +33 -23
- package/lib/esm/Markdown/common.js.map +1 -1
- package/lib/esm/Markdown/index.js +16 -1
- package/lib/esm/Markdown/index.js.map +1 -1
- package/lib/esm/Markdown/utils.js +24 -23
- package/lib/esm/Markdown/utils.js.map +1 -1
- package/lib/esm/index.js +49 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/test-data/codeBlob.js +9 -0
- package/lib/esm/test-data/codeBlob.js.map +1 -0
- package/lib/esm/test-data/index.js +13 -0
- package/lib/esm/test-data/index.js.map +1 -0
- package/lib/esm/utils/index.js +24 -1
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/esm/utils/utils.js +29 -22
- package/lib/esm/utils/utils.js.map +1 -1
- package/lib/index.js +0 -8
- package/lib/index.js.map +1 -1
- package/lib/test-data/codeBlob.js.map +1 -1
- package/lib/test-data/index.js +0 -1
- package/lib/test-data/index.js.map +1 -1
- package/lib/utils/index.js +4 -5
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/utils.d.ts +4 -4
- package/lib/utils/utils.js +1 -15
- package/lib/utils/utils.js.map +1 -1
- package/package.json +10 -10
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeMarkTags = exports.removeCodeLanguageTags = exports.regReplaceAll = exports.qualifyMarkdownText = exports.prepareCodeText = exports.getCodeLanguageFromTaggedText = exports.addMarkTags = exports.addCodeLanguageTags = void 0;
|
|
7
|
+
var _utils = require("../utils");
|
|
8
|
+
var regReplaceAll = (content, pattern, replacementFunc) => {
|
|
3
9
|
var target = new RegExp(pattern, 'gi');
|
|
4
10
|
return content.replace(target, replacementFunc);
|
|
5
11
|
};
|
|
6
|
-
|
|
12
|
+
exports.regReplaceAll = regReplaceAll;
|
|
13
|
+
var addMarkTags = (content, searchPattern) => {
|
|
7
14
|
var markedContent;
|
|
8
|
-
|
|
9
15
|
try {
|
|
10
16
|
var replacement = match => "<mark>".concat(match, "</mark>");
|
|
11
|
-
|
|
12
17
|
markedContent = regReplaceAll(content, searchPattern, replacement);
|
|
13
18
|
} catch (e) {
|
|
14
19
|
markedContent = content;
|
|
15
20
|
}
|
|
16
|
-
|
|
17
21
|
return markedContent;
|
|
18
22
|
};
|
|
19
|
-
|
|
23
|
+
exports.addMarkTags = addMarkTags;
|
|
24
|
+
var removeMarkTags = markedText => {
|
|
20
25
|
return markedText.replace(/<\/?mark>/g, '');
|
|
21
26
|
};
|
|
22
|
-
|
|
27
|
+
exports.removeMarkTags = removeMarkTags;
|
|
28
|
+
var addCodeLanguageTags = content => {
|
|
23
29
|
var languageTaggedContent;
|
|
24
|
-
|
|
25
30
|
try {
|
|
26
31
|
var searchPattern = /```([A-Za-z]+)$/gm;
|
|
27
32
|
var match = searchPattern.exec(content);
|
|
28
33
|
var language = match && match[1];
|
|
29
|
-
|
|
30
34
|
var replacement = () => "```\n<".concat(language, "/>");
|
|
31
|
-
|
|
32
35
|
languageTaggedContent = content.replace(searchPattern, replacement);
|
|
33
36
|
} catch (e) {
|
|
34
37
|
languageTaggedContent = content;
|
|
35
38
|
}
|
|
36
|
-
|
|
37
39
|
return languageTaggedContent;
|
|
38
40
|
};
|
|
39
|
-
|
|
41
|
+
exports.addCodeLanguageTags = addCodeLanguageTags;
|
|
42
|
+
var removeCodeLanguageTags = content => {
|
|
40
43
|
var untaggedContent;
|
|
41
|
-
|
|
42
44
|
try {
|
|
43
45
|
var replacement = () => '';
|
|
44
|
-
|
|
45
46
|
var searchPattern = /<(.*)\/>$/gm;
|
|
46
47
|
var match = searchPattern.exec(content);
|
|
47
48
|
var language = match && match[1];
|
|
48
|
-
|
|
49
|
-
if (language && instanceOfPrismLanguage(language)) {
|
|
49
|
+
if (language && (0, _utils.instanceOfPrismLanguage)(language)) {
|
|
50
50
|
untaggedContent = regReplaceAll(content, '<' + language + '/>\n', replacement);
|
|
51
51
|
} else {
|
|
52
52
|
untaggedContent = content;
|
|
@@ -54,15 +54,16 @@ export var removeCodeLanguageTags = content => {
|
|
|
54
54
|
} catch (e) {
|
|
55
55
|
untaggedContent = content;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
57
|
return untaggedContent;
|
|
59
58
|
};
|
|
60
|
-
|
|
59
|
+
exports.removeCodeLanguageTags = removeCodeLanguageTags;
|
|
60
|
+
var getCodeLanguageFromTaggedText = content => {
|
|
61
61
|
var searchPattern = /<(.*)\/>$/gm;
|
|
62
62
|
var match = searchPattern.exec(content);
|
|
63
63
|
return match ? match[1] : 'markup';
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
exports.getCodeLanguageFromTaggedText = getCodeLanguageFromTaggedText;
|
|
66
|
+
var prepareCodeText = content => {
|
|
66
67
|
var text = content;
|
|
67
68
|
var language = getCodeLanguageFromTaggedText(text);
|
|
68
69
|
text = removeCodeLanguageTags(text);
|
|
@@ -73,14 +74,14 @@ export var prepareCodeText = content => {
|
|
|
73
74
|
language
|
|
74
75
|
};
|
|
75
76
|
};
|
|
76
|
-
|
|
77
|
+
exports.prepareCodeText = prepareCodeText;
|
|
78
|
+
var qualifyMarkdownText = (content, pattern) => {
|
|
77
79
|
var qualifiedContent;
|
|
78
|
-
|
|
79
80
|
if (pattern !== '') {
|
|
80
81
|
qualifiedContent = addMarkTags(content, pattern);
|
|
81
82
|
}
|
|
82
|
-
|
|
83
83
|
qualifiedContent = addCodeLanguageTags(qualifiedContent || content);
|
|
84
84
|
return qualifiedContent;
|
|
85
85
|
};
|
|
86
|
+
exports.qualifyMarkdownText = qualifyMarkdownText;
|
|
86
87
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["regReplaceAll","content","pattern","replacementFunc","target","RegExp","replace","addMarkTags","searchPattern","markedContent","replacement","match","e","removeMarkTags","markedText","addCodeLanguageTags","languageTaggedContent","exec","language","removeCodeLanguageTags","untaggedContent","instanceOfPrismLanguage","getCodeLanguageFromTaggedText","prepareCodeText","text","trim","qualifyMarkdownText","qualifiedContent"],"sources":["../../../src/Markdown/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport { instanceOfPrismLanguage } from '../utils'\n\nexport const regReplaceAll = (\n content: string,\n pattern: string,\n replacementFunc: any\n) => {\n const target = new RegExp(pattern, 'gi')\n return content.replace(target, replacementFunc)\n}\n/**\n * Adds <mark> tags around text if search pattern is detected\n * @param content - the main content to render\n * @param searchPattern - the search pattern to consider\n * @returns - a 'marked' string to be rendered by markdown component\n */\nexport const addMarkTags = (content: string, searchPattern: string) => {\n let markedContent\n try {\n const replacement = (match: string) => `<mark>${match}</mark>`\n markedContent = regReplaceAll(content, searchPattern, replacement)\n } catch (e) {\n markedContent = content\n }\n return markedContent\n}\n\n/**\n * Removes <mark><mark/> tags from markdown text. The mark tag is removed from code styled\n * text as the code renderer cannot differentiate <mark><mark/> from the code text.\n * @param markedText - the markdown text input that contains <mark /> tags\n */\nexport const removeMarkTags = (markedText: string) => {\n return markedText.replace(/<\\/?mark>/g, '')\n}\n\n/**\n * Checks the input for code block decorators, the programming language used (```json), and returns a language tag\n * that is later used to inform syntax highlighting rules\n * @param content - the code blob to render\n * @returns - code blob string with code language tag\n */\nexport const addCodeLanguageTags = (content: string) => {\n let languageTaggedContent: string\n try {\n const searchPattern = /```([A-Za-z]+)$/gm\n const match = searchPattern.exec(content)\n const language = match && match[1]\n const replacement = () => `\\`\\`\\`\\n<${language}/>`\n languageTaggedContent = content.replace(searchPattern, replacement)\n } catch (e) {\n languageTaggedContent = content\n }\n return languageTaggedContent\n}\n\n/**\n * Removes the code language tag from the code blob text before text presentation to screen\n * @param content - code blob text with language tag\n * @returns - code blob text without language tag\n */\nexport const removeCodeLanguageTags = (content: string) => {\n let untaggedContent\n try {\n const replacement = () => ''\n const searchPattern = /<(.*)\\/>$/gm\n const match = searchPattern.exec(content)\n const language = match && match[1]\n if (language && instanceOfPrismLanguage(language)) {\n untaggedContent = regReplaceAll(\n content,\n '<' + language + '/>\\n',\n replacement\n )\n } else {\n untaggedContent = content\n }\n } catch (e) {\n untaggedContent = content\n }\n return untaggedContent\n}\n\n/**\n * Extracts the syntax highlighting language, if specified\n * @param content - language tagged code blob\n * @returns - syntax highlighting language\n */\nexport const getCodeLanguageFromTaggedText = (content: string): string => {\n const searchPattern = /<(.*)\\/>$/gm\n const match = searchPattern.exec(content)\n return match ? match[1] : 'markup'\n}\n\n/**\n * Removes tags that were applied for syntax highlighting or search pattern matching and returns just the code blob text\n * @param content - code blob text to render\n * @returns - rendered code text\n */\nexport const prepareCodeText = (content: string) => {\n let text = content\n const language = getCodeLanguageFromTaggedText(text)\n text = removeCodeLanguageTags(text)\n text = removeMarkTags(text)\n text = text.trim()\n return { text, language }\n}\n\n/**\n * Returns a 'qualified markdown' text, a string which contains search pattern match and syntax highlighting qualifiers used by this package\n * @param content The content to qualify\n * @param pattern The regex pattern to search\n * @returns qualified content\n */\nexport const qualifyMarkdownText = (\n content: string,\n pattern: string\n): string => {\n let qualifiedContent\n if (pattern !== '') {\n qualifiedContent = addMarkTags(content, pattern)\n }\n qualifiedContent = addCodeLanguageTags(qualifiedContent || content)\n return qualifiedContent\n}\n"],"mappings":"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"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _CodeCopy = require("./CodeCopy");
|
|
7
|
+
Object.keys(_CodeCopy).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _CodeCopy[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _CodeCopy[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _CodeDisplay = require("./CodeDisplay");
|
|
18
|
+
Object.keys(_CodeDisplay).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _CodeDisplay[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _CodeDisplay[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _CodeEditor = require("./CodeEditor");
|
|
29
|
+
Object.keys(_CodeEditor).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _CodeEditor[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _CodeEditor[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _Markdown = require("./Markdown");
|
|
40
|
+
Object.keys(_Markdown).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _Markdown[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _Markdown[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
5
50
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport * from './CodeCopy'\nexport * from './CodeDisplay'\nexport * from './CodeEditor'\nexport * from './Markdown'\n"],"mappings":";;;;;AAyBA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.pythonTestCode = void 0;
|
|
7
|
+
var pythonTestCode = "# GET /lookml_models -> Sequence[models.LookmlModel]\ndef all_lookml_models(\n self,\n # Requested fields.\n fields: Optional[str] = None,\n transport_options: Optional[transport.TransportOptions] = None,\n) -> Sequence[models.LookmlModel]:\n \"\"\"Get All LookML Models\"\"\"\n response = self.get(\n f\"/lookml_models\",\n Sequence[models.LookmlModel],\n query_params={\"fields\": fields},\n transport_options=transport_options\n )\n assert isinstance(response, list)\n return response";
|
|
8
|
+
exports.pythonTestCode = pythonTestCode;
|
|
9
|
+
//# sourceMappingURL=codeBlob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeBlob.js","names":["pythonTestCode"],"sources":["../../../src/test-data/codeBlob.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport const pythonTestCode = `# GET /lookml_models -> Sequence[models.LookmlModel]\ndef all_lookml_models(\n self,\n # Requested fields.\n fields: Optional[str] = None,\n transport_options: Optional[transport.TransportOptions] = None,\n) -> Sequence[models.LookmlModel]:\n \"\"\"Get All LookML Models\"\"\"\n response = self.get(\n f\"/lookml_models\",\n Sequence[models.LookmlModel],\n query_params={\"fields\": fields},\n transport_options=transport_options\n )\n assert isinstance(response, list)\n return response`\n"],"mappings":";;;;;;AAyBO,IAAMA,cAAc,2jBAeP;AAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "pythonTestCode", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _codeBlob.pythonTestCode;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _codeBlob = require("./codeBlob");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/test-data/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { pythonTestCode } from './codeBlob'\n"],"mappings":";;;;;;;;;;;AAyBA"}
|
package/lib/esm/utils/index.js
CHANGED
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "getOverriddenTheme", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _utils.getOverriddenTheme;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getPrismLanguage", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _utils.getPrismLanguage;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "instanceOfPrismLanguage", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _utils.instanceOfPrismLanguage;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _utils = require("./utils");
|
|
2
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/utils/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport {\n getPrismLanguage,\n getOverriddenTheme,\n instanceOfPrismLanguage,\n} from './utils'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA"}
|
package/lib/esm/utils/utils.js
CHANGED
|
@@ -1,38 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.instanceOfPrismLanguage = exports.getPrismLanguage = exports.getOverriddenTheme = void 0;
|
|
7
|
+
var _components = require("@looker/components");
|
|
8
|
+
var _prismReactRenderer = require("prism-react-renderer");
|
|
9
|
+
var _vsDark = _interopRequireDefault(require("prism-react-renderer/themes/vsDark"));
|
|
10
|
+
var _github = _interopRequireDefault(require("prism-react-renderer/themes/github"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
var instanceOfPrismLanguage = languageName => {
|
|
6
13
|
var extraHighlightingEngines = ['kotlin', 'csharp', 'swift', 'ruby'];
|
|
7
|
-
return Object.keys(Prism.languages).includes(languageName) || extraHighlightingEngines.includes(languageName);
|
|
14
|
+
return Object.keys(_prismReactRenderer.Prism.languages).includes(languageName) || extraHighlightingEngines.includes(languageName);
|
|
8
15
|
};
|
|
9
|
-
|
|
16
|
+
exports.instanceOfPrismLanguage = instanceOfPrismLanguage;
|
|
17
|
+
var getPrismLanguage = language => {
|
|
10
18
|
language = language.toLowerCase();
|
|
11
|
-
|
|
12
19
|
if (language === 'golang') {
|
|
13
20
|
language = 'go';
|
|
14
21
|
} else if (language === 'c#') {
|
|
15
22
|
language = 'csharp';
|
|
16
23
|
}
|
|
17
|
-
|
|
18
24
|
return instanceOfPrismLanguage(language) ? language : 'markup';
|
|
19
25
|
};
|
|
20
|
-
|
|
26
|
+
exports.getPrismLanguage = getPrismLanguage;
|
|
27
|
+
var getOverriddenTheme = (transparent, inline) => {
|
|
21
28
|
if (inline) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return
|
|
29
|
+
_github.default.plain.backgroundColor = _components.theme.colors.ui1;
|
|
30
|
+
_github.default.plain.border = "1px solid ".concat(_components.theme.colors.ui2);
|
|
31
|
+
_github.default.plain.borderRadius = '4px';
|
|
32
|
+
_github.default.plain.padding = '4px';
|
|
33
|
+
_github.default.plain.fontSize = _components.theme.fontSizes.small;
|
|
34
|
+
return _github.default;
|
|
28
35
|
} else if (transparent) {
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
_vsDark.default.plain.backgroundColor = 'none';
|
|
37
|
+
_vsDark.default.plain.padding = '0px';
|
|
31
38
|
} else {
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
_vsDark.default.plain.backgroundColor = _components.theme.colors.text;
|
|
40
|
+
_vsDark.default.plain.padding = '1rem';
|
|
34
41
|
}
|
|
35
|
-
|
|
36
|
-
return blockTheme;
|
|
42
|
+
return _vsDark.default;
|
|
37
43
|
};
|
|
44
|
+
exports.getOverriddenTheme = getOverriddenTheme;
|
|
38
45
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["instanceOfPrismLanguage","languageName","extraHighlightingEngines","Object","keys","Prism","languages","includes","getPrismLanguage","language","toLowerCase","getOverriddenTheme","transparent","inline","inlineTheme","plain","backgroundColor","theme","colors","ui1","border","ui2","borderRadius","padding","fontSize","fontSizes","small","blockTheme","text"],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport { theme } from '@looker/components'\nimport type { Language } from 'prism-react-renderer'\nimport { Prism } from 'prism-react-renderer'\nimport blockTheme from 'prism-react-renderer/themes/vsDark'\nimport inlineTheme from 'prism-react-renderer/themes/github'\n\n/**\n * checks whether input is supported syntax highlighting language\n * @param languageName - string lang name to test\n * @returns boolean\n */\nexport const instanceOfPrismLanguage = (languageName: string) => {\n const extraHighlightingEngines = ['kotlin', 'csharp', 'swift', 'ruby']\n return (\n Object.keys(Prism.languages).includes(languageName) ||\n extraHighlightingEngines.includes(languageName)\n )\n}\n\n/**\n * gets highlighter language type for input language name\n * @param language sdk language to be highlighted\n * @returns prism language if it exists\n */\nexport const getPrismLanguage = (language: string): Language => {\n language = language.toLowerCase()\n // TODO revert back to `go` in generator language definitions instead of using this\n if (language === 'golang') {\n language = 'go'\n } else if (language === 'c#') {\n language = 'csharp'\n }\n return instanceOfPrismLanguage(language) ? (language as Language) : 'markup'\n}\n\n/**\n * applies package overrides to the default theme. Inline CodeDisplay uses githubLight theme, else uses vsCodeDark theme.\n * @returns modified prism theme object\n */\nexport const getOverriddenTheme = (transparent: boolean, inline: boolean) => {\n if (inline) {\n inlineTheme.plain.backgroundColor = theme.colors.ui1\n inlineTheme.plain.border = `1px solid ${theme.colors.ui2}`\n inlineTheme.plain.borderRadius = '4px'\n inlineTheme.plain.padding = '4px'\n inlineTheme.plain.fontSize = theme.fontSizes.small\n return inlineTheme\n } else if (transparent) {\n blockTheme.plain.backgroundColor = 'none'\n blockTheme.plain.padding = '0px'\n } else {\n blockTheme.plain.backgroundColor = theme.colors.text\n blockTheme.plain.padding = '1rem'\n }\n return blockTheme\n}\n"],"mappings":";;;;;;AAyBA;AAEA;AACA;AACA;AAA4D;AAOrD,IAAMA,uBAAuB,GAAIC,YAAoB,IAAK;EAC/D,IAAMC,wBAAwB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC;EACtE,OACEC,MAAM,CAACC,IAAI,CAACC,yBAAK,CAACC,SAAS,CAAC,CAACC,QAAQ,CAACN,YAAY,CAAC,IACnDC,wBAAwB,CAACK,QAAQ,CAACN,YAAY,CAAC;AAEnD,CAAC;AAAA;AAOM,IAAMO,gBAAgB,GAAIC,QAAgB,IAAe;EAC9DA,QAAQ,GAAGA,QAAQ,CAACC,WAAW,EAAE;EAEjC,IAAID,QAAQ,KAAK,QAAQ,EAAE;IACzBA,QAAQ,GAAG,IAAI;EACjB,CAAC,MAAM,IAAIA,QAAQ,KAAK,IAAI,EAAE;IAC5BA,QAAQ,GAAG,QAAQ;EACrB;EACA,OAAOT,uBAAuB,CAACS,QAAQ,CAAC,GAAIA,QAAQ,GAAgB,QAAQ;AAC9E,CAAC;AAAA;AAMM,IAAME,kBAAkB,GAAG,CAACC,WAAoB,EAAEC,MAAe,KAAK;EAC3E,IAAIA,MAAM,EAAE;IACVC,eAAW,CAACC,KAAK,CAACC,eAAe,GAAGC,iBAAK,CAACC,MAAM,CAACC,GAAG;IACpDL,eAAW,CAACC,KAAK,CAACK,MAAM,uBAAgBH,iBAAK,CAACC,MAAM,CAACG,GAAG,CAAE;IAC1DP,eAAW,CAACC,KAAK,CAACO,YAAY,GAAG,KAAK;IACtCR,eAAW,CAACC,KAAK,CAACQ,OAAO,GAAG,KAAK;IACjCT,eAAW,CAACC,KAAK,CAACS,QAAQ,GAAGP,iBAAK,CAACQ,SAAS,CAACC,KAAK;IAClD,OAAOZ,eAAW;EACpB,CAAC,MAAM,IAAIF,WAAW,EAAE;IACtBe,eAAU,CAACZ,KAAK,CAACC,eAAe,GAAG,MAAM;IACzCW,eAAU,CAACZ,KAAK,CAACQ,OAAO,GAAG,KAAK;EAClC,CAAC,MAAM;IACLI,eAAU,CAACZ,KAAK,CAACC,eAAe,GAAGC,iBAAK,CAACC,MAAM,CAACU,IAAI;IACpDD,eAAU,CAACZ,KAAK,CAACQ,OAAO,GAAG,MAAM;EACnC;EACA,OAAOI,eAAU;AACnB,CAAC;AAAA"}
|
package/lib/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _CodeCopy = require("./CodeCopy");
|
|
8
|
-
|
|
9
7
|
Object.keys(_CodeCopy).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _CodeCopy[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_CodeCopy).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _CodeDisplay = require("./CodeDisplay");
|
|
21
|
-
|
|
22
18
|
Object.keys(_CodeDisplay).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _CodeDisplay[key]) return;
|
|
@@ -29,9 +25,7 @@ Object.keys(_CodeDisplay).forEach(function (key) {
|
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
27
|
});
|
|
32
|
-
|
|
33
28
|
var _CodeEditor = require("./CodeEditor");
|
|
34
|
-
|
|
35
29
|
Object.keys(_CodeEditor).forEach(function (key) {
|
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
|
37
31
|
if (key in exports && exports[key] === _CodeEditor[key]) return;
|
|
@@ -42,9 +36,7 @@ Object.keys(_CodeEditor).forEach(function (key) {
|
|
|
42
36
|
}
|
|
43
37
|
});
|
|
44
38
|
});
|
|
45
|
-
|
|
46
39
|
var _Markdown = require("./Markdown");
|
|
47
|
-
|
|
48
40
|
Object.keys(_Markdown).forEach(function (key) {
|
|
49
41
|
if (key === "default" || key === "__esModule") return;
|
|
50
42
|
if (key in exports && exports[key] === _Markdown[key]) return;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport * from './CodeCopy'\nexport * from './CodeDisplay'\nexport * from './CodeEditor'\nexport * from './Markdown'\n"],"mappings":";;;;;AAyBA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"codeBlob.js","names":["pythonTestCode"],"sources":["../../src/test-data/codeBlob.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport const pythonTestCode = `# GET /lookml_models -> Sequence[models.LookmlModel]\ndef all_lookml_models(\n self,\n # Requested fields.\n fields: Optional[str] = None,\n transport_options: Optional[transport.TransportOptions] = None,\n) -> Sequence[models.LookmlModel]:\n \"\"\"Get All LookML Models\"\"\"\n response = self.get(\n f\"/lookml_models\",\n Sequence[models.LookmlModel],\n query_params={\"fields\": fields},\n transport_options=transport_options\n )\n assert isinstance(response, list)\n return response`\n"],"mappings":";;;;;;AAyBO,IAAMA,cAAc,2jBAeP;AAAA"}
|
package/lib/test-data/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/test-data/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { pythonTestCode } from './codeBlob'\n"],"mappings":";;;;;;;;;;;AAyBA"}
|
package/lib/utils/index.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "getOverriddenTheme", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return _utils.
|
|
9
|
+
return _utils.getOverriddenTheme;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "getPrismLanguage", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return _utils.
|
|
15
|
+
return _utils.getPrismLanguage;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "instanceOfPrismLanguage", {
|
|
@@ -21,6 +21,5 @@ Object.defineProperty(exports, "instanceOfPrismLanguage", {
|
|
|
21
21
|
return _utils.instanceOfPrismLanguage;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
25
24
|
var _utils = require("./utils");
|
|
26
25
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport {\n getPrismLanguage,\n getOverriddenTheme,\n instanceOfPrismLanguage,\n} from './utils'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA"}
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export declare const getOverriddenTheme: (transparent: boolean, inline: boolean)
|
|
|
7
7
|
color?: string | undefined;
|
|
8
8
|
backgroundColor?: string | undefined;
|
|
9
9
|
fontStyle?: "normal" | "italic" | undefined;
|
|
10
|
-
fontWeight?: "
|
|
11
|
-
textDecorationLine?: "none" | "
|
|
10
|
+
fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
|
|
11
|
+
textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
|
|
12
12
|
opacity?: number | undefined;
|
|
13
13
|
};
|
|
14
14
|
styles: {
|
|
@@ -18,8 +18,8 @@ export declare const getOverriddenTheme: (transparent: boolean, inline: boolean)
|
|
|
18
18
|
color?: string | undefined;
|
|
19
19
|
backgroundColor?: string | undefined;
|
|
20
20
|
fontStyle?: "normal" | "italic" | undefined;
|
|
21
|
-
fontWeight?: "
|
|
22
|
-
textDecorationLine?: "none" | "
|
|
21
|
+
fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
|
|
22
|
+
textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
|
|
23
23
|
opacity?: number | undefined;
|
|
24
24
|
};
|
|
25
25
|
languages?: Language[] | undefined;
|
package/lib/utils/utils.js
CHANGED
|
@@ -3,39 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.instanceOfPrismLanguage = exports.getPrismLanguage = exports.getOverriddenTheme = void 0;
|
|
8
7
|
var _components = require("@looker/components");
|
|
9
|
-
|
|
10
8
|
var _prismReactRenderer = require("prism-react-renderer");
|
|
11
|
-
|
|
12
9
|
var _vsDark = _interopRequireDefault(require("prism-react-renderer/themes/vsDark"));
|
|
13
|
-
|
|
14
10
|
var _github = _interopRequireDefault(require("prism-react-renderer/themes/github"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
var instanceOfPrismLanguage = languageName => {
|
|
19
13
|
var extraHighlightingEngines = ['kotlin', 'csharp', 'swift', 'ruby'];
|
|
20
14
|
return Object.keys(_prismReactRenderer.Prism.languages).includes(languageName) || extraHighlightingEngines.includes(languageName);
|
|
21
15
|
};
|
|
22
|
-
|
|
23
16
|
exports.instanceOfPrismLanguage = instanceOfPrismLanguage;
|
|
24
|
-
|
|
25
17
|
var getPrismLanguage = language => {
|
|
26
18
|
language = language.toLowerCase();
|
|
27
|
-
|
|
28
19
|
if (language === 'golang') {
|
|
29
20
|
language = 'go';
|
|
30
21
|
} else if (language === 'c#') {
|
|
31
22
|
language = 'csharp';
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
return instanceOfPrismLanguage(language) ? language : 'markup';
|
|
35
25
|
};
|
|
36
|
-
|
|
37
26
|
exports.getPrismLanguage = getPrismLanguage;
|
|
38
|
-
|
|
39
27
|
var getOverriddenTheme = (transparent, inline) => {
|
|
40
28
|
if (inline) {
|
|
41
29
|
_github.default.plain.backgroundColor = _components.theme.colors.ui1;
|
|
@@ -51,9 +39,7 @@ var getOverriddenTheme = (transparent, inline) => {
|
|
|
51
39
|
_vsDark.default.plain.backgroundColor = _components.theme.colors.text;
|
|
52
40
|
_vsDark.default.plain.padding = '1rem';
|
|
53
41
|
}
|
|
54
|
-
|
|
55
42
|
return _vsDark.default;
|
|
56
43
|
};
|
|
57
|
-
|
|
58
44
|
exports.getOverriddenTheme = getOverriddenTheme;
|
|
59
45
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["instanceOfPrismLanguage","languageName","extraHighlightingEngines","Object","keys","Prism","languages","includes","getPrismLanguage","language","toLowerCase","getOverriddenTheme","transparent","inline","inlineTheme","plain","backgroundColor","theme","colors","ui1","border","ui2","borderRadius","padding","fontSize","fontSizes","small","blockTheme","text"],"sources":["../../src/utils/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport { theme } from '@looker/components'\nimport type { Language } from 'prism-react-renderer'\nimport { Prism } from 'prism-react-renderer'\nimport blockTheme from 'prism-react-renderer/themes/vsDark'\nimport inlineTheme from 'prism-react-renderer/themes/github'\n\n/**\n * checks whether input is supported syntax highlighting language\n * @param languageName - string lang name to test\n * @returns boolean\n */\nexport const instanceOfPrismLanguage = (languageName: string) => {\n const extraHighlightingEngines = ['kotlin', 'csharp', 'swift', 'ruby']\n return (\n Object.keys(Prism.languages).includes(languageName) ||\n extraHighlightingEngines.includes(languageName)\n )\n}\n\n/**\n * gets highlighter language type for input language name\n * @param language sdk language to be highlighted\n * @returns prism language if it exists\n */\nexport const getPrismLanguage = (language: string): Language => {\n language = language.toLowerCase()\n // TODO revert back to `go` in generator language definitions instead of using this\n if (language === 'golang') {\n language = 'go'\n } else if (language === 'c#') {\n language = 'csharp'\n }\n return instanceOfPrismLanguage(language) ? (language as Language) : 'markup'\n}\n\n/**\n * applies package overrides to the default theme. Inline CodeDisplay uses githubLight theme, else uses vsCodeDark theme.\n * @returns modified prism theme object\n */\nexport const getOverriddenTheme = (transparent: boolean, inline: boolean) => {\n if (inline) {\n inlineTheme.plain.backgroundColor = theme.colors.ui1\n inlineTheme.plain.border = `1px solid ${theme.colors.ui2}`\n inlineTheme.plain.borderRadius = '4px'\n inlineTheme.plain.padding = '4px'\n inlineTheme.plain.fontSize = theme.fontSizes.small\n return inlineTheme\n } else if (transparent) {\n blockTheme.plain.backgroundColor = 'none'\n blockTheme.plain.padding = '0px'\n } else {\n blockTheme.plain.backgroundColor = theme.colors.text\n blockTheme.plain.padding = '1rem'\n }\n return blockTheme\n}\n"],"mappings":";;;;;;AAyBA;AAEA;AACA;AACA;AAA4D;AAOrD,IAAMA,uBAAuB,GAAIC,YAAoB,IAAK;EAC/D,IAAMC,wBAAwB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC;EACtE,OACEC,MAAM,CAACC,IAAI,CAACC,yBAAK,CAACC,SAAS,CAAC,CAACC,QAAQ,CAACN,YAAY,CAAC,IACnDC,wBAAwB,CAACK,QAAQ,CAACN,YAAY,CAAC;AAEnD,CAAC;AAAA;AAOM,IAAMO,gBAAgB,GAAIC,QAAgB,IAAe;EAC9DA,QAAQ,GAAGA,QAAQ,CAACC,WAAW,EAAE;EAEjC,IAAID,QAAQ,KAAK,QAAQ,EAAE;IACzBA,QAAQ,GAAG,IAAI;EACjB,CAAC,MAAM,IAAIA,QAAQ,KAAK,IAAI,EAAE;IAC5BA,QAAQ,GAAG,QAAQ;EACrB;EACA,OAAOT,uBAAuB,CAACS,QAAQ,CAAC,GAAIA,QAAQ,GAAgB,QAAQ;AAC9E,CAAC;AAAA;AAMM,IAAME,kBAAkB,GAAG,CAACC,WAAoB,EAAEC,MAAe,KAAK;EAC3E,IAAIA,MAAM,EAAE;IACVC,eAAW,CAACC,KAAK,CAACC,eAAe,GAAGC,iBAAK,CAACC,MAAM,CAACC,GAAG;IACpDL,eAAW,CAACC,KAAK,CAACK,MAAM,uBAAgBH,iBAAK,CAACC,MAAM,CAACG,GAAG,CAAE;IAC1DP,eAAW,CAACC,KAAK,CAACO,YAAY,GAAG,KAAK;IACtCR,eAAW,CAACC,KAAK,CAACQ,OAAO,GAAG,KAAK;IACjCT,eAAW,CAACC,KAAK,CAACS,QAAQ,GAAGP,iBAAK,CAACQ,SAAS,CAACC,KAAK;IAClD,OAAOZ,eAAW;EACpB,CAAC,MAAM,IAAIF,WAAW,EAAE;IACtBe,eAAU,CAACZ,KAAK,CAACC,eAAe,GAAG,MAAM;IACzCW,eAAU,CAACZ,KAAK,CAACQ,OAAO,GAAG,KAAK;EAClC,CAAC,MAAM;IACLI,eAAU,CAACZ,KAAK,CAACC,eAAe,GAAGC,iBAAK,CAACC,MAAM,CAACU,IAAI;IACpDD,eAAU,CAACZ,KAAK,CAACQ,OAAO,GAAG,MAAM;EACnC;EACA,OAAOI,eAAU;AACnB,CAAC;AAAA"}
|