@alifd/chat 0.2.0 → 0.3.0-beta.0

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 (156) hide show
  1. package/es/HTMLRenderer/index.d.ts +4 -0
  2. package/es/HTMLRenderer/index.js +138 -0
  3. package/es/HTMLRenderer/index.less +194 -0
  4. package/es/HTMLRenderer/main.scss +233 -0
  5. package/es/HTMLRenderer/style.d.ts +1 -0
  6. package/es/HTMLRenderer/style.js +1 -0
  7. package/es/HTMLRenderer/types.d.ts +46 -0
  8. package/es/HTMLRenderer/types.js +1 -0
  9. package/es/ImagePreview/index.d.ts +13 -0
  10. package/es/ImagePreview/index.js +72 -0
  11. package/es/ImagePreview/main.scss +15 -0
  12. package/es/ImagePreview/style.d.ts +1 -0
  13. package/es/ImagePreview/style.js +1 -0
  14. package/es/ImagePreview/types.d.ts +31 -0
  15. package/es/ImagePreview/types.js +1 -0
  16. package/es/balloon/index.d.ts +7 -0
  17. package/es/balloon/index.js +7 -0
  18. package/es/balloon/style.d.ts +1 -0
  19. package/es/balloon/style.js +1 -0
  20. package/es/balloon/types.d.ts +219 -0
  21. package/es/balloon/types.js +1 -0
  22. package/es/card-loading/index.d.ts +11 -0
  23. package/es/card-loading/index.js +18 -0
  24. package/es/card-loading/main.scss +5 -0
  25. package/es/card-loading/style.d.ts +2 -0
  26. package/es/card-loading/style.js +2 -0
  27. package/es/card-loading/types.d.ts +10 -0
  28. package/es/card-loading/types.js +1 -0
  29. package/es/feedback/types.d.ts +8 -0
  30. package/es/float-button/hooks/useAutoHide.d.ts +0 -1
  31. package/es/float-button/hooks/useDragable.d.ts +0 -1
  32. package/es/float-button/index.d.ts +0 -1
  33. package/es/icon/index.d.ts +12 -0
  34. package/es/icon/index.js +21 -0
  35. package/es/icon/main.scss +1 -0
  36. package/es/icon/style.d.ts +2 -0
  37. package/es/icon/style.js +2 -0
  38. package/es/icon/types.d.ts +43 -0
  39. package/es/icon/types.js +1 -0
  40. package/es/index.d.ts +8 -0
  41. package/es/index.js +9 -1
  42. package/es/input/index.d.ts +1 -2
  43. package/es/list/index.d.ts +8 -0
  44. package/es/list/index.js +8 -0
  45. package/es/list/style.d.ts +1 -0
  46. package/es/list/style.js +1 -0
  47. package/es/list/types.d.ts +93 -0
  48. package/es/list/types.js +1 -0
  49. package/es/markdown/index.d.ts +6 -0
  50. package/es/markdown/index.js +138 -0
  51. package/es/markdown/main.scss +153 -0
  52. package/es/markdown/style.d.ts +3 -0
  53. package/es/markdown/style.js +3 -0
  54. package/es/markdown/types.d.ts +21 -0
  55. package/es/markdown/types.js +1 -0
  56. package/es/message/index.d.ts +75 -0
  57. package/es/message/index.js +30 -0
  58. package/es/message/main.scss +2 -0
  59. package/es/message/style.d.ts +2 -0
  60. package/es/message/style.js +2 -0
  61. package/es/message/types.d.ts +195 -0
  62. package/es/message/types.js +1 -0
  63. package/es/person-picker/index.d.ts +377 -2
  64. package/es/person-picker/index.js +3 -3
  65. package/es/tab/main.scss +2 -3
  66. package/es/tag/index.d.ts +20 -20
  67. package/es/tag/index.js +2 -2
  68. package/es/tag/main.scss +1 -1
  69. package/es/utils/func.d.ts +1 -0
  70. package/es/utils/func.js +9 -0
  71. package/lib/HTMLRenderer/index.d.ts +4 -0
  72. package/lib/HTMLRenderer/index.js +141 -0
  73. package/lib/HTMLRenderer/index.less +194 -0
  74. package/lib/HTMLRenderer/main.scss +233 -0
  75. package/lib/HTMLRenderer/style.d.ts +1 -0
  76. package/lib/HTMLRenderer/style.js +3 -0
  77. package/lib/HTMLRenderer/types.d.ts +46 -0
  78. package/lib/HTMLRenderer/types.js +2 -0
  79. package/lib/ImagePreview/index.d.ts +13 -0
  80. package/lib/ImagePreview/index.js +75 -0
  81. package/lib/ImagePreview/main.scss +15 -0
  82. package/lib/ImagePreview/style.d.ts +1 -0
  83. package/lib/ImagePreview/style.js +3 -0
  84. package/lib/ImagePreview/types.d.ts +31 -0
  85. package/lib/ImagePreview/types.js +2 -0
  86. package/lib/balloon/index.d.ts +7 -0
  87. package/lib/balloon/index.js +11 -0
  88. package/lib/balloon/style.d.ts +1 -0
  89. package/lib/balloon/style.js +3 -0
  90. package/lib/balloon/types.d.ts +219 -0
  91. package/lib/balloon/types.js +2 -0
  92. package/lib/card/view/card.js +2 -3
  93. package/lib/card-loading/index.d.ts +11 -0
  94. package/lib/card-loading/index.js +21 -0
  95. package/lib/card-loading/main.scss +5 -0
  96. package/lib/card-loading/style.d.ts +2 -0
  97. package/lib/card-loading/style.js +4 -0
  98. package/lib/card-loading/types.d.ts +10 -0
  99. package/lib/card-loading/types.js +2 -0
  100. package/lib/feedback/types.d.ts +8 -0
  101. package/lib/float-button/hooks/useAutoAlign.js +1 -2
  102. package/lib/float-button/hooks/useAutoHide.d.ts +0 -1
  103. package/lib/float-button/hooks/useAutoHide.js +1 -2
  104. package/lib/float-button/hooks/useDragable.d.ts +0 -1
  105. package/lib/float-button/hooks/useDragable.js +1 -2
  106. package/lib/float-button/hooks/useNestleEdge.js +1 -2
  107. package/lib/float-button/hooks/useTriggerType.js +1 -2
  108. package/lib/float-button/index.d.ts +0 -1
  109. package/lib/float-button/util.js +4 -5
  110. package/lib/float-button/view/balloon.js +1 -2
  111. package/lib/float-button/view/drawer.js +1 -2
  112. package/lib/float-button/view/inner-drawer.js +1 -2
  113. package/lib/icon/index.d.ts +12 -0
  114. package/lib/icon/index.js +23 -0
  115. package/lib/icon/main.scss +1 -0
  116. package/lib/icon/style.d.ts +2 -0
  117. package/lib/icon/style.js +4 -0
  118. package/lib/icon/types.d.ts +43 -0
  119. package/lib/icon/types.js +2 -0
  120. package/lib/index.d.ts +8 -0
  121. package/lib/index.js +30 -16
  122. package/lib/input/index.d.ts +1 -2
  123. package/lib/list/index.d.ts +8 -0
  124. package/lib/list/index.js +12 -0
  125. package/lib/list/style.d.ts +1 -0
  126. package/lib/list/style.js +3 -0
  127. package/lib/list/types.d.ts +93 -0
  128. package/lib/list/types.js +2 -0
  129. package/lib/markdown/index.d.ts +6 -0
  130. package/lib/markdown/index.js +141 -0
  131. package/lib/markdown/main.scss +153 -0
  132. package/lib/markdown/style.d.ts +3 -0
  133. package/lib/markdown/style.js +5 -0
  134. package/lib/markdown/types.d.ts +21 -0
  135. package/lib/markdown/types.js +2 -0
  136. package/lib/message/index.d.ts +75 -0
  137. package/lib/message/index.js +32 -0
  138. package/lib/message/main.scss +2 -0
  139. package/lib/message/style.d.ts +2 -0
  140. package/lib/message/style.js +4 -0
  141. package/lib/message/types.d.ts +195 -0
  142. package/lib/message/types.js +2 -0
  143. package/lib/person-picker/index.d.ts +377 -2
  144. package/lib/person-picker/index.js +3 -3
  145. package/lib/tab/main.scss +2 -3
  146. package/lib/tag/index.d.ts +20 -20
  147. package/lib/tag/index.js +2 -2
  148. package/lib/tag/main.scss +1 -1
  149. package/lib/utils/common.js +1 -2
  150. package/lib/utils/dingtalk.js +3 -4
  151. package/lib/utils/func.d.ts +1 -0
  152. package/lib/utils/func.js +12 -3
  153. package/lib/utils/hooks/useControlable.js +1 -2
  154. package/lib/utils/hooks/useDebounce.js +1 -2
  155. package/lib/utils/hooks/useThrottle.js +1 -2
  156. package/package.json +127 -5
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ /**
5
+ * @component HTML 渲染器
6
+ * @en HTML Renderer
7
+ * @type 通用 - General
8
+ * @remarks HTML 渲染组件用于解析和渲染 HTML 字符串,同时提供图片预览、链接处理和文本复制等功能。 - HTML renderer component used to parse and render HTML strings, with additional features such as image zoom, link handling, text copying and so on.
9
+ * @when 需要解析和渲染 HTML 字符串时使用。 - Use when you need to parse and render HTML strings.
10
+ */
11
+ const react_1 = tslib_1.__importStar(require("react"));
12
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
13
+ const sanitize_html_1 = tslib_1.__importDefault(require("sanitize-html"));
14
+ const html_react_parser_1 = tslib_1.__importStar(require("html-react-parser"));
15
+ const react_photo_view_1 = require("react-photo-view");
16
+ const query_string_1 = tslib_1.__importDefault(require("query-string"));
17
+ const ImagePreview_1 = tslib_1.__importDefault(require("../ImagePreview"));
18
+ const next_1 = require("@alifd/next");
19
+ const utils_1 = require("../utils");
20
+ const sanitizeHtmlOptions = {
21
+ allowedTags: sanitize_html_1.default.defaults.allowedTags.concat([
22
+ 'acronym', 'audio', 'big', 'center', 'del', 'dir', 'font',
23
+ 'img', 'ins', 'source', 'strike', 'track', 'tt', 'video',
24
+ ]),
25
+ allowedAttributes: {
26
+ '*': ['data-*', 'title', 'align', 'bgcolor', 'class', 'style'],
27
+ a: ['href', 'download'],
28
+ audio: ['controls', 'crossorigin', 'loop', 'muted', 'preload', 'src'],
29
+ br: ['clear'],
30
+ caption: ['align'],
31
+ col: ['span'],
32
+ colgroup: ['span'],
33
+ font: ['color', 'face', 'size'],
34
+ hr: ['color', 'noshade', 'size'],
35
+ img: ['alt', 'src', 'crossorigin', 'decoding', 'sizes', 'srcset', 'align', 'width', 'height'],
36
+ li: ['value', 'type'],
37
+ ol: ['reversed', 'start', 'type'],
38
+ source: ['sizes', 'src', 'srcset', 'type', 'media'],
39
+ table: ['border', 'cellpadding', 'cellspacing', 'frame', 'rules', 'summary'],
40
+ td: ['headers', 'colspan', 'rowspan'],
41
+ th: ['headers', 'colspan', 'rowspan'],
42
+ track: ['default', 'kind', 'label', 'src', 'srclang'],
43
+ ul: ['type'],
44
+ video: ['controls', 'crossorigin', 'loop', 'muted', 'preload', 'src', 'poster', 'width', 'height'],
45
+ },
46
+ enforceHtmlBoundary: false,
47
+ disallowedTagsMode: 'discard',
48
+ allowedSchemes: ['http', 'https', 'ftp', 'mailto', 'tel', 'message', 'copy', 'dingtalk', 'dtmd'],
49
+ allowedSchemesAppliedToAttributes: ['href', 'src', 'cite'],
50
+ allowProtocolRelative: false,
51
+ };
52
+ const HTMLRenderer = (0, react_1.memo)(function HTMLRenderer({ className, children, imagePreview, loose, handleOpenLink, sendTextMessage, copyText, i18n }) {
53
+ // 处理钉钉特定链接
54
+ function handleDingtalkUrl(href) {
55
+ return () => {
56
+ const { query } = query_string_1.default.parseUrl(href);
57
+ const { content, url, _assistant_adaptation, context } = query;
58
+ if (_assistant_adaptation === 'false') {
59
+ delete query._assistant_adaptation;
60
+ const newUrl = query_string_1.default.stringifyUrl({ url: href, query }, { sort: false });
61
+ handleOpenLink === null || handleOpenLink === void 0 ? void 0 : handleOpenLink(newUrl);
62
+ return;
63
+ }
64
+ let contextObj;
65
+ try {
66
+ contextObj = JSON.parse(context || '');
67
+ }
68
+ catch (e) {
69
+ contextObj = {};
70
+ }
71
+ if (contextObj.allowToDingtalk && contextObj.allowToDingtalk === true) {
72
+ handleOpenLink === null || handleOpenLink === void 0 ? void 0 : handleOpenLink(href);
73
+ }
74
+ else if (content) {
75
+ sendTextMessage === null || sendTextMessage === void 0 ? void 0 : sendTextMessage(`${content}`);
76
+ }
77
+ else if (url) {
78
+ handleOpenLink === null || handleOpenLink === void 0 ? void 0 : handleOpenLink(url === null || url === void 0 ? void 0 : url.toString());
79
+ }
80
+ else {
81
+ handleOpenLink === null || handleOpenLink === void 0 ? void 0 : handleOpenLink(href);
82
+ }
83
+ };
84
+ }
85
+ const parserOptions = {
86
+ replace: domNode => {
87
+ if (domNode instanceof html_react_parser_1.Element && domNode.attribs) {
88
+ const { name } = domNode;
89
+ if (name === 'a') {
90
+ const element = ((0, html_react_parser_1.domToReact)([domNode]));
91
+ const { props } = element;
92
+ if (props.href && props.href.startsWith('message://')) {
93
+ const msgValue = decodeURIComponent(props.href.slice(10));
94
+ return react_1.default.cloneElement(element, {
95
+ onClick: () => sendTextMessage === null || sendTextMessage === void 0 ? void 0 : sendTextMessage(msgValue),
96
+ href: undefined
97
+ });
98
+ }
99
+ if (props.href && props.href.startsWith('copy://')) {
100
+ const copyValue = decodeURIComponent(props.href.slice(7));
101
+ return react_1.default.cloneElement(element, {
102
+ onClick: copyText === null || copyText === void 0 ? void 0 : copyText(copyValue, i18n),
103
+ href: undefined
104
+ });
105
+ }
106
+ if (props.href && /^dtmd:\/\/dingtalkclient|^dingtalk:\/\/dingtalkclient\/action\/jumprobot|^(https?:)?\/\/qr.dingtalk.com\/action\/jumprobot/.test(props.href)) {
107
+ return react_1.default.cloneElement(element, {
108
+ onClick: handleDingtalkUrl(props.href),
109
+ href: undefined
110
+ });
111
+ }
112
+ return react_1.default.cloneElement(element, {
113
+ target: '_blank',
114
+ });
115
+ }
116
+ if (name === 'img') {
117
+ const element = ((0, html_react_parser_1.domToReact)([domNode]));
118
+ if (imagePreview) {
119
+ return react_1.default.createElement(ImagePreview_1.default, { className: "image", src: element.props.src }, element);
120
+ }
121
+ else {
122
+ return element;
123
+ }
124
+ }
125
+ }
126
+ }
127
+ };
128
+ const element = (0, react_1.useMemo)(() => {
129
+ return (0, html_react_parser_1.default)((0, sanitize_html_1.default)(children || '', sanitizeHtmlOptions), parserOptions);
130
+ }, [children]);
131
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)('box', className, {
132
+ 'loose': loose,
133
+ }) }, imagePreview ?
134
+ react_1.default.createElement(react_photo_view_1.PhotoProvider, null, element)
135
+ : element));
136
+ });
137
+ const HTMLRendererWithSub = (0, utils_1.assignSubComponent)(HTMLRenderer, {
138
+ displayName: 'HTMLRenderer',
139
+ });
140
+ tslib_1.__exportStar(require("./types"), exports);
141
+ exports.default = next_1.ConfigProvider.config(HTMLRendererWithSub);
@@ -0,0 +1,194 @@
1
+ @import '../../var.less';
2
+
3
+ .box {
4
+ font-size: 14px;
5
+ // color: hsla(230, 10%, 11%, 0.9);
6
+ word-break: break-word;
7
+ font-family: inherit;
8
+ .loose& {
9
+ font-size: 16px;
10
+ line-height: 1.85;
11
+ }
12
+ @media print {
13
+ color: #000 !important;
14
+ font-family: 'Times New Roman', Times, serif;
15
+ }
16
+ body:global(.dark) & {
17
+ filter: invert(1) hue-rotate(180deg);
18
+ }
19
+ img, video, iframe {
20
+ body:global(.dark) & {
21
+ filter: hue-rotate(180deg) invert(1);
22
+ }
23
+ }
24
+ img {
25
+ body:global(.dark) & {
26
+ background: #fff;
27
+ }
28
+ body:global(.dark.dim) & {
29
+ filter: hue-rotate(180deg) brightness(.75) invert(1);
30
+ }
31
+ }
32
+ body:global(.dark) & :global(.symbolic) > img {
33
+ filter: none;
34
+ background: none;
35
+ }
36
+ h1, h2, h3, h4, h5, h6, p, blockquote, table, .syntax-highlighter {
37
+ margin: 0;
38
+ .loose& {
39
+ margin: 20px 0;
40
+ }
41
+ }
42
+ h1, h2, h3, h4, h5, h6 {
43
+ font-weight: bold;
44
+ }
45
+ h1 {
46
+ font-size: 18px;
47
+ line-height: 1.8;
48
+ .loose& {
49
+ font-size: 28px;
50
+ }
51
+ }
52
+ h2 {
53
+ font-size: 16px;
54
+ line-height: 1.8;
55
+ .loose& {
56
+ font-size: 24px;
57
+ }
58
+ }
59
+ h3, h4, h5, h6 {
60
+ font-size: 14px;
61
+ line-height: 1.9;
62
+ }
63
+ h3 {
64
+ .loose& {
65
+ font-size: 18px;
66
+ }
67
+ }
68
+ h4, h5, h6 {
69
+ .loose& {
70
+ font-size: 16px;
71
+ }
72
+ }
73
+ img, video, .image {
74
+ max-width: 100%!important;
75
+ height: auto!important;
76
+ &:only-child {
77
+ display: block;
78
+ margin: 10px auto;
79
+ }
80
+ }
81
+ .image:only-child {
82
+ width: fit-content;
83
+ }
84
+ .image img {
85
+ margin: 0;
86
+ }
87
+ code {
88
+ margin: 0 .15em;
89
+ padding: .12em .25em;
90
+ border-radius: 3px;
91
+ font-size: 86%;
92
+ background: rgba(27,31,35,.05);
93
+ }
94
+ pre {
95
+ font-size: 14px;
96
+ line-height: 1.6;
97
+ border-radius: 2px;
98
+ border: 6px solid transparent;
99
+ overflow: auto;
100
+ margin: 0;
101
+ code {
102
+ font-size: 14px;
103
+ padding: 0;
104
+ margin: 0;
105
+ border: none;
106
+ font-size: inherit;
107
+ background: none;
108
+ border-radius: 0;
109
+ }
110
+ }
111
+ table, td, th {
112
+ border: 1px solid #caccce;
113
+ body:global(.dark) & {
114
+ border-color: #babcbd;
115
+ // border-color: #c9cace;
116
+ }
117
+ border-collapse: collapse;
118
+ border-spacing: 0;
119
+ }
120
+ table {
121
+ line-height: 1.6;
122
+ margin: 10px auto;
123
+ border-spacing: none;
124
+ border-collapse: collapse;
125
+ empty-cells: show;
126
+ font-size: 14px;
127
+ .loose& p {
128
+ margin: 0;
129
+ }
130
+ }
131
+ td, th {
132
+ border: 1px solid #e3e3e3;
133
+ padding: 10px 12px;
134
+ line-height: 1.3;
135
+ p {
136
+ margin: 0;
137
+ }
138
+ }
139
+ th {
140
+ background: hsla(230, 90%, 11%,.03);
141
+ }
142
+ a, a:visited {
143
+ color: #0080FF;
144
+ text-decoration: none;
145
+ &:hover {
146
+ text-decoration: underline;
147
+ }
148
+ }
149
+ ul, ol {
150
+ list-style: revert;
151
+ padding-left: 16px;
152
+ .loose& {
153
+ padding-left: 30px;
154
+ }
155
+ }
156
+ li {
157
+ list-style: revert;
158
+ }
159
+ blockquote {
160
+ opacity: 1;
161
+ border: none;
162
+ padding: 0;
163
+ margin-left: 20px;
164
+ opacity: 0.6;
165
+ font-style: italic;
166
+ position: relative;
167
+ margin-top: 6px;
168
+ margin-bottom: 6px;
169
+ .loose& {
170
+ margin-top: 20px;
171
+ margin-bottom: 20px;
172
+ }
173
+ &::before {
174
+ content: '|';
175
+ font-size: 0;
176
+ color: transparent;
177
+ display: inline-block;
178
+ width: 4px;
179
+ border-radius: 1px;
180
+ position: absolute;
181
+ margin-left: -16px;
182
+ top: 0;
183
+ bottom: 0;
184
+ background: hsla(230, 90%, 11%,.2);
185
+ }
186
+ }
187
+ hr {
188
+ height: 0;
189
+ border: none;
190
+ height: 1px;
191
+ background: hsla(230, 90%, 11%,.1);
192
+ margin: 10px 0;
193
+ }
194
+ }
@@ -0,0 +1,233 @@
1
+ .box {
2
+ font-size: 14px;
3
+ // color: hsla(230, 10%, 11%, 0.9);
4
+ word-break: break-word;
5
+ font-family: inherit;
6
+
7
+ &.loose {
8
+ font-size: 16px;
9
+ line-height: 1.85;
10
+ }
11
+
12
+ @media print {
13
+ color: #000 !important;
14
+ font-family: 'Times New Roman', Times, serif;
15
+ }
16
+
17
+ body.global-dark & {
18
+ filter: invert(1) hue-rotate(180deg);
19
+ }
20
+
21
+ img, video, iframe {
22
+ body.global-dark & {
23
+ filter: hue-rotate(180deg) invert(1);
24
+ }
25
+ }
26
+
27
+ img {
28
+ body.global-dark & {
29
+ background: #fff;
30
+ }
31
+ body.global-dark-dim & {
32
+ filter: hue-rotate(180deg) brightness(.75) invert(1);
33
+ }
34
+ }
35
+
36
+ body.global-dark & .symbolic > img {
37
+ filter: none;
38
+ background: none;
39
+ }
40
+
41
+ h1, h2, h3, h4, h5, h6, p, blockquote, table, .syntax-highlighter {
42
+ margin: 0;
43
+
44
+ &.loose {
45
+ margin: 20px 0;
46
+ }
47
+ }
48
+
49
+ h1, h2, h3, h4, h5, h6 {
50
+ font-weight: bold;
51
+ }
52
+
53
+ h1 {
54
+ font-size: 18px;
55
+ line-height: 1.8;
56
+
57
+ &.loose {
58
+ font-size: 28px;
59
+ }
60
+ }
61
+
62
+ h2 {
63
+ font-size: 16px;
64
+ line-height: 1.8;
65
+
66
+ &.loose {
67
+ font-size: 24px;
68
+ }
69
+ }
70
+
71
+ h3, h4, h5, h6 {
72
+ font-size: 14px;
73
+ line-height: 1.9;
74
+ }
75
+
76
+ h3 {
77
+ &.loose {
78
+ font-size: 18px;
79
+ }
80
+ }
81
+
82
+ h4, h5, h6 {
83
+ &.loose {
84
+ font-size: 16px;
85
+ }
86
+ }
87
+
88
+ img, video, .image {
89
+ max-width: 100% !important;
90
+ height: auto !important;
91
+
92
+ &:only-child {
93
+ display: block;
94
+ margin: 10px auto;
95
+ }
96
+ }
97
+
98
+ .image:only-child {
99
+ width: fit-content;
100
+ }
101
+
102
+ .image img {
103
+ margin: 0;
104
+ }
105
+
106
+ code {
107
+ margin: 0 .15em;
108
+ padding: .12em .25em;
109
+ border-radius: 3px;
110
+ font-size: 86%;
111
+ background: rgba(27, 31, 35, .05);
112
+ }
113
+
114
+ pre {
115
+ font-size: 14px;
116
+ line-height: 1.6;
117
+ border-radius: 4px;
118
+ border: 6px solid transparent;
119
+ overflow: auto;
120
+ margin: 0 0 8px 0;
121
+
122
+ code {
123
+ font-size: 14px;
124
+ padding: 0;
125
+ margin: 0;
126
+ border: none;
127
+ font-size: inherit;
128
+ background: none;
129
+ border-radius: 0;
130
+ }
131
+ }
132
+
133
+ table, td, th {
134
+ border: 1px solid #caccce;
135
+
136
+ body.global-dark & {
137
+ border-color: #babcbd;
138
+ // border-color: #c9cace;
139
+ }
140
+
141
+ border-collapse: collapse;
142
+ border-spacing: 0;
143
+ }
144
+
145
+ table {
146
+ line-height: 1.6;
147
+ margin: 10px auto;
148
+ border-spacing: none;
149
+ border-collapse: collapse;
150
+ empty-cells: show;
151
+ font-size: 14px;
152
+
153
+ &.loose p {
154
+ margin: 0;
155
+ }
156
+ }
157
+
158
+ td, th {
159
+ border: 1px solid #e3e3e3;
160
+ padding: 10px 12px;
161
+ line-height: 1.3;
162
+
163
+ p {
164
+ margin: 0;
165
+ }
166
+ }
167
+
168
+ th {
169
+ background: hsla(230, 90%, 11%, .03);
170
+ }
171
+
172
+ a, a:visited {
173
+ color: #0080FF;
174
+ text-decoration: none;
175
+
176
+ &:hover {
177
+ text-decoration: underline;
178
+ }
179
+ }
180
+
181
+ ul, ol {
182
+ list-style: revert;
183
+ padding-left: 16px;
184
+ margin: 0;
185
+
186
+ &.loose {
187
+ padding-left: 30px;
188
+ }
189
+ }
190
+
191
+ li {
192
+ list-style: revert;
193
+ }
194
+
195
+ blockquote {
196
+ opacity: 1;
197
+ border: none;
198
+ padding: 0;
199
+ margin-left: 20px;
200
+ opacity: 0.6;
201
+ font-style: italic;
202
+ position: relative;
203
+ margin-top: 6px;
204
+ margin-bottom: 6px;
205
+
206
+ &.loose {
207
+ margin-top: 20px;
208
+ margin-bottom: 20px;
209
+ }
210
+
211
+ &::before {
212
+ content: '|';
213
+ font-size: 0;
214
+ color: transparent;
215
+ display: inline-block;
216
+ width: 4px;
217
+ border-radius: 1px;
218
+ position: absolute;
219
+ margin-left: -16px;
220
+ top: 0;
221
+ bottom: 0;
222
+ background: hsla(230, 90%, 11%, .2);
223
+ }
224
+ }
225
+
226
+ hr {
227
+ height: 0;
228
+ border: none;
229
+ height: 1px;
230
+ background: hsla(230, 90%, 11%, .1);
231
+ margin: 10px 0;
232
+ }
233
+ }
@@ -0,0 +1 @@
1
+ import './main.scss';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("./main.scss");
@@ -0,0 +1,46 @@
1
+ import type React from 'react';
2
+ /**
3
+ * @api HTMLRenderer
4
+ */
5
+ export interface HTMLRendererProps extends React.HTMLAttributes<HTMLElement> {
6
+ /**
7
+ * 自定义类名
8
+ * @en Custom class name
9
+ */
10
+ className?: string;
11
+ /**
12
+ * 是否启用图片预览
13
+ * @en Enable image zoom
14
+ */
15
+ imagePreview?: boolean;
16
+ /**
17
+ * 是否使用松散模式
18
+ * @en Enable loose mode
19
+ */
20
+ loose?: boolean;
21
+ /**
22
+ * 要渲染的 HTML 字符串
23
+ * @en HTML string to render
24
+ */
25
+ children?: string;
26
+ /**
27
+ * 处理打开链接的函数
28
+ * @en Function to handle open link
29
+ */
30
+ handleOpenLink?: (href: string) => void;
31
+ /**
32
+ * 发送文本消息的函数
33
+ * @en Function to send text message
34
+ */
35
+ sendTextMessage?: (message: string) => void;
36
+ /**
37
+ * 复制文本的函数
38
+ * @en Function to copy text
39
+ */
40
+ copyText?: (text: string, i18n?: (key: string) => string) => void;
41
+ /**
42
+ * 国际化函数
43
+ * @en Internationalization function
44
+ */
45
+ i18n?: (key: string) => string;
46
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @component 图片预览
3
+ * @en ImagePreview
4
+ * @type 通用 - General
5
+ * @remarks 图片预览组件用于在钉钉环境中显示和预览图片。 - Image preview component used to display and preview images in DingTalk environment.
6
+ * @when 需要展示图片并提供预览功能时使用。 - Use when you need to display images and provide preview functionality.
7
+
8
+ */
9
+ import React from 'react';
10
+ import { ImagePreviewProps } from './types';
11
+ export * from './types';
12
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<ImagePreviewProps & React.RefAttributes<HTMLElement>, "key" | keyof ImagePreviewProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, HTMLElement, {}>;
13
+ export default _default;