@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # Changelog
2
2
 
3
+ ### [0.1.12](https://www.github.com/looker-open-source/sdk-codegen/compare/code-editor-v0.1.11...code-editor-v0.1.12) (2021-10-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * personalized Hackathon agenda ([#853](https://www.github.com/looker-open-source/sdk-codegen/issues/853)) ([a143225](https://www.github.com/looker-open-source/sdk-codegen/commit/a1432250bad0bd35d5d9c5044aced81cf2cc1346))
9
+
10
+ ### [0.1.11](https://www.github.com/looker-open-source/sdk-codegen/compare/code-editor-v0.1.10...code-editor-v0.1.11) (2021-10-19)
11
+
12
+
13
+ ### Features
14
+
15
+ * lots of RunIt form cleanup ([#814](https://www.github.com/looker-open-source/sdk-codegen/issues/814)) ([e92eae8](https://www.github.com/looker-open-source/sdk-codegen/commit/e92eae8fc127a0aa99545ca9c577152c08d59000))
16
+ * Use agenda data for the Hackathon home page ([#842](https://www.github.com/looker-open-source/sdk-codegen/issues/842)) ([0da2523](https://www.github.com/looker-open-source/sdk-codegen/commit/0da25239c3f108cb684309818c33c91c2a7c3278))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * Extension Api Explorer markdown link clicks ([#830](https://www.github.com/looker-open-source/sdk-codegen/issues/830)) ([dd8a3f0](https://www.github.com/looker-open-source/sdk-codegen/commit/dd8a3f03b8ea03858271bf55307c7d359631455a))
22
+
23
+
24
+ ### Dependencies
25
+
26
+ * The following workspace dependencies were updated
27
+ * devDependencies
28
+ * @looker/sdk-codegen bumped from ^21.0.25 to ^21.1.0
29
+
30
+ ### [0.1.10](https://www.github.com/looker-open-source/sdk-codegen/compare/code-editor-v0.1.9...code-editor-v0.1.10) (2021-09-01)
31
+
32
+
33
+ ### Features
34
+
35
+ * new configuration UI for API Explorer ([#803](https://www.github.com/looker-open-source/sdk-codegen/issues/803)) ([e6c67d1](https://www.github.com/looker-open-source/sdk-codegen/commit/e6c67d1211b412d4ce83127c9f7a8f091e3cf27f))
36
+
37
+
38
+ ### Dependencies
39
+
40
+ * The following workspace dependencies were updated
41
+ * devDependencies
42
+ * @looker/sdk-codegen bumped from ^21.0.24 to ^21.0.25
43
+
44
+ ### [0.1.9](https://www.github.com/looker-open-source/sdk-codegen/compare/code-editor-v0.1.8...code-editor-v0.1.9) (2021-08-11)
45
+
46
+
47
+ ### Dependencies
48
+
49
+ * The following workspace dependencies were updated
50
+ * devDependencies
51
+ * @looker/sdk-codegen bumped from ^21.0.23 to ^21.0.24
52
+
3
53
  ### [0.1.8](https://www.github.com/looker-open-source/sdk-codegen/compare/code-editor-v0.1.7...code-editor-v0.1.8) (2021-07-30)
4
54
 
5
55
 
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ## @looker/code-editor
2
- This package contains code display and editor components that are used in Looker extensions such as the API Explorer and LookML Diagram.
2
+
3
+ This package contains code display and editor components that are used in Looker extensions such as the API Explorer and LookML Diagram.
3
4
 
4
5
  ### Installation
5
6
 
@@ -16,25 +17,38 @@ npm install @looker/code-editor
16
17
  ```
17
18
 
18
19
  ### `<CodeDisplay />`
19
- This component is a specialized `<code />` or `<pre />` that has various search, syntax highlighting and other display options. Use this component for read-only code display use cases. This component is used by this package's CodeEditor and Markdown component for inline and block code sections.
20
20
 
21
- | Prop | Description | Default |
21
+ This component is a specialized `<code />` or `<pre />` that has various search, syntax highlighting and other display options. Use this component for read-only code display use cases. This component is used by this package's CodeEditor and Markdown component for inline and block code sections.
22
+
23
+ | Prop | Description | Default |
24
+ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
25
+ | language | This prop configures the syntax highlighting language and accepts any `react-prism-renderer` [supported language](https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js), as well as `ruby`, `kotlin`, `swift`, and `csharp` | `json` |
26
+ | code | The code to be displayed and highlighted. | _required_ |
27
+ | pattern | The search pattern to be highlighted in the input code. | `''` |
28
+ | transparent | A flag for disabling the backgroundColor added by default. | `false` |
29
+ | inline | When true, inline `<code />` is used. `<pre />` is used by default. | `false` |
30
+ | lineNumbers | A flag for enabling line numbers. | `false` |
31
+
32
+ ### `<CodeCopy />`
33
+
34
+ This component wraps the `<CodeDisplay />` component and adds a "copy to Clipboard" button
35
+
36
+ | Prop | Description | Default |
22
37
  | ----------- | ----------- | ----------- |
23
- | language | This prop configures the syntax highlighting language and accepts any `react-prism-renderer` [supported language](https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js), as well as `ruby`, `kotlin`, `swift`, and `csharp` | `json` |
24
- | code | The code to be displayed and highlighted. | _required_ |
25
- | pattern | The search pattern to be highlighted in the input code. | `''` |
26
- | transparent | A flag for disabling the backgroundColor added by default. | `false` |
27
- | inline | When true, inline `<code />` is used. `<pre />` is used by default. | `false` |
28
- | lineNumbers | A flag for enabling line numbers. | `false` |
38
+ | ... | All `<CodeDisplay />` props are accepted | |
39
+ | caption | An override for the Copy button text, which is "Copy" | _optional_ |
29
40
 
30
41
  ### `<CodeEditor />`
31
- This component extends the `<CodeDisplay />` component and adds a hidden `<textarea />` that allows for code editting.
32
- | Prop | Description | Default |
42
+
43
+ This component wraps the `<CodeDisplay />` component and adds a hidden `<textarea />` that allows for code editing.
44
+
45
+ | Prop | Description | Default |
33
46
  | ----------- | ----------- | ----------- |
34
- | ... | All `<CodeDisplay />` props are accepted | |
47
+ | ... | All `<CodeDisplay />` props are accepted | |
35
48
  | onChange | An event handler for capturing user input. | _required_ |
36
49
 
37
50
  #### Example
51
+
38
52
  ```javascript
39
53
  const CodeBlockEditor: React.FC = () => {
40
54
  const [codeString, setCodeString] = useState(`
@@ -59,7 +73,7 @@ def all_lookml_models(
59
73
  <CodeEditor
60
74
  code={codeString}
61
75
  onChange={setCodeString}
62
- language='python'
76
+ language="python"
63
77
  lineNumbers={true}
64
78
  />
65
79
  )
@@ -67,17 +81,21 @@ def all_lookml_models(
67
81
  ```
68
82
 
69
83
  ### `<Markdown />`
84
+
70
85
  This component is a wrapper around a `<ReactMarkdown />` component. It uses `@looker/component` renderers for text and `<CodeDisplay />` for inline and block code. It has options for link handling and renderer overrides.
71
- | Prop | Description | Default |
86
+
87
+ | Prop | Description | Default |
72
88
  | ----------- | ----------- | ----------- |
73
89
  | source | The Markdown string to be rendered | _required_ |
74
90
  | pattern | The search pattern to be highlighted in the source | `''` |
75
91
  | transformLinkUri | A function for pre-processing the link before it is navigated to, used for removing `<mark />` tags or modifying the destination. | _optional_ |
76
- | linkClickHandler | An override for link click behavior. | _optional_ |
92
+ | linkClickHandler | An override for link click behavior. | _optional_ |
77
93
  | paragraphOverride | An override for the default Paragraph renderer. | _optional_ |
78
94
 
79
95
  #### Using `<CodeDisplay />` inside Markdown
96
+
80
97
  This component checks for decorated code blocks. The following `source` would create a Ruby syntax highlighted code block.
98
+
81
99
  ````
82
100
  When using the Ruby SDK this would be passed as a Ruby hash like:
83
101
  ```ruby
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ import type { CodeDisplayProps } from '..';
3
+ interface CodeCopyProps extends CodeDisplayProps {
4
+ caption?: string;
5
+ }
6
+ export declare const CodeCopy: FC<CodeCopyProps>;
7
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CodeCopy = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _components = require("@looker/components");
11
+
12
+ var _ = require("..");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ var CodeCopy = _ref => {
17
+ var {
18
+ language = 'json',
19
+ code,
20
+ caption = 'Copy',
21
+ pattern = '',
22
+ transparent = false,
23
+ inline = false,
24
+ lineNumbers = true
25
+ } = _ref;
26
+ return _react.default.createElement(_components.Space, {
27
+ between: true,
28
+ align: "start",
29
+ pt: "xsmall"
30
+ }, _react.default.createElement(_.CodeDisplay, {
31
+ code: code,
32
+ language: language,
33
+ pattern: pattern,
34
+ transparent: transparent,
35
+ inline: inline,
36
+ lineNumbers: lineNumbers
37
+ }), _react.default.createElement(_components.CopyToClipboard, {
38
+ content: code
39
+ }, caption));
40
+ };
41
+
42
+ exports.CodeCopy = CodeCopy;
43
+ //# sourceMappingURL=CodeCopy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/CodeCopy/CodeCopy.tsx"],"names":["CodeCopy","language","code","caption","pattern","transparent","inline","lineNumbers"],"mappings":";;;;;;;AA0BA;;AACA;;AAEA;;;;AAQO,IAAMA,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,6BAAC,iBAAD;AAAO,IAAA,OAAO,MAAd;AAAe,IAAA,KAAK,EAAC,OAArB;AAA6B,IAAA,EAAE,EAAC;AAAhC,KACE,6BAAC,aAAD;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,6BAAC,2BAAD;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 @@
1
+ export * from './CodeCopy';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
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
+ });
18
+ });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/CodeCopy/index.ts"],"names":[],"mappings":";;;;;;AAyBA;;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'\n"],"file":"index.js"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
2
- import { CodeDisplayProps } from './types';
1
+ import type { FC } from 'react';
2
+ import type { CodeDisplayProps } from './types';
3
3
  export declare const CodeDisplay: FC<CodeDisplayProps>;
@@ -37,6 +37,8 @@ require('prismjs/components/prism-swift');
37
37
 
38
38
  require('prismjs/components/prism-ruby');
39
39
 
40
+ require('prismjs/components/prism-markdown');
41
+
40
42
  var Line = (0, _styledComponents.default)(_components.Span).withConfig({
41
43
  displayName: "CodeDisplay__Line",
42
44
  componentId: "iaw0ts-0"
@@ -62,7 +64,7 @@ var CodeDisplay = _ref => {
62
64
  return _react.default.createElement(_prismReactRenderer.default, _extends({}, _prismReactRenderer.defaultProps, {
63
65
  code: code.trim(),
64
66
  language: (0, _utils.getPrismLanguage)(language),
65
- theme: (0, _utils.getOverridenTheme)(transparent, inline)
67
+ theme: (0, _utils.getOverriddenTheme)(transparent, inline)
66
68
  }), _ref2 => {
67
69
  var {
68
70
  className,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/CodeDisplay/CodeDisplay.tsx"],"names":["global","window","Prism","require","Line","Span","LineNo","LineContent","CodeDisplay","language","code","pattern","transparent","inline","lineNumbers","defaultProps","trim","className","style","tokens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,MAAA,MAAM,EAAEL;AAAzD,OACGM,MAAM,CAACG,GAAP,CAAW,CAACC,IAAD,EAAOC,CAAP,KACV,6BAAC,IAAD;AAAM,MAAA,GAAG,EAAEA;AAAX,OAAkBJ,YAAY,CAAC;AAAEG,MAAAA,IAAF;AAAQE,MAAAA,GAAG,EAAED;AAAb,KAAD,CAA9B,GACGV,WAAW,IAAI,6BAAC,MAAD,QAASU,CAAC,GAAG,CAAb,CADlB,EAEE,6BAAC,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,6BAAC,kBAAD;AACE,QAAA,GAAG,EAAEA,GADP;AAEE,QAAA,KAAK,EAAEA,GAFT;AAGE,QAAA,UAAU,EAAEE,UAHd;AAIE,QAAA,OAAO,EAAEhB;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":["global","window","Prism","require","Line","Span","LineNo","LineContent","CodeDisplay","language","code","pattern","transparent","inline","lineNumbers","defaultProps","trim","className","style","tokens","getLineProps","getTokenProps","map","line","i","key","token","tokenProps"],"mappings":";;;;;;;AA2BA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEC,CAAC,OAAOA,MAAP,KAAkB,WAAlB,GAAiCA,MAAjC,GAAmDC,MAApD,EAAoEC,KAApE,GACCA,yBADD;;AAEDC,OAAO,CAAC,iCAAD,CAAP;;AACAA,OAAO,CAAC,iCAAD,CAAP;;AACAA,OAAO,CAAC,gCAAD,CAAP;;AACAA,OAAO,CAAC,+BAAD,CAAP;;AACAA,OAAO,CAAC,mCAAD,CAAP;;AAEA,IAAMC,IAAI,GAAG,+BAAOC,gBAAP,CAAH;AAAA;AAAA;AAAA,0BAAV;AAIA,IAAMC,MAAM,GAAG,+BAAOD,gBAAP,CAAH;AAAA;AAAA;AAAA,2FAAZ;AAQA,IAAME,WAAW,GAAG,+BAAOF,gBAAP,CAAH;AAAA;AAAA;AAAA,iDAAjB;;AAcO,IAAMG,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,6BAAC,2BAAD,eACMC,gCADN;AAEE,IAAA,IAAI,EAAEL,IAAI,CAACM,IAAL,EAFR;AAGE,IAAA,QAAQ,EAAE,6BAAiBP,QAAjB,CAHZ;AAIE,IAAA,KAAK,EAAE,+BAAmBG,WAAnB,EAAgCC,MAAhC;AAJT,MAMG;AAAA,QAAC;AAAEI,MAAAA,SAAF;AAAaC,MAAAA,KAAb;AAAoBC,MAAAA,MAApB;AAA4BC,MAAAA,YAA5B;AAA0CC,MAAAA;AAA1C,KAAD;AAAA,WACC,6BAAC,wBAAD;AAAa,MAAA,SAAS,EAAEJ,SAAxB;AAAmC,MAAA,KAAK,EAAEC,KAA1C;AAAiD,MAAA,MAAM,EAAEL;AAAzD,OACGM,MAAM,CAACG,GAAP,CAAW,CAACC,IAAD,EAAOC,CAAP,KACV,6BAAC,IAAD;AAAM,MAAA,GAAG,EAAEA;AAAX,OAAkBJ,YAAY,CAAC;AAAEG,MAAAA,IAAF;AAAQE,MAAAA,GAAG,EAAED;AAAb,KAAD,CAA9B,GACGV,WAAW,IAAI,6BAAC,MAAD,QAASU,CAAC,GAAG,CAAb,CADlB,EAEE,6BAAC,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,6BAAC,kBAAD;AACE,QAAA,GAAG,EAAEA,GADP;AAEE,QAAA,KAAK,EAAEA,GAFT;AAGE,QAAA,UAAU,EAAEE,UAHd;AAIE,QAAA,OAAO,EAAEhB;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"}
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  interface CodeWrapperProps {
3
3
  className: string;
4
4
  style: any;
@@ -14,7 +14,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
14
14
  var Pre = _styledComponents.default.pre.withConfig({
15
15
  displayName: "CodeWrapper__Pre",
16
16
  componentId: "sc-156h0dr-0"
17
- })(["white-space:pre-wrap;overflow:auto;margin:0px;.match{border:1px yellow solid;border-radius:4px;}"]);
17
+ })(["white-space:pre-wrap;overflow:auto;margin:0px;.match{background:#000000;border:1px#fff2c2 solid;border-radius:10px;padding:0.15px 4px;}"]);
18
18
 
19
19
  var Code = _styledComponents.default.code.withConfig({
20
20
  displayName: "CodeWrapper__Code",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/CodeDisplay/CodeWrapper.tsx"],"names":["Pre","styled","pre","Code","code","CodeWrapper","className","style","inline","children","Wrapper"],"mappings":";;;;;;;AA0BA;;AACA;;;;AASA,IAAMA,GAAG,GAAGC,0BAAOC,GAAV;AAAA;AAAA;AAAA,wGAAT;;AAaA,IAAMC,IAAI,GAAGF,0BAAOG,IAAV;AAAA;AAAA;AAAA,wCAAV;;AAUO,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,GAAUH,GAAhC;AACA,SACE,6BAAC,OAAD;AAAS,IAAA,SAAS,EAAEM,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":["Pre","styled","pre","Code","code","CodeWrapper","className","style","inline","children","Wrapper"],"mappings":";;;;;;;AA2BA;;AACA;;;;AASA,IAAMA,GAAG,GAAGC,0BAAOC,GAAV;AAAA;AAAA;AAAA,+IAAT;;AAeA,IAAMC,IAAI,GAAGF,0BAAOG,IAAV;AAAA;AAAA;AAAA,wCAAV;;AAUO,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,GAAUH,GAAhC;AACA,SACE,6BAAC,OAAD;AAAS,IAAA,SAAS,EAAEM,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,3 +1,3 @@
1
- import { FC } from 'react';
2
- import { LineItemProps } from './types';
1
+ import type { FC } from 'react';
2
+ import type { LineItemProps } from './types';
3
3
  export declare const LineItem: FC<LineItemProps>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/CodeDisplay/LineItem.tsx"],"names":["LineItem","index","tokenProps","pattern","text","children","toLowerCase","includes","className"],"mappings":";;;;;;;AA0BA;;;;;;AASO,IAAMA,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":["LineItem","index","tokenProps","pattern","text","children","toLowerCase","includes","className"],"mappings":";;;;;;;AA2BA;;;;;;AASO,IAAMA,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,5 +1,5 @@
1
- import { FC } from 'react';
2
- import { CodeDisplayProps } from '../CodeDisplay/types';
1
+ import type { FC } from 'react';
2
+ import type { CodeDisplayProps } from '../CodeDisplay/types';
3
3
  interface CodeEditorProps extends CodeDisplayProps {
4
4
  onChange: (text: string) => void;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/CodeEditor/CodeEditor.tsx"],"names":["CodeEditor","code","onChange","language","pattern","transparent","lineNumbers","trim","width","color","whiteSpace","overflow","fontFamily"],"mappings":";;;;;;;AA0BA;;AACA;;AAGA;;;;AAWO,IAAMA,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,6BAAC,8BAAD;AACE,IAAA,KAAK,EAAEL,IAAI,CAACM,IAAL,EADT;AAEE,IAAA,IAAI,EAAE,aAFR;AAGE,IAAA,aAAa,EAAEL,QAHjB;AAIE,IAAA,SAAS,EAAGD,IAAD,IACT,6BAAC,kBAAD;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":["CodeEditor","code","onChange","language","pattern","transparent","lineNumbers","trim","width","color","whiteSpace","overflow","fontFamily"],"mappings":";;;;;;;AA2BA;;AACA;;AAGA;;;;AAWO,IAAMA,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,6BAAC,8BAAD;AACE,IAAA,KAAK,EAAEL,IAAI,CAACM,IAAL,EADT;AAEE,IAAA,IAAI,EAAE,aAFR;AAGE,IAAA,aAAa,EAAEL,QAHjB;AAIE,IAAA,SAAS,EAAGD,IAAD,IACT,6BAAC,kBAAD;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"}
@@ -1,4 +1,4 @@
1
- import { FC, ReactNode } from 'react';
1
+ import type { FC, ReactNode } from 'react';
2
2
  interface MarkdownProps {
3
3
  source: string;
4
4
  pattern?: string;
@@ -53,7 +53,7 @@ var Markdown = _ref => {
53
53
  var a = findAnchor(e.target);
54
54
 
55
55
  if (a) {
56
- linkClickHandler(a.pathname, a.href);
56
+ linkClickHandler(a.getAttribute('pathname') || '', a.getAttribute('href') || '');
57
57
  }
58
58
  }
59
59
  };
@@ -130,5 +130,5 @@ exports.Markdown = Markdown;
130
130
  var MarkdownWrapper = _styledComponents.default.div.withConfig({
131
131
  displayName: "Markdown__MarkdownWrapper",
132
132
  componentId: "sc-11uco0h-0"
133
- })(["& > ul{padding-left:20px;list-style:disc outside;}& > ol{padding-left:20px;list-style:decimal outside;}"]);
133
+ })(["& > ul{padding-left:20px;list-style:disc outside;}& > ol{padding-left:20px;list-style:decimal outside;}& mark{background-color:#fff2c2;font-weight:500;}"]);
134
134
  //# sourceMappingURL=Markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Markdown/Markdown.tsx"],"names":["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","Link","ul","MDList","ol","link","li","MDListItem","table","MDTable","thead","TableHead","tbody","TableBody","tr","TableRow","td","TableCell","th","gfm","rehypeRaw","MarkdownWrapper","styled","div"],"mappings":";;;;;;;AA0BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;AAYO,IAAMA,QAA2B,GAAG,QAMrC;AAAA,MANsC;AAC1CC,IAAAA,MAD0C;AAE1CC,IAAAA,OAAO,GAAG,EAFgC;AAG1CC,IAAAA,gBAH0C;AAI1CC,IAAAA,gBAJ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A,+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":["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","Link","ul","MDList","ol","link","li","MDListItem","table","MDTable","thead","TableHead","tbody","TableBody","tr","TableRow","td","TableCell","th","gfm","rehypeRaw","MarkdownWrapper","styled","div"],"mappings":";;;;;;;AA2BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;AAYO,IAAMA,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,CAACC,cAAF;;AACA,QAAIT,gBAAJ,EAAsB;AAEpB,UAAMU,CAAC,GAAGR,UAAU,CAACM,CAAC,CAACG,MAAH,CAApB;;AACA,UAAID,CAAJ,EAAO;AACLV,QAAAA,gBAAgB,CACdU,CAAC,CAACE,YAAF,CAAe,UAAf,KAA8B,EADhB,EAEdF,CAAC,CAACE,YAAF,CAAe,MAAf,KAA0B,EAFZ,CAAhB;AAID;AACF;AACF,GAZD;;AAcA,MAAMC,OAAO,GAAG;AAAA,QAAC;AACfC,MAAAA,KADe;AAEfC,MAAAA;AAFe,KAAD;AAAA,WAMV,6BAAC,iBAAD;AAAW,MAAA,EAAE,aAAMD,KA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AAEC,qBAfU;AAgBjBC,IAAAA,KAAK,EAAEC,qBAhBU;AAiBjBC,IAAAA,EAAE,EAAEC,oBAjBa;AAkBjBC,IAAAA,EAAE,EAAEC,oBAlBa;AAmBjBC,IAAAA,EAAE,EAAED;AAnBa,GAAnB;AAsBA,SACE,6BAAC,eAAD;AAAiB,IAAA,OAAO,EAAEzC;AAA1B,KACE,6BAAC,sBAAD;AACE,IAAA,aAAa,EAAE,CAAC2C,kBAAD,CADjB;AAEE,IAAA,aAAa,EAAE,CAACC,kBAAD,CAFjB;AAGE,IAAA,gBAAgB,EAAEpD,gBAHpB;AAIE,IAAA,UAAU,EAAEyB;AAJd,KAMG,gCAAoB3B,MAApB,EAA4BC,OAA5B,CANH,CADF,CADF;AAYD,CA7FM;;;;AA+FP,IAAMsD,eAAe,GAAGC,0BAAOC,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,2 +1,2 @@
1
- import { FC, PropsWithChildren } from 'react';
1
+ import type { FC, PropsWithChildren } from 'react';
2
2
  export declare const TableCell: FC<PropsWithChildren<any>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Markdown/TableCell.tsx"],"names":["TableCell","isHeader","rest"],"mappings":";;;;;;;AAyBA;;AACA;;;;;;;;AAEO,IAAMA,SAAqC,GAAG;AAAA,MAAC;AAAEC,IAAAA;AAAF,GAAD;AAAA,MAAgBC,IAAhB;;AAAA,SACnDD,QAAQ,GAAG,6BAAC,2BAAD,EAAqBC,IAArB,CAAH,GAAmC,6BAAC,yBAAD,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":["TableCell","isHeader","rest"],"mappings":";;;;;;;AA0BA;;AACA;;;;;;;;AAEO,IAAMA,SAAqC,GAAG;AAAA,MAAC;AAAEC,IAAAA;AAAF,GAAD;AAAA,MAAgBC,IAAhB;;AAAA,SACnDD,QAAQ,GAAG,6BAAC,2BAAD,EAAqBC,IAArB,CAAH,GAAmC,6BAAC,yBAAD,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"}
@@ -1,6 +1,14 @@
1
1
  import React from 'react';
2
- export declare const MDHeading: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("@looker/components/lib/Text/TextBase").TextBaseProps & import("@looker/components").HeadingProps, never>;
3
- export declare const MDParagraph: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("@looker/components/lib/Text/TextBase").TextBaseProps & import("@looker/components").ParagraphProps, never>;
2
+ import type { HeadingProps, ParagraphProps, TableProps } from '@looker/components';
3
+ export declare const MDHeading: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("@looker/components/Text/TextBase").TextBaseProps & HeadingProps & {
4
+ mb: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>;
5
+ pt: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>;
6
+ }, "mb" | "pt">;
7
+ export declare const MDParagraph: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("@looker/components/Text/TextBase").TextBaseProps & ParagraphProps & {
8
+ mb: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>;
9
+ }, "mb">;
4
10
  export declare const MDList: React.FC<any>;
5
11
  export declare const MDListItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
6
- export declare const MDTable: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, import("@looker/components").TableProps, never>;
12
+ export declare const MDTable: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, TableProps & {
13
+ mb: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>;
14
+ }, "mb">;
@@ -17,28 +17,37 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
17
17
 
18
18
  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; }
19
19
 
20
- var MDHeading = (0, _styledComponents.default)(_components.Heading).withConfig({
20
+ var MDHeading = (0, _styledComponents.default)(_components.Heading).attrs(_ref => {
21
+ var {
22
+ mb = 'xsmall',
23
+ pt = 'xsmall'
24
+ } = _ref;
25
+ return {
26
+ mb,
27
+ pt
28
+ };
29
+ }).withConfig({
21
30
  displayName: "common__MDHeading",
22
31
  componentId: "i00oep-0"
23
32
  })([""]);
24
33
  exports.MDHeading = MDHeading;
25
- MDHeading.defaultProps = {
26
- mb: 'xsmall',
27
- pt: 'xsmall'
28
- };
29
- var MDParagraph = (0, _styledComponents.default)(_components.Paragraph).withConfig({
34
+ var MDParagraph = (0, _styledComponents.default)(_components.Paragraph).attrs(_ref2 => {
35
+ var {
36
+ mb = 'large'
37
+ } = _ref2;
38
+ return {
39
+ mb
40
+ };
41
+ }).withConfig({
30
42
  displayName: "common__MDParagraph",
31
43
  componentId: "i00oep-1"
32
- })(["color:", ";max-width:600px;"], _ref => {
44
+ })(["color:", ";max-width:600px;"], _ref3 => {
33
45
  var {
34
46
  theme
35
- } = _ref;
47
+ } = _ref3;
36
48
  return theme.colors.text5;
37
49
  });
38
50
  exports.MDParagraph = MDParagraph;
39
- MDParagraph.defaultProps = {
40
- mb: 'large'
41
- };
42
51
 
43
52
  var OListInternal = _styledComponents.default.ol.withConfig({
44
53
  displayName: "common__OListInternal",
@@ -50,11 +59,11 @@ var UListInternal = _styledComponents.default.ul.withConfig({
50
59
  componentId: "i00oep-3"
51
60
  })(["max-width:600px;margin-bottom:20px;"]);
52
61
 
53
- var MDList = _ref2 => {
62
+ var MDList = _ref4 => {
54
63
  var {
55
64
  ordered
56
- } = _ref2,
57
- rest = _objectWithoutProperties(_ref2, ["ordered"]);
65
+ } = _ref4,
66
+ rest = _objectWithoutProperties(_ref4, ["ordered"]);
58
67
 
59
68
  return ordered ? _react.default.createElement(OListInternal, rest) : _react.default.createElement(UListInternal, rest);
60
69
  };
@@ -67,12 +76,16 @@ var MDListItem = _styledComponents.default.li.withConfig({
67
76
  })(["max-width:600px;margin-bottom:4px;"]);
68
77
 
69
78
  exports.MDListItem = MDListItem;
70
- var MDTable = (0, _styledComponents.default)(_components.Table).withConfig({
79
+ var MDTable = (0, _styledComponents.default)(_components.Table).attrs(_ref5 => {
80
+ var {
81
+ mb = 'large'
82
+ } = _ref5;
83
+ return {
84
+ mb
85
+ };
86
+ }).withConfig({
71
87
  displayName: "common__MDTable",
72
88
  componentId: "i00oep-5"
73
89
  })([""]);
74
90
  exports.MDTable = MDTable;
75
- MDTable.defaultProps = {
76
- mb: 'large'
77
- };
78
91
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Markdown/common.tsx"],"names":["MDHeading","Heading","defaultProps","mb","pt","MDParagraph","Paragraph","theme","colors","text5","OListInternal","styled","ol","UListInternal","ul","MDList","ordered","rest","MDListItem","li","MDTable","Table"],"mappings":";;;;;;;AAyBA;;AACA;;AACA;;;;;;;;AAMO,IAAMA,SAAS,GAAG,+BAAOC,mBAAP,CAAH;AAAA;AAAA;AAAA,QAAf;;AAEPD,SAAS,CAACE,YAAV,GAAyB;AACvBC,EAAAA,EAAE,EAAE,QADmB;AAEvBC,EAAAA,EAAE,EAAE;AAFmB,CAAzB;AAKO,IAAMC,WAAW,GAAG,+BAAOC,qBAAP,CAAH;AAAA;AAAA;AAAA,oCACb;AAAA,MAAC;AAAEC,IAAAA;AAAF,GAAD;AAAA,SAAeA,KAAK,CAACC,MAAN,CAAaC,KAA5B;AAAA,CADa,CAAjB;;AAIPJ,WAAW,CAACH,YAAZ,GAA2B;AACzBC,EAAAA,EAAE,EAAE;AADqB,CAA3B;;AAIA,IAAMO,aAAa,GAAGC,0BAAOC,EAAV;AAAA;AAAA;AAAA,2CAAnB;;AAKA,IAAMC,aAAa,GAAGF,0BAAOG,EAAV;AAAA;AAAA;AAAA,2CAAnB;;AAKO,IAAMC,MAAqB,GAAG,SAA0B;AAAA,MAAzB;AAAEC,IAAAA;AAAF,GAAyB;AAAA,MAAXC,IAAW;;AAC7D,SAAOD,OAAO,GAAG,6BAAC,aAAD,EAAmBC,IAAnB,CAAH,GAAiC,6BAAC,aAAD,EAAmBA,IAAnB,CAA/C;AACD,CAFM;;;;AAIA,IAAMC,UAAU,GAAGP,0BAAOQ,EAAV;AAAA;AAAA;AAAA,0CAAhB;;;AAKA,IAAMC,OAAO,GAAG,+BAAOC,iBAAP,CAAH;AAAA;AAAA;AAAA,QAAb;;AACPD,OAAO,CAAClB,YAAR,GAAuB;AAAEC,EAAAA,EAAE,EAAE;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":["MDHeading","Heading","attrs","mb","pt","MDParagraph","Paragraph","theme","colors","text5","OListInternal","styled","ol","UListInternal","ul","MDList","ordered","rest","MDListItem","li","MDTable","Table"],"mappings":";;;;;;;AAyBA;;AACA;;AACA;;;;;;;;AAWO,IAA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by 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"}