@douyinfe/semi-foundation 2.56.3 → 2.56.4-alpha.2

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.
@@ -0,0 +1,5 @@
1
+ declare const cssClasses: {
2
+ PREFIX: string;
3
+ };
4
+ declare const strings: {};
5
+ export { cssClasses, strings };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.strings = exports.cssClasses = void 0;
7
+ var _constants = require("../base/constants");
8
+ const cssClasses = {
9
+ PREFIX: `${_constants.BASE_CLASS_PREFIX}-markdownRender`
10
+ };
11
+ exports.cssClasses = cssClasses;
12
+ const strings = {};
13
+ exports.strings = strings;
@@ -0,0 +1,19 @@
1
+ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
+ import { MDXProps } from 'mdx/types';
3
+ export interface MarkdownRenderAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
4
+ getRuntime: () => any;
5
+ }
6
+ export interface MarkdownRenderBaseProps {
7
+ mdxRaw: string;
8
+ components: MDXProps['components'];
9
+ }
10
+ export interface MarkdownRenderBaseState {
11
+ MDXContentComponent: any;
12
+ }
13
+ declare class MarkdownRenderFoundation extends BaseFoundation<MarkdownRenderAdapter> {
14
+ private getOptions;
15
+ compile: (mdxRaw: string) => Promise<import("vfile").VFile>;
16
+ evaluate: (mdxRaw: string) => Promise<import("mdx/types").MDXContent>;
17
+ evaluateSync: (mdxRaw: string) => import("mdx/types").MDXContent;
18
+ }
19
+ export default MarkdownRenderFoundation;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _foundation = _interopRequireDefault(require("../base/foundation"));
8
+ var _mdx = require("@mdx-js/mdx");
9
+ var _remarkGfm = _interopRequireDefault(require("remark-gfm"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) {
13
+ return value instanceof P ? value : new P(function (resolve) {
14
+ resolve(value);
15
+ });
16
+ }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) {
19
+ try {
20
+ step(generator.next(value));
21
+ } catch (e) {
22
+ reject(e);
23
+ }
24
+ }
25
+ function rejected(value) {
26
+ try {
27
+ step(generator["throw"](value));
28
+ } catch (e) {
29
+ reject(e);
30
+ }
31
+ }
32
+ function step(result) {
33
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
34
+ }
35
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
36
+ });
37
+ };
38
+ class MarkdownRenderFoundation extends _foundation.default {
39
+ constructor() {
40
+ super(...arguments);
41
+ this.getOptions = () => {
42
+ return {
43
+ evaluateOptions: {
44
+ remarkPlugins: [_remarkGfm.default]
45
+ },
46
+ compileOptions: {},
47
+ runOptions: {}
48
+ };
49
+ };
50
+ this.compile = mdxRaw => __awaiter(this, void 0, void 0, function* () {
51
+ return yield (0, _mdx.compile)(mdxRaw, this.getOptions().compileOptions);
52
+ });
53
+ this.evaluate = mdxRaw => __awaiter(this, void 0, void 0, function* () {
54
+ return (yield (0, _mdx.evaluate)(mdxRaw, Object.assign(Object.assign(Object.assign({}, this.getOptions().runOptions), this.getOptions().evaluateOptions), this._adapter.getRuntime()))).default;
55
+ });
56
+ this.evaluateSync = mdxRaw => {
57
+ return (0, _mdx.evaluateSync)(mdxRaw, Object.assign(Object.assign(Object.assign({}, this.getOptions().runOptions), this.getOptions().evaluateOptions), this._adapter.getRuntime())).default;
58
+ };
59
+ }
60
+ }
61
+ var _default = MarkdownRenderFoundation;
62
+ exports.default = _default;
@@ -0,0 +1,26 @@
1
+ /* shadow */
2
+ /* sizing */
3
+ /* spacing */
4
+ .semi-markdownRender ul, .semi-markdownRender li {
5
+ color: var(--semi-color-text-0);
6
+ }
7
+ .semi-markdownRender-component-image {
8
+ margin: 16px 16px 16px 16px;
9
+ max-width: 50%;
10
+ max-height: 500px;
11
+ display: flex;
12
+ flex-direction: column;
13
+ justify-content: center;
14
+ }
15
+ .semi-markdownRender-component-image-alt {
16
+ margin-top: 8px;
17
+ text-align: center;
18
+ color: var(--semi-color-tertiary);
19
+ }
20
+ .semi-markdownRender .semi-markdownRender-component-header {
21
+ margin-top: 16px;
22
+ margin-bottom: 16px;
23
+ }
24
+ .semi-markdownRender-component-p strong {
25
+ font-weight: 600;
26
+ }
@@ -0,0 +1,41 @@
1
+ @import "./variables.scss";
2
+
3
+ $module: #{$prefix}-markdownRender;
4
+
5
+ .#{$module} {
6
+
7
+ ul,li {
8
+ color:$color-markdownRender_component_list
9
+ }
10
+
11
+ &-component-image{
12
+ margin: $spacing-markdownRender_component_image-marginTop $spacing-markdownRender_component_image-marginRight $spacing-markdownRender_component_image-marginBottom $spacing-markdownRender_component_image-marginLeft;
13
+ max-width: $width-markdownRender_component_image-maxWidth;
14
+ max-height: $width-markdownRender_component_image-maxHeight;
15
+ display:flex;
16
+ flex-direction: column;
17
+ justify-content: center;
18
+
19
+ &-alt{
20
+ margin-top: $spacing-markdownRender_component_image_alt-marginTop;
21
+ text-align: center;
22
+ color:$color-markdownRender_component_image_alt;
23
+ }
24
+ }
25
+
26
+ & &-component-header{
27
+ margin-top: $spacing-markdownRender_component_header-marginTop;
28
+ margin-bottom: $spacing-markdownRender_component_header-marginBottom;
29
+ }
30
+
31
+ &-component-p{
32
+ strong{
33
+ font-weight: $font-weight-bold;
34
+ }
35
+ }
36
+
37
+
38
+
39
+
40
+
41
+ }
@@ -0,0 +1,15 @@
1
+ $spacing-markdownRender_component_image-marginLeft:16px;
2
+ $spacing-markdownRender_component_image-marginRight:16px;
3
+ $spacing-markdownRender_component_image-marginTop:16px;
4
+ $spacing-markdownRender_component_image-marginBottom:16px;
5
+ $width-markdownRender_component_image-maxWidth: 50%;
6
+ $width-markdownRender_component_image-maxHeight: 500px;
7
+ $spacing-markdownRender_component_image_alt-marginTop: 8px;
8
+
9
+
10
+ $spacing-markdownRender_component_header-marginTop: 16px;
11
+ $spacing-markdownRender_component_header-marginBottom: 16px;
12
+
13
+
14
+ $color-markdownRender_component_list: var(--semi-color-text-0);
15
+ $color-markdownRender_component_image_alt:var(--semi-color-tertiary);
@@ -0,0 +1,5 @@
1
+ declare const cssClasses: {
2
+ PREFIX: string;
3
+ };
4
+ declare const strings: {};
5
+ export { cssClasses, strings };
@@ -0,0 +1,6 @@
1
+ import { BASE_CLASS_PREFIX } from '../base/constants';
2
+ const cssClasses = {
3
+ PREFIX: `${BASE_CLASS_PREFIX}-markdownRender`
4
+ };
5
+ const strings = {};
6
+ export { cssClasses, strings };
@@ -0,0 +1,19 @@
1
+ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
+ import { MDXProps } from 'mdx/types';
3
+ export interface MarkdownRenderAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
4
+ getRuntime: () => any;
5
+ }
6
+ export interface MarkdownRenderBaseProps {
7
+ mdxRaw: string;
8
+ components: MDXProps['components'];
9
+ }
10
+ export interface MarkdownRenderBaseState {
11
+ MDXContentComponent: any;
12
+ }
13
+ declare class MarkdownRenderFoundation extends BaseFoundation<MarkdownRenderAdapter> {
14
+ private getOptions;
15
+ compile: (mdxRaw: string) => Promise<import("vfile").VFile>;
16
+ evaluate: (mdxRaw: string) => Promise<import("mdx/types").MDXContent>;
17
+ evaluateSync: (mdxRaw: string) => import("mdx/types").MDXContent;
18
+ }
19
+ export default MarkdownRenderFoundation;
@@ -0,0 +1,54 @@
1
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) {
3
+ return value instanceof P ? value : new P(function (resolve) {
4
+ resolve(value);
5
+ });
6
+ }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) {
9
+ try {
10
+ step(generator.next(value));
11
+ } catch (e) {
12
+ reject(e);
13
+ }
14
+ }
15
+ function rejected(value) {
16
+ try {
17
+ step(generator["throw"](value));
18
+ } catch (e) {
19
+ reject(e);
20
+ }
21
+ }
22
+ function step(result) {
23
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
24
+ }
25
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
26
+ });
27
+ };
28
+ import BaseFoundation from '../base/foundation';
29
+ import { evaluate, compile, evaluateSync } from '@mdx-js/mdx';
30
+ import remarkGfm from 'remark-gfm';
31
+ class MarkdownRenderFoundation extends BaseFoundation {
32
+ constructor() {
33
+ super(...arguments);
34
+ this.getOptions = () => {
35
+ return {
36
+ evaluateOptions: {
37
+ remarkPlugins: [remarkGfm]
38
+ },
39
+ compileOptions: {},
40
+ runOptions: {}
41
+ };
42
+ };
43
+ this.compile = mdxRaw => __awaiter(this, void 0, void 0, function* () {
44
+ return yield compile(mdxRaw, this.getOptions().compileOptions);
45
+ });
46
+ this.evaluate = mdxRaw => __awaiter(this, void 0, void 0, function* () {
47
+ return (yield evaluate(mdxRaw, Object.assign(Object.assign(Object.assign({}, this.getOptions().runOptions), this.getOptions().evaluateOptions), this._adapter.getRuntime()))).default;
48
+ });
49
+ this.evaluateSync = mdxRaw => {
50
+ return evaluateSync(mdxRaw, Object.assign(Object.assign(Object.assign({}, this.getOptions().runOptions), this.getOptions().evaluateOptions), this._adapter.getRuntime())).default;
51
+ };
52
+ }
53
+ }
54
+ export default MarkdownRenderFoundation;
@@ -0,0 +1,26 @@
1
+ /* shadow */
2
+ /* sizing */
3
+ /* spacing */
4
+ .semi-markdownRender ul, .semi-markdownRender li {
5
+ color: var(--semi-color-text-0);
6
+ }
7
+ .semi-markdownRender-component-image {
8
+ margin: 16px 16px 16px 16px;
9
+ max-width: 50%;
10
+ max-height: 500px;
11
+ display: flex;
12
+ flex-direction: column;
13
+ justify-content: center;
14
+ }
15
+ .semi-markdownRender-component-image-alt {
16
+ margin-top: 8px;
17
+ text-align: center;
18
+ color: var(--semi-color-tertiary);
19
+ }
20
+ .semi-markdownRender .semi-markdownRender-component-header {
21
+ margin-top: 16px;
22
+ margin-bottom: 16px;
23
+ }
24
+ .semi-markdownRender-component-p strong {
25
+ font-weight: 600;
26
+ }
@@ -0,0 +1,41 @@
1
+ @import "./variables.scss";
2
+
3
+ $module: #{$prefix}-markdownRender;
4
+
5
+ .#{$module} {
6
+
7
+ ul,li {
8
+ color:$color-markdownRender_component_list
9
+ }
10
+
11
+ &-component-image{
12
+ margin: $spacing-markdownRender_component_image-marginTop $spacing-markdownRender_component_image-marginRight $spacing-markdownRender_component_image-marginBottom $spacing-markdownRender_component_image-marginLeft;
13
+ max-width: $width-markdownRender_component_image-maxWidth;
14
+ max-height: $width-markdownRender_component_image-maxHeight;
15
+ display:flex;
16
+ flex-direction: column;
17
+ justify-content: center;
18
+
19
+ &-alt{
20
+ margin-top: $spacing-markdownRender_component_image_alt-marginTop;
21
+ text-align: center;
22
+ color:$color-markdownRender_component_image_alt;
23
+ }
24
+ }
25
+
26
+ & &-component-header{
27
+ margin-top: $spacing-markdownRender_component_header-marginTop;
28
+ margin-bottom: $spacing-markdownRender_component_header-marginBottom;
29
+ }
30
+
31
+ &-component-p{
32
+ strong{
33
+ font-weight: $font-weight-bold;
34
+ }
35
+ }
36
+
37
+
38
+
39
+
40
+
41
+ }
@@ -0,0 +1,15 @@
1
+ $spacing-markdownRender_component_image-marginLeft:16px;
2
+ $spacing-markdownRender_component_image-marginRight:16px;
3
+ $spacing-markdownRender_component_image-marginTop:16px;
4
+ $spacing-markdownRender_component_image-marginBottom:16px;
5
+ $width-markdownRender_component_image-maxWidth: 50%;
6
+ $width-markdownRender_component_image-maxHeight: 500px;
7
+ $spacing-markdownRender_component_image_alt-marginTop: 8px;
8
+
9
+
10
+ $spacing-markdownRender_component_header-marginTop: 16px;
11
+ $spacing-markdownRender_component_header-marginBottom: 16px;
12
+
13
+
14
+ $color-markdownRender_component_list: var(--semi-color-text-0);
15
+ $color-markdownRender_component_image_alt:var(--semi-color-tertiary);
@@ -0,0 +1,11 @@
1
+ import { BASE_CLASS_PREFIX } from '../base/constants';
2
+
3
+ const cssClasses = {
4
+ PREFIX: `${BASE_CLASS_PREFIX}-markdownRender`,
5
+ };
6
+
7
+ const strings = {
8
+
9
+ };
10
+
11
+ export { cssClasses, strings };
@@ -0,0 +1,67 @@
1
+ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
+ import { CompileOptions, evaluate, compile, EvaluateOptions, evaluateSync, RunOptions } from '@mdx-js/mdx';
3
+ import { MDXProps } from 'mdx/types';
4
+ import remarkGfm from 'remark-gfm';
5
+ export interface MarkdownRenderAdapter <P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
6
+ getRuntime: () => any
7
+
8
+ }
9
+
10
+
11
+
12
+
13
+ export interface MarkdownRenderBaseProps{
14
+ mdxRaw: string;
15
+ components: MDXProps['components']
16
+ }
17
+
18
+
19
+ export interface MarkdownRenderBaseState{
20
+ MDXContentComponent: any
21
+ }
22
+
23
+ class MarkdownRenderFoundation extends BaseFoundation<MarkdownRenderAdapter> {
24
+
25
+ private getOptions = ()=>{
26
+ return {
27
+ evaluateOptions: {
28
+ remarkPlugins: [remarkGfm]
29
+ },
30
+ compileOptions: {
31
+
32
+ },
33
+ runOptions: {
34
+ }
35
+ } as {
36
+ evaluateOptions: EvaluateOptions;
37
+ compileOptions: CompileOptions;
38
+ runOptions: RunOptions
39
+ };
40
+ }
41
+
42
+ compile = async (mdxRaw: string)=>{
43
+ return await compile(mdxRaw, this.getOptions().compileOptions);
44
+ }
45
+
46
+ evaluate = async (mdxRaw: string)=>{
47
+ return (await evaluate(mdxRaw, {
48
+ ...this.getOptions().runOptions,
49
+ ...this.getOptions().evaluateOptions,
50
+ ...this._adapter.getRuntime()
51
+ })).default;
52
+ }
53
+
54
+ evaluateSync = (mdxRaw: string)=>{
55
+ return ( evaluateSync(mdxRaw, {
56
+ ...this.getOptions().runOptions,
57
+ ...this.getOptions().evaluateOptions,
58
+ ...this._adapter.getRuntime()
59
+ })).default;
60
+ }
61
+
62
+
63
+
64
+ }
65
+
66
+ export default MarkdownRenderFoundation;
67
+
@@ -0,0 +1,41 @@
1
+ @import "./variables.scss";
2
+
3
+ $module: #{$prefix}-markdownRender;
4
+
5
+ .#{$module} {
6
+
7
+ ul,li {
8
+ color:$color-markdownRender_component_list
9
+ }
10
+
11
+ &-component-image{
12
+ margin: $spacing-markdownRender_component_image-marginTop $spacing-markdownRender_component_image-marginRight $spacing-markdownRender_component_image-marginBottom $spacing-markdownRender_component_image-marginLeft;
13
+ max-width: $width-markdownRender_component_image-maxWidth;
14
+ max-height: $width-markdownRender_component_image-maxHeight;
15
+ display:flex;
16
+ flex-direction: column;
17
+ justify-content: center;
18
+
19
+ &-alt{
20
+ margin-top: $spacing-markdownRender_component_image_alt-marginTop;
21
+ text-align: center;
22
+ color:$color-markdownRender_component_image_alt;
23
+ }
24
+ }
25
+
26
+ & &-component-header{
27
+ margin-top: $spacing-markdownRender_component_header-marginTop;
28
+ margin-bottom: $spacing-markdownRender_component_header-marginBottom;
29
+ }
30
+
31
+ &-component-p{
32
+ strong{
33
+ font-weight: $font-weight-bold;
34
+ }
35
+ }
36
+
37
+
38
+
39
+
40
+
41
+ }
@@ -0,0 +1,15 @@
1
+ $spacing-markdownRender_component_image-marginLeft:16px;
2
+ $spacing-markdownRender_component_image-marginRight:16px;
3
+ $spacing-markdownRender_component_image-marginTop:16px;
4
+ $spacing-markdownRender_component_image-marginBottom:16px;
5
+ $width-markdownRender_component_image-maxWidth: 50%;
6
+ $width-markdownRender_component_image-maxHeight: 500px;
7
+ $spacing-markdownRender_component_image_alt-marginTop: 8px;
8
+
9
+
10
+ $spacing-markdownRender_component_header-marginTop: 16px;
11
+ $spacing-markdownRender_component_header-marginBottom: 16px;
12
+
13
+
14
+ $color-markdownRender_component_list: var(--semi-color-text-0);
15
+ $color-markdownRender_component_image_alt:var(--semi-color-tertiary);
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.56.3",
3
+ "version": "2.56.4-alpha.2",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.56.3",
10
+ "@douyinfe/semi-animation": "2.56.4-alpha.2",
11
+ "@mdx-js/mdx": "^3.0.1",
11
12
  "async-validator": "^3.5.0",
12
13
  "classnames": "^2.2.6",
13
14
  "date-fns": "^2.29.3",
@@ -15,6 +16,7 @@
15
16
  "fast-copy": "^3.0.1 ",
16
17
  "lodash": "^4.17.21",
17
18
  "memoize-one": "^5.2.1",
19
+ "remark-gfm": "^4.0.0",
18
20
  "scroll-into-view-if-needed": "^2.2.24"
19
21
  },
20
22
  "keywords": [],
@@ -24,11 +26,12 @@
24
26
  "*.scss",
25
27
  "*.css"
26
28
  ],
27
- "gitHead": "933e2bf0c8d66a690b83d0410656ba4cdf265537",
29
+ "gitHead": "da5eaf67cac576a79ab6e556874d05b6c061c94a",
28
30
  "devDependencies": {
29
31
  "@babel/plugin-transform-runtime": "^7.15.8",
30
32
  "@babel/preset-env": "^7.15.8",
31
33
  "@types/lodash": "^4.14.176",
34
+ "@types/mdx": "^2.0.13",
32
35
  "babel-plugin-lodash": "^3.3.4",
33
36
  "del": "^6.0.0",
34
37
  "gulp": "^4.0.2",