@alifd/chat 0.3.8 → 0.3.9-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/index.js CHANGED
@@ -20,4 +20,4 @@ export { default as CardLoading } from './card-loading';
20
20
  export { default as Origin } from './origin';
21
21
  export { default as Loading } from './loading';
22
22
  export { default as Drawer } from './drawer';
23
- export const version = '0.3.8';
23
+ export const version = '0.3.9-beta.1';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @component svg-render
3
+ * @en svg-render
4
+ * @type 通用 - svg 渲染组件
5
+ * @when svg 渲染
6
+ */
7
+ import React from 'react';
8
+ import type { SvgRenderProps } from './types';
9
+ export * from './types';
10
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<SvgRenderProps & React.RefAttributes<HTMLDivElement>, "key" | keyof SvgRenderProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, HTMLDivElement, {}>;
11
+ export default _default;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @component svg-render
3
+ * @en svg-render
4
+ * @type 通用 - svg 渲染组件
5
+ * @when svg 渲染
6
+ */
7
+ import React, { forwardRef } from 'react';
8
+ import { ConfigProvider } from '@alifd/next';
9
+ import cs from 'classnames';
10
+ import { PREFIX_DEFAULT, assignSubComponent } from '../utils';
11
+ import { ReactSVG } from 'react-svg';
12
+ const SvgRender = forwardRef(({ className, svgClassName, src, options }) => {
13
+ return (React.createElement(ReactSVG, { className: cs(`${PREFIX_DEFAULT}svg-render`, className), src: src, beforeInjection: (svg) => {
14
+ if (options === null || options === void 0 ? void 0 : options.clearColor) {
15
+ // 去除 svg 下面 g 标签的 fill 属性
16
+ svg.querySelectorAll('*').forEach(dom => {
17
+ dom.removeAttribute('fill');
18
+ });
19
+ }
20
+ svgClassName && svg.classList.add(svgClassName);
21
+ } }));
22
+ });
23
+ const SvgRenderWithSub = assignSubComponent(SvgRender, {
24
+ displayName: 'SvgRender',
25
+ });
26
+ export * from './types';
27
+ export default ConfigProvider.config(SvgRenderWithSub);
File without changes
@@ -0,0 +1 @@
1
+ import './main.scss';
@@ -0,0 +1 @@
1
+ import './main.scss';
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { type CommonProps } from '@alifd/next';
3
+ /**
4
+ * @api svg-render
5
+ */
6
+ export interface SvgRenderProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
7
+ className?: string;
8
+ svgClassName?: string;
9
+ src: string;
10
+ options?: {
11
+ clearColor?: boolean;
12
+ };
13
+ }
@@ -0,0 +1 @@
1
+ export {};
package/lib/index.js CHANGED
@@ -46,4 +46,4 @@ var loading_1 = require("./loading");
46
46
  Object.defineProperty(exports, "Loading", { enumerable: true, get: function () { return tslib_1.__importDefault(loading_1).default; } });
47
47
  var drawer_1 = require("./drawer");
48
48
  Object.defineProperty(exports, "Drawer", { enumerable: true, get: function () { return tslib_1.__importDefault(drawer_1).default; } });
49
- exports.version = '0.3.8';
49
+ exports.version = '0.3.9-beta.1';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @component svg-render
3
+ * @en svg-render
4
+ * @type 通用 - svg 渲染组件
5
+ * @when svg 渲染
6
+ */
7
+ import React from 'react';
8
+ import type { SvgRenderProps } from './types';
9
+ export * from './types';
10
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<SvgRenderProps & React.RefAttributes<HTMLDivElement>, "key" | keyof SvgRenderProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, HTMLDivElement, {}>;
11
+ export default _default;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * @component svg-render
4
+ * @en svg-render
5
+ * @type 通用 - svg 渲染组件
6
+ * @when svg 渲染
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const tslib_1 = require("tslib");
10
+ const react_1 = tslib_1.__importStar(require("react"));
11
+ const next_1 = require("@alifd/next");
12
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
13
+ const utils_1 = require("../utils");
14
+ const react_svg_1 = require("react-svg");
15
+ const SvgRender = (0, react_1.forwardRef)(({ className, svgClassName, src, options }) => {
16
+ return (react_1.default.createElement(react_svg_1.ReactSVG, { className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}svg-render`, className), src: src, beforeInjection: (svg) => {
17
+ if (options === null || options === void 0 ? void 0 : options.clearColor) {
18
+ // 去除 svg 下面 g 标签的 fill 属性
19
+ svg.querySelectorAll('*').forEach(dom => {
20
+ dom.removeAttribute('fill');
21
+ });
22
+ }
23
+ svgClassName && svg.classList.add(svgClassName);
24
+ } }));
25
+ });
26
+ const SvgRenderWithSub = (0, utils_1.assignSubComponent)(SvgRender, {
27
+ displayName: 'SvgRender',
28
+ });
29
+ tslib_1.__exportStar(require("./types"), exports);
30
+ exports.default = next_1.ConfigProvider.config(SvgRenderWithSub);
File without changes
@@ -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,13 @@
1
+ import React from 'react';
2
+ import { type CommonProps } from '@alifd/next';
3
+ /**
4
+ * @api svg-render
5
+ */
6
+ export interface SvgRenderProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
7
+ className?: string;
8
+ svgClassName?: string;
9
+ src: string;
10
+ options?: {
11
+ clearColor?: boolean;
12
+ };
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alifd/chat",
3
- "version": "0.3.8",
3
+ "version": "0.3.9-beta.1",
4
4
  "description": "A configurable component library for chat built on React.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -325,6 +325,18 @@
325
325
  "./drawer/style.js": {
326
326
  "import": "./es/drawer/style.js",
327
327
  "require": "./lib/drawer/style.js"
328
+ },
329
+ "./svg-render": {
330
+ "import": "./es/svg-render/index.js",
331
+ "require": "./lib/svg-render/index.js"
332
+ },
333
+ "./svg-render/style": {
334
+ "import": "./es/svg-render/style.js",
335
+ "require": "./lib/svg-render/style.js"
336
+ },
337
+ "./svg-render/style.js": {
338
+ "import": "./es/svg-render/style.js",
339
+ "require": "./lib/svg-render/style.js"
328
340
  }
329
341
  },
330
342
  "files": [
@@ -393,7 +405,7 @@
393
405
  "rehype-slug": "^6.0.0",
394
406
  "remark-gfm": "^4.0.0",
395
407
  "sass": "^1.70.0",
396
- "sass-loader": "^14.0.0",
408
+ "sass-loader": "^16.0.0",
397
409
  "ts-morph": "^21.0.1",
398
410
  "tsconfck": "^3.1.1",
399
411
  "tsx": "^4.7.0",
@@ -422,7 +434,8 @@
422
434
  "react-copy-to-clipboard": "^5.1.0",
423
435
  "react-photo-view": "^1.2.6",
424
436
  "sanitize-html": "~2.7.3",
425
- "tslib": "^2.6.2"
437
+ "tslib": "^2.6.2",
438
+ "react-svg": "^16.1.34"
426
439
  },
427
440
  "sideEffects": [
428
441
  "es/**/style.js",