@redocly/theme 0.1.10 → 0.1.13

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 (122) hide show
  1. package/CodeBlock/CodeBlock.js +2 -1
  2. package/Markdown/StyledMarkdown.d.ts +0 -2
  3. package/Markdown/StyledMarkdown.js +5 -16
  4. package/Markdown/index.d.ts +0 -1
  5. package/Markdown/index.js +0 -1
  6. package/Navbar/NavbarMenu.js +1 -1
  7. package/OperationBadge/OperationBadge.js +1 -1
  8. package/Search/ClearIcon.js +2 -2
  9. package/Search/Input.js +1 -1
  10. package/Search/Popover.js +1 -1
  11. package/Search/SearchIcon.js +2 -2
  12. package/Sidebar/ApiCallItem.js +1 -1
  13. package/TableOfContent/TableOfContent.js +5 -6
  14. package/globalStyle.d.ts +1 -0
  15. package/globalStyle.js +25 -3
  16. package/mocks/Link.js +4 -1
  17. package/mocks/hooks/usePageData.js +4 -1
  18. package/package.json +1 -1
  19. package/src/CodeBlock/CodeBlock.ts +3 -42
  20. package/src/Markdown/StyledMarkdown.tsx +14 -28
  21. package/src/Markdown/index.ts +0 -1
  22. package/src/Navbar/NavbarMenu.tsx +1 -1
  23. package/src/OperationBadge/OperationBadge.ts +5 -2
  24. package/src/Search/ClearIcon.tsx +12 -13
  25. package/src/Search/Input.tsx +7 -7
  26. package/src/Search/Popover.tsx +2 -2
  27. package/src/Search/SearchIcon.tsx +12 -13
  28. package/src/Sidebar/ApiCallItem.tsx +1 -2
  29. package/src/TableOfContent/TableOfContent.tsx +6 -4
  30. package/src/globalStyle.ts +829 -536
  31. package/src/mocks/Link.tsx +5 -2
  32. package/src/mocks/hooks/usePageData.ts +4 -1
  33. package/src/ui/Typography.tsx +12 -89
  34. package/src/ui/UniversalLink.tsx +3 -8
  35. package/src/utils/ClipboardService.ts +3 -86
  36. package/src/utils/isUrl.ts +4 -4
  37. package/src/utils/theme-helpers.ts +46 -0
  38. package/ui/Typography.d.ts +2 -71
  39. package/ui/Typography.js +15 -93
  40. package/ui/UniversalLink.js +1 -5
  41. package/utils/ClipboardService.d.ts +1 -5
  42. package/utils/ClipboardService.js +2 -73
  43. package/utils/isUrl.d.ts +2 -2
  44. package/utils/isUrl.js +4 -4
  45. package/utils/theme-helpers.d.ts +1 -0
  46. package/utils/theme-helpers.js +42 -2
  47. package/Markdown/CodeSample/CodeSample.d.ts +0 -8
  48. package/Markdown/CodeSample/CodeSample.js +0 -30
  49. package/Markdown/CodeSample/index.d.ts +0 -3
  50. package/Markdown/CodeSample/index.js +0 -19
  51. package/Markdown/CodeSample/styled.d.ts +0 -5
  52. package/Markdown/CodeSample/styled.js +0 -109
  53. package/Markdown/CodeSample/types.d.ts +0 -9
  54. package/Markdown/CodeSample/types.js +0 -2
  55. package/src/Button/Button.stories.tsx +0 -74
  56. package/src/Button/__tests__/Button.test.tsx +0 -42
  57. package/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +0 -274
  58. package/src/CodeBlock/__tests__/CodeBlock.test.tsx +0 -12
  59. package/src/CodeBlock/__tests__/__snapshots__/CodeBlock.test.tsx.snap +0 -140
  60. package/src/CopyButton/CopyButton.stories.tsx +0 -18
  61. package/src/CopyButton/__tests__/CopyButton.test.tsx +0 -35
  62. package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +0 -17
  63. package/src/CopyButton/__tests__/__snapshots__/CopyButton.test.tsx.snap +0 -55
  64. package/src/CopyButton/__tests__/__snapshots__/CopyButtonWrapper.test.tsx.snap +0 -46
  65. package/src/Footer/Footer.stories.tsx +0 -57
  66. package/src/Footer/__tests__/Footer.test.tsx +0 -55
  67. package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +0 -253
  68. package/src/Headings/Headings.stories.tsx +0 -36
  69. package/src/Headings/__tests__/Headings.test.tsx +0 -24
  70. package/src/Headings/__tests__/__snapshots__/Headings.test.tsx.snap +0 -57
  71. package/src/JsonViewer/JsonViewer.stories.tsx +0 -57
  72. package/src/JsonViewer/__tests__/JsonViewer.test.tsx +0 -83
  73. package/src/JsonViewer/__tests__/__snapshots__/JsonViewer.test.tsx.snap +0 -2728
  74. package/src/Layout/__tests__/PageLayout.test.tsx +0 -17
  75. package/src/Layout/__tests__/RootLayout.test.tsx +0 -17
  76. package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +0 -38
  77. package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +0 -18
  78. package/src/Markdown/CodeSample/CodeSample.tsx +0 -39
  79. package/src/Markdown/CodeSample/index.ts +0 -3
  80. package/src/Markdown/CodeSample/styled.ts +0 -289
  81. package/src/Markdown/CodeSample/types.ts +0 -40
  82. package/src/Navbar/Navbar.stories.tsx +0 -32
  83. package/src/NavbarLogo/NavbarLogo.stories.tsx +0 -20
  84. package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +0 -47
  85. package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +0 -38
  86. package/src/OperationBadge/OperationBadge.stories.tsx +0 -35
  87. package/src/OperationBadge/__tests__/OperationBadge.test.tsx +0 -59
  88. package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +0 -651
  89. package/src/Panel/CodePanel.stories.tsx +0 -26
  90. package/src/Panel/ContentPanel.stories.tsx +0 -26
  91. package/src/Panel/Panel.stories.tsx +0 -56
  92. package/src/Panel/__tests__/CodePanel.test.tsx +0 -26
  93. package/src/Panel/__tests__/ContentPanel.test.tsx +0 -26
  94. package/src/Panel/__tests__/Panel.test.tsx +0 -53
  95. package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +0 -258
  96. package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +0 -278
  97. package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +0 -398
  98. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +0 -18
  99. package/src/SamplesPanelControls/__tests__/SamplesPanelControls.test.tsx +0 -36
  100. package/src/SamplesPanelControls/__tests__/__snapshots__/SamplesPanelControls.test.tsx.snap +0 -228
  101. package/src/SidebarLogo/SidebarLogo.stories.tsx +0 -21
  102. package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +0 -32
  103. package/src/SidebarLogo/__tests__/__snapshots__/SidebarLogo.test.tsx.snap +0 -62
  104. package/src/SourceCode/SourceCode.stories.tsx +0 -29
  105. package/src/SourceCode/__tests__/SourceCode.test.tsx +0 -48
  106. package/src/SourceCode/__tests__/__snapshots__/SourceCode.test.tsx.snap +0 -786
  107. package/src/TableOfContent/TableOfContent.stories.tsx +0 -39
  108. package/src/Tooltip/Tooltip.stories.tsx +0 -27
  109. package/src/Tooltip/__tests__/Tooltip.test.tsx +0 -41
  110. package/src/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +0 -83
  111. package/src/Welcome.stories.mdx +0 -7
  112. package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +0 -36
  113. package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +0 -54
  114. package/src/icons/ShelfIcon/__tests__/__snapshots__/ShelfIcon.test.tsx.snap +0 -235
  115. package/src/utils/__tests__/ClipboardService.test.ts +0 -24
  116. package/src/utils/__tests__/__snapshots__/highlight.test.ts.snap +0 -5
  117. package/src/utils/__tests__/__snapshots__/jsonToHtml.test.ts.snap +0 -5
  118. package/src/utils/__tests__/css-variables.test.ts +0 -20
  119. package/src/utils/__tests__/highlight.test.ts +0 -51
  120. package/src/utils/__tests__/jsonToHtml.test.ts +0 -40
  121. package/src/utils/__tests__/media-css.test.ts +0 -20
  122. package/src/utils/__tests__/theme-helpers.test.ts +0 -25
@@ -1,7 +1,10 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
+ import { omit } from 'lodash';
2
3
 
3
4
  // TODO: use real typings here
4
5
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
5
6
  export function Link(props: any): JSX.Element {
6
- return <a href={props.to} {...props} />;
7
+ // We omit "active" property to avoid "Warning: Received `false` for a non-boolean attribute `active`."
8
+ const filteredProps = omit(props, ['active', 'httpVerb', 'hasActiveSubItem']);
9
+ return <a href={filteredProps.to} {...filteredProps} />;
7
10
  }
@@ -4,5 +4,8 @@ export function usePageData(): {
4
4
  prevPage: ResolvedNavLinkItem | null;
5
5
  nextPage: ResolvedNavLinkItem | null;
6
6
  } {
7
- return { prevPage: null, nextPage: null };
7
+ return {
8
+ prevPage: { label: 'Intro', type: 'link', link: '#prev' },
9
+ nextPage: { label: 'FAQ', type: 'link', link: '#next' },
10
+ };
8
11
  }
@@ -1,86 +1,7 @@
1
- import styled, { css, SimpleInterpolation } from 'styled-components';
1
+ import styled from 'styled-components';
2
2
  import { color, typography as typographySystem, ColorProps, TypographyProps } from 'styled-system';
3
3
 
4
- export interface ITypography {
5
- fontSize?: string;
6
- fontWeight?: string | number;
7
- fontFamily?: string;
8
- lineHeight?: string;
9
- color?: string;
10
- transform?: string;
11
- marginTop?: string;
12
- marginRight?: string;
13
- marginLeft?: string;
14
- marginBottom?: string;
15
- marginVertical?: string;
16
- marginHorizontal?: string;
17
- }
18
-
19
- export const typographyTokens = {
20
- typography: {
21
- fontSize: 'var(--font-size-base)',
22
- fontFamily: 'var(--h-font-family)',
23
- lineHeight: 'var(--line-height-base)',
24
- },
25
- heading1: {
26
- fontSize: 'var(--h1-font-size)',
27
- fontFamily: 'var(--h-font-family)',
28
- fontWeight: 'var(--font-weight-bold)',
29
- lineHeight: 'var(--h1-line-height)',
30
- color: 'var(--color-content)',
31
- marginTop: 'var(--h1-margin-top)',
32
- marginBottom: 'var(--h1-margin-bottom)',
33
- },
34
- heading2: {
35
- fontSize: 'var(--h2-font-size)',
36
- fontFamily: 'var(--h-font-family)',
37
- fontWeight: 'var(--font-weight-bold)',
38
- lineHeight: 'var(--h2-line-height)',
39
- color: 'var(--color-content)',
40
- marginTop: 'var(--h2-margin-top)',
41
- marginBottom: 'var(--h2-margin-bottom)',
42
- },
43
- heading3: {
44
- fontSize: 'var(--h3-font-size)',
45
- fontFamily: 'var(--h-font-family)',
46
- fontWeight: 'var(--font-weight-bold)',
47
- lineHeight: 'var(--h3-line-height)',
48
- color: 'var(--color-content)',
49
- marginTop: 'var(--h3-margin-top)',
50
- marginBottom: 'var(--h3-margin-bottom)',
51
- },
52
- heading4: {},
53
- heading5: {},
54
- heading6: {},
55
- blockquote: {
56
- color: 'var(--color-content)',
57
- },
58
- alert: {
59
- fontSize: 'var(--admonition-font-size)',
60
- fontWeight: 'var(--admonition-font-weight)',
61
- lineHeight: 'var(--admonition-line-height)',
62
- marginTop: 'var(--admonition-margin-vertical)',
63
- marginBottom: 'var(--admonition-margin-vertical)',
64
- heading: {
65
- fontSize: 'var(--admonition-heading-font-size)',
66
- fontWeight: 'var(--admonition-heading-font-weight)',
67
- lineHeight: 'var(--admonition-line-height)',
68
- transform: 'var(--admonition-heading-transform)',
69
- },
70
- },
71
- };
72
-
73
- export function typography(theme?: ITypography): string | SimpleInterpolation {
74
- if (!theme) return '';
75
- return css`
76
- font-size: ${theme.fontSize || ''};
77
- font-weight: ${theme.fontWeight || ''};
78
- font-family: ${theme.fontFamily || ''};
79
- line-height: ${theme.lineHeight || ''};
80
- color: ${theme.color || ''};
81
- text-transform: ${theme.transform || ''};
82
- `;
83
- }
4
+ import { typography } from '@theme/utils';
84
5
 
85
6
  type HeadingProps = TypographyProps &
86
7
  ColorProps & {
@@ -97,7 +18,7 @@ export const Emphasis = styled.strong.attrs(() => ({
97
18
  export const H1 = styled.h1.attrs(() => ({
98
19
  'data-component-name': 'ui/Typography/H1',
99
20
  }))<HeadingProps>`
100
- ${typography(typographyTokens.heading1)};
21
+ ${typography('h1', 'h')};
101
22
  margin: 1.35em 0 0.9em;
102
23
  && {
103
24
  ${({ mt }) => mt && `margin-top: ${mt};`}
@@ -107,10 +28,10 @@ export const H1 = styled.h1.attrs(() => ({
107
28
  }
108
29
  `;
109
30
 
110
- export const H2 = styled.h1.attrs(() => ({
31
+ export const H2 = styled.h2.attrs(() => ({
111
32
  'data-component-name': 'ui/Typography/H2',
112
33
  }))<HeadingProps>`
113
- ${typography(typographyTokens.heading2)};
34
+ ${typography('h2', 'h')};
114
35
  margin: 1.25em 0 0.8em;
115
36
  && {
116
37
  ${({ mt }) => mt && `margin-top: ${mt};`}
@@ -120,10 +41,10 @@ export const H2 = styled.h1.attrs(() => ({
120
41
  }
121
42
  `;
122
43
 
123
- export const H3 = styled.h1.attrs(() => ({
44
+ export const H3 = styled.h3.attrs(() => ({
124
45
  'data-component-name': 'ui/Typography/H3',
125
46
  }))<HeadingProps>`
126
- ${typography(typographyTokens.heading3)};
47
+ ${typography('h3', 'h')};
127
48
  margin: 1.25em 0 0.8em;
128
49
  && {
129
50
  ${({ mt }) => mt && `margin-top: ${mt};`}
@@ -139,7 +60,7 @@ export const SectionHeader = styled.h2`
139
60
  font-weight: var(--font-weight-regular);
140
61
  text-align: center;
141
62
  margin: 2.65em 0;
142
- padding: 0px 20px;
63
+ padding: 0 20px;
143
64
  font-family: var(--h-font-family);
144
65
  `;
145
66
 
@@ -152,9 +73,11 @@ export const Typography = styled.p.attrs(() => ({
152
73
  mb?: string;
153
74
  }
154
75
  >`
155
- ${typography(typographyTokens.typography)};
76
+ font-size: var(--font-size-base);
77
+ font-family: var(--font-family-base);
78
+ line-height: var(--line-height-base);
156
79
  color: var(--color-content);
157
- ${color}
80
+ ${color};
158
81
  margin-top: ${({ mt }) => mt || '1em'};
159
82
  margin-bottom: ${({ mb }) => mb || '1em'};
160
83
  ${typographySystem}
@@ -3,7 +3,6 @@ import { useLocation, LinkProps } from 'react-router-dom';
3
3
  import styled from 'styled-components';
4
4
 
5
5
  import { isUrl } from '@theme/utils/isUrl';
6
- import { replaceHashInColor } from '@theme/utils/replaceHashInColor';
7
6
  import { Link } from '@portal/Link';
8
7
 
9
8
  const StyledExternalLink = styled.a`
@@ -14,15 +13,11 @@ const StyledExternalLink = styled.a`
14
13
  content: '';
15
14
  display: inline-block;
16
15
  position: absolute;
17
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' x='0' y='0' viewBox='0 0 100 125' enable-background='new 0 0 100 100' xml:space='preserve'%3E%3Cpath fill='${({
18
- theme,
19
- }) =>
20
- replaceHashInColor(
21
- theme.colors.text.primary,
22
- )}' d='M-408.2-318.5 98.6 4.8c0-0.1 0-0.2-0.1-0.3 0-0.1-0.1-0.2-0.1-0.3 0-0.1 0-0.1-0.1-0.2 0 0 0-0.1 0-0.1 0-0.1-0.1-0.2-0.2-0.3 0-0.1-0.1-0.2-0.2-0.3 -0.1-0.1-0.1-0.2-0.2-0.3C97.7 2.9 97.6 2.8 97.5 2.7c-0.1-0.1-0.2-0.2-0.3-0.3 -0.1-0.1-0.1-0.1-0.2-0.2 -0.1-0.1-0.2-0.2-0.3-0.2 -0.1-0.1-0.2-0.1-0.2-0.2 -0.1-0.1-0.2-0.1-0.3-0.2 -0.1 0-0.2-0.1-0.3-0.1 0 0-0.1 0-0.1-0.1 -0.1 0-0.2 0-0.2-0.1 -0.1 0-0.2-0.1-0.3-0.1 -0.1 0-0.2-0.1-0.4-0.1 -0.1 0-0.2 0-0.3 0 -0.1 0-0.3 0-0.4 0 -0.1 0-0.1 0-0.2 0L63.8 1.3c-2.5 0-4.6 2.1-4.6 4.6 0 2.5 2.1 4.6 4.6 4.5l19.3-0.1 -29.8 30.2c-1.1 1.1-1.5 2.7-1.2 4.1 0.2 0.9 0.6 1.7 1.3 2.4 0.9 0.9 2.1 1.3 3.2 1.3 1.2 0 2.3-0.5 3.2-1.4l0 0 29.8-30.2 0.1 19.3c0 2.5 2.1 4.6 4.6 4.5 1.3 0 2.4-0.5 3.2-1.4 0.8-0.8 1.3-2 1.3-3.2L98.7 5.7c0-0.1 0-0.1 0-0.2 0-0.1 0-0.2 0-0.4C98.6 5 98.6 4.9 98.6 4.8zM6.5 83.3c0 5.7 4.6 10.4 10.4 10.4l55.6 0.1c5.7 0 10.4-4.6 10.4-10.4l-0.1-40.8h6.1v40.8c0 9-7.3 16.3-16.3 16.3l-56.4-0.1c-8.6 0-15.6-7-15.6-15.6L0.6 27.8c0-9 7.3-16.3 16.3-16.3l41.1-0.1v6.1L17 17.5c-5.7 0-10.4 4.6-10.4 10.4L6.5 83.3z'/%3E%3C/svg%3E");
16
+ background: var(--color-content);
17
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' x='0' y='0' viewBox='0 0 100 125' enable-background='new 0 0 100 100' xml:space='preserve'%3E%3Cpath d='M-408.2-318.5 98.6 4.8c0-0.1 0-0.2-0.1-0.3 0-0.1-0.1-0.2-0.1-0.3 0-0.1 0-0.1-0.1-0.2 0 0 0-0.1 0-0.1 0-0.1-0.1-0.2-0.2-0.3 0-0.1-0.1-0.2-0.2-0.3 -0.1-0.1-0.1-0.2-0.2-0.3C97.7 2.9 97.6 2.8 97.5 2.7c-0.1-0.1-0.2-0.2-0.3-0.3 -0.1-0.1-0.1-0.1-0.2-0.2 -0.1-0.1-0.2-0.2-0.3-0.2 -0.1-0.1-0.2-0.1-0.2-0.2 -0.1-0.1-0.2-0.1-0.3-0.2 -0.1 0-0.2-0.1-0.3-0.1 0 0-0.1 0-0.1-0.1 -0.1 0-0.2 0-0.2-0.1 -0.1 0-0.2-0.1-0.3-0.1 -0.1 0-0.2-0.1-0.4-0.1 -0.1 0-0.2 0-0.3 0 -0.1 0-0.3 0-0.4 0 -0.1 0-0.1 0-0.2 0L63.8 1.3c-2.5 0-4.6 2.1-4.6 4.6 0 2.5 2.1 4.6 4.6 4.5l19.3-0.1 -29.8 30.2c-1.1 1.1-1.5 2.7-1.2 4.1 0.2 0.9 0.6 1.7 1.3 2.4 0.9 0.9 2.1 1.3 3.2 1.3 1.2 0 2.3-0.5 3.2-1.4l0 0 29.8-30.2 0.1 19.3c0 2.5 2.1 4.6 4.6 4.5 1.3 0 2.4-0.5 3.2-1.4 0.8-0.8 1.3-2 1.3-3.2L98.7 5.7c0-0.1 0-0.1 0-0.2 0-0.1 0-0.2 0-0.4C98.6 5 98.6 4.9 98.6 4.8zM6.5 83.3c0 5.7 4.6 10.4 10.4 10.4l55.6 0.1c5.7 0 10.4-4.6 10.4-10.4l-0.1-40.8h6.1v40.8c0 9-7.3 16.3-16.3 16.3l-56.4-0.1c-8.6 0-15.6-7-15.6-15.6L0.6 27.8c0-9 7.3-16.3 16.3-16.3l41.1-0.1v6.1L17 17.5c-5.7 0-10.4 4.6-10.4 10.4L6.5 83.3z'/%3E%3C/svg%3E");
18
+ mask-repeat: no-repeat;
23
19
  width: 10px;
24
20
  height: 10px;
25
- background-repeat: no-repeat;
26
21
  top: 50%;
27
22
  right: -15px;
28
23
  transform: translateY(-50%);
@@ -1,92 +1,9 @@
1
1
  export class ClipboardService {
2
2
  static isSupported(): boolean {
3
- return (
4
- typeof document !== 'undefined' &&
5
- !!document.queryCommandSupported &&
6
- document.queryCommandSupported('copy')
7
- );
3
+ return typeof navigator?.clipboard !== 'undefined';
8
4
  }
9
5
 
10
- static selectElement(element: HTMLDivElement | null): void {
11
- if (!element) {
12
- return;
13
- }
14
- let range;
15
- let selection;
16
- if ((document.body as any).createTextRange) {
17
- range = (document.body as any).createTextRange();
18
- range.moveToElementText(element);
19
- range.select();
20
- } else if (document.createRange && window.getSelection) {
21
- selection = window.getSelection();
22
- range = document.createRange();
23
- range.selectNodeContents(element);
24
- selection?.removeAllRanges();
25
- selection?.addRange(range);
26
- }
27
- }
28
-
29
- static deselect(): void {
30
- if ((document as any).selection) {
31
- (document as any).selection.empty();
32
- } else if (window.getSelection) {
33
- const selection = window.getSelection();
34
- if (selection) {
35
- selection.removeAllRanges();
36
- }
37
- }
38
- }
39
-
40
- static copySelected(): boolean {
41
- let result;
42
- try {
43
- result = document.execCommand('copy');
44
- } catch (err) {
45
- result = false;
46
- }
47
- return result;
48
- }
49
-
50
- static copyElement(element: HTMLDivElement | null): boolean {
51
- ClipboardService.selectElement(element);
52
- const res = ClipboardService.copySelected();
53
- if (res) {
54
- ClipboardService.deselect();
55
- }
56
- return res;
57
- }
58
-
59
- static copyCustom(text: string): boolean {
60
- const textArea = document.createElement('textarea');
61
- textArea.style.position = 'fixed';
62
- textArea.style.top = '0';
63
- textArea.style.left = '0';
64
-
65
- // Ensure it has a small width and height. Setting to 1px / 1em
66
- // doesn't work as this gives a negative w/h on some browsers.
67
- textArea.style.width = '2em';
68
- textArea.style.height = '2em';
69
-
70
- // We don't need padding, reducing the size if it does flash render.
71
- textArea.style.padding = '0';
72
-
73
- // Clean up any borders.
74
- textArea.style.border = 'none';
75
- textArea.style.outline = 'none';
76
- textArea.style.boxShadow = 'none';
77
-
78
- // Avoid flash of white box if rendered for any reason.
79
- textArea.style.background = 'transparent';
80
-
81
- textArea.value = text;
82
-
83
- document.body.appendChild(textArea);
84
-
85
- textArea.select();
86
-
87
- const res = ClipboardService.copySelected();
88
-
89
- document.body.removeChild(textArea);
90
- return res;
6
+ static copyCustom(text: string): Promise<void> {
7
+ return navigator.clipboard.writeText(text);
91
8
  }
92
9
  }
@@ -12,16 +12,16 @@ const nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/;
12
12
  /**
13
13
  * Loosely validate a URL `string`.
14
14
  *
15
- * @param {String} string
15
+ * @param {String} input
16
16
  * @return {Boolean}
17
17
  */
18
18
 
19
- export function isUrl(string: string): boolean {
20
- if (typeof string !== 'string') {
19
+ export function isUrl(input: unknown): boolean {
20
+ if (typeof input !== 'string') {
21
21
  return false;
22
22
  }
23
23
 
24
- const match = string.match(protocolAndDomainRE);
24
+ const match = input.match(protocolAndDomainRE);
25
25
  if (!match) {
26
26
  return false;
27
27
  }
@@ -1,6 +1,36 @@
1
1
  import type { FlattenSimpleInterpolation } from 'styled-components';
2
2
  import { css } from 'styled-components';
3
3
 
4
+ enum Token {
5
+ Comment = 'comment',
6
+ Prolog = 'prolog',
7
+ Doctype = 'doctype',
8
+ Cdata = 'cdata',
9
+ Punctuation = 'punctuation',
10
+ property = 'property',
11
+ Tag = 'tag',
12
+ Number = 'number',
13
+ Constant = 'constant',
14
+ Symbol = 'symbol',
15
+ Boolean = 'boolean',
16
+ Selector = 'selector',
17
+ String = 'string',
18
+ Char = 'char',
19
+ Builtin = 'builtin',
20
+ Inserted = 'inserted',
21
+ Operator = 'operator',
22
+ Entity = 'entity',
23
+ Url = 'url',
24
+ Variable = 'variable',
25
+ Atrule = 'atrule',
26
+ Keyword = 'keyword',
27
+ Regex = 'regex',
28
+ Important = 'important',
29
+ Bold = 'bold',
30
+ Italic = 'italic',
31
+ Deleted = 'deleted',
32
+ }
33
+
4
34
  const typographyProperties = Object.entries({
5
35
  fontSize: 'font-size',
6
36
  fontWeight: 'font-weight',
@@ -32,3 +62,19 @@ export function typography(
32
62
  ${getTypographyCssRulesByComponentName(componentName, fallbackName)}
33
63
  `;
34
64
  }
65
+
66
+ export function generateCodeBlockTokens(): FlattenSimpleInterpolation | string {
67
+ let res = '';
68
+
69
+ for (const token of Object.values(Token)) {
70
+ const cssTokenColorVariableName = `--code-block-tokens-${token}-color`;
71
+ res += `.token.${token} { color: var(${cssTokenColorVariableName})}; }\n`;
72
+ }
73
+
74
+ return css`
75
+ pre& {
76
+ color: var(--code-block-tokens-default-color);
77
+ }
78
+ ${res}
79
+ `;
80
+ }
@@ -1,73 +1,4 @@
1
- import { SimpleInterpolation } from 'styled-components';
2
1
  import { ColorProps, TypographyProps } from 'styled-system';
3
- export interface ITypography {
4
- fontSize?: string;
5
- fontWeight?: string | number;
6
- fontFamily?: string;
7
- lineHeight?: string;
8
- color?: string;
9
- transform?: string;
10
- marginTop?: string;
11
- marginRight?: string;
12
- marginLeft?: string;
13
- marginBottom?: string;
14
- marginVertical?: string;
15
- marginHorizontal?: string;
16
- }
17
- export declare const typographyTokens: {
18
- typography: {
19
- fontSize: string;
20
- fontFamily: string;
21
- lineHeight: string;
22
- };
23
- heading1: {
24
- fontSize: string;
25
- fontFamily: string;
26
- fontWeight: string;
27
- lineHeight: string;
28
- color: string;
29
- marginTop: string;
30
- marginBottom: string;
31
- };
32
- heading2: {
33
- fontSize: string;
34
- fontFamily: string;
35
- fontWeight: string;
36
- lineHeight: string;
37
- color: string;
38
- marginTop: string;
39
- marginBottom: string;
40
- };
41
- heading3: {
42
- fontSize: string;
43
- fontFamily: string;
44
- fontWeight: string;
45
- lineHeight: string;
46
- color: string;
47
- marginTop: string;
48
- marginBottom: string;
49
- };
50
- heading4: {};
51
- heading5: {};
52
- heading6: {};
53
- blockquote: {
54
- color: string;
55
- };
56
- alert: {
57
- fontSize: string;
58
- fontWeight: string;
59
- lineHeight: string;
60
- marginTop: string;
61
- marginBottom: string;
62
- heading: {
63
- fontSize: string;
64
- fontWeight: string;
65
- lineHeight: string;
66
- transform: string;
67
- };
68
- };
69
- };
70
- export declare function typography(theme?: ITypography): string | SimpleInterpolation;
71
2
  export declare const Emphasis: import("styled-components").StyledComponent<"strong", any, {
72
3
  'data-component-name': string;
73
4
  }, "data-component-name">;
@@ -77,13 +8,13 @@ export declare const H1: import("styled-components").StyledComponent<"h1", any,
77
8
  mt?: string | undefined;
78
9
  mb?: string | undefined;
79
10
  }, "data-component-name">;
80
- export declare const H2: import("styled-components").StyledComponent<"h1", any, {
11
+ export declare const H2: import("styled-components").StyledComponent<"h2", any, {
81
12
  'data-component-name': string;
82
13
  } & TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & {
83
14
  mt?: string | undefined;
84
15
  mb?: string | undefined;
85
16
  }, "data-component-name">;
86
- export declare const H3: import("styled-components").StyledComponent<"h1", any, {
17
+ export declare const H3: import("styled-components").StyledComponent<"h3", any, {
87
18
  'data-component-name': string;
88
19
  } & TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & {
89
20
  mt?: string | undefined;
package/ui/Typography.js CHANGED
@@ -3,126 +3,48 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
4
  return cooked;
5
5
  };
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
- Object.defineProperty(o, "default", { enumerable: true, value: v });
19
- }) : function(o, v) {
20
- o["default"] = v;
21
- });
22
- var __importStar = (this && this.__importStar) || function (mod) {
23
- if (mod && mod.__esModule) return mod;
24
- var result = {};
25
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
- __setModuleDefault(result, mod);
27
- return result;
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
8
  };
29
9
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.CompactTypography = exports.Typography = exports.SectionHeader = exports.H3 = exports.H2 = exports.H1 = exports.Emphasis = exports.typography = exports.typographyTokens = void 0;
31
- var styled_components_1 = __importStar(require("styled-components"));
10
+ exports.CompactTypography = exports.Typography = exports.SectionHeader = exports.H3 = exports.H2 = exports.H1 = exports.Emphasis = void 0;
11
+ var styled_components_1 = __importDefault(require("styled-components"));
32
12
  var styled_system_1 = require("styled-system");
33
- exports.typographyTokens = {
34
- typography: {
35
- fontSize: 'var(--font-size-base)',
36
- fontFamily: 'var(--h-font-family)',
37
- lineHeight: 'var(--line-height-base)',
38
- },
39
- heading1: {
40
- fontSize: 'var(--h1-font-size)',
41
- fontFamily: 'var(--h-font-family)',
42
- fontWeight: 'var(--font-weight-bold)',
43
- lineHeight: 'var(--h1-line-height)',
44
- color: 'var(--color-content)',
45
- marginTop: 'var(--h1-margin-top)',
46
- marginBottom: 'var(--h1-margin-bottom)',
47
- },
48
- heading2: {
49
- fontSize: 'var(--h2-font-size)',
50
- fontFamily: 'var(--h-font-family)',
51
- fontWeight: 'var(--font-weight-bold)',
52
- lineHeight: 'var(--h2-line-height)',
53
- color: 'var(--color-content)',
54
- marginTop: 'var(--h2-margin-top)',
55
- marginBottom: 'var(--h2-margin-bottom)',
56
- },
57
- heading3: {
58
- fontSize: 'var(--h3-font-size)',
59
- fontFamily: 'var(--h-font-family)',
60
- fontWeight: 'var(--font-weight-bold)',
61
- lineHeight: 'var(--h3-line-height)',
62
- color: 'var(--color-content)',
63
- marginTop: 'var(--h3-margin-top)',
64
- marginBottom: 'var(--h3-margin-bottom)',
65
- },
66
- heading4: {},
67
- heading5: {},
68
- heading6: {},
69
- blockquote: {
70
- color: 'var(--color-content)',
71
- },
72
- alert: {
73
- fontSize: 'var(--admonition-font-size)',
74
- fontWeight: 'var(--admonition-font-weight)',
75
- lineHeight: 'var(--admonition-line-height)',
76
- marginTop: 'var(--admonition-margin-vertical)',
77
- marginBottom: 'var(--admonition-margin-vertical)',
78
- heading: {
79
- fontSize: 'var(--admonition-heading-font-size)',
80
- fontWeight: 'var(--admonition-heading-font-weight)',
81
- lineHeight: 'var(--admonition-line-height)',
82
- transform: 'var(--admonition-heading-transform)',
83
- },
84
- },
85
- };
86
- function typography(theme) {
87
- if (!theme)
88
- return '';
89
- return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: ", ";\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n text-transform: ", ";\n "], ["\n font-size: ", ";\n font-weight: ", ";\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n text-transform: ", ";\n "])), theme.fontSize || '', theme.fontWeight || '', theme.fontFamily || '', theme.lineHeight || '', theme.color || '', theme.transform || '');
90
- }
91
- exports.typography = typography;
13
+ var utils_1 = require("../utils");
92
14
  exports.Emphasis = styled_components_1.default.strong.attrs(function () { return ({
93
15
  'data-component-name': 'ui/Typography/Emphasis',
94
- }); })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-weight: var(--font-weight-bold);\n"], ["\n font-weight: var(--font-weight-bold);\n"])));
16
+ }); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-weight: var(--font-weight-bold);\n"], ["\n font-weight: var(--font-weight-bold);\n"])));
95
17
  exports.H1 = styled_components_1.default.h1.attrs(function () { return ({
96
18
  'data-component-name': 'ui/Typography/H1',
97
- }); })(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n margin: 1.35em 0 0.9em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"], ["\n ", ";\n margin: 1.35em 0 0.9em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"])), typography(exports.typographyTokens.heading1), function (_a) {
19
+ }); })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", ";\n margin: 1.35em 0 0.9em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"], ["\n ", ";\n margin: 1.35em 0 0.9em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"])), (0, utils_1.typography)('h1', 'h'), function (_a) {
98
20
  var mt = _a.mt;
99
21
  return mt && "margin-top: ".concat(mt, ";");
100
22
  }, function (_a) {
101
23
  var mb = _a.mb;
102
24
  return mb && "margin-bottom: ".concat(mb, ";");
103
25
  }, styled_system_1.color, styled_system_1.typography);
104
- exports.H2 = styled_components_1.default.h1.attrs(function () { return ({
26
+ exports.H2 = styled_components_1.default.h2.attrs(function () { return ({
105
27
  'data-component-name': 'ui/Typography/H2',
106
- }); })(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n margin: 1.25em 0 0.8em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"], ["\n ", ";\n margin: 1.25em 0 0.8em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"])), typography(exports.typographyTokens.heading2), function (_a) {
28
+ }); })(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n margin: 1.25em 0 0.8em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"], ["\n ", ";\n margin: 1.25em 0 0.8em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"])), (0, utils_1.typography)('h2', 'h'), function (_a) {
107
29
  var mt = _a.mt;
108
30
  return mt && "margin-top: ".concat(mt, ";");
109
31
  }, function (_a) {
110
32
  var mb = _a.mb;
111
33
  return mb && "margin-bottom: ".concat(mb, ";");
112
34
  }, styled_system_1.color, styled_system_1.typography);
113
- exports.H3 = styled_components_1.default.h1.attrs(function () { return ({
35
+ exports.H3 = styled_components_1.default.h3.attrs(function () { return ({
114
36
  'data-component-name': 'ui/Typography/H3',
115
- }); })(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n margin: 1.25em 0 0.8em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"], ["\n ", ";\n margin: 1.25em 0 0.8em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"])), typography(exports.typographyTokens.heading3), function (_a) {
37
+ }); })(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n margin: 1.25em 0 0.8em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"], ["\n ", ";\n margin: 1.25em 0 0.8em;\n && {\n ", "\n ", "\n ", "\n ", "\n }\n"])), (0, utils_1.typography)('h3', 'h'), function (_a) {
116
38
  var mt = _a.mt;
117
39
  return mt && "margin-top: ".concat(mt, ";");
118
40
  }, function (_a) {
119
41
  var mb = _a.mb;
120
42
  return mb && "margin-bottom: ".concat(mb, ";");
121
43
  }, styled_system_1.color, styled_system_1.typography);
122
- exports.SectionHeader = styled_components_1.default.h2(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: var(--h-color);\n font-size: 1.75em;\n font-weight: var(--font-weight-regular);\n text-align: center;\n margin: 2.65em 0;\n padding: 0px 20px;\n font-family: var(--h-font-family);\n"], ["\n color: var(--h-color);\n font-size: 1.75em;\n font-weight: var(--font-weight-regular);\n text-align: center;\n margin: 2.65em 0;\n padding: 0px 20px;\n font-family: var(--h-font-family);\n"])));
44
+ exports.SectionHeader = styled_components_1.default.h2(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: var(--h-color);\n font-size: 1.75em;\n font-weight: var(--font-weight-regular);\n text-align: center;\n margin: 2.65em 0;\n padding: 0 20px;\n font-family: var(--h-font-family);\n"], ["\n color: var(--h-color);\n font-size: 1.75em;\n font-weight: var(--font-weight-regular);\n text-align: center;\n margin: 2.65em 0;\n padding: 0 20px;\n font-family: var(--h-font-family);\n"])));
123
45
  exports.Typography = styled_components_1.default.p.attrs(function () { return ({
124
46
  'data-component-name': 'ui/Typography/Typography',
125
- }); })(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", ";\n color: var(--color-content);\n ", "\n margin-top: ", ";\n margin-bottom: ", ";\n ", "\n"], ["\n ", ";\n color: var(--color-content);\n ", "\n margin-top: ", ";\n margin-bottom: ", ";\n ", "\n"])), typography(exports.typographyTokens.typography), styled_system_1.color, function (_a) {
47
+ }); })(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: var(--font-size-base);\n font-family: var(--font-family-base);\n line-height: var(--line-height-base);\n color: var(--color-content);\n ", ";\n margin-top: ", ";\n margin-bottom: ", ";\n ", "\n"], ["\n font-size: var(--font-size-base);\n font-family: var(--font-family-base);\n line-height: var(--line-height-base);\n color: var(--color-content);\n ", ";\n margin-top: ", ";\n margin-bottom: ", ";\n ", "\n"])), styled_system_1.color, function (_a) {
126
48
  var mt = _a.mt;
127
49
  return mt || '1em';
128
50
  }, function (_a) {
@@ -133,5 +55,5 @@ exports.CompactTypography = (0, styled_components_1.default)(exports.Typography)
133
55
  mt: '0em',
134
56
  mb: '0em',
135
57
  'data-component-name': 'ui/Typography/CompactTypography',
136
- }); })(templateObject_8 || (templateObject_8 = __makeTemplateObject([""], [""])));
137
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
58
+ }); })(templateObject_7 || (templateObject_7 = __makeTemplateObject([""], [""])));
59
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -23,12 +23,8 @@ var jsx_runtime_1 = require("react/jsx-runtime");
23
23
  var react_router_dom_1 = require("react-router-dom");
24
24
  var styled_components_1 = __importDefault(require("styled-components"));
25
25
  var isUrl_1 = require("../utils/isUrl");
26
- var replaceHashInColor_1 = require("../utils/replaceHashInColor");
27
26
  var Link_1 = require("../mocks/Link");
28
- var StyledExternalLink = styled_components_1.default.a(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.external-url {\n position: relative;\n\n :after {\n content: '';\n display: inline-block;\n position: absolute;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' x='0' y='0' viewBox='0 0 100 125' enable-background='new 0 0 100 100' xml:space='preserve'%3E%3Cpath fill='", "' d='M-408.2-318.5 98.6 4.8c0-0.1 0-0.2-0.1-0.3 0-0.1-0.1-0.2-0.1-0.3 0-0.1 0-0.1-0.1-0.2 0 0 0-0.1 0-0.1 0-0.1-0.1-0.2-0.2-0.3 0-0.1-0.1-0.2-0.2-0.3 -0.1-0.1-0.1-0.2-0.2-0.3C97.7 2.9 97.6 2.8 97.5 2.7c-0.1-0.1-0.2-0.2-0.3-0.3 -0.1-0.1-0.1-0.1-0.2-0.2 -0.1-0.1-0.2-0.2-0.3-0.2 -0.1-0.1-0.2-0.1-0.2-0.2 -0.1-0.1-0.2-0.1-0.3-0.2 -0.1 0-0.2-0.1-0.3-0.1 0 0-0.1 0-0.1-0.1 -0.1 0-0.2 0-0.2-0.1 -0.1 0-0.2-0.1-0.3-0.1 -0.1 0-0.2-0.1-0.4-0.1 -0.1 0-0.2 0-0.3 0 -0.1 0-0.3 0-0.4 0 -0.1 0-0.1 0-0.2 0L63.8 1.3c-2.5 0-4.6 2.1-4.6 4.6 0 2.5 2.1 4.6 4.6 4.5l19.3-0.1 -29.8 30.2c-1.1 1.1-1.5 2.7-1.2 4.1 0.2 0.9 0.6 1.7 1.3 2.4 0.9 0.9 2.1 1.3 3.2 1.3 1.2 0 2.3-0.5 3.2-1.4l0 0 29.8-30.2 0.1 19.3c0 2.5 2.1 4.6 4.6 4.5 1.3 0 2.4-0.5 3.2-1.4 0.8-0.8 1.3-2 1.3-3.2L98.7 5.7c0-0.1 0-0.1 0-0.2 0-0.1 0-0.2 0-0.4C98.6 5 98.6 4.9 98.6 4.8zM6.5 83.3c0 5.7 4.6 10.4 10.4 10.4l55.6 0.1c5.7 0 10.4-4.6 10.4-10.4l-0.1-40.8h6.1v40.8c0 9-7.3 16.3-16.3 16.3l-56.4-0.1c-8.6 0-15.6-7-15.6-15.6L0.6 27.8c0-9 7.3-16.3 16.3-16.3l41.1-0.1v6.1L17 17.5c-5.7 0-10.4 4.6-10.4 10.4L6.5 83.3z'/%3E%3C/svg%3E\");\n width: 10px;\n height: 10px;\n background-repeat: no-repeat;\n top: 50%;\n right: -15px;\n transform: translateY(-50%);\n }\n }\n"], ["\n &.external-url {\n position: relative;\n\n :after {\n content: '';\n display: inline-block;\n position: absolute;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' x='0' y='0' viewBox='0 0 100 125' enable-background='new 0 0 100 100' xml:space='preserve'%3E%3Cpath fill='", "' d='M-408.2-318.5 98.6 4.8c0-0.1 0-0.2-0.1-0.3 0-0.1-0.1-0.2-0.1-0.3 0-0.1 0-0.1-0.1-0.2 0 0 0-0.1 0-0.1 0-0.1-0.1-0.2-0.2-0.3 0-0.1-0.1-0.2-0.2-0.3 -0.1-0.1-0.1-0.2-0.2-0.3C97.7 2.9 97.6 2.8 97.5 2.7c-0.1-0.1-0.2-0.2-0.3-0.3 -0.1-0.1-0.1-0.1-0.2-0.2 -0.1-0.1-0.2-0.2-0.3-0.2 -0.1-0.1-0.2-0.1-0.2-0.2 -0.1-0.1-0.2-0.1-0.3-0.2 -0.1 0-0.2-0.1-0.3-0.1 0 0-0.1 0-0.1-0.1 -0.1 0-0.2 0-0.2-0.1 -0.1 0-0.2-0.1-0.3-0.1 -0.1 0-0.2-0.1-0.4-0.1 -0.1 0-0.2 0-0.3 0 -0.1 0-0.3 0-0.4 0 -0.1 0-0.1 0-0.2 0L63.8 1.3c-2.5 0-4.6 2.1-4.6 4.6 0 2.5 2.1 4.6 4.6 4.5l19.3-0.1 -29.8 30.2c-1.1 1.1-1.5 2.7-1.2 4.1 0.2 0.9 0.6 1.7 1.3 2.4 0.9 0.9 2.1 1.3 3.2 1.3 1.2 0 2.3-0.5 3.2-1.4l0 0 29.8-30.2 0.1 19.3c0 2.5 2.1 4.6 4.6 4.5 1.3 0 2.4-0.5 3.2-1.4 0.8-0.8 1.3-2 1.3-3.2L98.7 5.7c0-0.1 0-0.1 0-0.2 0-0.1 0-0.2 0-0.4C98.6 5 98.6 4.9 98.6 4.8zM6.5 83.3c0 5.7 4.6 10.4 10.4 10.4l55.6 0.1c5.7 0 10.4-4.6 10.4-10.4l-0.1-40.8h6.1v40.8c0 9-7.3 16.3-16.3 16.3l-56.4-0.1c-8.6 0-15.6-7-15.6-15.6L0.6 27.8c0-9 7.3-16.3 16.3-16.3l41.1-0.1v6.1L17 17.5c-5.7 0-10.4 4.6-10.4 10.4L6.5 83.3z'/%3E%3C/svg%3E\");\n width: 10px;\n height: 10px;\n background-repeat: no-repeat;\n top: 50%;\n right: -15px;\n transform: translateY(-50%);\n }\n }\n"])), function (_a) {
29
- var theme = _a.theme;
30
- return (0, replaceHashInColor_1.replaceHashInColor)(theme.colors.text.primary);
31
- });
27
+ var StyledExternalLink = styled_components_1.default.a(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.external-url {\n position: relative;\n\n :after {\n content: '';\n display: inline-block;\n position: absolute;\n background: var(--color-content);\n mask-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' x='0' y='0' viewBox='0 0 100 125' enable-background='new 0 0 100 100' xml:space='preserve'%3E%3Cpath d='M-408.2-318.5 98.6 4.8c0-0.1 0-0.2-0.1-0.3 0-0.1-0.1-0.2-0.1-0.3 0-0.1 0-0.1-0.1-0.2 0 0 0-0.1 0-0.1 0-0.1-0.1-0.2-0.2-0.3 0-0.1-0.1-0.2-0.2-0.3 -0.1-0.1-0.1-0.2-0.2-0.3C97.7 2.9 97.6 2.8 97.5 2.7c-0.1-0.1-0.2-0.2-0.3-0.3 -0.1-0.1-0.1-0.1-0.2-0.2 -0.1-0.1-0.2-0.2-0.3-0.2 -0.1-0.1-0.2-0.1-0.2-0.2 -0.1-0.1-0.2-0.1-0.3-0.2 -0.1 0-0.2-0.1-0.3-0.1 0 0-0.1 0-0.1-0.1 -0.1 0-0.2 0-0.2-0.1 -0.1 0-0.2-0.1-0.3-0.1 -0.1 0-0.2-0.1-0.4-0.1 -0.1 0-0.2 0-0.3 0 -0.1 0-0.3 0-0.4 0 -0.1 0-0.1 0-0.2 0L63.8 1.3c-2.5 0-4.6 2.1-4.6 4.6 0 2.5 2.1 4.6 4.6 4.5l19.3-0.1 -29.8 30.2c-1.1 1.1-1.5 2.7-1.2 4.1 0.2 0.9 0.6 1.7 1.3 2.4 0.9 0.9 2.1 1.3 3.2 1.3 1.2 0 2.3-0.5 3.2-1.4l0 0 29.8-30.2 0.1 19.3c0 2.5 2.1 4.6 4.6 4.5 1.3 0 2.4-0.5 3.2-1.4 0.8-0.8 1.3-2 1.3-3.2L98.7 5.7c0-0.1 0-0.1 0-0.2 0-0.1 0-0.2 0-0.4C98.6 5 98.6 4.9 98.6 4.8zM6.5 83.3c0 5.7 4.6 10.4 10.4 10.4l55.6 0.1c5.7 0 10.4-4.6 10.4-10.4l-0.1-40.8h6.1v40.8c0 9-7.3 16.3-16.3 16.3l-56.4-0.1c-8.6 0-15.6-7-15.6-15.6L0.6 27.8c0-9 7.3-16.3 16.3-16.3l41.1-0.1v6.1L17 17.5c-5.7 0-10.4 4.6-10.4 10.4L6.5 83.3z'/%3E%3C/svg%3E\");\n mask-repeat: no-repeat;\n width: 10px;\n height: 10px;\n top: 50%;\n right: -15px;\n transform: translateY(-50%);\n }\n }\n"], ["\n &.external-url {\n position: relative;\n\n :after {\n content: '';\n display: inline-block;\n position: absolute;\n background: var(--color-content);\n mask-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' x='0' y='0' viewBox='0 0 100 125' enable-background='new 0 0 100 100' xml:space='preserve'%3E%3Cpath d='M-408.2-318.5 98.6 4.8c0-0.1 0-0.2-0.1-0.3 0-0.1-0.1-0.2-0.1-0.3 0-0.1 0-0.1-0.1-0.2 0 0 0-0.1 0-0.1 0-0.1-0.1-0.2-0.2-0.3 0-0.1-0.1-0.2-0.2-0.3 -0.1-0.1-0.1-0.2-0.2-0.3C97.7 2.9 97.6 2.8 97.5 2.7c-0.1-0.1-0.2-0.2-0.3-0.3 -0.1-0.1-0.1-0.1-0.2-0.2 -0.1-0.1-0.2-0.2-0.3-0.2 -0.1-0.1-0.2-0.1-0.2-0.2 -0.1-0.1-0.2-0.1-0.3-0.2 -0.1 0-0.2-0.1-0.3-0.1 0 0-0.1 0-0.1-0.1 -0.1 0-0.2 0-0.2-0.1 -0.1 0-0.2-0.1-0.3-0.1 -0.1 0-0.2-0.1-0.4-0.1 -0.1 0-0.2 0-0.3 0 -0.1 0-0.3 0-0.4 0 -0.1 0-0.1 0-0.2 0L63.8 1.3c-2.5 0-4.6 2.1-4.6 4.6 0 2.5 2.1 4.6 4.6 4.5l19.3-0.1 -29.8 30.2c-1.1 1.1-1.5 2.7-1.2 4.1 0.2 0.9 0.6 1.7 1.3 2.4 0.9 0.9 2.1 1.3 3.2 1.3 1.2 0 2.3-0.5 3.2-1.4l0 0 29.8-30.2 0.1 19.3c0 2.5 2.1 4.6 4.6 4.5 1.3 0 2.4-0.5 3.2-1.4 0.8-0.8 1.3-2 1.3-3.2L98.7 5.7c0-0.1 0-0.1 0-0.2 0-0.1 0-0.2 0-0.4C98.6 5 98.6 4.9 98.6 4.8zM6.5 83.3c0 5.7 4.6 10.4 10.4 10.4l55.6 0.1c5.7 0 10.4-4.6 10.4-10.4l-0.1-40.8h6.1v40.8c0 9-7.3 16.3-16.3 16.3l-56.4-0.1c-8.6 0-15.6-7-15.6-15.6L0.6 27.8c0-9 7.3-16.3 16.3-16.3l41.1-0.1v6.1L17 17.5c-5.7 0-10.4 4.6-10.4 10.4L6.5 83.3z'/%3E%3C/svg%3E\");\n mask-repeat: no-repeat;\n width: 10px;\n height: 10px;\n top: 50%;\n right: -15px;\n transform: translateY(-50%);\n }\n }\n"])));
32
28
  // TODO: We're using our own Link component so probably filtering is not necessary here.
33
29
  // filter out unnecessary props
34
30
  var propsList = [
@@ -1,8 +1,4 @@
1
1
  export declare class ClipboardService {
2
2
  static isSupported(): boolean;
3
- static selectElement(element: HTMLDivElement | null): void;
4
- static deselect(): void;
5
- static copySelected(): boolean;
6
- static copyElement(element: HTMLDivElement | null): boolean;
7
- static copyCustom(text: string): boolean;
3
+ static copyCustom(text: string): Promise<void>;
8
4
  }