@draftbit/core 46.2.4-6d236f.2 → 46.2.4-70e86e.10
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/lib/commonjs/components/Config.js +1 -1
- package/lib/commonjs/components/Markdown.js +78 -0
- package/lib/commonjs/components/SVG.js +4 -5
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/mappings/MapView.js +1 -0
- package/lib/commonjs/mappings/Markdown.js +23 -0
- package/lib/commonjs/mappings/SVG.js +2 -1
- package/lib/module/components/Config.js +1 -1
- package/lib/module/components/Markdown.js +63 -0
- package/lib/module/components/SVG.js +4 -5
- package/lib/module/index.js +2 -1
- package/lib/module/mappings/MapView.js +1 -0
- package/lib/module/mappings/Markdown.js +14 -0
- package/lib/module/mappings/SVG.js +3 -2
- package/lib/typescript/src/components/Markdown.d.ts +6 -0
- package/lib/typescript/src/components/SVG.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/mappings/MapView.d.ts +1 -0
- package/lib/typescript/src/mappings/Markdown.d.ts +9 -0
- package/lib/typescript/src/mappings/SVG.d.ts +1 -0
- package/package.json +6 -4
- package/src/components/Config.js +1 -1
- package/src/components/Config.ts +1 -1
- package/src/components/Markdown.js +57 -0
- package/src/components/Markdown.tsx +70 -0
- package/src/components/SVG.js +4 -5
- package/src/components/SVG.tsx +7 -7
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/MapView.js +1 -0
- package/src/mappings/MapView.ts +1 -0
- package/src/mappings/Markdown.js +14 -0
- package/src/mappings/Markdown.ts +15 -0
- package/src/mappings/SVG.js +8 -2
- package/src/mappings/SVG.ts +12 -2
|
@@ -62,7 +62,7 @@ var _default = {
|
|
|
62
62
|
width: size.width,
|
|
63
63
|
height: size.height
|
|
64
64
|
}, "image-placeholder_1"),
|
|
65
|
-
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-
|
|
65
|
+
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-image.svg",
|
|
66
66
|
squareImageUrl: buildImageUrl({
|
|
67
67
|
width: 100,
|
|
68
68
|
height: 100
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNativeMarkdownPackage = _interopRequireDefault(require("react-native-markdown-package"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const MarkdownComponent = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
content
|
|
22
|
+
} = _ref;
|
|
23
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_reactNativeMarkdownPackage.default, {
|
|
24
|
+
styles: markdownStyle.collectiveMd
|
|
25
|
+
}, content));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const markdownStyle = {
|
|
29
|
+
singleLineMd: {
|
|
30
|
+
text: {
|
|
31
|
+
color: "blue",
|
|
32
|
+
textAlign: "right"
|
|
33
|
+
},
|
|
34
|
+
view: {
|
|
35
|
+
alignSelf: "stretch"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
collectiveMd: {
|
|
39
|
+
heading1: {
|
|
40
|
+
color: "red"
|
|
41
|
+
},
|
|
42
|
+
heading2: {
|
|
43
|
+
color: "green",
|
|
44
|
+
textAlign: "right"
|
|
45
|
+
},
|
|
46
|
+
strong: {
|
|
47
|
+
color: "blue"
|
|
48
|
+
},
|
|
49
|
+
em: {
|
|
50
|
+
color: "cyan"
|
|
51
|
+
},
|
|
52
|
+
text: {
|
|
53
|
+
color: "black"
|
|
54
|
+
},
|
|
55
|
+
blockQuoteText: {
|
|
56
|
+
color: "grey"
|
|
57
|
+
},
|
|
58
|
+
blockQuoteSection: {
|
|
59
|
+
flexDirection: "row"
|
|
60
|
+
},
|
|
61
|
+
blockQuoteSectionBar: {
|
|
62
|
+
width: 3,
|
|
63
|
+
height: null,
|
|
64
|
+
backgroundColor: "#DDDDDD",
|
|
65
|
+
marginRight: 15
|
|
66
|
+
},
|
|
67
|
+
codeBlock: {
|
|
68
|
+
fontFamily: "Courier",
|
|
69
|
+
fontWeight: "500",
|
|
70
|
+
backgroundColor: "#DDDDDD"
|
|
71
|
+
},
|
|
72
|
+
tableHeader: {
|
|
73
|
+
backgroundColor: "grey"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var _default = MarkdownComponent;
|
|
78
|
+
exports.default = _default;
|
|
@@ -21,26 +21,25 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
21
|
|
|
22
22
|
const SVG = _ref => {
|
|
23
23
|
let {
|
|
24
|
-
source,
|
|
24
|
+
source = _Config.default.placeholderSvgURL,
|
|
25
25
|
style
|
|
26
26
|
} = _ref;
|
|
27
|
-
let svgSource = source === null || source === undefined ? _Config.default.placeholderSvgURL : source;
|
|
28
27
|
return /*#__PURE__*/React.createElement(React.Fragment, null, _reactNative.Platform.OS === "ios" && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
29
28
|
style: style
|
|
30
29
|
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgUri, {
|
|
31
30
|
width: "100%",
|
|
32
31
|
height: "100%",
|
|
33
|
-
uri:
|
|
32
|
+
uri: source
|
|
34
33
|
})), _reactNative.Platform.OS === "android" && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
35
34
|
style: style
|
|
36
35
|
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgUri, {
|
|
37
36
|
width: "100%",
|
|
38
37
|
height: "100%",
|
|
39
|
-
uri:
|
|
38
|
+
uri: source
|
|
40
39
|
})), _reactNative.Platform.OS === "web" && /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
41
40
|
style: style,
|
|
42
41
|
source: {
|
|
43
|
-
uri:
|
|
42
|
+
uri: source
|
|
44
43
|
}
|
|
45
44
|
}));
|
|
46
45
|
};
|
package/lib/commonjs/index.js
CHANGED
|
@@ -213,6 +213,12 @@ Object.defineProperty(exports, "Link", {
|
|
|
213
213
|
return _Text.Link;
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
|
+
Object.defineProperty(exports, "Markdown", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () {
|
|
219
|
+
return _Markdown.default;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
216
222
|
Object.defineProperty(exports, "NumberInput", {
|
|
217
223
|
enumerable: true,
|
|
218
224
|
get: function () {
|
|
@@ -512,6 +518,8 @@ var _Stepper = _interopRequireDefault(require("./components/Stepper"));
|
|
|
512
518
|
|
|
513
519
|
var _useAuthState = require("./components/useAuthState");
|
|
514
520
|
|
|
521
|
+
var _Markdown = _interopRequireDefault(require("./components/Markdown"));
|
|
522
|
+
|
|
515
523
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
516
524
|
|
|
517
525
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SEED_DATA = void 0;
|
|
7
|
+
|
|
8
|
+
var _types = require("@draftbit/types");
|
|
9
|
+
|
|
10
|
+
const SEED_DATA = {
|
|
11
|
+
name: "Markdown",
|
|
12
|
+
tag: "MarkdownComponent",
|
|
13
|
+
description: "A markdown component",
|
|
14
|
+
category: _types.COMPONENT_TYPES.basic,
|
|
15
|
+
props: {
|
|
16
|
+
content: (0, _types.createTextProp)({
|
|
17
|
+
label: "Markdown Text",
|
|
18
|
+
description: "Markdown Text",
|
|
19
|
+
defaultValue: null
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.SEED_DATA = SEED_DATA;
|
|
@@ -16,8 +16,9 @@ const SEED_DATA = {
|
|
|
16
16
|
width: 100,
|
|
17
17
|
height: 100
|
|
18
18
|
},
|
|
19
|
+
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
19
20
|
props: {
|
|
20
|
-
source: (0, _types.
|
|
21
|
+
source: (0, _types.createSVGProp)()
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
width: size.width,
|
|
55
55
|
height: size.height
|
|
56
56
|
}, "image-placeholder_1"),
|
|
57
|
-
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-
|
|
57
|
+
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-image.svg",
|
|
58
58
|
squareImageUrl: buildImageUrl({
|
|
59
59
|
width: 100,
|
|
60
60
|
height: 100
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from "react"; // @ts-ignore
|
|
2
|
+
|
|
3
|
+
import Markdown from "react-native-markdown-package";
|
|
4
|
+
|
|
5
|
+
const MarkdownComponent = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
content
|
|
8
|
+
} = _ref;
|
|
9
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Markdown, {
|
|
10
|
+
styles: markdownStyle.collectiveMd
|
|
11
|
+
}, content));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const markdownStyle = {
|
|
15
|
+
singleLineMd: {
|
|
16
|
+
text: {
|
|
17
|
+
color: "blue",
|
|
18
|
+
textAlign: "right"
|
|
19
|
+
},
|
|
20
|
+
view: {
|
|
21
|
+
alignSelf: "stretch"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
collectiveMd: {
|
|
25
|
+
heading1: {
|
|
26
|
+
color: "red"
|
|
27
|
+
},
|
|
28
|
+
heading2: {
|
|
29
|
+
color: "green",
|
|
30
|
+
textAlign: "right"
|
|
31
|
+
},
|
|
32
|
+
strong: {
|
|
33
|
+
color: "blue"
|
|
34
|
+
},
|
|
35
|
+
em: {
|
|
36
|
+
color: "cyan"
|
|
37
|
+
},
|
|
38
|
+
text: {
|
|
39
|
+
color: "black"
|
|
40
|
+
},
|
|
41
|
+
blockQuoteText: {
|
|
42
|
+
color: "grey"
|
|
43
|
+
},
|
|
44
|
+
blockQuoteSection: {
|
|
45
|
+
flexDirection: "row"
|
|
46
|
+
},
|
|
47
|
+
blockQuoteSectionBar: {
|
|
48
|
+
width: 3,
|
|
49
|
+
height: null,
|
|
50
|
+
backgroundColor: "#DDDDDD",
|
|
51
|
+
marginRight: 15
|
|
52
|
+
},
|
|
53
|
+
codeBlock: {
|
|
54
|
+
fontFamily: "Courier",
|
|
55
|
+
fontWeight: "500",
|
|
56
|
+
backgroundColor: "#DDDDDD"
|
|
57
|
+
},
|
|
58
|
+
tableHeader: {
|
|
59
|
+
backgroundColor: "grey"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export default MarkdownComponent;
|
|
@@ -5,26 +5,25 @@ import Config from "./Config";
|
|
|
5
5
|
|
|
6
6
|
const SVG = _ref => {
|
|
7
7
|
let {
|
|
8
|
-
source,
|
|
8
|
+
source = Config.placeholderSvgURL,
|
|
9
9
|
style
|
|
10
10
|
} = _ref;
|
|
11
|
-
let svgSource = source === null || source === undefined ? Config.placeholderSvgURL : source;
|
|
12
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, Platform.OS === "ios" && /*#__PURE__*/React.createElement(View, {
|
|
13
12
|
style: style
|
|
14
13
|
}, /*#__PURE__*/React.createElement(SvgUri, {
|
|
15
14
|
width: "100%",
|
|
16
15
|
height: "100%",
|
|
17
|
-
uri:
|
|
16
|
+
uri: source
|
|
18
17
|
})), Platform.OS === "android" && /*#__PURE__*/React.createElement(View, {
|
|
19
18
|
style: style
|
|
20
19
|
}, /*#__PURE__*/React.createElement(SvgUri, {
|
|
21
20
|
width: "100%",
|
|
22
21
|
height: "100%",
|
|
23
|
-
uri:
|
|
22
|
+
uri: source
|
|
24
23
|
})), Platform.OS === "web" && /*#__PURE__*/React.createElement(Image, {
|
|
25
24
|
style: style,
|
|
26
25
|
source: {
|
|
27
|
-
uri:
|
|
26
|
+
uri: source
|
|
28
27
|
}
|
|
29
28
|
}));
|
|
30
29
|
};
|
package/lib/module/index.js
CHANGED
|
@@ -50,4 +50,5 @@ export { default as RowHeadlineImageCaption } from "./components/RowHeadlineImag
|
|
|
50
50
|
export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIcon";
|
|
51
51
|
export { default as Slider } from "./components/Slider";
|
|
52
52
|
export { default as Stepper } from "./components/Stepper";
|
|
53
|
-
export { useAuthState } from "./components/useAuthState";
|
|
53
|
+
export { useAuthState } from "./components/useAuthState";
|
|
54
|
+
export { default as Markdown } from "./components/Markdown"; // a comment to fix sourcemap comment issue
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createTextProp } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Markdown",
|
|
4
|
+
tag: "MarkdownComponent",
|
|
5
|
+
description: "A markdown component",
|
|
6
|
+
category: COMPONENT_TYPES.basic,
|
|
7
|
+
props: {
|
|
8
|
+
content: createTextProp({
|
|
9
|
+
label: "Markdown Text",
|
|
10
|
+
description: "Markdown Text",
|
|
11
|
+
defaultValue: null
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES,
|
|
1
|
+
import { COMPONENT_TYPES, createSVGProp, StylesPanelSections } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "SVG",
|
|
4
4
|
tag: "SVG",
|
|
@@ -8,7 +8,8 @@ export const SEED_DATA = {
|
|
|
8
8
|
width: 100,
|
|
9
9
|
height: 100
|
|
10
10
|
},
|
|
11
|
+
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
11
12
|
props: {
|
|
12
|
-
source:
|
|
13
|
+
source: createSVGProp()
|
|
13
14
|
}
|
|
14
15
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import { StyleProp, ImageStyle } from "react-native";
|
|
3
3
|
declare type SVGComponentProps = {
|
|
4
4
|
source: string;
|
|
5
5
|
style?: StyleProp<ImageStyle>;
|
|
6
6
|
};
|
|
7
|
-
declare const SVG:
|
|
7
|
+
declare const SVG: React.FC<React.PropsWithChildren<SVGComponentProps>>;
|
|
8
8
|
export default SVG;
|
|
@@ -49,3 +49,4 @@ export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIc
|
|
|
49
49
|
export { default as Slider } from "./components/Slider";
|
|
50
50
|
export { default as Stepper } from "./components/Stepper";
|
|
51
51
|
export { useAuthState } from "./components/useAuthState";
|
|
52
|
+
export { default as Markdown } from "./components/Markdown";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.2.4-
|
|
3
|
+
"version": "46.2.4-70e86e.10+70e86e38",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.
|
|
44
|
+
"@draftbit/types": "^46.3.0",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -52,8 +52,10 @@
|
|
|
52
52
|
"lodash.isnumber": "^3.0.3",
|
|
53
53
|
"lodash.omit": "^4.5.0",
|
|
54
54
|
"lodash.tonumber": "^4.0.3",
|
|
55
|
+
"react-native-markdown-display": "^7.0.0-alpha.2",
|
|
56
|
+
"react-native-markdown-package": "^1.8.2",
|
|
55
57
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
56
|
-
"react-native-svg": "
|
|
58
|
+
"react-native-svg": "12.3.0",
|
|
57
59
|
"react-native-typography": "^1.4.1",
|
|
58
60
|
"react-native-web-swiper": "^2.2.3"
|
|
59
61
|
},
|
|
@@ -80,5 +82,5 @@
|
|
|
80
82
|
]
|
|
81
83
|
]
|
|
82
84
|
},
|
|
83
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "70e86e38470d1aa32cd3a90888166a0c61db9b1a"
|
|
84
86
|
}
|
package/src/components/Config.js
CHANGED
|
@@ -42,7 +42,7 @@ export default {
|
|
|
42
42
|
cardIconElevation: 1,
|
|
43
43
|
placeholderImageURL: "https://static.draftbit.com/images/placeholder-image" + getExtension(),
|
|
44
44
|
getPlaceholderImageUrl: (size) => buildImageUrl({ width: size.width, height: size.height }, "image-placeholder_1"),
|
|
45
|
-
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-
|
|
45
|
+
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-image.svg",
|
|
46
46
|
squareImageUrl: buildImageUrl({ width: 100, height: 100 }, "Avatar"),
|
|
47
47
|
FABSize: 40,
|
|
48
48
|
FABBorderRadius: 20,
|
package/src/components/Config.ts
CHANGED
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
{ width: size.width, height: size.height },
|
|
61
61
|
"image-placeholder_1"
|
|
62
62
|
),
|
|
63
|
-
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-
|
|
63
|
+
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-image.svg",
|
|
64
64
|
squareImageUrl: buildImageUrl({ width: 100, height: 100 }, "Avatar"),
|
|
65
65
|
FABSize: 40,
|
|
66
66
|
FABBorderRadius: 20,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import Markdown from "react-native-markdown-package";
|
|
4
|
+
const MarkdownComponent = ({ content }) => {
|
|
5
|
+
return (React.createElement(React.Fragment, null,
|
|
6
|
+
React.createElement(Markdown, { styles: markdownStyle.collectiveMd }, content)));
|
|
7
|
+
};
|
|
8
|
+
const markdownStyle = {
|
|
9
|
+
singleLineMd: {
|
|
10
|
+
text: {
|
|
11
|
+
color: "blue",
|
|
12
|
+
textAlign: "right",
|
|
13
|
+
},
|
|
14
|
+
view: {
|
|
15
|
+
alignSelf: "stretch",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
collectiveMd: {
|
|
19
|
+
heading1: {
|
|
20
|
+
color: "red",
|
|
21
|
+
},
|
|
22
|
+
heading2: {
|
|
23
|
+
color: "green",
|
|
24
|
+
textAlign: "right",
|
|
25
|
+
},
|
|
26
|
+
strong: {
|
|
27
|
+
color: "blue",
|
|
28
|
+
},
|
|
29
|
+
em: {
|
|
30
|
+
color: "cyan",
|
|
31
|
+
},
|
|
32
|
+
text: {
|
|
33
|
+
color: "black",
|
|
34
|
+
},
|
|
35
|
+
blockQuoteText: {
|
|
36
|
+
color: "grey",
|
|
37
|
+
},
|
|
38
|
+
blockQuoteSection: {
|
|
39
|
+
flexDirection: "row",
|
|
40
|
+
},
|
|
41
|
+
blockQuoteSectionBar: {
|
|
42
|
+
width: 3,
|
|
43
|
+
height: null,
|
|
44
|
+
backgroundColor: "#DDDDDD",
|
|
45
|
+
marginRight: 15,
|
|
46
|
+
},
|
|
47
|
+
codeBlock: {
|
|
48
|
+
fontFamily: "Courier",
|
|
49
|
+
fontWeight: "500",
|
|
50
|
+
backgroundColor: "#DDDDDD",
|
|
51
|
+
},
|
|
52
|
+
tableHeader: {
|
|
53
|
+
backgroundColor: "grey",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export default MarkdownComponent;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import Markdown from "react-native-markdown-package";
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
content?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const MarkdownComponent: React.FC<Props> = ({ content }) => {
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
{
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
}
|
|
15
|
+
<Markdown styles={markdownStyle.collectiveMd}>{content}</Markdown>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const markdownStyle = {
|
|
21
|
+
singleLineMd: {
|
|
22
|
+
text: {
|
|
23
|
+
color: "blue",
|
|
24
|
+
textAlign: "right",
|
|
25
|
+
},
|
|
26
|
+
view: {
|
|
27
|
+
alignSelf: "stretch",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
collectiveMd: {
|
|
31
|
+
heading1: {
|
|
32
|
+
color: "red",
|
|
33
|
+
},
|
|
34
|
+
heading2: {
|
|
35
|
+
color: "green",
|
|
36
|
+
textAlign: "right",
|
|
37
|
+
},
|
|
38
|
+
strong: {
|
|
39
|
+
color: "blue",
|
|
40
|
+
},
|
|
41
|
+
em: {
|
|
42
|
+
color: "cyan",
|
|
43
|
+
},
|
|
44
|
+
text: {
|
|
45
|
+
color: "black",
|
|
46
|
+
},
|
|
47
|
+
blockQuoteText: {
|
|
48
|
+
color: "grey",
|
|
49
|
+
},
|
|
50
|
+
blockQuoteSection: {
|
|
51
|
+
flexDirection: "row",
|
|
52
|
+
},
|
|
53
|
+
blockQuoteSectionBar: {
|
|
54
|
+
width: 3,
|
|
55
|
+
height: null,
|
|
56
|
+
backgroundColor: "#DDDDDD",
|
|
57
|
+
marginRight: 15,
|
|
58
|
+
},
|
|
59
|
+
codeBlock: {
|
|
60
|
+
fontFamily: "Courier",
|
|
61
|
+
fontWeight: "500",
|
|
62
|
+
backgroundColor: "#DDDDDD",
|
|
63
|
+
},
|
|
64
|
+
tableHeader: {
|
|
65
|
+
backgroundColor: "grey",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default MarkdownComponent;
|
package/src/components/SVG.js
CHANGED
|
@@ -2,13 +2,12 @@ import * as React from "react";
|
|
|
2
2
|
import { View, Platform, Image } from "react-native";
|
|
3
3
|
import { SvgUri } from "react-native-svg";
|
|
4
4
|
import Config from "./Config";
|
|
5
|
-
const SVG = ({ source, style }) => {
|
|
6
|
-
let svgSource = source === null || source === undefined ? Config.placeholderSvgURL : source;
|
|
5
|
+
const SVG = ({ source = Config.placeholderSvgURL, style, }) => {
|
|
7
6
|
return (React.createElement(React.Fragment, null,
|
|
8
7
|
Platform.OS === "ios" && (React.createElement(View, { style: style },
|
|
9
|
-
React.createElement(SvgUri, { width: "100%", height: "100%", uri:
|
|
8
|
+
React.createElement(SvgUri, { width: "100%", height: "100%", uri: source }))),
|
|
10
9
|
Platform.OS === "android" && (React.createElement(View, { style: style },
|
|
11
|
-
React.createElement(SvgUri, { width: "100%", height: "100%", uri:
|
|
12
|
-
Platform.OS === "web" && (React.createElement(Image, { style: style, source: { uri:
|
|
10
|
+
React.createElement(SvgUri, { width: "100%", height: "100%", uri: source }))),
|
|
11
|
+
Platform.OS === "web" && (React.createElement(Image, { style: style, source: { uri: source } }))));
|
|
13
12
|
};
|
|
14
13
|
export default SVG;
|
package/src/components/SVG.tsx
CHANGED
|
@@ -9,24 +9,24 @@ type SVGComponentProps = {
|
|
|
9
9
|
style?: StyleProp<ImageStyle>;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const SVG
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const SVG: React.FC<React.PropsWithChildren<SVGComponentProps>> = ({
|
|
13
|
+
source = Config.placeholderSvgURL,
|
|
14
|
+
style,
|
|
15
|
+
}) => {
|
|
16
16
|
return (
|
|
17
17
|
<>
|
|
18
18
|
{Platform.OS === "ios" && (
|
|
19
19
|
<View style={style}>
|
|
20
|
-
<SvgUri width="100%" height="100%" uri={
|
|
20
|
+
<SvgUri width="100%" height="100%" uri={source} />
|
|
21
21
|
</View>
|
|
22
22
|
)}
|
|
23
23
|
{Platform.OS === "android" && (
|
|
24
24
|
<View style={style}>
|
|
25
|
-
<SvgUri width="100%" height="100%" uri={
|
|
25
|
+
<SvgUri width="100%" height="100%" uri={source} />
|
|
26
26
|
</View>
|
|
27
27
|
)}
|
|
28
28
|
{Platform.OS === "web" && (
|
|
29
|
-
<Image style={style} source={{ uri:
|
|
29
|
+
<Image style={style} source={{ uri: source }} />
|
|
30
30
|
)}
|
|
31
31
|
</>
|
|
32
32
|
);
|
package/src/index.js
CHANGED
|
@@ -50,4 +50,5 @@ export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIc
|
|
|
50
50
|
export { default as Slider } from "./components/Slider";
|
|
51
51
|
export { default as Stepper } from "./components/Stepper";
|
|
52
52
|
export { useAuthState } from "./components/useAuthState";
|
|
53
|
+
export { default as Markdown } from "./components/Markdown";
|
|
53
54
|
// a comment to fix sourcemap comment issue
|
package/src/index.tsx
CHANGED
|
@@ -70,5 +70,6 @@ export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIc
|
|
|
70
70
|
export { default as Slider } from "./components/Slider";
|
|
71
71
|
export { default as Stepper } from "./components/Stepper";
|
|
72
72
|
export { useAuthState } from "./components/useAuthState";
|
|
73
|
+
export { default as Markdown } from "./components/Markdown";
|
|
73
74
|
|
|
74
75
|
// a comment to fix sourcemap comment issue
|
package/src/mappings/MapView.js
CHANGED
package/src/mappings/MapView.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createTextProp } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Markdown",
|
|
4
|
+
tag: "MarkdownComponent",
|
|
5
|
+
description: "A markdown component",
|
|
6
|
+
category: COMPONENT_TYPES.basic,
|
|
7
|
+
props: {
|
|
8
|
+
content: createTextProp({
|
|
9
|
+
label: "Markdown Text",
|
|
10
|
+
description: "Markdown Text",
|
|
11
|
+
defaultValue: null,
|
|
12
|
+
}),
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createTextProp } from "@draftbit/types";
|
|
2
|
+
|
|
3
|
+
export const SEED_DATA = {
|
|
4
|
+
name: "Markdown",
|
|
5
|
+
tag: "MarkdownComponent",
|
|
6
|
+
description: "A markdown component",
|
|
7
|
+
category: COMPONENT_TYPES.basic,
|
|
8
|
+
props: {
|
|
9
|
+
content: createTextProp({
|
|
10
|
+
label: "Markdown Text",
|
|
11
|
+
description: "Markdown Text",
|
|
12
|
+
defaultValue: null,
|
|
13
|
+
}),
|
|
14
|
+
},
|
|
15
|
+
};
|
package/src/mappings/SVG.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES,
|
|
1
|
+
import { COMPONENT_TYPES, createSVGProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "SVG",
|
|
4
4
|
tag: "SVG",
|
|
@@ -8,7 +8,13 @@ export const SEED_DATA = {
|
|
|
8
8
|
width: 100,
|
|
9
9
|
height: 100,
|
|
10
10
|
},
|
|
11
|
+
stylesPanelSections: [
|
|
12
|
+
StylesPanelSections.Size,
|
|
13
|
+
StylesPanelSections.Margins,
|
|
14
|
+
StylesPanelSections.Position,
|
|
15
|
+
StylesPanelSections.Effects,
|
|
16
|
+
],
|
|
11
17
|
props: {
|
|
12
|
-
source:
|
|
18
|
+
source: createSVGProp(),
|
|
13
19
|
},
|
|
14
20
|
};
|
package/src/mappings/SVG.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
createSVGProp,
|
|
4
|
+
StylesPanelSections,
|
|
5
|
+
} from "@draftbit/types";
|
|
2
6
|
|
|
3
7
|
export const SEED_DATA = {
|
|
4
8
|
name: "SVG",
|
|
@@ -9,7 +13,13 @@ export const SEED_DATA = {
|
|
|
9
13
|
width: 100,
|
|
10
14
|
height: 100,
|
|
11
15
|
},
|
|
16
|
+
stylesPanelSections: [
|
|
17
|
+
StylesPanelSections.Size,
|
|
18
|
+
StylesPanelSections.Margins,
|
|
19
|
+
StylesPanelSections.Position,
|
|
20
|
+
StylesPanelSections.Effects,
|
|
21
|
+
],
|
|
12
22
|
props: {
|
|
13
|
-
source:
|
|
23
|
+
source: createSVGProp(),
|
|
14
24
|
},
|
|
15
25
|
};
|