@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, styles }: Props) => JSX.Element>;
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 initialStyles from './styles';
10
- const Markdown = ({ children = '', errorHandler, styles = initialStyles }) => {
9
+ import { useThemedStyles } from './styles';
10
+ const Markdown = ({ children = '', errorHandler }) => {
11
+ const styles = useThemedStyles();
11
12
  const _renderContent = () => {
12
13
  try {
13
- const mergedStyles = Object.assign(Object.assign({}, initialStyles), styles);
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, { style: [styles.view] }, _renderContent());
27
+ return React.createElement(View, null, _renderContent());
28
28
  };
29
29
  export default React.memo(Markdown);
@@ -1,128 +1,6 @@
1
- declare const _default: {
2
- blockQuoteSection: {
3
- flexDirection: "row";
4
- };
5
- blockQuoteSectionBar: {
6
- width: number;
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 { StyleSheet } from 'react-native';
5
- export default StyleSheet.create({
6
- blockQuoteSection: {
7
- flexDirection: 'row',
8
- },
9
- blockQuoteSectionBar: {
10
- width: 3,
11
- backgroundColor: '#DDDDDD',
12
- marginRight: 15,
13
- },
14
- codeBlock: {
15
- fontFamily: 'Courier',
16
- fontWeight: '500',
17
- },
18
- del: {
19
- textDecorationLine: 'line-through',
20
- },
21
- em: {
22
- fontStyle: 'italic',
23
- },
24
- heading: {
25
- fontWeight: '200',
26
- },
27
- heading1: {
28
- fontSize: 32,
29
- },
30
- heading2: {
31
- fontSize: 24,
32
- },
33
- heading3: {
34
- fontSize: 18,
35
- },
36
- heading4: {
37
- fontSize: 16,
38
- },
39
- heading5: {
40
- fontSize: 13,
41
- },
42
- heading6: {
43
- fontSize: 11,
44
- },
45
- hr: {
46
- backgroundColor: '#cccccc',
47
- },
48
- image: {
49
- width: 320,
50
- height: 320,
51
- },
52
- inlineCode: {
53
- backgroundColor: '#eeeeee',
54
- borderColor: '#dddddd',
55
- borderRadius: 3,
56
- borderWidth: 1,
57
- fontFamily: 'Courier',
58
- fontWeight: 'bold',
59
- },
60
- link: {
61
- textDecorationLine: 'underline',
62
- },
63
- list: { width: '100%' },
64
- listItem: {
65
- flexDirection: 'row',
66
- alignItems: 'center',
67
- width: '100%',
68
- },
69
- listItemNumber: {
70
- fontWeight: 'bold',
71
- },
72
- listItemBullet: {
73
- fontWeight: 'bold',
74
- },
75
- mailTo: {
76
- textDecorationLine: 'underline',
77
- },
78
- paragraph: {
79
- flexDirection: 'row',
80
- alignItems: 'flex-start',
81
- justifyContent: 'flex-start',
82
- },
83
- listItemText: {
84
- flexDirection: 'row',
85
- justifyContent: 'flex-start',
86
- alignItems: 'flex-start',
87
- color: '#222222',
88
- },
89
- strong: {
90
- fontWeight: 'bold',
91
- },
92
- table: {
93
- borderWidth: 1,
94
- borderColor: '#222222',
95
- borderRadius: 3,
96
- },
97
- tableHeader: {
98
- backgroundColor: '#222222',
99
- flexDirection: 'row',
100
- justifyContent: 'space-around',
101
- },
102
- tableHeaderCell: {
103
- color: '#ffffff',
104
- fontWeight: 'bold',
105
- padding: 5,
106
- },
107
- tableRow: {
108
- borderBottomWidth: 1,
109
- borderColor: '#222222',
110
- flexDirection: 'row',
111
- justifyContent: 'space-around',
112
- },
113
- tableRowLast: {
114
- borderColor: 'transparent',
115
- },
116
- tableRowCell: {
117
- padding: 5,
118
- },
119
- text: {
120
- color: '#222222',
121
- },
122
- u: {
123
- textDecorationLine: 'underline',
124
- },
125
- video: {
126
- width: 300,
127
- height: 300,
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-rc.8",
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": "75843635fa1be05214dfd4b46dc978a9c538d477"
49
+ "gitHead": "35d882320519d7130219eb060f3aee86caeacd3a"
49
50
  }
package/dist/typings.d.js DELETED
@@ -1 +0,0 @@
1
- "use strict";