@looker/code-editor 0.1.30 → 0.1.31
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 +112 -148
- package/README.md +13 -13
- package/lib/CodeCopy/CodeCopy.d.ts +2 -2
- package/lib/CodeCopy/CodeCopy.js.map +1 -1
- package/lib/CodeCopy/index.js.map +1 -1
- package/lib/CodeDisplay/CodeDisplay.js +5 -5
- package/lib/CodeDisplay/CodeDisplay.js.map +1 -1
- package/lib/CodeDisplay/CodeWrapper.js.map +1 -1
- package/lib/CodeDisplay/LineItem.js.map +1 -1
- package/lib/CodeDisplay/index.js.map +1 -1
- package/lib/CodeDisplay/types.d.ts +1 -1
- package/lib/CodeDisplay/types.js.map +1 -1
- package/lib/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/CodeEditor/index.js.map +1 -1
- package/lib/Markdown/Markdown.d.ts +2 -1
- package/lib/Markdown/Markdown.js +1 -1
- package/lib/Markdown/Markdown.js.map +1 -1
- package/lib/Markdown/TableCell.js.map +1 -1
- package/lib/Markdown/common.js +10 -14
- package/lib/Markdown/common.js.map +1 -1
- package/lib/Markdown/index.js.map +1 -1
- package/lib/Markdown/utils.js.map +1 -1
- package/lib/esm/CodeCopy/CodeCopy.js +7 -15
- package/lib/esm/CodeCopy/CodeCopy.js.map +1 -1
- package/lib/esm/CodeCopy/index.js +1 -16
- package/lib/esm/CodeCopy/index.js.map +1 -1
- package/lib/esm/CodeDisplay/CodeDisplay.js +22 -32
- package/lib/esm/CodeDisplay/CodeDisplay.js.map +1 -1
- package/lib/esm/CodeDisplay/CodeWrapper.js +6 -14
- package/lib/esm/CodeDisplay/CodeWrapper.js.map +1 -1
- package/lib/esm/CodeDisplay/LineItem.js +3 -11
- package/lib/esm/CodeDisplay/LineItem.js.map +1 -1
- package/lib/esm/CodeDisplay/index.js +1 -12
- package/lib/esm/CodeDisplay/index.js.map +1 -1
- package/lib/esm/CodeDisplay/types.js.map +1 -1
- package/lib/esm/CodeEditor/CodeEditor.js +6 -14
- package/lib/esm/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/esm/CodeEditor/index.js +1 -12
- package/lib/esm/CodeEditor/index.js.map +1 -1
- package/lib/esm/Markdown/Markdown.js +32 -40
- package/lib/esm/Markdown/Markdown.js.map +1 -1
- package/lib/esm/Markdown/TableCell.js +4 -12
- package/lib/esm/Markdown/TableCell.js.map +1 -1
- package/lib/esm/Markdown/common.js +17 -29
- package/lib/esm/Markdown/common.js.map +1 -1
- package/lib/esm/Markdown/index.js +1 -16
- package/lib/esm/Markdown/index.js.map +1 -1
- package/lib/esm/Markdown/utils.js +10 -24
- package/lib/esm/Markdown/utils.js.map +1 -1
- package/lib/esm/index.js +4 -49
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/test-data/codeBlob.js +1 -8
- package/lib/esm/test-data/codeBlob.js.map +1 -1
- package/lib/esm/test-data/index.js +1 -12
- package/lib/esm/test-data/index.js.map +1 -1
- package/lib/esm/utils/index.js +1 -24
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/esm/utils/utils.js +19 -29
- package/lib/esm/utils/utils.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/test-data/codeBlob.js +1 -2
- package/lib/test-data/codeBlob.js.map +1 -1
- package/lib/test-data/index.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/utils.js.map +1 -1
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeDisplay.js","names":["_react","_interopRequireDefault","require","_styledComponents","_components","_prismReactRenderer","_interopRequireWildcard","_utils","_CodeWrapper","_LineItem","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"file":"CodeDisplay.js","names":["_react","_interopRequireDefault","require","_styledComponents","_components","_prismReactRenderer","_interopRequireWildcard","_utils","_CodeWrapper","_LineItem","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_extends","assign","bind","target","arguments","length","source","key","apply","global","window","Prism","Line","styled","Span","withConfig","displayName","componentId","LineNo","LineContent","CodeDisplay","_ref","language","code","pattern","transparent","inline","lineNumbers","createElement","defaultProps","trim","getPrismLanguage","theme","getOverriddenTheme","_ref2","className","style","tokens","getLineProps","getTokenProps","CodeWrapper","map","line","token","tokenProps","LineItem","index","exports"],"sources":["../../src/CodeDisplay/CodeDisplay.tsx"],"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, { Prism, defaultProps } from 'prism-react-renderer';\n\nimport { getOverriddenTheme, getPrismLanguage } 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"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA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ACXqC,UAAU,EAAEA,UAAW;QACvBpB,OAAO,EAAEA;MAAQ,CAClB,CAAC;IAEN,CAAC,CACU,CACT,CACP,CACU,CAAC;EAAA,CAEP,CAAC;AAEhB,CAAC;AAACuB,OAAA,CAAA3B,WAAA,GAAAA,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeWrapper.js","names":["_react","_interopRequireDefault","require","_styledComponents","obj","__esModule","default","Pre","styled","pre","withConfig","displayName","componentId","Code","code","CodeWrapper","_ref","className","style","inline","children","Wrapper","createElement","exports"],"sources":["../../src/CodeDisplay/CodeWrapper.tsx"],"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'
|
|
1
|
+
{"version":3,"file":"CodeWrapper.js","names":["_react","_interopRequireDefault","require","_styledComponents","obj","__esModule","default","Pre","styled","pre","withConfig","displayName","componentId","Code","code","CodeWrapper","_ref","className","style","inline","children","Wrapper","createElement","exports"],"sources":["../../src/CodeDisplay/CodeWrapper.tsx"],"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"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AASvC,IAAMG,GAAG,GAAGC,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+IAcrB;AACD,IAAMC,IAAI,GAAGL,yBAAM,CAACM,IAAI,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wCAKvB;AAKM,IAAMG,WAAiC,GAAGC,IAAA,IAK3C;EAAA,IAL4C;IAChDC,SAAS;IACTC,KAAK;IACLC,MAAM;IACNC;EACF,CAAC,GAAAJ,IAAA;EACC,IAAMK,OAAO,GAAGF,MAAM,GAAGN,IAAI,GAAGN,GAAG;EACnC,OACEP,MAAA,CAAAM,OAAA,CAAAgB,aAAA,CAACD,OAAO;IAACJ,SAAS,EAAEA,SAAU;IAACC,KAAK,EAAEA;EAAM,GACzCE,QACM,CAAC;AAEd,CAAC;AAACG,OAAA,CAAAR,WAAA,GAAAA,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineItem.js","names":["_react","_interopRequireDefault","require","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","LineItem","_ref","index","tokenProps","pattern","text","children","toLowerCase","includes","className","createElement","exports"],"sources":["../../src/CodeDisplay/LineItem.tsx"],"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'
|
|
1
|
+
{"version":3,"file":"LineItem.js","names":["_react","_interopRequireDefault","require","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","LineItem","_ref","index","tokenProps","pattern","text","children","toLowerCase","includes","className","createElement","exports"],"sources":["../../src/CodeDisplay/LineItem.tsx"],"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"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AASnB,IAAMQ,QAA2B,GAAGC,IAAA,IAAoC;EAAA,IAAnC;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAQ,CAAC,GAAAH,IAAA;EACxE,IAAMI,IAAI,GAAGF,UAAU,CAACG,QAAQ,CAACC,WAAW,CAAC,CAAC;EAC9C,IAAIH,OAAO,KAAK,EAAE,IAAIC,IAAI,CAACG,QAAQ,CAACJ,OAAO,CAACG,WAAW,CAAC,CAAC,CAAC,EAAE;IAC1DJ,UAAU,CAACM,SAAS,IAAI,QAAQ;EAClC;EACA,OAAO7B,MAAA,CAAAK,OAAA,CAAAyB,aAAA,SAAAxB,QAAA;IAAMS,GAAG,EAAEO;EAAM,GAAKC,UAAU,CAAG,CAAC;AAC7C,CAAC;AAACQ,OAAA,CAAAX,QAAA,GAAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_CodeDisplay","require"],"sources":["../../src/CodeDisplay/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 { CodeDisplay } from './CodeDisplay'
|
|
1
|
+
{"version":3,"file":"index.js","names":["_CodeDisplay","require"],"sources":["../../src/CodeDisplay/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 { CodeDisplay } from './CodeDisplay';\nexport type { CodeDisplayProps } from './types';\n"],"mappings":";;;;;;;;;;;AAyBA,IAAAA,YAAA,GAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/CodeDisplay/types.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 */\n\nexport interface CodeDisplayProps {\n code: string
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/CodeDisplay/types.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 */\n\nexport interface CodeDisplayProps {\n code: string;\n language?: string;\n pattern?: string;\n transparent?: boolean;\n inline?: boolean;\n lineNumbers?: boolean;\n}\n\nexport type TokenOutputProps = {\n key?: React.Key;\n style?: any;\n className: string;\n children: string;\n [otherProp: string]: any;\n};\n\nexport interface LineItemProps {\n index: number;\n tokenProps: TokenOutputProps;\n pattern: string;\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.js","names":["_react","_interopRequireDefault","require","_reactSimpleCodeEditor","_index","obj","__esModule","default","CodeEditor","_ref","code","onChange","language","pattern","transparent","lineNumbers","createElement","value","trim","role","onValueChange","highlight","CodeDisplay","padding","style","width","color","whiteSpace","overflow","fontFamily","exports"],"sources":["../../src/CodeEditor/CodeEditor.tsx"],"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'
|
|
1
|
+
{"version":3,"file":"CodeEditor.js","names":["_react","_interopRequireDefault","require","_reactSimpleCodeEditor","_index","obj","__esModule","default","CodeEditor","_ref","code","onChange","language","pattern","transparent","lineNumbers","createElement","value","trim","role","onValueChange","highlight","CodeDisplay","padding","style","width","color","whiteSpace","overflow","fontFamily","exports"],"sources":["../../src/CodeEditor/CodeEditor.tsx"],"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"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AAAuC,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAWhC,IAAMG,UAA+B,GAAGC,IAAA,IAOzC;EAAA,IAP0C;IAC9CC,IAAI;IACJC,QAAQ;IACRC,QAAQ,GAAG,MAAM;IACjBC,OAAO,GAAG,EAAE;IACZC,WAAW,GAAG,KAAK;IACnBC,WAAW,GAAG;EAChB,CAAC,GAAAN,IAAA;EACC,OACET,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACb,sBAAA,CAAAI,OAAM;IACLU,KAAK,EAAEP,IAAI,CAACQ,IAAI,CAAC,CAAE;IACnBC,IAAI,EAAE,aAAc;IACpBC,aAAa,EAAET,QAAS;IACxBU,SAAS,EAAGX,IAAY,IACtBV,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACZ,MAAA,CAAAkB,WAAW;MACVZ,IAAI,EAAEA,IAAK;MACXE,QAAQ,EAAEA,QAAS;MACnBC,OAAO,EAAEA,OAAQ;MACjBC,WAAW,EAAEA,WAAY;MACzBC,WAAW,EAAEA;IAAY,CAC1B,CACD;IACFQ,OAAO,EAAC,MAAM;IACdC,KAAK,EAAE;MACLC,KAAK,EAAE,MAAM;MACbC,KAAK,EAAE,MAAM;MACbC,UAAU,EAAE,UAAU;MACtBC,QAAQ,EAAE,MAAM;MAChBC,UAAU,EAAE;IACd;EAAE,CACH,CAAC;AAEN,CAAC;AAACC,OAAA,CAAAtB,UAAA,GAAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_CodeEditor","require"],"sources":["../../src/CodeEditor/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 { CodeEditor } from './CodeEditor'
|
|
1
|
+
{"version":3,"file":"index.js","names":["_CodeEditor","require"],"sources":["../../src/CodeEditor/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 { CodeEditor } from './CodeEditor';\n"],"mappings":";;;;;;;;;;;AAyBA,IAAAA,WAAA,GAAAC,OAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
interface MarkdownProps {
|
|
3
4
|
source: string;
|
|
4
5
|
pattern?: string;
|
|
@@ -8,5 +9,5 @@ interface MarkdownProps {
|
|
|
8
9
|
children: ReactNode;
|
|
9
10
|
}) => ReactNode;
|
|
10
11
|
}
|
|
11
|
-
export declare const Markdown: ({ source, pattern, transformLinkUri, linkClickHandler, paragraphOverride, }: MarkdownProps) => JSX.Element;
|
|
12
|
+
export declare const Markdown: ({ source, pattern, transformLinkUri, linkClickHandler, paragraphOverride, }: MarkdownProps) => React.JSX.Element;
|
|
12
13
|
export {};
|
package/lib/Markdown/Markdown.js
CHANGED
|
@@ -100,7 +100,7 @@ var Markdown = _ref => {
|
|
|
100
100
|
rehypePlugins: [_rehypeRaw.default],
|
|
101
101
|
transformLinkUri: transformLinkUri,
|
|
102
102
|
components: components
|
|
103
|
-
}, (0, _utils.qualifyMarkdownText)(source, pattern)));
|
|
103
|
+
}, (0, _utils.qualifyMarkdownText)(source, pattern !== null && pattern !== void 0 ? pattern : '')));
|
|
104
104
|
};
|
|
105
105
|
exports.Markdown = Markdown;
|
|
106
106
|
var MarkdownWrapper = _styledComponents.default.div.withConfig({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.js","names":["_react","_interopRequireDefault","require","_styledComponents","_reactMarkdown","_rehypeRaw","_remarkGfm","_components","_CodeDisplay","_utils","_TableCell","_common","obj","__esModule","default","Markdown","_ref","source","pattern","transformLinkUri","linkClickHandler","paragraphOverride","findAnchor","ele","tagName","parentElement","undefined","handleClick","e","preventDefault","a","target","getAttribute","heading","_ref2","level","children","createElement","MDHeading","as","concat","paragraph","_ref3","MDParagraph","code","_ref4","inline","text","language","prepareCodeText","toString","codeProps","lineNumbers","CodeDisplay","components","h1","h2","h3","h4","h5","h6","p","Link","ul","MDList","ol","link","li","MDListItem","table","MDTable","thead","TableHead","tbody","TableBody","tr","TableRow","td","TableCell","th","MarkdownWrapper","onClick","remarkPlugins","gfm","rehypePlugins","rehypeRaw","qualifyMarkdownText","exports","styled","div","withConfig","displayName","componentId"],"sources":["../../src/Markdown/Markdown.tsx"],"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, ReactNode } from 'react'
|
|
1
|
+
{"version":3,"file":"Markdown.js","names":["_react","_interopRequireDefault","require","_styledComponents","_reactMarkdown","_rehypeRaw","_remarkGfm","_components","_CodeDisplay","_utils","_TableCell","_common","obj","__esModule","default","Markdown","_ref","source","pattern","transformLinkUri","linkClickHandler","paragraphOverride","findAnchor","ele","tagName","parentElement","undefined","handleClick","e","preventDefault","a","target","getAttribute","heading","_ref2","level","children","createElement","MDHeading","as","concat","paragraph","_ref3","MDParagraph","code","_ref4","inline","text","language","prepareCodeText","toString","codeProps","lineNumbers","CodeDisplay","components","h1","h2","h3","h4","h5","h6","p","Link","ul","MDList","ol","link","li","MDListItem","table","MDTable","thead","TableHead","tbody","TableBody","tr","TableRow","td","TableCell","th","MarkdownWrapper","onClick","remarkPlugins","gfm","rehypePlugins","rehypeRaw","qualifyMarkdownText","exports","styled","div","withConfig","displayName","componentId"],"sources":["../../src/Markdown/Markdown.tsx"],"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, 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 { Link, TableBody, TableHead, TableRow } from '@looker/components';\n\nimport { CodeDisplay } from '../CodeDisplay';\nimport { prepareCodeText, qualifyMarkdownText } 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 = ({\n source,\n pattern = '',\n transformLinkUri,\n linkClickHandler,\n paragraphOverride,\n}: MarkdownProps) => {\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] as any}\n rehypePlugins={[rehypeRaw] as any}\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"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAA+E,SAAAD,uBAAAW,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAYxE,IAAMG,QAAQ,GAAGC,IAAA,IAMH;EAAA,IANI;IACvBC,MAAM;IACNC,OAAO,GAAG,EAAE;IACZC,gBAAgB;IAChBC,gBAAgB;IAChBC;EACa,CAAC,GAAAL,IAAA;EACd,IAAMM,UAAU,GAAIC,GAAgB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,CAAAxE,QAAA,GAAAA,QAAA;AAEF,IAAMiE,eAAe,GAAGQ,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gKAajC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.js","names":["_react","_interopRequireDefault","require","_components","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","TableCell","_ref","isHeader","rest","createElement","TableHeaderCell","TableDataCell","exports"],"sources":["../../src/Markdown/TableCell.tsx"],"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'
|
|
1
|
+
{"version":3,"file":"TableCell.js","names":["_react","_interopRequireDefault","require","_components","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","TableCell","_ref","isHeader","rest","createElement","TableHeaderCell","TableDataCell","exports"],"sources":["../../src/Markdown/TableCell.tsx"],"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"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAoE,IAAAE,SAAA;AAAA,SAAAH,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OA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CAAC;AAAA;AAACI,OAAA,CAAAP,SAAA,GAAAA,SAAA"}
|
package/lib/Markdown/common.js
CHANGED
|
@@ -11,7 +11,7 @@ var _excluded = ["ordered"];
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
13
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
|
-
var MDHeading = (0, _styledComponents.default)(_components.Heading).attrs(_ref => {
|
|
14
|
+
var MDHeading = exports.MDHeading = (0, _styledComponents.default)(_components.Heading).attrs(_ref => {
|
|
15
15
|
var {
|
|
16
16
|
mb = 'xsmall',
|
|
17
17
|
pt = 'xsmall'
|
|
@@ -22,10 +22,9 @@ var MDHeading = (0, _styledComponents.default)(_components.Heading).attrs(_ref =
|
|
|
22
22
|
};
|
|
23
23
|
}).withConfig({
|
|
24
24
|
displayName: "common__MDHeading",
|
|
25
|
-
componentId: "
|
|
25
|
+
componentId: "i00oep-0"
|
|
26
26
|
})([""]);
|
|
27
|
-
exports.
|
|
28
|
-
var MDParagraph = (0, _styledComponents.default)(_components.Paragraph).attrs(_ref2 => {
|
|
27
|
+
var MDParagraph = exports.MDParagraph = (0, _styledComponents.default)(_components.Paragraph).attrs(_ref2 => {
|
|
29
28
|
var {
|
|
30
29
|
mb = 'large'
|
|
31
30
|
} = _ref2;
|
|
@@ -34,17 +33,16 @@ var MDParagraph = (0, _styledComponents.default)(_components.Paragraph).attrs(_r
|
|
|
34
33
|
};
|
|
35
34
|
}).withConfig({
|
|
36
35
|
displayName: "common__MDParagraph",
|
|
37
|
-
componentId: "
|
|
36
|
+
componentId: "i00oep-1"
|
|
38
37
|
})(["color:", ";max-width:600px;"], _ref3 => {
|
|
39
38
|
var {
|
|
40
39
|
theme
|
|
41
40
|
} = _ref3;
|
|
42
41
|
return theme.colors.text5;
|
|
43
42
|
});
|
|
44
|
-
exports.MDParagraph = MDParagraph;
|
|
45
43
|
var OListInternal = _styledComponents.default.ol.withConfig({
|
|
46
44
|
displayName: "common__OListInternal",
|
|
47
|
-
componentId: "
|
|
45
|
+
componentId: "i00oep-2"
|
|
48
46
|
})(["color:", ";max-width:600px;margin-bottom:20px;"], _ref4 => {
|
|
49
47
|
var {
|
|
50
48
|
theme
|
|
@@ -53,7 +51,7 @@ var OListInternal = _styledComponents.default.ol.withConfig({
|
|
|
53
51
|
});
|
|
54
52
|
var UListInternal = _styledComponents.default.ul.withConfig({
|
|
55
53
|
displayName: "common__UListInternal",
|
|
56
|
-
componentId: "
|
|
54
|
+
componentId: "i00oep-3"
|
|
57
55
|
})(["color:", ";max-width:600px;margin-bottom:20px;"], _ref5 => {
|
|
58
56
|
var {
|
|
59
57
|
theme
|
|
@@ -68,17 +66,16 @@ var MDList = _ref6 => {
|
|
|
68
66
|
return ordered ? _react.default.createElement(OListInternal, rest) : _react.default.createElement(UListInternal, rest);
|
|
69
67
|
};
|
|
70
68
|
exports.MDList = MDList;
|
|
71
|
-
var MDListItem = _styledComponents.default.li.withConfig({
|
|
69
|
+
var MDListItem = exports.MDListItem = _styledComponents.default.li.withConfig({
|
|
72
70
|
displayName: "common__MDListItem",
|
|
73
|
-
componentId: "
|
|
71
|
+
componentId: "i00oep-4"
|
|
74
72
|
})(["color:", ";max-width:600px;margin-bottom:4px;line-height:1.5;"], _ref7 => {
|
|
75
73
|
var {
|
|
76
74
|
theme
|
|
77
75
|
} = _ref7;
|
|
78
76
|
return theme.colors.text5;
|
|
79
77
|
});
|
|
80
|
-
exports.
|
|
81
|
-
var MDTable = (0, _styledComponents.default)(_components.Table).attrs(_ref8 => {
|
|
78
|
+
var MDTable = exports.MDTable = (0, _styledComponents.default)(_components.Table).attrs(_ref8 => {
|
|
82
79
|
var {
|
|
83
80
|
mb = 'large'
|
|
84
81
|
} = _ref8;
|
|
@@ -87,7 +84,6 @@ var MDTable = (0, _styledComponents.default)(_components.Table).attrs(_ref8 => {
|
|
|
87
84
|
};
|
|
88
85
|
}).withConfig({
|
|
89
86
|
displayName: "common__MDTable",
|
|
90
|
-
componentId: "
|
|
87
|
+
componentId: "i00oep-5"
|
|
91
88
|
})([""]);
|
|
92
|
-
exports.MDTable = MDTable;
|
|
93
89
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","names":["_react","_interopRequireDefault","require","_styledComponents","_components","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","MDHeading","styled","Heading","attrs","_ref","mb","pt","withConfig","displayName","componentId","
|
|
1
|
+
{"version":3,"file":"common.js","names":["_react","_interopRequireDefault","require","_styledComponents","_components","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","MDHeading","exports","styled","Heading","attrs","_ref","mb","pt","withConfig","displayName","componentId","MDParagraph","Paragraph","_ref2","_ref3","theme","colors","text5","OListInternal","ol","_ref4","UListInternal","ul","_ref5","MDList","_ref6","ordered","rest","createElement","MDListItem","li","_ref7","MDTable","Table","_ref8"],"sources":["../../src/Markdown/common.tsx"],"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 { Heading, Paragraph, Table } 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)<ParagraphProps>`\n color: ${({ theme }) => theme.colors.text5};\n max-width: 600px;\n`;\n\nconst OListInternal = styled.ol`\n color: ${({ theme }) => theme.colors.text5};\n max-width: 600px;\n margin-bottom: 20px;\n`;\n\nconst UListInternal = styled.ul`\n color: ${({ theme }) => theme.colors.text5};\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 color: ${({ theme }) => theme.colors.text5};\n max-width: 600px;\n margin-bottom: 4px;\n line-height: 1.5;\n`;\n\nexport const MDTable = styled(Table).attrs(({ mb = 'large' }: TableProps) => ({\n mb,\n}))``;\n"],"mappings":";;;;;;AAyBA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAA+D,IAAAG,SAAA;AAAA,SAAAJ,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,MAAA,EAAAC,QAAA,QAAAD,MAAA,yBAAAE,MAAA,GAAAC,6BAAA,CAAAH,MAAA,EAAAC,QAAA,OAAAG,GAAA,EAAAC,CAAA,MAAAC,MAAA,CAAAC,qBAAA,QAAAC,gBAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAP,MAAA,QAAAK,CAAA,MAAAA,CAAA,GAAAG,gBAAA,CAAAC,MAAA,EAAAJ,CAAA,MAAAD,GAAA,GAAAI,gBAAA,CAAAH,CAAA,OAAAJ,QAAA,CAAAS,OAAA,CAAAN,GAAA,uBAAAE,MAAA,CAAAK,SAAA,CAAAC,oBAAA,CAAAC,IAAA,CAAAb,MAAA,EAAAI,GAAA,aAAAF,MAAA,CAAAE,GAAA,IAAAJ,MAAA,CAAAI,GAAA,cAAAF,MAAA;AAAA,SAAAC,8BAAAH,MAAA,EAAAC,QAAA,QAAAD,MAAA,yBAAAE,MAAA,WAAAY,UAAA,GAAAR,MAAA,CAAAS,IAAA,CAAAf,MAAA,OAAAI,GAAA,EAAAC,CAAA,OAAAA,CAAA,MAAAA,CAAA,GAAAS,UAAA,CAAAL,MAAA,EAAAJ,CAAA,MAAAD,GAAA,GAAAU,UAAA,CAAAT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O,MAAqB,GAAGC,KAAA,IAA0B;EAAA,IAAzB;MAAEC;IAAiB,CAAC,GAAAD,KAAA;IAANE,IAAI,GAAA5C,wBAAA,CAAA0C,KAAA,EAAA9C,SAAA;EACtD,OAAO+C,OAAO,GAAGpD,MAAA,CAAAQ,OAAA,CAAA8C,aAAA,CAACV,aAAa,EAAKS,IAAO,CAAC,GAAGrD,MAAA,CAAAQ,OAAA,CAAA8C,aAAA,CAACP,aAAa,EAAKM,IAAO,CAAC;AAC5E,CAAC;AAAC1B,OAAA,CAAAuB,MAAA,GAAAA,MAAA;AAEK,IAAMK,UAAU,GAAA5B,OAAA,CAAA4B,UAAA,GAAG3B,yBAAM,CAAC4B,EAAE,CAAAtB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,sEACxBqB,KAAA;EAAA,IAAC;IAAEhB;EAAM,CAAC,GAAAgB,KAAA;EAAA,OAAKhB,KAAK,CAACC,MAAM,CAACC,KAAK;AAAA,EAI3C;AAEM,IAAMe,OAAO,GAAA/B,OAAA,CAAA+B,OAAA,GAAG,IAAA9B,yBAAM,EAAC+B,iBAAK,CAAC,CAAC7B,KAAK,CAAC8B,KAAA;EAAA,IAAC;IAAE5B,EAAE,GAAG;EAAoB,CAAC,GAAA4B,KAAA;EAAA,OAAM;IAC5E5B;EACF,CAAC;AAAA,CAAC,CAAC,CAAAE,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,QAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Markdown","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../src/Markdown/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 './Markdown'
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Markdown","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../src/Markdown/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 './Markdown';\n"],"mappings":";;;;;AAyBA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_utils","require","regReplaceAll","content","pattern","replacementFunc","target","RegExp","replace","exports","addMarkTags","searchPattern","markedContent","replacement","match","concat","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'
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_utils","require","regReplaceAll","content","pattern","replacementFunc","target","RegExp","replace","exports","addMarkTags","searchPattern","markedContent","replacement","match","concat","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":";;;;;;AAyBA,IAAAA,MAAA,GAAAC,OAAA;AAEO,IAAMC,aAAa,GAAGA,CAC3BC,OAAe,EACfC,OAAe,EACfC,eAAoB,KACjB;EACH,IAAMC,MAAM,GAAG,IAAIC,MAAM,CAACH,OAAO,EAAE,IAAI,CAAC;EACxC,OAAOD,OAAO,CAACK,OAAO,CAACF,MAAM,EAAED,eAAe,CAAC;AACjD,CAAC;AAACI,OAAA,CAAAP,aAAA,GAAAA,aAAA;AAOK,IAAMQ,WAAW,GAAGA,CAACP,OAAe,EAAEQ,aAAqB,KAAK;EACrE,IAAIC,aAAa;EACjB,IAAI;IACF,IAAMC,WAAW,GAAIC,KAAa,aAAAC,MAAA,CAAcD,KAAK,YAAS;IAC9DF,aAAa,GAAGV,aAAa,CAACC,OAAO,EAAEQ,aAAa,EAAEE,WAAW,CAAC;EACpE,CAAC,CAAC,OAAOG,CAAC,EAAE;IACVJ,aAAa,GAAGT,OAAO;EACzB;EACA,OAAOS,aAAa;AACtB,CAAC;AAACH,OAAA,CAAAC,WAA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|
-
var _components = require("@looker/components");
|
|
9
|
-
var _ = require("..");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
var CodeCopy = _ref => {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CopyToClipboard, Space } from '@looker/components';
|
|
3
|
+
import { CodeDisplay } from '..';
|
|
4
|
+
export var CodeCopy = _ref => {
|
|
12
5
|
var {
|
|
13
6
|
language = 'json',
|
|
14
7
|
code,
|
|
@@ -18,20 +11,19 @@ var CodeCopy = _ref => {
|
|
|
18
11
|
inline = false,
|
|
19
12
|
lineNumbers = true
|
|
20
13
|
} = _ref;
|
|
21
|
-
return
|
|
14
|
+
return React.createElement(Space, {
|
|
22
15
|
between: true,
|
|
23
16
|
align: "start",
|
|
24
17
|
pt: "xsmall"
|
|
25
|
-
},
|
|
18
|
+
}, React.createElement(CodeDisplay, {
|
|
26
19
|
code: code,
|
|
27
20
|
language: language,
|
|
28
21
|
pattern: pattern,
|
|
29
22
|
transparent: transparent,
|
|
30
23
|
inline: inline,
|
|
31
24
|
lineNumbers: lineNumbers
|
|
32
|
-
}),
|
|
25
|
+
}), React.createElement(CopyToClipboard, {
|
|
33
26
|
content: code
|
|
34
27
|
}, caption || 'Copy'));
|
|
35
28
|
};
|
|
36
|
-
exports.CodeCopy = CodeCopy;
|
|
37
29
|
//# sourceMappingURL=CodeCopy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeCopy.js","names":["
|
|
1
|
+
{"version":3,"file":"CodeCopy.js","names":["React","CopyToClipboard","Space","CodeDisplay","CodeCopy","_ref","language","code","caption","pattern","transparent","inline","lineNumbers","createElement","between","align","pt","content"],"sources":["../../../src/CodeCopy/CodeCopy.tsx"],"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 { CopyToClipboard, Space } 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 = ({\n language = 'json',\n code,\n caption = 'Copy',\n pattern = '',\n transparent = false,\n inline = false,\n lineNumbers = true,\n}: CodeCopyProps) => {\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 {/* TODO why is caption || 'Copy' required here? */}\n <CopyToClipboard content={code}>{caption || 'Copy'}</CopyToClipboard>\n </Space>\n );\n};\n"],"mappings":"AAyBA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,KAAK,QAAQ,oBAAoB;AAE3D,SAASC,WAAW,QAAQ,IAAI;AAQhC,OAAO,IAAMC,QAAQ,GAAGC,IAAA,IAQH;EAAA,IARI;IACvBC,QAAQ,GAAG,MAAM;IACjBC,IAAI;IACJC,OAAO,GAAG,MAAM;IAChBC,OAAO,GAAG,EAAE;IACZC,WAAW,GAAG,KAAK;IACnBC,MAAM,GAAG,KAAK;IACdC,WAAW,GAAG;EACD,CAAC,GAAAP,IAAA;EACd,OACEL,KAAA,CAAAa,aAAA,CAACX,KAAK;IAACY,OAAO;IAACC,KAAK,EAAC,OAAO;IAACC,EAAE,EAAC;EAAQ,GACtChB,KAAA,CAAAa,aAAA,CAACV,WAAW;IACVI,IAAI,EAAEA,IAAK;IACXD,QAAQ,EAAEA,QAAS;IACnBG,OAAO,EAAEA,OAAQ;IACjBC,WAAW,EAAEA,WAAY;IACzBC,MAAM,EAAEA,MAAO;IACfC,WAAW,EAAEA;EAAY,CAC1B,CAAC,EAEFZ,KAAA,CAAAa,aAAA,CAACZ,eAAe;IAACgB,OAAO,EAAEV;EAAK,GAAEC,OAAO,IAAI,MAAwB,CAC/D,CAAC;AAEZ,CAAC"}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
});
|
|
1
|
+
export * from './CodeCopy';
|
|
17
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/CodeCopy/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';\n"],"mappings":"AAyBA,cAAc,YAAY"}
|