@looker/code-editor 0.1.8 → 0.1.12

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +33 -15
  3. package/lib/CodeCopy/CodeCopy.d.ts +7 -0
  4. package/lib/CodeCopy/CodeCopy.js +43 -0
  5. package/lib/CodeCopy/CodeCopy.js.map +1 -0
  6. package/lib/CodeCopy/index.d.ts +1 -0
  7. package/lib/CodeCopy/index.js +19 -0
  8. package/lib/CodeCopy/index.js.map +1 -0
  9. package/lib/CodeDisplay/CodeDisplay.d.ts +2 -2
  10. package/lib/CodeDisplay/CodeDisplay.js +3 -1
  11. package/lib/CodeDisplay/CodeDisplay.js.map +1 -1
  12. package/lib/CodeDisplay/CodeWrapper.d.ts +1 -1
  13. package/lib/CodeDisplay/CodeWrapper.js +1 -1
  14. package/lib/CodeDisplay/CodeWrapper.js.map +1 -1
  15. package/lib/CodeDisplay/LineItem.d.ts +2 -2
  16. package/lib/CodeDisplay/LineItem.js.map +1 -1
  17. package/lib/CodeEditor/CodeEditor.d.ts +2 -2
  18. package/lib/CodeEditor/CodeEditor.js.map +1 -1
  19. package/lib/Markdown/Markdown.d.ts +1 -1
  20. package/lib/Markdown/Markdown.js +2 -2
  21. package/lib/Markdown/Markdown.js.map +1 -1
  22. package/lib/Markdown/TableCell.d.ts +1 -1
  23. package/lib/Markdown/TableCell.js.map +1 -1
  24. package/lib/Markdown/common.d.ts +11 -3
  25. package/lib/Markdown/common.js +31 -18
  26. package/lib/Markdown/common.js.map +1 -1
  27. package/lib/esm/CodeCopy/CodeCopy.js +29 -0
  28. package/lib/esm/CodeCopy/CodeCopy.js.map +1 -0
  29. package/lib/esm/CodeCopy/index.js +2 -0
  30. package/lib/esm/CodeCopy/index.js.map +1 -0
  31. package/lib/esm/CodeDisplay/CodeDisplay.js +4 -2
  32. package/lib/esm/CodeDisplay/CodeDisplay.js.map +1 -1
  33. package/lib/esm/CodeDisplay/CodeWrapper.js +1 -1
  34. package/lib/esm/CodeDisplay/CodeWrapper.js.map +1 -1
  35. package/lib/esm/CodeDisplay/LineItem.js.map +1 -1
  36. package/lib/esm/CodeEditor/CodeEditor.js.map +1 -1
  37. package/lib/esm/Markdown/Markdown.js +2 -2
  38. package/lib/esm/Markdown/Markdown.js.map +1 -1
  39. package/lib/esm/Markdown/TableCell.js.map +1 -1
  40. package/lib/esm/Markdown/common.js +31 -18
  41. package/lib/esm/Markdown/common.js.map +1 -1
  42. package/lib/esm/index.js +4 -3
  43. package/lib/esm/index.js.map +1 -1
  44. package/lib/esm/utils/index.js +1 -1
  45. package/lib/esm/utils/index.js.map +1 -1
  46. package/lib/esm/utils/utils.js +1 -1
  47. package/lib/esm/utils/utils.js.map +1 -1
  48. package/lib/index.d.ts +4 -4
  49. package/lib/index.js +45 -17
  50. package/lib/index.js.map +1 -1
  51. package/lib/utils/index.d.ts +1 -1
  52. package/lib/utils/index.js +2 -2
  53. package/lib/utils/index.js.map +1 -1
  54. package/lib/utils/utils.d.ts +6 -6
  55. package/lib/utils/utils.js +3 -3
  56. package/lib/utils/utils.js.map +1 -1
  57. package/package.json +6 -6
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { Space, CopyToClipboard } from '@looker/components';
3
+ import { CodeDisplay } from '..';
4
+ export var CodeCopy = _ref => {
5
+ var {
6
+ language = 'json',
7
+ code,
8
+ caption = 'Copy',
9
+ pattern = '',
10
+ transparent = false,
11
+ inline = false,
12
+ lineNumbers = true
13
+ } = _ref;
14
+ return React.createElement(Space, {
15
+ between: true,
16
+ align: "start",
17
+ pt: "xsmall"
18
+ }, React.createElement(CodeDisplay, {
19
+ code: code,
20
+ language: language,
21
+ pattern: pattern,
22
+ transparent: transparent,
23
+ inline: inline,
24
+ lineNumbers: lineNumbers
25
+ }), React.createElement(CopyToClipboard, {
26
+ content: code
27
+ }, caption));
28
+ };
29
+ //# sourceMappingURL=CodeCopy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/CodeCopy/CodeCopy.tsx"],"names":["React","Space","CopyToClipboard","CodeDisplay","CodeCopy","language","code","caption","pattern","transparent","inline","lineNumbers"],"mappings":"AA0BA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,KAAT,EAAgBC,eAAhB,QAAuC,oBAAvC;AAEA,SAASC,WAAT,QAA4B,IAA5B;AAQA,OAAO,IAAMC,QAA2B,GAAG,QAQrC;AAAA,MARsC;AAC1CC,IAAAA,QAAQ,GAAG,MAD+B;AAE1CC,IAAAA,IAF0C;AAG1CC,IAAAA,OAAO,GAAG,MAHgC;AAI1CC,IAAAA,OAAO,GAAG,EAJgC;AAK1CC,IAAAA,WAAW,GAAG,KAL4B;AAM1CC,IAAAA,MAAM,GAAG,KANiC;AAO1CC,IAAAA,WAAW,GAAG;AAP4B,GAQtC;AACJ,SACE,oBAAC,KAAD;AAAO,IAAA,OAAO,MAAd;AAAe,IAAA,KAAK,EAAC,OAArB;AAA6B,IAAA,EAAE,EAAC;AAAhC,KACE,oBAAC,WAAD;AACE,IAAA,IAAI,EAAEL,IADR;AAEE,IAAA,QAAQ,EAAED,QAFZ;AAGE,IAAA,OAAO,EAAEG,OAHX;AAIE,IAAA,WAAW,EAAEC,WAJf;AAKE,IAAA,MAAM,EAAEC,MALV;AAME,IAAA,WAAW,EAAEC;AANf,IADF,EASE,oBAAC,eAAD;AAAiB,IAAA,OAAO,EAAEL;AAA1B,KAAiCC,OAAjC,CATF,CADF;AAaD,CAtBM","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 type { FC } from 'react'\nimport React from 'react'\nimport { Space, CopyToClipboard } from '@looker/components'\nimport type { CodeDisplayProps } from '..'\nimport { CodeDisplay } from '..'\n\ninterface CodeCopyProps extends CodeDisplayProps {\n caption?: string\n}\n/**\n * Shows code with clipboard copying support\n */\nexport const CodeCopy: FC<CodeCopyProps> = ({\n language = 'json',\n code,\n caption = 'Copy',\n pattern = '',\n transparent = false,\n inline = false,\n lineNumbers = true,\n}) => {\n return (\n <Space between align=\"start\" pt=\"xsmall\">\n <CodeDisplay\n code={code}\n language={language}\n pattern={pattern}\n transparent={transparent}\n inline={inline}\n lineNumbers={lineNumbers}\n />\n <CopyToClipboard content={code}>{caption}</CopyToClipboard>\n </Space>\n )\n}\n"],"file":"CodeCopy.js"}
@@ -0,0 +1,2 @@
1
+ export * from './CodeCopy';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/CodeCopy/index.ts"],"names":[],"mappings":"AAyBA,cAAc,YAAd","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'\n"],"file":"index.js"}
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import styled from 'styled-components';
5
5
  import { Span } from '@looker/components';
6
6
  import Highlight, { defaultProps, Prism } from 'prism-react-renderer';
7
- import { getPrismLanguage, getOverridenTheme } from '../utils';
7
+ import { getPrismLanguage, getOverriddenTheme } from '../utils';
8
8
  import { CodeWrapper } from './CodeWrapper';
9
9
  import { LineItem } from './LineItem';
10
10
  (typeof global !== 'undefined' ? global : window).Prism = Prism;
@@ -17,6 +17,8 @@ require('prismjs/components/prism-swift');
17
17
 
18
18
  require('prismjs/components/prism-ruby');
19
19
 
20
+ require('prismjs/components/prism-markdown');
21
+
20
22
  var Line = styled(Span).withConfig({
21
23
  displayName: "CodeDisplay__Line",
22
24
  componentId: "iaw0ts-0"
@@ -41,7 +43,7 @@ export var CodeDisplay = _ref => {
41
43
  return React.createElement(Highlight, _extends({}, defaultProps, {
42
44
  code: code.trim(),
43
45
  language: getPrismLanguage(language),
44
- theme: getOverridenTheme(transparent, inline)
46
+ theme: getOverriddenTheme(transparent, inline)
45
47
  }), _ref2 => {
46
48
  var {
47
49
  className,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/CodeDisplay/CodeDisplay.tsx"],"names":["React","styled","Span","Highlight","defaultProps","Prism","getPrismLanguage","getOverridenTheme","CodeWrapper","LineItem","global","window","require","Line","LineNo","LineContent","CodeDisplay","language","code","pattern","transparent","inline","lineNumbers","trim","className","style","tokens","getLineProps","getTokenProps","map","line","i","key","token","tokenProps"],"mappings":";;AA0BA,OAAOA,KAAP,MAA0B,OAA1B;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,IAAT,QAAqB,oBAArB;AACA,OAAOC,SAAP,IAAoBC,YAApB,EAAkCC,KAAlC,QAA+C,sBAA/C;AAEA,SAASC,gBAAT,EAA2BC,iBAA3B,QAAoD,UAApD;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,QAAT,QAAyB,YAAzB;AAEC,CAAC,OAAOC,MAAP,KAAkB,WAAlB,GAAiCA,MAAjC,GAAmDC,MAApD,EAAoEN,KAApE,GACCA,KADD;;AAEDO,OAAO,CAAC,iCAAD,CAAP;;AACAA,OAAO,CAAC,iCAAD,CAAP;;AACAA,OAAO,CAAC,gCAAD,CAAP;;AACAA,OAAO,CAAC,+BAAD,CAAP;;AAEA,IAAMC,IAAI,GAAGZ,MAAM,CAACC,IAAD,CAAT;AAAA;AAAA;AAAA,0BAAV;AAIA,IAAMY,MAAM,GAAGb,MAAM,CAACC,IAAD,CAAT;AAAA;AAAA;AAAA,2FAAZ;AAQA,IAAMa,WAAW,GAAGd,MAAM,CAACC,IAAD,CAAT;AAAA;AAAA;AAAA,iDAAjB;AAcA,OAAO,IAAMc,WAAiC,GAAG,QAO3C;AAAA,MAP4C;AAChDC,IAAAA,QAAQ,GAAG,MADqC;AAEhDC,IAAAA,IAFgD;AAGhDC,IAAAA,OAAO,GAAG,EAHsC;AAIhDC,IAAAA,WAAW,GAAG,KAJkC;AAKhDC,IAAAA,MAAM,GAAG,KALuC;AAMhDC,IAAAA,WAAW,GAAG;AANkC,GAO5C;AACJ,SACE,oBAAC,SAAD,eACMlB,YADN;AAEE,IAAA,IAAI,EAAEc,IAAI,CAACK,IAAL,EAFR;AAGE,IAAA,QAAQ,EAAEjB,gBAAgB,CAACW,QAAD,CAH5B;AAIE,IAAA,KAAK,EAAEV,iBAAiB,CAACa,WAAD,EAAcC,MAAd;AAJ1B,MAMG;AAAA,QAAC;AAAEG,MAAAA,SAAF;AAAaC,MAAAA,KAAb;AAAoBC,MAAAA,MAApB;AAA4BC,MAAAA,YAA5B;AAA0CC,MAAAA;AAA1C,KAAD;AAAA,WACC,oBAAC,WAAD;AAAa,MAAA,SAAS,EAAEJ,SAAxB;AAAmC,MAAA,KAAK,EAAEC,KAA1C;AAAiD,MAAA,MAAM,EAAEJ;AAAzD,OACGK,MAAM,CAACG,GAAP,CAAW,CAACC,IAAD,EAAOC,CAAP,KACV,oBAAC,IAAD;AAAM,MAAA,GAAG,EAAEA;AAAX,OAAkBJ,YAAY,CAAC;AAAEG,MAAAA,IAAF;AAAQE,MAAAA,GAAG,EAAED;AAAb,KAAD,CAA9B,GACGT,WAAW,IAAI,oBAAC,MAAD,QAASS,CAAC,GAAG,CAAb,CADlB,EAEE,oBAAC,WAAD,QACGD,IAAI,CAACD,GAAL,CAAS,CAACI,KAAD,EAAQD,GAAR,KAAgB;AACxB,UAAME,UAAU,GAAGN,aAAa,CAAC;AAAEK,QAAAA,KAAF;AAASD,QAAAA;AAAT,OAAD,CAAhC;AACA,aACE,oBAAC,QAAD;AACE,QAAA,GAAG,EAAEA,GADP;AAEE,QAAA,KAAK,EAAEA,GAFT;AAGE,QAAA,UAAU,EAAEE,UAHd;AAIE,QAAA,OAAO,EAAEf;AAJX,QADF;AAQD,KAVA,CADH,CAFF,CADD,CADH,CADD;AAAA,GANH,CADF;AA+BD,CAvCM","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 */\n\nimport React, { FC } from 'react'\nimport styled from 'styled-components'\nimport { Span } from '@looker/components'\nimport Highlight, { defaultProps, Prism } from 'prism-react-renderer'\n\nimport { getPrismLanguage, getOverridenTheme } from '../utils'\nimport { CodeWrapper } from './CodeWrapper'\nimport { LineItem } from './LineItem'\nimport { CodeDisplayProps } from './types'\n;(typeof global !== 'undefined' ? (global as any) : (window as any)).Prism =\n Prism\nrequire('prismjs/components/prism-kotlin')\nrequire('prismjs/components/prism-csharp')\nrequire('prismjs/components/prism-swift')\nrequire('prismjs/components/prism-ruby')\n\nconst Line = styled(Span)`\n display: table-row;\n`\n\nconst LineNo = styled(Span)`\n display: table-cell;\n text-align: right;\n padding-right: 1em;\n user-select: none;\n opacity: 0.5;\n`\n\nconst LineContent = styled(Span)`\n display: table-cell;\n font-family: monospace;\n`\n\n/**\n * Provides a view-only syntax highlighter for all supported SDK languages.\n * @param language - highlighting language\n * @param code - string content to display\n * @param pattern - Search pattern to be marked\n * @param transparent - Flag to provide background styling or not\n * @param inline - Flag to use block or inline code\n * @param lineNumbers - flag to toggle line numbers\n */\nexport const CodeDisplay: FC<CodeDisplayProps> = ({\n language = 'json',\n code,\n pattern = '',\n transparent = false,\n inline = false,\n lineNumbers = true,\n}) => {\n return (\n <Highlight\n {...defaultProps}\n code={code.trim()}\n language={getPrismLanguage(language)}\n theme={getOverridenTheme(transparent, inline)}\n >\n {({ className, style, tokens, getLineProps, getTokenProps }) => (\n <CodeWrapper className={className} style={style} inline={inline}>\n {tokens.map((line, i) => (\n <Line key={i} {...getLineProps({ line, key: i })}>\n {lineNumbers && <LineNo>{i + 1}</LineNo>}\n <LineContent>\n {line.map((token, key) => {\n const tokenProps = getTokenProps({ token, key })\n return (\n <LineItem\n key={key}\n index={key}\n tokenProps={tokenProps}\n pattern={pattern}\n />\n )\n })}\n </LineContent>\n </Line>\n ))}\n </CodeWrapper>\n )}\n </Highlight>\n )\n}\n"],"file":"CodeDisplay.js"}
1
+ {"version":3,"sources":["../../../src/CodeDisplay/CodeDisplay.tsx"],"names":["React","styled","Span","Highlight","defaultProps","Prism","getPrismLanguage","getOverriddenTheme","CodeWrapper","LineItem","global","window","require","Line","LineNo","LineContent","CodeDisplay","language","code","pattern","transparent","inline","lineNumbers","trim","className","style","tokens","getLineProps","getTokenProps","map","line","i","key","token","tokenProps"],"mappings":";;AA2BA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,IAAT,QAAqB,oBAArB;AACA,OAAOC,SAAP,IAAoBC,YAApB,EAAkCC,KAAlC,QAA+C,sBAA/C;AAEA,SAASC,gBAAT,EAA2BC,kBAA3B,QAAqD,UAArD;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,QAAT,QAAyB,YAAzB;AAEC,CAAC,OAAOC,MAAP,KAAkB,WAAlB,GAAiCA,MAAjC,GAAmDC,MAApD,EAAoEN,KAApE,GACCA,KADD;;AAEDO,OAAO,CAAC,iCAAD,CAAP;;AACAA,OAAO,CAAC,iCAAD,CAAP;;AACAA,OAAO,CAAC,gCAAD,CAAP;;AACAA,OAAO,CAAC,+BAAD,CAAP;;AACAA,OA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EE,oBAAC,WAAD,QACGD,IAAI,CAACD,GAAL,CAAS,CAACI,KAAD,EAAQD,GAAR,KAAgB;AACxB,UAAME,UAAU,GAAGN,aAAa,CAAC;AAAEK,QAAAA,KAAF;AAASD,QAAAA;AAAT,OAAD,CAAhC;AACA,aACE,oBAAC,QAAD;AACE,QAAA,GAAG,EAAEA,GADP;AAEE,QAAA,KAAK,EAAEA,GAFT;AAGE,QAAA,UAAU,EAAEE,UAHd;AAIE,QAAA,OAAO,EAAEf;AAJX,QADF;AAQD,KAVA,CADH,CAFF,CADD,CADH,CADD;AAAA,GANH,CADF;AA+BD,CAvCM","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 */\n\nimport type { FC } from 'react'\nimport React from 'react'\nimport styled from 'styled-components'\nimport { Span } from '@looker/components'\nimport Highlight, { defaultProps, Prism } from 'prism-react-renderer'\n\nimport { getPrismLanguage, getOverriddenTheme } from '../utils'\nimport { CodeWrapper } from './CodeWrapper'\nimport { LineItem } from './LineItem'\nimport type { CodeDisplayProps } from './types'\n;(typeof global !== 'undefined' ? (global as any) : (window as any)).Prism =\n Prism\nrequire('prismjs/components/prism-kotlin')\nrequire('prismjs/components/prism-csharp')\nrequire('prismjs/components/prism-swift')\nrequire('prismjs/components/prism-ruby')\nrequire('prismjs/components/prism-markdown')\n\nconst Line = styled(Span)`\n display: table-row;\n`\n\nconst LineNo = styled(Span)`\n display: table-cell;\n text-align: right;\n padding-right: 1em;\n user-select: none;\n opacity: 0.5;\n`\n\nconst LineContent = styled(Span)`\n display: table-cell;\n font-family: monospace;\n`\n\n/**\n * Provides a view-only syntax highlighter for all supported SDK languages.\n * @param language - highlighting language\n * @param code - string content to display\n * @param pattern - Search pattern to be marked\n * @param transparent - Flag to provide background styling or not\n * @param inline - Flag to use block or inline code\n * @param lineNumbers - flag to toggle line numbers\n */\nexport const CodeDisplay: FC<CodeDisplayProps> = ({\n language = 'json',\n code,\n pattern = '',\n transparent = false,\n inline = false,\n lineNumbers = true,\n}) => {\n return (\n <Highlight\n {...defaultProps}\n code={code.trim()}\n language={getPrismLanguage(language)}\n theme={getOverriddenTheme(transparent, inline)}\n >\n {({ className, style, tokens, getLineProps, getTokenProps }) => (\n <CodeWrapper className={className} style={style} inline={inline}>\n {tokens.map((line, i) => (\n <Line key={i} {...getLineProps({ line, key: i })}>\n {lineNumbers && <LineNo>{i + 1}</LineNo>}\n <LineContent>\n {line.map((token, key) => {\n const tokenProps = getTokenProps({ token, key })\n return (\n <LineItem\n key={key}\n index={key}\n tokenProps={tokenProps}\n pattern={pattern}\n />\n )\n })}\n </LineContent>\n </Line>\n ))}\n </CodeWrapper>\n )}\n </Highlight>\n )\n}\n"],"file":"CodeDisplay.js"}
@@ -3,7 +3,7 @@ import styled from 'styled-components';
3
3
  var Pre = styled.pre.withConfig({
4
4
  displayName: "CodeWrapper__Pre",
5
5
  componentId: "sc-156h0dr-0"
6
- })(["white-space:pre-wrap;overflow:auto;margin:0px;.match{border:1px yellow solid;border-radius:4px;}"]);
6
+ })(["white-space:pre-wrap;overflow:auto;margin:0px;.match{background:#000000;border:1px#fff2c2 solid;border-radius:10px;padding:0.15px 4px;}"]);
7
7
  var Code = styled.code.withConfig({
8
8
  displayName: "CodeWrapper__Code",
9
9
  componentId: "sc-156h0dr-1"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/CodeDisplay/CodeWrapper.tsx"],"names":["React","styled","Pre","pre","Code","code","CodeWrapper","className","style","inline","children","Wrapper"],"mappings":"AA0BA,OAAOA,KAAP,MAA0B,OAA1B;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AASA,IAAMC,GAAG,GAAGD,MAAM,CAACE,GAAV;AAAA;AAAA;AAAA,wGAAT;AAaA,IAAMC,IAAI,GAAGH,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,wCAAV;AAUA,OAAO,IAAMC,WAAiC,GAAG,QAK3C;AAAA,MAL4C;AAChDC,IAAAA,SADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,MAHgD;AAIhDC,IAAAA;AAJgD,GAK5C;AACJ,MAAMC,OAAO,GAAGF,MAAM,GAAGL,IAAH,GAAUF,GAAhC;AACA,SACE,oBAAC,OAAD;AAAS,IAAA,SAAS,EAAEK,SAApB;AAA+B,IAAA,KAAK,EAAEC;AAAtC,KACGE,QADH,CADF;AAKD,CAZM","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 */\n\nimport React, { FC } from 'react'\nimport styled from 'styled-components'\n\ninterface CodeWrapperProps {\n className: string\n style: any\n inline: boolean\n children: any\n}\n\nconst Pre = styled.pre`\n white-space: pre-wrap;\n overflow: auto;\n // override default margin for Pre\n // so we can set from parent\n margin: 0px;\n\n // selector for search matches\n .match {\n border: 1px yellow solid;\n border-radius: 4px;\n }\n`\nconst Code = styled.code`\n // selector for search matches\n .match {\n background-color: yellow;\n }\n`\n\n/**\n * A wrapper for CodeDisplay which applies search highlighting styles on proper container component\n */\nexport const CodeWrapper: FC<CodeWrapperProps> = ({\n className,\n style,\n inline,\n children,\n}) => {\n const Wrapper = inline ? Code : Pre\n return (\n <Wrapper className={className} style={style}>\n {children}\n </Wrapper>\n )\n}\n"],"file":"CodeWrapper.js"}
1
+ {"version":3,"sources":["../../../src/CodeDisplay/CodeWrapper.tsx"],"names":["React","styled","Pre","pre","Code","code","CodeWrapper","className","style","inline","children","Wrapper"],"mappings":"AA2BA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AASA,IAAMC,GAAG,GAAGD,MAAM,CAACE,GAAV;AAAA;AAAA;AAAA,+IAAT;AAeA,IAAMC,IAAI,GAAGH,MAAM,CAACI,IAAV;AAAA;AAAA;AAAA,wCAAV;AAUA,OAAO,IAAMC,WAAiC,GAAG,QAK3C;AAAA,MAL4C;AAChDC,IAAAA,SADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,MAHgD;AAIhDC,IAAAA;AAJgD,GAK5C;AACJ,MAAMC,OAAO,GAAGF,MAAM,GAAGL,IAAH,GAAUF,GAAhC;AACA,SACE,oBAAC,OAAD;AAAS,IAAA,SAAS,EAAEK,SAApB;AAA+B,IAAA,KAAK,EAAEC;AAAtC,KACGE,QADH,CADF;AAKD,CAZM","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 */\n\nimport type { FC } from 'react'\nimport React from 'react'\nimport styled from 'styled-components'\n\ninterface CodeWrapperProps {\n className: string\n style: any\n inline: boolean\n children: any\n}\n\nconst Pre = styled.pre`\n white-space: pre-wrap;\n overflow: auto;\n // override default margin for Pre\n // so we can set from parent\n margin: 0px;\n\n // selector for search matches\n .match {\n background: #000000;\n border: 1px#fff2c2 solid;\n border-radius: 10px;\n padding: 0.15px 4px;\n }\n`\nconst Code = styled.code`\n // selector for search matches\n .match {\n background-color: yellow;\n }\n`\n\n/**\n * A wrapper for CodeDisplay which applies search highlighting styles on proper container component\n */\nexport const CodeWrapper: FC<CodeWrapperProps> = ({\n className,\n style,\n inline,\n children,\n}) => {\n const Wrapper = inline ? Code : Pre\n return (\n <Wrapper className={className} style={style}>\n {children}\n </Wrapper>\n )\n}\n"],"file":"CodeWrapper.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/CodeDisplay/LineItem.tsx"],"names":["React","LineItem","index","tokenProps","pattern","text","children","toLowerCase","includes","className"],"mappings":";;AA0BA,OAAOA,KAAP,MAA0B,OAA1B;AASA,OAAO,IAAMC,QAA2B,GAAG,QAAoC;AAAA,MAAnC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,UAAT;AAAqBC,IAAAA;AAArB,GAAmC;AAC7E,MAAMC,IAAI,GAAGF,UAAU,CAACG,QAAX,CAAoBC,WAApB,EAAb;;AACA,MAAIH,OAAO,KAAK,EAAZ,IAAkBC,IAAI,CAACG,QAAL,CAAcJ,OAAO,CAACG,WAAR,EAAd,CAAtB,EAA4D;AAC1DJ,IAAAA,UAAU,CAACM,SAAX,IAAwB,QAAxB;AACD;;AACD,SAAO;AAAM,IAAA,GAAG,EAAEP;AAAX,KAAsBC,UAAtB,EAAP;AACD,CANM","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 */\n\nimport React, { FC } from 'react'\nimport { LineItemProps } from './types'\n\n/**\n * Takes a 'line of code' as a list of Tokens and returns syntax highlighting styled spans\n * @param key - component identifier\n * @param tokenProps - the style props from prism renderer\n * @param pattern - search pattern to consider\n */\nexport const LineItem: FC<LineItemProps> = ({ index, tokenProps, pattern }) => {\n const text = tokenProps.children.toLowerCase()\n if (pattern !== '' && text.includes(pattern.toLowerCase())) {\n tokenProps.className += ' match'\n }\n return <span key={index} {...tokenProps} />\n}\n"],"file":"LineItem.js"}
1
+ {"version":3,"sources":["../../../src/CodeDisplay/LineItem.tsx"],"names":["React","LineItem","index","tokenProps","pattern","text","children","toLowerCase","includes","className"],"mappings":";;AA2BA,OAAOA,KAAP,MAAkB,OAAlB;AASA,OAAO,IAAMC,QAA2B,GAAG,QAAoC;AAAA,MAAnC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,UAAT;AAAqBC,IAAAA;AAArB,GAAmC;AAC7E,MAAMC,IAAI,GAAGF,UAAU,CAACG,QAAX,CAAoBC,WAApB,EAAb;;AACA,MAAIH,OAAO,KAAK,EAAZ,IAAkBC,IAAI,CAACG,QAAL,CAAcJ,OAAO,CAACG,WAAR,EAAd,CAAtB,EAA4D;AAC1DJ,IAAAA,UAAU,CAACM,SAAX,IAAwB,QAAxB;AACD;;AACD,SAAO;AAAM,IAAA,GAAG,EAAEP;AAAX,KAAsBC,UAAtB,EAAP;AACD,CANM","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 */\n\nimport type { FC } from 'react'\nimport React from 'react'\nimport type { LineItemProps } from './types'\n\n/**\n * Takes a 'line of code' as a list of Tokens and returns syntax highlighting styled spans\n * @param key - component identifier\n * @param tokenProps - the style props from prism renderer\n * @param pattern - search pattern to consider\n */\nexport const LineItem: FC<LineItemProps> = ({ index, tokenProps, pattern }) => {\n const text = tokenProps.children.toLowerCase()\n if (pattern !== '' && text.includes(pattern.toLowerCase())) {\n tokenProps.className += ' match'\n }\n return <span key={index} {...tokenProps} />\n}\n"],"file":"LineItem.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/CodeEditor/CodeEditor.tsx"],"names":["React","Editor","CodeDisplay","CodeEditor","code","onChange","language","pattern","transparent","lineNumbers","trim","width","color","whiteSpace","overflow","fontFamily"],"mappings":"AA0BA,OAAOA,KAAP,MAA0B,OAA1B;AACA,OAAOC,MAAP,MAAmB,0BAAnB;AAGA,SAASC,WAAT,QAA4B,UAA5B;AAWA,OAAO,IAAMC,UAA+B,GAAG,QAOzC;AAAA,MAP0C;AAC9CC,IAAAA,IAD8C;AAE9CC,IAAAA,QAF8C;AAG9CC,IAAAA,QAAQ,GAAG,MAHmC;AAI9CC,IAAAA,OAAO,GAAG,EAJoC;AAK9CC,IAAAA,WAAW,GAAG,KALgC;AAM9CC,IAAAA,WAAW,GAAG;AANgC,GAO1C;AACJ,SACE,oBAAC,MAAD;AACE,IAAA,KAAK,EAAEL,IAAI,CAACM,IAAL,EADT;AAEE,IAAA,IAAI,EAAE,aAFR;AAGE,IAAA,aAAa,EAAEL,QAHjB;AAIE,IAAA,SAAS,EAAGD,IAAD,IACT,oBAAC,WAAD;AACE,MAAA,IAAI,EAAEA,IADR;AAEE,MAAA,QAAQ,EAAEE,QAFZ;AAGE,MAAA,OAAO,EAAEC,OAHX;AAIE,MAAA,WAAW,EAAEC,WAJf;AAKE,MAAA,WAAW,EAAEC;AALf,MALJ;AAaE,IAAA,OAAO,EAAC,MAbV;AAcE,IAAA,KAAK,EAAE;AACLE,MAAAA,KAAK,EAAE,MADF;AAELC,MAAAA,KAAK,EAAE,MAFF;AAGLC,MAAAA,UAAU,EAAE,UAHP;AAILC,MAAAA,QAAQ,EAAE,MAJL;AAKLC,MAAAA,UAAU,EAAE;AALP;AAdT,IADF;AAwBD,CAhCM","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 */\n\nimport React, { FC } from 'react'\nimport Editor from 'react-simple-code-editor'\n\nimport { CodeDisplayProps } from '../CodeDisplay/types'\nimport { CodeDisplay } from '../index'\n\ninterface CodeEditorProps extends CodeDisplayProps {\n /** onChange event handler, for Editor functionality */\n onChange: (text: string) => void\n}\n\n/**\n * Extends CodeDisplay functionality to provide\n * Editor functionality for syntax highlighted code blocks\n */\nexport const CodeEditor: FC<CodeEditorProps> = ({\n code,\n onChange,\n language = 'json',\n pattern = '',\n transparent = false,\n lineNumbers = true,\n}) => {\n return (\n <Editor\n value={code.trim()}\n role={'code-editor'}\n onValueChange={onChange}\n highlight={(code: string) => (\n <CodeDisplay\n code={code}\n language={language}\n pattern={pattern}\n transparent={transparent}\n lineNumbers={lineNumbers}\n />\n )}\n padding=\"1rem\"\n style={{\n width: '100%',\n color: '#FFF',\n whiteSpace: 'pre-wrap',\n overflow: 'auto',\n fontFamily: 'monospace',\n }}\n />\n )\n}\n"],"file":"CodeEditor.js"}
1
+ {"version":3,"sources":["../../../src/CodeEditor/CodeEditor.tsx"],"names":["React","Editor","CodeDisplay","CodeEditor","code","onChange","language","pattern","transparent","lineNumbers","trim","width","color","whiteSpace","overflow","fontFamily"],"mappings":"AA2BA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAAmB,0BAAnB;AAGA,SAASC,WAAT,QAA4B,UAA5B;AAWA,OAAO,IAAMC,UAA+B,GAAG,QAOzC;AAAA,MAP0C;AAC9CC,IAAAA,IAD8C;AAE9CC,IAAAA,QAF8C;AAG9CC,IAAAA,QAAQ,GAAG,MAHmC;AAI9CC,IAAAA,OAAO,GAAG,EAJoC;AAK9CC,IAAAA,WAAW,GAAG,KALgC;AAM9CC,IAAAA,WAAW,GAAG;AANgC,GAO1C;AACJ,SACE,oBAAC,MAAD;AACE,IAAA,KAAK,EAAEL,IAAI,CAACM,IAAL,EADT;AAEE,IAAA,IAAI,EAAE,aAFR;AAGE,IAAA,aAAa,EAAEL,QAHjB;AAIE,IAAA,SAAS,EAAGD,IAAD,IACT,oBAAC,WAAD;AACE,MAAA,IAAI,EAAEA,IADR;AAEE,MAAA,QAAQ,EAAEE,QAFZ;AAGE,MAAA,OAAO,EAAEC,OAHX;AAIE,MAAA,WAAW,EAAEC,WAJf;AAKE,MAAA,WAAW,EAAEC;AALf,MALJ;AAaE,IAAA,OAAO,EAAC,MAbV;AAcE,IAAA,KAAK,EAAE;AACLE,MAAAA,KAAK,EAAE,MADF;AAELC,MAAAA,KAAK,EAAE,MAFF;AAGLC,MAAAA,UAAU,EAAE,UAHP;AAILC,MAAAA,QAAQ,EAAE,MAJL;AAKLC,MAAAA,UAAU,EAAE;AALP;AAdT,IADF;AAwBD,CAhCM","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 */\n\nimport type { FC } from 'react'\nimport React from 'react'\nimport Editor from 'react-simple-code-editor'\n\nimport type { CodeDisplayProps } from '../CodeDisplay/types'\nimport { CodeDisplay } from '../index'\n\ninterface CodeEditorProps extends CodeDisplayProps {\n /** onChange event handler, for Editor functionality */\n onChange: (text: string) => void\n}\n\n/**\n * Extends CodeDisplay functionality to provide\n * Editor functionality for syntax highlighted code blocks\n */\nexport const CodeEditor: FC<CodeEditorProps> = ({\n code,\n onChange,\n language = 'json',\n pattern = '',\n transparent = false,\n lineNumbers = true,\n}) => {\n return (\n <Editor\n value={code.trim()}\n role={'code-editor'}\n onValueChange={onChange}\n highlight={(code: string) => (\n <CodeDisplay\n code={code}\n language={language}\n pattern={pattern}\n transparent={transparent}\n lineNumbers={lineNumbers}\n />\n )}\n padding=\"1rem\"\n style={{\n width: '100%',\n color: '#FFF',\n whiteSpace: 'pre-wrap',\n overflow: 'auto',\n fontFamily: 'monospace',\n }}\n />\n )\n}\n"],"file":"CodeEditor.js"}
@@ -34,7 +34,7 @@ export var Markdown = _ref => {
34
34
  var a = findAnchor(e.target);
35
35
 
36
36
  if (a) {
37
- linkClickHandler(a.pathname, a.href);
37
+ linkClickHandler(a.getAttribute('pathname') || '', a.getAttribute('href') || '');
38
38
  }
39
39
  }
40
40
  };
@@ -108,5 +108,5 @@ export var Markdown = _ref => {
108
108
  var MarkdownWrapper = styled.div.withConfig({
109
109
  displayName: "Markdown__MarkdownWrapper",
110
110
  componentId: "sc-11uco0h-0"
111
- })(["& > ul{padding-left:20px;list-style:disc outside;}& > ol{padding-left:20px;list-style:decimal outside;}"]);
111
+ })(["& > ul{padding-left:20px;list-style:disc outside;}& > ol{padding-left:20px;list-style:decimal outside;}& mark{background-color:#fff2c2;font-weight:500;}"]);
112
112
  //# sourceMappingURL=Markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Markdown/Markdown.tsx"],"names":["React","styled","ReactMarkdown","rehypeRaw","gfm","TableHead","TableBody","TableRow","Link","CodeDisplay","qualifyMarkdownText","prepareCodeText","TableCell","MDHeading","MDList","MDListItem","MDParagraph","MDTable","Markdown","source","pattern","transformLinkUri","linkClickHandler","paragraphOverride","findAnchor","ele","tagName","parentElement","undefined","handleClick","e","preventDefault","a","target","pathname","href","heading","level","children","paragraph","code","inline","text","language","toString","codeProps","lineNumbers","components","h1","h2","h3","h4","h5","h6","p","ul","ol","link","li","table","thead","tbody","tr","td","th","MarkdownWrapper","div"],"mappings":"AA0BA,OAAOA,KAAP,MAAyD,OAAzD;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,aAAP,MAA0B,gBAA1B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,GAAP,MAAgB,YAAhB;AACA,SAASC,SAAT,EAAoBC,SAApB,EAA+BC,QAA/B,EAAyCC,IAAzC,QAAqD,oBAArD;AAEA,SAASC,WAAT,QAA4B,gBAA5B;AACA,SAASC,mBAAT,EAA8BC,eAA9B,QAAqD,SAArD;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,UAA5B,EAAwCC,WAAxC,EAAqDC,OAArD,QAAoE,UAApE;AAYA,OAAO,IAAMC,QAA2B,GAAG,QAMrC;AAAA,MANsC;AAC1CC,IAAAA,MAD0C;AAE1CC,IAAAA,OAAO,GAAG,EAFgC;AAG1CC,IAAAA,gBAH0C;AAI1CC,IAAAA,gBAJ0C;AAK1CC,IAAAA;AAL0C,GAMtC;;AACJ,MAAMC,UAAU,GAAIC,GAAD,IAAqD;AACtE,QAAIA,GAAG,CAACC,OAAJ,KAAgB,GAApB,EAAyB,OAAOD,GAAP;;AACzB,QAAIA,GAAG,CAACE,aAAR,EAAuB;AACrB,aAAOH,UAAU,CAACC,GAAG,CAACE,aAAL,CAAjB;AACD;;AACD,WAAOC,SAAP;AACD,GAND;;AAQA,MAAMC,WAAW,GAAIC,CAAD,IAA2B;AAC7CA,IAAAA,CAAC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AE,EAAEhB,OALa;AAMjBiB,IAAAA,EAAE,EAAEjB,OANa;AAOjBkB,IAAAA,CAAC,EAAE/B,iBAAiB,IAAIgB,SAPP;AAQjBC,IAAAA,IAAI,EAAEA,IARW;AASjBR,IAAAA,CAAC,EAAExB,IATc;AAUjB+C,IAAAA,EAAE,EAAEzC,MAVa;AAWjB0C,IAAAA,EAAE,EAAE1C,MAXa;AAYjB2C,IAAAA,IAAI,EAAEjD,IAZW;AAajBkD,IAAAA,EAAE,EAAE3C,UAba;AAcjB4C,IAAAA,KAAK,EAAE1C,OAdU;AAejB2C,IAAAA,KAAK,EAAEvD,SAfU;AAgBjBwD,IAAAA,KAAK,EAAEvD,SAhBU;AAiBjBwD,IAAAA,EAAE,EAAEvD,QAjBa;AAkBjBwD,IAAAA,EAAE,EAAEnD,SAlBa;AAmBjBoD,IAAAA,EAAE,EAAEpD;AAnBa,GAAnB;AAsBA,SACE,oBAAC,eAAD;AAAiB,IAAA,OAAO,EAAEiB;AAA1B,KACE,oBAAC,aAAD;AACE,IAAA,aAAa,EAAE,CAACzB,GAAD,CADjB;AAEE,IAAA,aAAa,EAAE,CAACD,SAAD,CAFjB;AAGE,IAAA,gBAAgB,EAAEkB,gBAHpB;AAIE,IAAA,UAAU,EAAE0B;AAJd,KAMGrC,mBAAmB,CAACS,MAAD,EAASC,OAAT,CANtB,CADF,CADF;AAYD,CA1FM;AA4FP,IAAM6C,eAAe,GAAGhE,MAAM,CAACiE,GAAV;AAAA;AAAA;AAAA,+GAArB","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 */\n\nimport React, { BaseSyntheticEvent, FC, ReactNode } from 'react'\nimport styled from 'styled-components'\nimport ReactMarkdown from 'react-markdown'\nimport rehypeRaw from 'rehype-raw'\nimport gfm from 'remark-gfm'\nimport { TableHead, TableBody, TableRow, Link } from '@looker/components'\n\nimport { CodeDisplay } from '../CodeDisplay'\nimport { qualifyMarkdownText, prepareCodeText } from './utils'\nimport { TableCell } from './TableCell'\nimport { MDHeading, MDList, MDListItem, MDParagraph, MDTable } from './common'\n\ninterface MarkdownProps {\n source: string\n pattern?: string\n transformLinkUri?: (url: string) => string\n linkClickHandler?: (pathname: string, href: string) => void\n paragraphOverride?: ({ children }: { children: ReactNode }) => ReactNode\n}\n\ntype HeadingLevels = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n\nexport const Markdown: FC<MarkdownProps> = ({\n source,\n pattern = '',\n transformLinkUri,\n linkClickHandler,\n paragraphOverride,\n}) => {\n const findAnchor = (ele: HTMLElement): HTMLAnchorElement | undefined => {\n if (ele.tagName === 'A') return ele as HTMLAnchorElement\n if (ele.parentElement) {\n return findAnchor(ele.parentElement)\n }\n return undefined\n }\n\n const handleClick = (e: BaseSyntheticEvent) => {\n e.preventDefault()\n if (linkClickHandler) {\n // Could be a <mark> tag wrapped by an anchor\n const a = findAnchor(e.target)\n if (a) {\n linkClickHandler(a.pathname, a.href)\n }\n }\n }\n\n const heading = ({\n level,\n children,\n }: {\n level: number\n children: ReactNode\n }) => <MDHeading as={`h${level}` as HeadingLevels}>{children}</MDHeading>\n\n const paragraph = ({ children }: { children: ReactNode }) => (\n <MDParagraph>{children}</MDParagraph>\n )\n\n const code = ({\n inline,\n children,\n }: {\n inline?: boolean\n children: ReactNode\n }) => {\n const { text, language } = prepareCodeText(children?.toString() || '')\n const codeProps = {\n language: language,\n code: text,\n pattern: pattern,\n lineNumbers: false,\n inline: inline,\n }\n return <CodeDisplay {...codeProps} />\n }\n\n const components = {\n h1: heading,\n h2: heading,\n h3: heading,\n h4: heading,\n h5: heading,\n h6: heading,\n p: paragraphOverride || paragraph,\n code: code,\n a: Link,\n ul: MDList,\n ol: MDList,\n link: Link,\n li: MDListItem,\n table: MDTable,\n thead: TableHead,\n tbody: TableBody,\n tr: TableRow,\n td: TableCell,\n th: TableCell,\n }\n\n return (\n <MarkdownWrapper onClick={handleClick}>\n <ReactMarkdown\n remarkPlugins={[gfm]}\n rehypePlugins={[rehypeRaw]}\n transformLinkUri={transformLinkUri}\n components={components}\n >\n {qualifyMarkdownText(source, pattern)}\n </ReactMarkdown>\n </MarkdownWrapper>\n )\n}\n\nconst MarkdownWrapper = styled.div`\n & > ul {\n padding-left: 20px;\n list-style: disc outside;\n }\n & > ol {\n padding-left: 20px;\n list-style: decimal outside;\n }\n`\n"],"file":"Markdown.js"}
1
+ {"version":3,"sources":["../../../src/Markdown/Markdown.tsx"],"names":["React","styled","ReactMarkdown","rehypeRaw","gfm","TableHead","TableBody","TableRow","Link","CodeDisplay","qualifyMarkdownText","prepareCodeText","TableCell","MDHeading","MDList","MDListItem","MDParagraph","MDTable","Markdown","source","pattern","transformLinkUri","linkClickHandler","paragraphOverride","findAnchor","ele","tagName","parentElement","undefined","handleClick","e","preventDefault","a","target","getAttribute","heading","level","children","paragraph","code","inline","text","language","toString","codeProps","lineNumbers","components","h1","h2","h3","h4","h5","h6","p","ul","ol","link","li","table","thead","tbody","tr","td","th","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EAAEzC,MAXa;AAYjB0C,IAAAA,IAAI,EAAEhD,IAZW;AAajBiD,IAAAA,EAAE,EAAE1C,UAba;AAcjB2C,IAAAA,KAAK,EAAEzC,OAdU;AAejB0C,IAAAA,KAAK,EAAEtD,SAfU;AAgBjBuD,IAAAA,KAAK,EAAEtD,SAhBU;AAiBjBuD,IAAAA,EAAE,EAAEtD,QAjBa;AAkBjBuD,IAAAA,EAAE,EAAElD,SAlBa;AAmBjBmD,IAAAA,EAAE,EAAEnD;AAnBa,GAAnB;AAsBA,SACE,oBAAC,eAAD;AAAiB,IAAA,OAAO,EAAEiB;AAA1B,KACE,oBAAC,aAAD;AACE,IAAA,aAAa,EAAE,CAACzB,GAAD,CADjB;AAEE,IAAA,aAAa,EAAE,CAACD,SAAD,CAFjB;AAGE,IAAA,gBAAgB,EAAEkB,gBAHpB;AAIE,IAAA,UAAU,EAAEyB;AAJd,KAMGpC,mBAAmB,CAACS,MAAD,EAASC,OAAT,CANtB,CADF,CADF;AAYD,CA7FM;AA+FP,IAAM4C,eAAe,GAAG/D,MAAM,CAACgE,GAAV;AAAA;AAAA;AAAA,gKAArB","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 */\n\nimport type { BaseSyntheticEvent, FC, ReactNode } from 'react'\nimport React from 'react'\nimport styled from 'styled-components'\nimport ReactMarkdown from 'react-markdown'\nimport rehypeRaw from 'rehype-raw'\nimport gfm from 'remark-gfm'\nimport { TableHead, TableBody, TableRow, Link } from '@looker/components'\n\nimport { CodeDisplay } from '../CodeDisplay'\nimport { qualifyMarkdownText, prepareCodeText } from './utils'\nimport { TableCell } from './TableCell'\nimport { MDHeading, MDList, MDListItem, MDParagraph, MDTable } from './common'\n\ntype HeadingLevels = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n\ninterface MarkdownProps {\n source: string\n pattern?: string\n transformLinkUri?: (url: string) => string\n linkClickHandler?: (pathname: string, href: string) => void\n paragraphOverride?: ({ children }: { children: ReactNode }) => ReactNode\n}\n\nexport const Markdown: FC<MarkdownProps> = ({\n source,\n pattern = '',\n transformLinkUri,\n linkClickHandler,\n paragraphOverride,\n}) => {\n const findAnchor = (ele: HTMLElement): HTMLAnchorElement | undefined => {\n if (ele.tagName === 'A') return ele as HTMLAnchorElement\n if (ele.parentElement) {\n return findAnchor(ele.parentElement)\n }\n return undefined\n }\n\n const handleClick = (e: BaseSyntheticEvent) => {\n e.preventDefault()\n if (linkClickHandler) {\n // Could be a <mark> tag wrapped by an anchor\n const a = findAnchor(e.target)\n if (a) {\n linkClickHandler(\n a.getAttribute('pathname') || '',\n a.getAttribute('href') || ''\n )\n }\n }\n }\n\n const heading = ({\n level,\n children,\n }: {\n level: number\n children: ReactNode\n }) => <MDHeading as={`h${level}` as HeadingLevels}>{children}</MDHeading>\n\n const paragraph = ({ children }: { children: ReactNode }) => (\n <MDParagraph>{children}</MDParagraph>\n )\n\n const code = ({\n inline,\n children,\n }: {\n inline?: boolean\n children: ReactNode\n }) => {\n const { text, language } = prepareCodeText(children?.toString() || '')\n const codeProps = {\n language: language,\n code: text,\n pattern: pattern,\n lineNumbers: false,\n inline: inline,\n }\n return <CodeDisplay {...codeProps} />\n }\n\n const components = {\n h1: heading,\n h2: heading,\n h3: heading,\n h4: heading,\n h5: heading,\n h6: heading,\n p: paragraphOverride || paragraph,\n code: code,\n a: Link,\n ul: MDList,\n ol: MDList,\n link: Link,\n li: MDListItem,\n table: MDTable,\n thead: TableHead,\n tbody: TableBody,\n tr: TableRow,\n td: TableCell,\n th: TableCell,\n }\n\n return (\n <MarkdownWrapper onClick={handleClick}>\n <ReactMarkdown\n remarkPlugins={[gfm]}\n rehypePlugins={[rehypeRaw]}\n transformLinkUri={transformLinkUri}\n components={components}\n >\n {qualifyMarkdownText(source, pattern)}\n </ReactMarkdown>\n </MarkdownWrapper>\n )\n}\n\nconst MarkdownWrapper = styled.div`\n & > ul {\n padding-left: 20px;\n list-style: disc outside;\n }\n & > ol {\n padding-left: 20px;\n list-style: decimal outside;\n }\n & mark {\n background-color: #fff2c2;\n font-weight: 500;\n }\n`\n"],"file":"Markdown.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Markdown/TableCell.tsx"],"names":["React","TableDataCell","TableHeaderCell","TableCell","isHeader","rest"],"mappings":";;;;AAyBA,OAAOA,KAAP,MAA6C,OAA7C;AACA,SAASC,aAAT,EAAwBC,eAAxB,QAA+C,oBAA/C;AAEA,OAAO,IAAMC,SAAqC,GAAG;AAAA,MAAC;AAAEC,IAAAA;AAAF,GAAD;AAAA,MAAgBC,IAAhB;;AAAA,SACnDD,QAAQ,GAAG,oBAAC,eAAD,EAAqBC,IAArB,CAAH,GAAmC,oBAAC,aAAD,EAAmBA,IAAnB,CADQ;AAAA,CAA9C","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 React, { FC, PropsWithChildren } from 'react'\nimport { TableDataCell, TableHeaderCell } from '@looker/components'\n\nexport const TableCell: FC<PropsWithChildren<any>> = ({ isHeader, ...rest }) =>\n isHeader ? <TableHeaderCell {...rest} /> : <TableDataCell {...rest} />\n"],"file":"TableCell.js"}
1
+ {"version":3,"sources":["../../../src/Markdown/TableCell.tsx"],"names":["React","TableDataCell","TableHeaderCell","TableCell","isHeader","rest"],"mappings":";;;;AA0BA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,aAAT,EAAwBC,eAAxB,QAA+C,oBAA/C;AAEA,OAAO,IAAMC,SAAqC,GAAG;AAAA,MAAC;AAAEC,IAAAA;AAAF,GAAD;AAAA,MAAgBC,IAAhB;;AAAA,SACnDD,QAAQ,GAAG,oBAAC,eAAD,EAAqBC,IAArB,CAAH,GAAmC,oBAAC,aAAD,EAAmBA,IAAnB,CADQ;AAAA,CAA9C","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 type { FC, PropsWithChildren } from 'react'\nimport React from 'react'\nimport { TableDataCell, TableHeaderCell } from '@looker/components'\n\nexport const TableCell: FC<PropsWithChildren<any>> = ({ isHeader, ...rest }) =>\n isHeader ? <TableHeaderCell {...rest} /> : <TableDataCell {...rest} />\n"],"file":"TableCell.js"}
@@ -5,26 +5,35 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
5
5
  import React from 'react';
6
6
  import styled from 'styled-components';
7
7
  import { Paragraph, Table, Heading } from '@looker/components';
8
- export var MDHeading = styled(Heading).withConfig({
8
+ export var MDHeading = styled(Heading).attrs(_ref => {
9
+ var {
10
+ mb = 'xsmall',
11
+ pt = 'xsmall'
12
+ } = _ref;
13
+ return {
14
+ mb,
15
+ pt
16
+ };
17
+ }).withConfig({
9
18
  displayName: "common__MDHeading",
10
19
  componentId: "i00oep-0"
11
20
  })([""]);
12
- MDHeading.defaultProps = {
13
- mb: 'xsmall',
14
- pt: 'xsmall'
15
- };
16
- export var MDParagraph = styled(Paragraph).withConfig({
21
+ export var MDParagraph = styled(Paragraph).attrs(_ref2 => {
22
+ var {
23
+ mb = 'large'
24
+ } = _ref2;
25
+ return {
26
+ mb
27
+ };
28
+ }).withConfig({
17
29
  displayName: "common__MDParagraph",
18
30
  componentId: "i00oep-1"
19
- })(["color:", ";max-width:600px;"], _ref => {
31
+ })(["color:", ";max-width:600px;"], _ref3 => {
20
32
  var {
21
33
  theme
22
- } = _ref;
34
+ } = _ref3;
23
35
  return theme.colors.text5;
24
36
  });
25
- MDParagraph.defaultProps = {
26
- mb: 'large'
27
- };
28
37
  var OListInternal = styled.ol.withConfig({
29
38
  displayName: "common__OListInternal",
30
39
  componentId: "i00oep-2"
@@ -33,11 +42,11 @@ var UListInternal = styled.ul.withConfig({
33
42
  displayName: "common__UListInternal",
34
43
  componentId: "i00oep-3"
35
44
  })(["max-width:600px;margin-bottom:20px;"]);
36
- export var MDList = _ref2 => {
45
+ export var MDList = _ref4 => {
37
46
  var {
38
47
  ordered
39
- } = _ref2,
40
- rest = _objectWithoutProperties(_ref2, ["ordered"]);
48
+ } = _ref4,
49
+ rest = _objectWithoutProperties(_ref4, ["ordered"]);
41
50
 
42
51
  return ordered ? React.createElement(OListInternal, rest) : React.createElement(UListInternal, rest);
43
52
  };
@@ -45,11 +54,15 @@ export var MDListItem = styled.li.withConfig({
45
54
  displayName: "common__MDListItem",
46
55
  componentId: "i00oep-4"
47
56
  })(["max-width:600px;margin-bottom:4px;"]);
48
- export var MDTable = styled(Table).withConfig({
57
+ export var MDTable = styled(Table).attrs(_ref5 => {
58
+ var {
59
+ mb = 'large'
60
+ } = _ref5;
61
+ return {
62
+ mb
63
+ };
64
+ }).withConfig({
49
65
  displayName: "common__MDTable",
50
66
  componentId: "i00oep-5"
51
67
  })([""]);
52
- MDTable.defaultProps = {
53
- mb: 'large'
54
- };
55
68
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Markdown/common.tsx"],"names":["React","styled","Paragraph","Table","Heading","MDHeading","defaultProps","mb","pt","MDPar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AAE;AAAN,CAAvB","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 React from 'react'\nimport styled from 'styled-components'\nimport { Paragraph, Table, Heading } from '@looker/components'\n\n/**\n * Common styled components used by DocMarkdown\n */\n\nexport const MDHeading = styled(Heading)``\n\nMDHeading.defaultProps = {\n mb: 'xsmall',\n pt: 'xsmall',\n}\n\nexport const MDParagraph = styled(Paragraph)`\n color: ${({ theme }) => theme.colors.text5};\n max-width: 600px;\n`\nMDParagraph.defaultProps = {\n mb: 'large',\n}\n\nconst OListInternal = styled.ol`\n max-width: 600px;\n margin-bottom: 20px;\n`\n\nconst UListInternal = styled.ul`\n max-width: 600px;\n margin-bottom: 20px;\n`\n\nexport const MDList: React.FC<any> = ({ ordered, ...rest }) => {\n return ordered ? <OListInternal {...rest} /> : <UListInternal {...rest} />\n}\n\nexport const MDListItem = styled.li`\n max-width: 600px;\n margin-bottom: 4px;\n`\n\nexport const MDTable = styled(Table)``\nMDTable.defaultProps = { mb: 'large' }\n"],"file":"common.js"}
1
+ {"version":3,"sources":["../../../src/Markdown/common.tsx"],"names":["React","styled","Paragraph","Table","Heading","MDHeading","attrs","mb","pt","MDParagraph","theme","colors","text5","OListInternal","ol","UListInternal","ul","MDList","ordered","rest","MDListItem","li","MDTable"],"mappings":";;;;AAyBA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAASC,SAAT,EAAoBC,KAApB,EAA2BC,OAA3B,QAA0C,oBAA1C;AAWA,OAAO,IAAMC,SAAS,GAAGJ,MAAM,CAACG,OAAD,CAAN,CAAgBE,KAAhB,CACvB;AAAA,MAAC;AAAEC,IAAAA,EAAE,GAAG,QAAP;AAAiBC,IAAAA,EAAE,GAAG;AAAtB,GAAD;AAAA,SAAqD;AAAED,IAAAA,EAAF;AAAMC,IAAAA;AAAN,GAArD;AAAA,CADuB,CAAH;AAAA;AAAA;AAAA,QAAf;AAIP,OAAO,IAAMC,WAAW,GAAGR,MAAM,CAACC,SAAD,CAAN,CAAkBI,KAAlB,CACzB;AAAA,MAAC;AAAEC,IAAAA,EAAE,GAAG;AAAP,GAAD;AAAA,SAAuC;AACrCA,IAAAA;AADqC,GAAvC;AAAA,CADyB,CAAH;AAAA;AAAA;AAAA,oCAKb;AAAA,MAAC;AAAEG,IAAAA;AAAF,GAAD;AAAA,SAAeA,KAAK,CAACC,MAAN,CAAaC,KAA5B;AAAA,CALa,CAAjB;AASP,IAAMC,aAAa,GAAGZ,MAAM,CAACa,EAAV;AAAA;AAAA;AAAA,2CAAnB;AAKA,IAAMC,aAAa,GAAGd,MAAM,CAACe,EAAV;AAAA;AAAA;AAAA,2CAAnB;AAKA,OAAO,IAAMC,MAAqB,GAAG,SAA0B;AAAA,MAAzB;AAAEC,IAAAA;AAAF,GAAyB;AAAA,MAAXC,IAAW;;AAC7D,SAAOD,OAAO,GAAG,oBAAC,aAAD,EAAmBC,IAAnB,CAAH,GAAiC,oBAAC,aAAD,EAAmBA,IAAnB,CAA/C;AACD,CAFM;AAIP,OAAO,IAAMC,UAAU,GAAGnB,MAAM,CAACoB,EAAV;AAAA;AAAA;AAAA,0CAAhB;AAKP,OAAO,IAAMC,OAAO,GAAGrB,MAAM,CAACE,KAAD,CAAN,CAAcG,KAAd,CAAoB;AAAA,MAAC;AAAEC,IAAAA,EAAE,GAAG;AAAP,GAAD;AAAA,SAAmC;AAC5EA,IAAAA;AAD4E,GAAnC;AAAA,CAApB,CAAH;AAAA;AAAA;AAAA,QAAb","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 React from 'react'\nimport styled from 'styled-components'\nimport { Paragraph, Table, Heading } from '@looker/components'\nimport type {\n HeadingProps,\n ParagraphProps,\n TableProps,\n} from '@looker/components'\n\n/**\n * Common styled components used by DocMarkdown\n */\n\nexport const MDHeading = styled(Heading).attrs(\n ({ mb = 'xsmall', pt = 'xsmall' }: HeadingProps) => ({ mb, pt })\n)<HeadingProps>``\n\nexport const MDParagraph = styled(Paragraph).attrs(\n ({ mb = 'large' }: ParagraphProps) => ({\n mb,\n })\n)`\n color: ${({ theme }) => theme.colors.text5};\n max-width: 600px;\n`\n\nconst OListInternal = styled.ol`\n max-width: 600px;\n margin-bottom: 20px;\n`\n\nconst UListInternal = styled.ul`\n max-width: 600px;\n margin-bottom: 20px;\n`\n\nexport const MDList: React.FC<any> = ({ ordered, ...rest }) => {\n return ordered ? <OListInternal {...rest} /> : <UListInternal {...rest} />\n}\n\nexport const MDListItem = styled.li`\n max-width: 600px;\n margin-bottom: 4px;\n`\n\nexport const MDTable = styled(Table).attrs(({ mb = 'large' }: TableProps) => ({\n mb,\n}))``\n"],"file":"common.js"}
package/lib/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export { CodeDisplay } from './CodeDisplay';
2
- export { CodeEditor } from './CodeEditor';
3
- export { Markdown } from './Markdown';
1
+ export * from './CodeCopy';
2
+ export * from './CodeDisplay';
3
+ export * from './CodeEditor';
4
+ export * from './Markdown';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":["CodeDisplay","CodeEditor","Markdown"],"mappings":"AAyBA,SAASA,WAAT,QAA4B,eAA5B;AAEA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,QAAT,QAAyB,YAAzB","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 { CodeDisplay } from './CodeDisplay'\nexport type { CodeDisplayProps } from './CodeDisplay'\nexport { CodeEditor } from './CodeEditor'\nexport { Markdown } from './Markdown'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":"AAyBA,cAAc,YAAd;AACA,cAAc,eAAd;AACA,cAAc,cAAd;AACA,cAAc,YAAd","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"],"file":"index.js"}
@@ -1,2 +1,2 @@
1
- export { getPrismLanguage, getOverridenTheme, instanceOfPrismLanguage } from './utils';
1
+ export { getPrismLanguage, getOverriddenTheme, instanceOfPrismLanguage } from './utils';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/index.ts"],"names":["getPrismLanguage","getOverridenTheme","instanceOfPrismLanguage"],"mappings":"AAyBA,SACEA,gBADF,EAEEC,iBAFF,EAGEC,uBAHF,QAIO,SAJP","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 getOverridenTheme,\n instanceOfPrismLanguage,\n} from './utils'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/utils/index.ts"],"names":["getPrismLanguage","getOverriddenTheme","instanceOfPrismLanguage"],"mappings":"AAyBA,SACEA,gBADF,EAEEC,kBAFF,EAGEC,uBAHF,QAIO,SAJP","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"],"file":"index.js"}
@@ -17,7 +17,7 @@ export var getPrismLanguage = language => {
17
17
 
18
18
  return instanceOfPrismLanguage(language) ? language : 'markup';
19
19
  };
20
- export var getOverridenTheme = (transparent, inline) => {
20
+ export var getOverriddenTheme = (transparent, inline) => {
21
21
  if (inline) {
22
22
  inlineTheme.plain.backgroundColor = theme.colors.ui1;
23
23
  inlineTheme.plain.border = "1px solid ".concat(theme.colors.ui2);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/utils.ts"],"names":["theme","Prism","blockTheme","inlineTheme","instanceOfPrismLanguage","languageName","extraHighlightingEngines","Object","keys","languages","includes","getPrismLanguage","language","toLowerCase","getOverridenTheme","transparent","inline","plain","backgroundColor","colors","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AAA,WAAW,CAACc,KAAZ,CAAkBQ,QAAlB,GAA6BzB,KAAK,CAAC0B,SAAN,CAAgBC,KAA7C;AACA,WAAOxB,WAAP;AACD,GAPD,MAOO,IAAIY,WAAJ,EAAiB;AACtBb,IAAAA,UAAU,CAACe,KAAX,CAAiBC,eAAjB,GAAmC,MAAnC;AACAhB,IAAAA,UAAU,CAACe,KAAX,CAAiBO,OAAjB,GAA2B,KAA3B;AACD,GAHM,MAGA;AACLtB,IAAAA,UAAU,CAACe,KAAX,CAAiBC,eAAjB,GAAmClB,KAAK,CAACmB,MAAN,CAAaS,IAAhD;AACA1B,IAAAA,UAAU,CAACe,KAAX,CAAiBO,OAAjB,GAA2B,MAA3B;AACD;;AACD,SAAOtB,UAAP;AACD,CAhBM","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 { Language, 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 getOverridenTheme = (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"],"file":"utils.js"}
1
+ {"version":3,"sources":["../../../src/utils/utils.ts"],"names":["theme","Prism","blockTheme","inlineTheme","instanceOfPrismLanguage","languageName","extraHighlightingEngines","Object","keys","languages","includes","getPrismLanguage","language","toLowerCase","getOverriddenTheme","transparent","inline","plain","backgroundColor","colors","ui1","border","ui2","borderRadius","padding","fontSize","fontSizes","small","text"],"mappings":"AAyBA,SAASA,KAAT,QAAsB,oBAAtB;AAEA,SAASC,KAAT,QAAsB,sBAAtB;AACA,OAAOC,UAA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,EAAiB;AACtBb,IAAAA,UAAU,CAACe,KAAX,CAAiBC,eAAjB,GAAmC,MAAnC;AACAhB,IAAAA,UAAU,CAACe,KAAX,CAAiBO,OAAjB,GAA2B,KAA3B;AACD,GAHM,MAGA;AACLtB,IAAAA,UAAU,CAACe,KAAX,CAAiBC,eAAjB,GAAmClB,KAAK,CAACmB,MAAN,CAAaS,IAAhD;AACA1B,IAAAA,UAAU,CAACe,KAAX,CAAiBO,OAAjB,GAA2B,MAA3B;AACD;;AACD,SAAOtB,UAAP;AACD,CAhBM","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"],"file":"utils.js"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { CodeDisplay } from './CodeDisplay';
2
- export type { CodeDisplayProps } from './CodeDisplay';
3
- export { CodeEditor } from './CodeEditor';
4
- export { Markdown } from './Markdown';
1
+ export * from './CodeCopy';
2
+ export * from './CodeDisplay';
3
+ export * from './CodeEditor';
4
+ export * from './Markdown';
package/lib/index.js CHANGED
@@ -3,28 +3,56 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "CodeDisplay", {
7
- enumerable: true,
8
- get: function get() {
9
- return _CodeDisplay.CodeDisplay;
10
- }
11
- });
12
- Object.defineProperty(exports, "CodeEditor", {
13
- enumerable: true,
14
- get: function get() {
15
- return _CodeEditor.CodeEditor;
16
- }
17
- });
18
- Object.defineProperty(exports, "Markdown", {
19
- enumerable: true,
20
- get: function get() {
21
- return _Markdown.Markdown;
22
- }
6
+
7
+ var _CodeCopy = require("./CodeCopy");
8
+
9
+ Object.keys(_CodeCopy).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _CodeCopy[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _CodeCopy[key];
16
+ }
17
+ });
23
18
  });
24
19
 
25
20
  var _CodeDisplay = require("./CodeDisplay");
26
21
 
22
+ Object.keys(_CodeDisplay).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _CodeDisplay[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _CodeDisplay[key];
29
+ }
30
+ });
31
+ });
32
+
27
33
  var _CodeEditor = require("./CodeEditor");
28
34
 
35
+ Object.keys(_CodeEditor).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _CodeEditor[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _CodeEditor[key];
42
+ }
43
+ });
44
+ });
45
+
29
46
  var _Markdown = require("./Markdown");
47
+
48
+ Object.keys(_Markdown).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _Markdown[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function get() {
54
+ return _Markdown[key];
55
+ }
56
+ });
57
+ });
30
58
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA;;AAEA;;AACA","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 { CodeDisplay } from './CodeDisplay'\nexport type { CodeDisplayProps } from './CodeDisplay'\nexport { CodeEditor } from './CodeEditor'\nexport { Markdown } from './Markdown'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAyBA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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"],"file":"index.js"}
@@ -1 +1 @@
1
- export { getPrismLanguage, getOverridenTheme, instanceOfPrismLanguage, } from './utils';
1
+ export { getPrismLanguage, getOverriddenTheme, instanceOfPrismLanguage, } from './utils';
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "getPrismLanguage", {
9
9
  return _utils.getPrismLanguage;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "getOverridenTheme", {
12
+ Object.defineProperty(exports, "getOverriddenTheme", {
13
13
  enumerable: true,
14
14
  get: function get() {
15
- return _utils.getOverridenTheme;
15
+ return _utils.getOverriddenTheme;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "instanceOfPrismLanguage", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA","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 getOverridenTheme,\n instanceOfPrismLanguage,\n} from './utils'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA","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"],"file":"index.js"}
@@ -1,14 +1,14 @@
1
- import { Language } from 'prism-react-renderer';
1
+ import type { Language } from 'prism-react-renderer';
2
2
  export declare const instanceOfPrismLanguage: (languageName: string) => boolean;
3
3
  export declare const getPrismLanguage: (language: string) => Language;
4
- export declare const getOverridenTheme: (transparent: boolean, inline: boolean) => {
4
+ export declare const getOverriddenTheme: (transparent: boolean, inline: boolean) => {
5
5
  plain: {
6
6
  [styleKey: string]: string | number | void;
7
7
  color?: string | undefined;
8
8
  backgroundColor?: string | undefined;
9
9
  fontStyle?: "normal" | "italic" | undefined;
10
- fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
11
- textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
10
+ fontWeight?: "bold" | "normal" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
11
+ textDecorationLine?: "none" | "line-through" | "underline" | "underline line-through" | undefined;
12
12
  opacity?: number | undefined;
13
13
  };
14
14
  styles: {
@@ -18,8 +18,8 @@ export declare const getOverridenTheme: (transparent: boolean, inline: boolean)
18
18
  color?: string | undefined;
19
19
  backgroundColor?: string | undefined;
20
20
  fontStyle?: "normal" | "italic" | undefined;
21
- fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
22
- textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
21
+ fontWeight?: "bold" | "normal" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
22
+ textDecorationLine?: "none" | "line-through" | "underline" | "underline line-through" | undefined;
23
23
  opacity?: number | undefined;
24
24
  };
25
25
  languages?: Language[] | undefined;