@storybook/addon-ondevice-notes 6.5.0-rc.8 → 6.5.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.
|
@@ -15,5 +15,5 @@ export type Props = {
|
|
|
15
15
|
export type DefaultProps = Props & {
|
|
16
16
|
styles: Object;
|
|
17
17
|
};
|
|
18
|
-
declare const _default: React.MemoExoticComponent<({ children, errorHandler
|
|
18
|
+
declare const _default: React.MemoExoticComponent<({ children, errorHandler }: Props) => JSX.Element>;
|
|
19
19
|
export default _default;
|
|
@@ -6,12 +6,12 @@ import { View } from 'react-native';
|
|
|
6
6
|
import SimpleMarkdown from 'simple-markdown';
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
import initialRules from './rules';
|
|
9
|
-
import
|
|
10
|
-
const Markdown = ({ children = '', errorHandler
|
|
9
|
+
import { useThemedStyles } from './styles';
|
|
10
|
+
const Markdown = ({ children = '', errorHandler }) => {
|
|
11
|
+
const styles = useThemedStyles();
|
|
11
12
|
const _renderContent = () => {
|
|
12
13
|
try {
|
|
13
|
-
const
|
|
14
|
-
const rules = initialRules(mergedStyles);
|
|
14
|
+
const rules = initialRules(styles);
|
|
15
15
|
// @TODO: Add another \n?
|
|
16
16
|
const blockSource = `${children}\n\n`;
|
|
17
17
|
const tree = SimpleMarkdown.parserFor(rules)(blockSource, {
|
|
@@ -24,6 +24,6 @@ const Markdown = ({ children = '', errorHandler, styles = initialStyles }) => {
|
|
|
24
24
|
}
|
|
25
25
|
return null;
|
|
26
26
|
};
|
|
27
|
-
return React.createElement(View,
|
|
27
|
+
return React.createElement(View, null, _renderContent());
|
|
28
28
|
};
|
|
29
29
|
export default React.memo(Markdown);
|
|
@@ -1,128 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
backgroundColor: string;
|
|
8
|
-
marginRight: number;
|
|
9
|
-
};
|
|
10
|
-
codeBlock: {
|
|
11
|
-
fontFamily: string;
|
|
12
|
-
fontWeight: "500";
|
|
13
|
-
};
|
|
14
|
-
del: {
|
|
15
|
-
textDecorationLine: "line-through";
|
|
16
|
-
};
|
|
17
|
-
em: {
|
|
18
|
-
fontStyle: "italic";
|
|
19
|
-
};
|
|
20
|
-
heading: {
|
|
21
|
-
fontWeight: "200";
|
|
22
|
-
};
|
|
23
|
-
heading1: {
|
|
24
|
-
fontSize: number;
|
|
25
|
-
};
|
|
26
|
-
heading2: {
|
|
27
|
-
fontSize: number;
|
|
28
|
-
};
|
|
29
|
-
heading3: {
|
|
30
|
-
fontSize: number;
|
|
31
|
-
};
|
|
32
|
-
heading4: {
|
|
33
|
-
fontSize: number;
|
|
34
|
-
};
|
|
35
|
-
heading5: {
|
|
36
|
-
fontSize: number;
|
|
37
|
-
};
|
|
38
|
-
heading6: {
|
|
39
|
-
fontSize: number;
|
|
40
|
-
};
|
|
41
|
-
hr: {
|
|
42
|
-
backgroundColor: string;
|
|
43
|
-
};
|
|
44
|
-
image: {
|
|
45
|
-
width: number;
|
|
46
|
-
height: number;
|
|
47
|
-
};
|
|
48
|
-
inlineCode: {
|
|
49
|
-
backgroundColor: string;
|
|
50
|
-
borderColor: string;
|
|
51
|
-
borderRadius: number;
|
|
52
|
-
borderWidth: number;
|
|
53
|
-
fontFamily: string;
|
|
54
|
-
fontWeight: "bold";
|
|
55
|
-
};
|
|
56
|
-
link: {
|
|
57
|
-
textDecorationLine: "underline";
|
|
58
|
-
};
|
|
59
|
-
list: {
|
|
60
|
-
width: string;
|
|
61
|
-
};
|
|
62
|
-
listItem: {
|
|
63
|
-
flexDirection: "row";
|
|
64
|
-
alignItems: "center";
|
|
65
|
-
width: string;
|
|
66
|
-
};
|
|
67
|
-
listItemNumber: {
|
|
68
|
-
fontWeight: "bold";
|
|
69
|
-
};
|
|
70
|
-
listItemBullet: {
|
|
71
|
-
fontWeight: "bold";
|
|
72
|
-
};
|
|
73
|
-
mailTo: {
|
|
74
|
-
textDecorationLine: "underline";
|
|
75
|
-
};
|
|
76
|
-
paragraph: {
|
|
77
|
-
flexDirection: "row";
|
|
78
|
-
alignItems: "flex-start";
|
|
79
|
-
justifyContent: "flex-start";
|
|
80
|
-
};
|
|
81
|
-
listItemText: {
|
|
82
|
-
flexDirection: "row";
|
|
83
|
-
justifyContent: "flex-start";
|
|
84
|
-
alignItems: "flex-start";
|
|
85
|
-
color: string;
|
|
86
|
-
};
|
|
87
|
-
strong: {
|
|
88
|
-
fontWeight: "bold";
|
|
89
|
-
};
|
|
90
|
-
table: {
|
|
91
|
-
borderWidth: number;
|
|
92
|
-
borderColor: string;
|
|
93
|
-
borderRadius: number;
|
|
94
|
-
};
|
|
95
|
-
tableHeader: {
|
|
96
|
-
backgroundColor: string;
|
|
97
|
-
flexDirection: "row";
|
|
98
|
-
justifyContent: "space-around";
|
|
99
|
-
};
|
|
100
|
-
tableHeaderCell: {
|
|
101
|
-
color: string;
|
|
102
|
-
fontWeight: "bold";
|
|
103
|
-
padding: number;
|
|
104
|
-
};
|
|
105
|
-
tableRow: {
|
|
106
|
-
borderBottomWidth: number;
|
|
107
|
-
borderColor: string;
|
|
108
|
-
flexDirection: "row";
|
|
109
|
-
justifyContent: "space-around";
|
|
110
|
-
};
|
|
111
|
-
tableRowLast: {
|
|
112
|
-
borderColor: string;
|
|
113
|
-
};
|
|
114
|
-
tableRowCell: {
|
|
115
|
-
padding: number;
|
|
116
|
-
};
|
|
117
|
-
text: {
|
|
118
|
-
color: string;
|
|
119
|
-
};
|
|
120
|
-
u: {
|
|
121
|
-
textDecorationLine: "underline";
|
|
122
|
-
};
|
|
123
|
-
video: {
|
|
124
|
-
width: number;
|
|
125
|
-
height: number;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
export default _default;
|
|
1
|
+
import { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native/types';
|
|
2
|
+
interface Styles {
|
|
3
|
+
[key: string]: StyleProp<ViewStyle | TextStyle | ImageStyle>;
|
|
4
|
+
}
|
|
5
|
+
export declare const useThemedStyles: () => Styles;
|
|
6
|
+
export {};
|
|
@@ -1,129 +1,134 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* mostly based on code from https://github.com/CharlesMangwa/react-native-simple-markdown
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
4
|
+
import { useTheme } from 'emotion-theming';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
export const useThemedStyles = () => {
|
|
7
|
+
const theme = useTheme();
|
|
8
|
+
const styles = useMemo(() => ({
|
|
9
|
+
blockQuoteSection: {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
},
|
|
12
|
+
blockQuoteSectionBar: {
|
|
13
|
+
width: 3,
|
|
14
|
+
backgroundColor: '#DDDDDD',
|
|
15
|
+
marginRight: 15,
|
|
16
|
+
},
|
|
17
|
+
codeBlock: {
|
|
18
|
+
fontWeight: '500',
|
|
19
|
+
},
|
|
20
|
+
del: {
|
|
21
|
+
textDecorationLine: 'line-through',
|
|
22
|
+
},
|
|
23
|
+
em: {
|
|
24
|
+
fontStyle: 'italic',
|
|
25
|
+
},
|
|
26
|
+
heading: {
|
|
27
|
+
fontWeight: '200',
|
|
28
|
+
},
|
|
29
|
+
heading1: {
|
|
30
|
+
fontSize: 32,
|
|
31
|
+
},
|
|
32
|
+
heading2: {
|
|
33
|
+
fontSize: 24,
|
|
34
|
+
},
|
|
35
|
+
heading3: {
|
|
36
|
+
fontSize: 18,
|
|
37
|
+
},
|
|
38
|
+
heading4: {
|
|
39
|
+
fontSize: 16,
|
|
40
|
+
},
|
|
41
|
+
heading5: {
|
|
42
|
+
fontSize: 13,
|
|
43
|
+
},
|
|
44
|
+
heading6: {
|
|
45
|
+
fontSize: 11,
|
|
46
|
+
},
|
|
47
|
+
hr: {
|
|
48
|
+
backgroundColor: '#cccccc',
|
|
49
|
+
},
|
|
50
|
+
image: {
|
|
51
|
+
width: 320,
|
|
52
|
+
height: 320,
|
|
53
|
+
},
|
|
54
|
+
inlineCode: {
|
|
55
|
+
backgroundColor: '#eeeeee',
|
|
56
|
+
borderColor: '#dddddd',
|
|
57
|
+
borderRadius: 3,
|
|
58
|
+
borderWidth: 1,
|
|
59
|
+
fontWeight: 'bold',
|
|
60
|
+
},
|
|
61
|
+
link: {
|
|
62
|
+
textDecorationLine: 'underline',
|
|
63
|
+
},
|
|
64
|
+
list: { width: '100%' },
|
|
65
|
+
listItem: {
|
|
66
|
+
flexDirection: 'row',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
width: '100%',
|
|
69
|
+
},
|
|
70
|
+
listItemNumber: {
|
|
71
|
+
fontWeight: 'bold',
|
|
72
|
+
color: theme.text.primaryColor,
|
|
73
|
+
},
|
|
74
|
+
listItemBullet: {
|
|
75
|
+
fontWeight: 'bold',
|
|
76
|
+
color: theme.text.primaryColor,
|
|
77
|
+
},
|
|
78
|
+
mailTo: {
|
|
79
|
+
textDecorationLine: 'underline',
|
|
80
|
+
},
|
|
81
|
+
paragraph: {
|
|
82
|
+
flexDirection: 'row',
|
|
83
|
+
alignItems: 'flex-start',
|
|
84
|
+
justifyContent: 'flex-start',
|
|
85
|
+
},
|
|
86
|
+
listItemText: {
|
|
87
|
+
flexDirection: 'row',
|
|
88
|
+
justifyContent: 'flex-start',
|
|
89
|
+
alignItems: 'flex-start',
|
|
90
|
+
color: theme.text.primaryColor,
|
|
91
|
+
},
|
|
92
|
+
strong: {
|
|
93
|
+
fontWeight: 'bold',
|
|
94
|
+
},
|
|
95
|
+
table: {
|
|
96
|
+
borderWidth: 1,
|
|
97
|
+
borderColor: theme.text.primaryColor,
|
|
98
|
+
borderRadius: 3,
|
|
99
|
+
},
|
|
100
|
+
tableHeader: {
|
|
101
|
+
backgroundColor: theme.text.primaryColor,
|
|
102
|
+
flexDirection: 'row',
|
|
103
|
+
justifyContent: 'space-around',
|
|
104
|
+
},
|
|
105
|
+
tableHeaderCell: {
|
|
106
|
+
color: theme.backgroundColor,
|
|
107
|
+
fontWeight: 'bold',
|
|
108
|
+
padding: 5,
|
|
109
|
+
},
|
|
110
|
+
tableRow: {
|
|
111
|
+
borderBottomWidth: 1,
|
|
112
|
+
borderColor: theme.text.primaryColor,
|
|
113
|
+
flexDirection: 'row',
|
|
114
|
+
justifyContent: 'space-around',
|
|
115
|
+
},
|
|
116
|
+
tableRowLast: {
|
|
117
|
+
borderColor: 'transparent',
|
|
118
|
+
},
|
|
119
|
+
tableRowCell: {
|
|
120
|
+
padding: 5,
|
|
121
|
+
},
|
|
122
|
+
text: {
|
|
123
|
+
color: theme.text.primaryColor,
|
|
124
|
+
},
|
|
125
|
+
u: {
|
|
126
|
+
textDecorationLine: 'underline',
|
|
127
|
+
},
|
|
128
|
+
video: {
|
|
129
|
+
width: 300,
|
|
130
|
+
height: 300,
|
|
131
|
+
},
|
|
132
|
+
}), [theme.backgroundColor, theme.text.primaryColor]);
|
|
133
|
+
return styles;
|
|
134
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-ondevice-notes",
|
|
3
|
-
"version": "6.5.0
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "Write notes for your react-native Storybook stories.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@storybook/client-logger": "^6.5.14",
|
|
36
36
|
"@storybook/core-events": "^6.5.14",
|
|
37
37
|
"core-js": "^3.0.1",
|
|
38
|
+
"emotion-theming": "^10.0.19",
|
|
38
39
|
"prop-types": "^15.7.2",
|
|
39
40
|
"simple-markdown": "^0.7.3"
|
|
40
41
|
},
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"publishConfig": {
|
|
46
47
|
"access": "public"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "35d882320519d7130219eb060f3aee86caeacd3a"
|
|
49
50
|
}
|
package/dist/typings.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|