@expensify/react-native-live-markdown 0.1.3
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/LICENSE +20 -0
- package/README.md +139 -0
- package/RNLiveMarkdown.podspec +44 -0
- package/android/build.gradle +143 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/cpp/CMakeLists.txt +23 -0
- package/android/src/main/cpp/MarkdownUtils.cpp +44 -0
- package/android/src/main/cpp/MarkdownUtils.h +41 -0
- package/android/src/main/cpp/OnLoad.cpp +8 -0
- package/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownPackage.java +24 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownBackgroundColorSpan.java +11 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownBlockquoteSpan.java +47 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownBoldSpan.java +10 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownFontFamilySpan.java +39 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownFontSizeSpan.java +9 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownForegroundColorSpan.java +11 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownItalicSpan.java +10 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownLineHeightSpan.java +18 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownSpan.java +7 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownStrikethroughSpan.java +5 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownStyle.java +186 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java +85 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorViewManager.java +31 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownTextWatcher.java +38 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownUnderlineSpan.java +5 -0
- package/android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java +176 -0
- package/android/src/newarch/MarkdownTextInputDecoratorViewManagerSpec.java +24 -0
- package/android/src/oldarch/MarkdownTextInputDecoratorViewManagerSpec.java +10 -0
- package/ios/MarkdownLayoutManager.h +12 -0
- package/ios/MarkdownLayoutManager.mm +35 -0
- package/ios/MarkdownTextInputDecoratorComponentView.h +12 -0
- package/ios/MarkdownTextInputDecoratorComponentView.mm +55 -0
- package/ios/MarkdownTextInputDecoratorView.h +12 -0
- package/ios/MarkdownTextInputDecoratorView.mm +106 -0
- package/ios/MarkdownTextInputDecoratorViewManager.h +8 -0
- package/ios/MarkdownTextInputDecoratorViewManager.mm +23 -0
- package/ios/RCTBackedTextFieldDelegateAdapter+Markdown.h +14 -0
- package/ios/RCTBackedTextFieldDelegateAdapter+Markdown.m +43 -0
- package/ios/RCTBaseTextInputView+Markdown.h +16 -0
- package/ios/RCTBaseTextInputView+Markdown.m +66 -0
- package/ios/RCTMarkdownStyle.h +35 -0
- package/ios/RCTMarkdownStyle.mm +81 -0
- package/ios/RCTMarkdownUtils.h +18 -0
- package/ios/RCTMarkdownUtils.mm +134 -0
- package/ios/RCTTextInputComponentView+Markdown.h +21 -0
- package/ios/RCTTextInputComponentView+Markdown.mm +51 -0
- package/ios/RCTUITextView+Markdown.h +15 -0
- package/ios/RCTUITextView+Markdown.mm +42 -0
- package/lib/commonjs/MarkdownTextInput.js +103 -0
- package/lib/commonjs/MarkdownTextInput.js.map +1 -0
- package/lib/commonjs/MarkdownTextInput.web.js +21 -0
- package/lib/commonjs/MarkdownTextInput.web.js.map +1 -0
- package/lib/commonjs/MarkdownTextInputDecoratorViewNativeComponent.js +10 -0
- package/lib/commonjs/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -0
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/MarkdownTextInput.js +96 -0
- package/lib/module/MarkdownTextInput.js.map +1 -0
- package/lib/module/MarkdownTextInput.web.js +15 -0
- package/lib/module/MarkdownTextInput.web.js.map +1 -0
- package/lib/module/MarkdownTextInputDecoratorViewNativeComponent.js +3 -0
- package/lib/module/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/src/MarkdownTextInput.d.ts +15 -0
- package/lib/typescript/src/MarkdownTextInput.d.ts.map +1 -0
- package/lib/typescript/src/MarkdownTextInput.web.d.ts +9 -0
- package/lib/typescript/src/MarkdownTextInput.web.d.ts.map +1 -0
- package/lib/typescript/src/MarkdownTextInputDecoratorViewNativeComponent.d.ts +46 -0
- package/lib/typescript/src/MarkdownTextInputDecoratorViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +159 -0
- package/parser/react-native-live-markdown-parser.js +34 -0
- package/src/MarkdownTextInput.tsx +129 -0
- package/src/MarkdownTextInput.web.tsx +24 -0
- package/src/MarkdownTextInputDecoratorViewNativeComponent.ts +48 -0
- package/src/index.tsx +2 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#import <RNLiveMarkdown/RCTUITextView+Markdown.h>
|
|
2
|
+
#import <RNLiveMarkdown/RCTMarkdownUtils.h>
|
|
3
|
+
#import <objc/message.h>
|
|
4
|
+
|
|
5
|
+
@implementation RCTUITextView (Markdown)
|
|
6
|
+
|
|
7
|
+
- (void)setMarkdownUtils:(RCTMarkdownUtils *)markdownUtils {
|
|
8
|
+
objc_setAssociatedObject(self, @selector(getMarkdownUtils), markdownUtils, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
- (RCTMarkdownUtils *)getMarkdownUtils {
|
|
12
|
+
return objc_getAssociatedObject(self, @selector(getMarkdownUtils));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
- (void)markdown_textDidChange
|
|
16
|
+
{
|
|
17
|
+
RCTMarkdownUtils *markdownUtils = [self getMarkdownUtils];
|
|
18
|
+
if (markdownUtils != nil) {
|
|
19
|
+
UITextRange *range = self.selectedTextRange;
|
|
20
|
+
super.attributedText = [markdownUtils parseMarkdown:self.attributedText];
|
|
21
|
+
[super setSelectedTextRange:range]; // prevents cursor from jumping at the end when typing in the middle of the text
|
|
22
|
+
self.typingAttributes = self.defaultTextAttributes; // removes indent in new line when typing after blockquote
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Call the original method
|
|
26
|
+
[self markdown_textDidChange];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
+ (void)load
|
|
30
|
+
{
|
|
31
|
+
static dispatch_once_t onceToken;
|
|
32
|
+
dispatch_once(&onceToken, ^{
|
|
33
|
+
Class cls = [self class];
|
|
34
|
+
SEL originalSelector = @selector(textDidChange);
|
|
35
|
+
SEL swizzledSelector = @selector(markdown_textDidChange);
|
|
36
|
+
Method originalMethod = class_getInstanceMethod(cls, originalSelector);
|
|
37
|
+
Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
|
|
38
|
+
method_exchangeImplementations(originalMethod, swizzledMethod);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _MarkdownTextInputDecoratorViewNativeComponent = _interopRequireDefault(require("./MarkdownTextInputDecoratorViewNativeComponent"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
12
|
+
const FONT_FAMILY_MONOSPACE = _reactNative.Platform.select({
|
|
13
|
+
ios: 'Courier',
|
|
14
|
+
default: 'monospace'
|
|
15
|
+
});
|
|
16
|
+
function makeDefaultMarkdownStyle() {
|
|
17
|
+
return {
|
|
18
|
+
syntax: {
|
|
19
|
+
color: 'gray'
|
|
20
|
+
},
|
|
21
|
+
link: {
|
|
22
|
+
color: 'blue'
|
|
23
|
+
},
|
|
24
|
+
h1: {
|
|
25
|
+
fontSize: 25
|
|
26
|
+
},
|
|
27
|
+
blockquote: {
|
|
28
|
+
borderColor: 'gray',
|
|
29
|
+
borderWidth: 6,
|
|
30
|
+
marginLeft: 6,
|
|
31
|
+
paddingLeft: 6
|
|
32
|
+
},
|
|
33
|
+
code: {
|
|
34
|
+
fontFamily: FONT_FAMILY_MONOSPACE,
|
|
35
|
+
color: 'black',
|
|
36
|
+
backgroundColor: 'lightgray'
|
|
37
|
+
},
|
|
38
|
+
pre: {
|
|
39
|
+
fontFamily: FONT_FAMILY_MONOSPACE,
|
|
40
|
+
color: 'black',
|
|
41
|
+
backgroundColor: 'lightgray'
|
|
42
|
+
},
|
|
43
|
+
mentionHere: {
|
|
44
|
+
color: 'green',
|
|
45
|
+
backgroundColor: 'lime'
|
|
46
|
+
},
|
|
47
|
+
mentionUser: {
|
|
48
|
+
color: 'blue',
|
|
49
|
+
backgroundColor: 'cyan'
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function mergeMarkdownStyleWithDefault(input) {
|
|
54
|
+
const output = makeDefaultMarkdownStyle();
|
|
55
|
+
if (input !== undefined) {
|
|
56
|
+
Object.keys(input).forEach(key => {
|
|
57
|
+
if (!(key in output)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
Object.assign(output[key], input[key]);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return output;
|
|
64
|
+
}
|
|
65
|
+
function processColorsInMarkdownStyle(input) {
|
|
66
|
+
const output = JSON.parse(JSON.stringify(input));
|
|
67
|
+
Object.keys(output).forEach(key => {
|
|
68
|
+
const obj = output[key];
|
|
69
|
+
Object.keys(obj).forEach(prop => {
|
|
70
|
+
// TODO: use ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes'
|
|
71
|
+
if (!(prop === 'color' || prop.endsWith('Color'))) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
obj[prop] = (0, _reactNative.processColor)(obj[prop]);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
return output;
|
|
78
|
+
}
|
|
79
|
+
function processMarkdownStyle(input) {
|
|
80
|
+
return processColorsInMarkdownStyle(mergeMarkdownStyleWithDefault(input));
|
|
81
|
+
}
|
|
82
|
+
const MarkdownTextInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
83
|
+
const IS_FABRIC = ('nativeFabricUIManager' in global);
|
|
84
|
+
const markdownStyle = _react.default.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({}, props, {
|
|
86
|
+
ref: ref
|
|
87
|
+
})), /*#__PURE__*/_react.default.createElement(_MarkdownTextInputDecoratorViewNativeComponent.default, {
|
|
88
|
+
style: IS_FABRIC ? styles.farAway : styles.displayNone,
|
|
89
|
+
markdownStyle: markdownStyle
|
|
90
|
+
}));
|
|
91
|
+
});
|
|
92
|
+
const styles = _reactNative.StyleSheet.create({
|
|
93
|
+
displayNone: {
|
|
94
|
+
display: 'none'
|
|
95
|
+
},
|
|
96
|
+
farAway: {
|
|
97
|
+
position: 'absolute',
|
|
98
|
+
top: 1e8,
|
|
99
|
+
left: 1e8
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
var _default = exports.default = MarkdownTextInput;
|
|
103
|
+
//# sourceMappingURL=MarkdownTextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_MarkdownTextInputDecoratorViewNativeComponent","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","FONT_FAMILY_MONOSPACE","Platform","select","ios","makeDefaultMarkdownStyle","syntax","color","link","h1","fontSize","blockquote","borderColor","borderWidth","marginLeft","paddingLeft","code","fontFamily","backgroundColor","pre","mentionHere","mentionUser","mergeMarkdownStyleWithDefault","input","output","undefined","keys","forEach","processColorsInMarkdownStyle","JSON","parse","stringify","prop","endsWith","processColor","processMarkdownStyle","MarkdownTextInput","React","forwardRef","props","ref","IS_FABRIC","global","markdownStyle","useMemo","createElement","Fragment","TextInput","style","styles","farAway","displayNone","StyleSheet","create","display","position","top","left","_default","exports"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,8CAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA4G,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,K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A,CAAAiE,SAAS,EAAA5D,QAAA,KACJoD,KAAK;IACTC,GAAG,EAAEA;EAAI,EACV,CAAC,eACF7D,MAAA,CAAAO,OAAA,CAAA2D,aAAA,CAAC9D,8CAAA,CAAAG,OAA6C;IAC5C8D,KAAK,EAAEP,SAAS,GAAGQ,MAAM,CAACC,OAAO,GAAGD,MAAM,CAACE,WAAY;IACvDR,aAAa,EAAEA;EAAc,CAC9B,CACD,CAAC;AAEP,CAAC,CAAC;AAEF,MAAMM,MAAM,GAAGG,uBAAU,CAACC,MAAM,CAAC;EAC/BF,WAAW,EAAE;IACXG,OAAO,EAAE;EACX,CAAC;EACDJ,OAAO,EAAE;IACPK,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,GAAG;IACRC,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzE,OAAA,GAIYkD,iBAAiB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line arrow-body-style
|
|
14
|
+
const MarkdownTextInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
15
|
+
// TODO: add web implementation here
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({}, props, {
|
|
17
|
+
ref: ref
|
|
18
|
+
}));
|
|
19
|
+
});
|
|
20
|
+
var _default = exports.default = MarkdownTextInput;
|
|
21
|
+
//# sourceMappingURL=MarkdownTextInput.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","MarkdownTextInput","React","forwardRef","props","ref","createElement","TextInput","_default","exports"],"sourceRoot":"../../src","sources":["MarkdownTextInput.web.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA0B,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAG1B;;AAKA;AACA,MAAMQ,iBAAiB,gBAAGC,cAAK,CAACC,UAAU,CAAoC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5F;EACA,oBACEvB,MAAA,CAAAI,OAAA,CAAAoB,aAAA,CAAC1B,YAAA,CAAA2B,SAAS,EAAApB,QAAA,KACJiB,KAAK;IACTC,GAAG,EAAEA;EAAI,EACV,CAAC;AAEN,CAAC,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAvB,OAAA,GAEYe,iBAAiB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = exports.default = (0, _codegenNativeComponent.default)('MarkdownTextInputDecoratorView');
|
|
10
|
+
//# sourceMappingURL=MarkdownTextInputDecoratorViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","obj","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../src","sources":["MarkdownTextInputDecoratorViewNativeComponent.ts"],"mappings":";;;;;;AAGA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GA0C9E,IAAAG,+BAAsB,EAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "MarkdownTextInput", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _MarkdownTextInput.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _MarkdownTextInput = _interopRequireDefault(require("./MarkdownTextInput"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_MarkdownTextInput","_interopRequireDefault","require","obj","__esModule","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiE,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Platform, StyleSheet, TextInput, processColor } from 'react-native';
|
|
4
|
+
import MarkdownTextInputDecoratorViewNativeComponent from './MarkdownTextInputDecoratorViewNativeComponent';
|
|
5
|
+
const FONT_FAMILY_MONOSPACE = Platform.select({
|
|
6
|
+
ios: 'Courier',
|
|
7
|
+
default: 'monospace'
|
|
8
|
+
});
|
|
9
|
+
function makeDefaultMarkdownStyle() {
|
|
10
|
+
return {
|
|
11
|
+
syntax: {
|
|
12
|
+
color: 'gray'
|
|
13
|
+
},
|
|
14
|
+
link: {
|
|
15
|
+
color: 'blue'
|
|
16
|
+
},
|
|
17
|
+
h1: {
|
|
18
|
+
fontSize: 25
|
|
19
|
+
},
|
|
20
|
+
blockquote: {
|
|
21
|
+
borderColor: 'gray',
|
|
22
|
+
borderWidth: 6,
|
|
23
|
+
marginLeft: 6,
|
|
24
|
+
paddingLeft: 6
|
|
25
|
+
},
|
|
26
|
+
code: {
|
|
27
|
+
fontFamily: FONT_FAMILY_MONOSPACE,
|
|
28
|
+
color: 'black',
|
|
29
|
+
backgroundColor: 'lightgray'
|
|
30
|
+
},
|
|
31
|
+
pre: {
|
|
32
|
+
fontFamily: FONT_FAMILY_MONOSPACE,
|
|
33
|
+
color: 'black',
|
|
34
|
+
backgroundColor: 'lightgray'
|
|
35
|
+
},
|
|
36
|
+
mentionHere: {
|
|
37
|
+
color: 'green',
|
|
38
|
+
backgroundColor: 'lime'
|
|
39
|
+
},
|
|
40
|
+
mentionUser: {
|
|
41
|
+
color: 'blue',
|
|
42
|
+
backgroundColor: 'cyan'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function mergeMarkdownStyleWithDefault(input) {
|
|
47
|
+
const output = makeDefaultMarkdownStyle();
|
|
48
|
+
if (input !== undefined) {
|
|
49
|
+
Object.keys(input).forEach(key => {
|
|
50
|
+
if (!(key in output)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
Object.assign(output[key], input[key]);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return output;
|
|
57
|
+
}
|
|
58
|
+
function processColorsInMarkdownStyle(input) {
|
|
59
|
+
const output = JSON.parse(JSON.stringify(input));
|
|
60
|
+
Object.keys(output).forEach(key => {
|
|
61
|
+
const obj = output[key];
|
|
62
|
+
Object.keys(obj).forEach(prop => {
|
|
63
|
+
// TODO: use ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes'
|
|
64
|
+
if (!(prop === 'color' || prop.endsWith('Color'))) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
obj[prop] = processColor(obj[prop]);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
return output;
|
|
71
|
+
}
|
|
72
|
+
function processMarkdownStyle(input) {
|
|
73
|
+
return processColorsInMarkdownStyle(mergeMarkdownStyleWithDefault(input));
|
|
74
|
+
}
|
|
75
|
+
const MarkdownTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
76
|
+
const IS_FABRIC = ('nativeFabricUIManager' in global);
|
|
77
|
+
const markdownStyle = React.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
|
|
78
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextInput, _extends({}, props, {
|
|
79
|
+
ref: ref
|
|
80
|
+
})), /*#__PURE__*/React.createElement(MarkdownTextInputDecoratorViewNativeComponent, {
|
|
81
|
+
style: IS_FABRIC ? styles.farAway : styles.displayNone,
|
|
82
|
+
markdownStyle: markdownStyle
|
|
83
|
+
}));
|
|
84
|
+
});
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
displayNone: {
|
|
87
|
+
display: 'none'
|
|
88
|
+
},
|
|
89
|
+
farAway: {
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
top: 1e8,
|
|
92
|
+
left: 1e8
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
export default MarkdownTextInput;
|
|
96
|
+
//# sourceMappingURL=MarkdownTextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","TextInput","processColor","MarkdownTextInputDecoratorViewNativeComponent","FONT_FAMILY_MONOSPACE","select","ios","default","makeDefaultMarkdownStyle","syntax","color","link","h1","fontSize","blockquote","borderColor","borderWidth","marginLeft","paddingLeft","code","fontFamily","backgroundColor","pre","mentionHere","mentionUser","mergeMarkdownStyleWithDefault","input","output","undefined","Object","keys","forEach","key","assign","processColorsInMarkdownStyle","JSON","parse","stringify","obj","prop","endsWith","processMarkdownStyle","MarkdownTextInput","forwardRef","props","ref","IS_FABRIC","global","markdownStyle","useMemo","createElement","Fragment","_extends","style","styles","farAway","displayNone","create","display","position","top","left"],"sourceRoot":"../../src","sources":["MarkdownTextInput.tsx"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,QAAQ,EAAEC,UAAU,EAAEC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AC5CkD,KAAK,EAAEP,SAAS,GAAGQ,MAAM,CAACC,OAAO,GAAGD,MAAM,CAACE,WAAY;IACvDR,aAAa,EAAEA;EAAc,CAC9B,CACD,CAAC;AAEP,CAAC,CAAC;AAEF,MAAMM,MAAM,GAAGtD,UAAU,CAACyD,MAAM,CAAC;EAC/BD,WAAW,EAAE;IACXE,OAAO,EAAE;EACX,CAAC;EACDH,OAAO,EAAE;IACPI,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,GAAG;IACRC,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAIF,eAAenB,iBAAiB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line arrow-body-style
|
|
8
|
+
const MarkdownTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
9
|
+
// TODO: add web implementation here
|
|
10
|
+
return /*#__PURE__*/React.createElement(TextInput, _extends({}, props, {
|
|
11
|
+
ref: ref
|
|
12
|
+
}));
|
|
13
|
+
});
|
|
14
|
+
export default MarkdownTextInput;
|
|
15
|
+
//# sourceMappingURL=MarkdownTextInput.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TextInput","React","MarkdownTextInput","forwardRef","props","ref","createElement","_extends"],"sourceRoot":"../../src","sources":["MarkdownTextInput.web.tsx"],"mappings":";AAAA,SAAQA,SAAS,QAAO,cAAc;AAEtC,OAAOC,KAAK,MAAM,OAAO;;AAGzB;;AAKA;AACA,MAAMC,iBAAiB,gBAAGD,KAAK,CAACE,UAAU,CAAoC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5F;EACA,oBACEJ,KAAA,CAAAK,aAAA,CAACN,SAAS,EAAAO,QAAA,KACJH,KAAK;IACTC,GAAG,EAAEA;EAAI,EACV,CAAC;AAEN,CAAC,CAAC;AAEF,eAAeH,iBAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../src","sources":["MarkdownTextInputDecoratorViewNativeComponent.ts"],"mappings":"AAGA,OAAOA,sBAAsB,MAAM,yDAAyD;AA0C5F,eAAeA,sBAAsB,CAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","MarkdownTextInput"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAAQA,OAAO,IAAIC,iBAAiB,QAAO,qBAAqB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import type { TextInputProps } from 'react-native';
|
|
4
|
+
import type * as MarkdownTextInputDecoractorView from './MarkdownTextInputDecoratorViewNativeComponent';
|
|
5
|
+
type MarkdownStyle = MarkdownTextInputDecoractorView.MarkdownStyle;
|
|
6
|
+
type PartialMarkdownStyle = Partial<{
|
|
7
|
+
[K in keyof MarkdownStyle]: Partial<MarkdownStyle[K]>;
|
|
8
|
+
}>;
|
|
9
|
+
interface MarkdownTextInputProps extends TextInputProps {
|
|
10
|
+
markdownStyle?: PartialMarkdownStyle;
|
|
11
|
+
}
|
|
12
|
+
declare const MarkdownTextInput: React.ForwardRefExoticComponent<MarkdownTextInputProps & React.RefAttributes<TextInput>>;
|
|
13
|
+
export type { PartialMarkdownStyle as MarkdownStyle, MarkdownTextInputProps };
|
|
14
|
+
export default MarkdownTextInput;
|
|
15
|
+
//# sourceMappingURL=MarkdownTextInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownTextInput.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAuB,SAAS,EAAe,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,KAAK,+BAA+B,MAAM,iDAAiD,CAAC;AAGxG,KAAK,aAAa,GAAG,+BAA+B,CAAC,aAAa,CAAC;AA6CnE,KAAK,oBAAoB,GAAG,OAAO,CAAC;KACjC,CAAC,IAAI,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CACtD,CAAC,CAAC;AAsCH,UAAU,sBAAuB,SAAQ,cAAc;IACrD,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,QAAA,MAAM,iBAAiB,0FAiBrB,CAAC;AAaH,YAAY,EAAC,oBAAoB,IAAI,aAAa,EAAE,sBAAsB,EAAC,CAAC;AAE5E,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TextInput } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { TextInputProps } from 'react-native';
|
|
4
|
+
interface MarkdownTextInputProps extends TextInputProps {
|
|
5
|
+
}
|
|
6
|
+
declare const MarkdownTextInput: React.ForwardRefExoticComponent<MarkdownTextInputProps & React.RefAttributes<TextInput>>;
|
|
7
|
+
export default MarkdownTextInput;
|
|
8
|
+
export type { MarkdownTextInputProps };
|
|
9
|
+
//# sourceMappingURL=MarkdownTextInput.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownTextInput.web.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInput.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAGjD,UAAU,sBAAuB,SAAQ,cAAc;CAEtD;AAGD,QAAA,MAAM,iBAAiB,0FAQrB,CAAC;AAEH,eAAe,iBAAiB,CAAC;AAEjC,YAAY,EAAC,sBAAsB,EAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react-native/types/modules/Codegen" />
|
|
2
|
+
/// <reference types="react-native/Codegen" />
|
|
3
|
+
import type { ColorValue, ViewProps } from 'react-native';
|
|
4
|
+
import type { Float } from 'react-native/Libraries/Types/CodegenTypes';
|
|
5
|
+
interface MarkdownStyle {
|
|
6
|
+
syntax: {
|
|
7
|
+
color: ColorValue;
|
|
8
|
+
};
|
|
9
|
+
link: {
|
|
10
|
+
color: ColorValue;
|
|
11
|
+
};
|
|
12
|
+
h1: {
|
|
13
|
+
fontSize: Float;
|
|
14
|
+
};
|
|
15
|
+
blockquote: {
|
|
16
|
+
borderColor: ColorValue;
|
|
17
|
+
borderWidth: Float;
|
|
18
|
+
marginLeft: Float;
|
|
19
|
+
paddingLeft: Float;
|
|
20
|
+
};
|
|
21
|
+
code: {
|
|
22
|
+
fontFamily: string;
|
|
23
|
+
color: ColorValue;
|
|
24
|
+
backgroundColor: ColorValue;
|
|
25
|
+
};
|
|
26
|
+
pre: {
|
|
27
|
+
fontFamily: string;
|
|
28
|
+
color: ColorValue;
|
|
29
|
+
backgroundColor: ColorValue;
|
|
30
|
+
};
|
|
31
|
+
mentionHere: {
|
|
32
|
+
color: ColorValue;
|
|
33
|
+
backgroundColor: ColorValue;
|
|
34
|
+
};
|
|
35
|
+
mentionUser: {
|
|
36
|
+
color: ColorValue;
|
|
37
|
+
backgroundColor: ColorValue;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface NativeProps extends ViewProps {
|
|
41
|
+
markdownStyle: MarkdownStyle;
|
|
42
|
+
}
|
|
43
|
+
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
44
|
+
export default _default;
|
|
45
|
+
export type { MarkdownStyle };
|
|
46
|
+
//# sourceMappingURL=MarkdownTextInputDecoratorViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownTextInputDecoratorViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInputDecoratorViewNativeComponent.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,2CAA2C,CAAC;AAGrE,UAAU,aAAa;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IACF,IAAI,EAAE;QACJ,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IACF,EAAE,EAAE;QACF,QAAQ,EAAE,KAAK,CAAC;KACjB,CAAC;IACF,UAAU,EAAE;QACV,WAAW,EAAE,UAAU,CAAC;QACxB,WAAW,EAAE,KAAK,CAAC;QACnB,UAAU,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC;KACpB,CAAC;IACF,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,GAAG,EAAE;QACH,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;CACH;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,aAAa,EAAE,aAAa,CAAC;CAC9B;;AAED,wBAAqF;AAErF,YAAY,EAAC,aAAa,EAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACjE,YAAY,EAAC,sBAAsB,EAAE,aAAa,EAAC,MAAM,qBAAqB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@expensify/react-native-live-markdown",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"parser/react-native-live-markdown-parser.js",
|
|
14
|
+
"android",
|
|
15
|
+
"ios",
|
|
16
|
+
"cpp",
|
|
17
|
+
"*.podspec",
|
|
18
|
+
"!ios/build",
|
|
19
|
+
"!android/build",
|
|
20
|
+
"!android/gradle",
|
|
21
|
+
"!android/gradlew",
|
|
22
|
+
"!android/gradlew.bat",
|
|
23
|
+
"!android/local.properties",
|
|
24
|
+
"!**/__tests__",
|
|
25
|
+
"!**/__fixtures__",
|
|
26
|
+
"!**/__mocks__",
|
|
27
|
+
"!**/.*"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"example": "yarn workspace @expensify/react-native-live-markdown-example",
|
|
31
|
+
"test": "jest",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"lint": "eslint . --ext .js,.ts,.tsx",
|
|
34
|
+
"lint:root": "eslint . --ext .js,.ts,.tsx --ignore-pattern '/example/**/*' --ignore-pattern '/WebExample/**/*' --ignore-pattern '/parser/**/*'",
|
|
35
|
+
"lint:example": "eslint example --ext .js,.ts,.tsx",
|
|
36
|
+
"lint:parser": "eslint parser --ext .js,.ts,.tsx",
|
|
37
|
+
"lint:web": "eslint WebExample --ext .js,.ts,.tsx",
|
|
38
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
39
|
+
"prepare": "bob build",
|
|
40
|
+
"release": "release-it"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"react-native",
|
|
44
|
+
"ios",
|
|
45
|
+
"android"
|
|
46
|
+
],
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/expensify/react-native-live-markdown.git"
|
|
50
|
+
},
|
|
51
|
+
"author": "Expensify, Inc.",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/expensify/react-native-live-markdown/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/expensify/react-native-live-markdown#readme",
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"registry": "https://registry.npmjs.org/"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@babel/preset-env": "^7.20.2",
|
|
62
|
+
"@babel/preset-react": "^7.18.6",
|
|
63
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
64
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
65
|
+
"@lwc/eslint-plugin-lwc": "^1.7.2",
|
|
66
|
+
"@react-native/eslint-config": "^0.72.2",
|
|
67
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
68
|
+
"@types/jest": "^28.1.2",
|
|
69
|
+
"@types/react": "~17.0.21",
|
|
70
|
+
"@types/react-native": "0.70.0",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
72
|
+
"@typescript-eslint/parser": "^6.15.0",
|
|
73
|
+
"del-cli": "^5.0.0",
|
|
74
|
+
"eslint": "^8.56.0",
|
|
75
|
+
"eslint-config-expensify": "^2.0.24",
|
|
76
|
+
"eslint-config-prettier": "^8.5.0",
|
|
77
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
78
|
+
"eslint-plugin-deprecation": "^2.0.0",
|
|
79
|
+
"eslint-plugin-es": "^4.1.0",
|
|
80
|
+
"eslint-plugin-filenames": "^1.3.2",
|
|
81
|
+
"eslint-plugin-header": "^3.1.1",
|
|
82
|
+
"eslint-plugin-import": "^2.29.1",
|
|
83
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
84
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
85
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
86
|
+
"eslint-plugin-tsdoc": "^0.2.17",
|
|
87
|
+
"jest": "^28.1.1",
|
|
88
|
+
"pod-install": "^0.1.0",
|
|
89
|
+
"prettier": "^2.0.5",
|
|
90
|
+
"react": "18.2.0",
|
|
91
|
+
"react-native": "0.72.9",
|
|
92
|
+
"react-native-builder-bob": "^0.20.0",
|
|
93
|
+
"release-it": "^15.0.0",
|
|
94
|
+
"turbo": "^1.10.7",
|
|
95
|
+
"typescript": "^5.3.3"
|
|
96
|
+
},
|
|
97
|
+
"resolutions": {
|
|
98
|
+
"@types/react": "17.0.21"
|
|
99
|
+
},
|
|
100
|
+
"peerDependencies": {
|
|
101
|
+
"react": "*",
|
|
102
|
+
"react-native": "*"
|
|
103
|
+
},
|
|
104
|
+
"workspaces": [
|
|
105
|
+
"example"
|
|
106
|
+
],
|
|
107
|
+
"packageManager": "yarn@3.6.1",
|
|
108
|
+
"engines": {
|
|
109
|
+
"node": ">= 18.0.0"
|
|
110
|
+
},
|
|
111
|
+
"jest": {
|
|
112
|
+
"preset": "react-native",
|
|
113
|
+
"modulePathIgnorePatterns": [
|
|
114
|
+
"<rootDir>/example/node_modules",
|
|
115
|
+
"<rootDir>/lib/"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"commitlint": {
|
|
119
|
+
"extends": [
|
|
120
|
+
"@commitlint/config-conventional"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"release-it": {
|
|
124
|
+
"git": {
|
|
125
|
+
"commitMessage": "chore: release ${version}",
|
|
126
|
+
"tagName": "v${version}"
|
|
127
|
+
},
|
|
128
|
+
"npm": {
|
|
129
|
+
"publish": true
|
|
130
|
+
},
|
|
131
|
+
"github": {
|
|
132
|
+
"release": true
|
|
133
|
+
},
|
|
134
|
+
"plugins": {
|
|
135
|
+
"@release-it/conventional-changelog": {
|
|
136
|
+
"preset": "angular"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"react-native-builder-bob": {
|
|
141
|
+
"source": "src",
|
|
142
|
+
"output": "lib",
|
|
143
|
+
"targets": [
|
|
144
|
+
"commonjs",
|
|
145
|
+
"module",
|
|
146
|
+
[
|
|
147
|
+
"typescript",
|
|
148
|
+
{
|
|
149
|
+
"project": "tsconfig.json"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"codegenConfig": {
|
|
155
|
+
"name": "RNLiveMarkdownSpec",
|
|
156
|
+
"type": "components",
|
|
157
|
+
"jsSrcsDir": "src"
|
|
158
|
+
}
|
|
159
|
+
}
|