@expensify/react-native-live-markdown 0.1.187 → 0.1.189

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.
Files changed (75) hide show
  1. package/README.md +55 -8
  2. package/RNLiveMarkdown.podspec +2 -4
  3. package/android/build.gradle +4 -9
  4. package/android/src/main/cpp/CMakeLists.txt +14 -6
  5. package/android/src/main/cpp/MarkdownUtils.cpp +13 -24
  6. package/android/src/main/cpp/MarkdownUtils.h +2 -7
  7. package/android/src/main/cpp/OnLoad.cpp +6 -0
  8. package/android/src/main/java/com/expensify/livemarkdown/CustomFabricUIManager.java +2 -2
  9. package/android/src/main/java/com/expensify/livemarkdown/CustomMountingManager.java +4 -6
  10. package/android/src/main/java/com/expensify/livemarkdown/LiveMarkdownModule.java +12 -0
  11. package/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorView.java +17 -3
  12. package/android/src/main/java/com/expensify/livemarkdown/MarkdownTextInputDecoratorViewManager.java +6 -0
  13. package/android/src/main/java/com/expensify/livemarkdown/MarkdownUtils.java +21 -34
  14. package/android/src/main/new_arch/MarkdownCommitHook.cpp +7 -4
  15. package/android/src/main/new_arch/MarkdownCommitHook.h +2 -0
  16. package/android/src/newarch/LiveMarkdownModuleSpec.java +9 -0
  17. package/android/src/oldarch/LiveMarkdownModuleSpec.java +12 -0
  18. package/android/src/oldarch/MarkdownTextInputDecoratorViewManagerSpec.java +1 -0
  19. package/apple/LiveMarkdownModule.h +16 -0
  20. package/apple/{RCTLiveMarkdownModule.mm → LiveMarkdownModule.mm} +31 -17
  21. package/apple/MarkdownCommitHook.mm +2 -0
  22. package/apple/MarkdownTextInputDecoratorComponentView.mm +4 -0
  23. package/apple/MarkdownTextInputDecoratorView.h +2 -0
  24. package/apple/MarkdownTextInputDecoratorView.mm +13 -0
  25. package/apple/MarkdownTextInputDecoratorViewManager.mm +9 -0
  26. package/apple/RCTMarkdownUtils.h +1 -0
  27. package/apple/RCTMarkdownUtils.mm +43 -45
  28. package/cpp/MarkdownGlobal.cpp +45 -0
  29. package/cpp/MarkdownGlobal.h +24 -0
  30. package/cpp/RuntimeDecorator.cpp +43 -0
  31. package/cpp/RuntimeDecorator.h +13 -0
  32. package/lib/commonjs/MarkdownTextInput.js +43 -2
  33. package/lib/commonjs/MarkdownTextInput.js.map +1 -1
  34. package/lib/commonjs/MarkdownTextInput.web.js +20 -14
  35. package/lib/commonjs/MarkdownTextInput.web.js.map +1 -1
  36. package/lib/commonjs/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -1
  37. package/lib/commonjs/index.js +7 -0
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/parseExpensiMark.js +263 -0
  40. package/lib/commonjs/parseExpensiMark.js.map +1 -0
  41. package/lib/commonjs/web/utils/parserUtils.js +2 -2
  42. package/lib/commonjs/web/utils/parserUtils.js.map +1 -1
  43. package/lib/module/MarkdownTextInput.js +43 -2
  44. package/lib/module/MarkdownTextInput.js.map +1 -1
  45. package/lib/module/MarkdownTextInput.web.js +20 -14
  46. package/lib/module/MarkdownTextInput.web.js.map +1 -1
  47. package/lib/module/MarkdownTextInputDecoratorViewNativeComponent.js.map +1 -1
  48. package/lib/module/index.js +1 -0
  49. package/lib/module/index.js.map +1 -1
  50. package/lib/module/parseExpensiMark.js +258 -0
  51. package/lib/module/parseExpensiMark.js.map +1 -0
  52. package/lib/module/web/utils/parserUtils.js +2 -2
  53. package/lib/module/web/utils/parserUtils.js.map +1 -1
  54. package/lib/typescript/src/MarkdownTextInput.d.ts +9 -1
  55. package/lib/typescript/src/MarkdownTextInput.d.ts.map +1 -1
  56. package/lib/typescript/src/MarkdownTextInput.web.d.ts +2 -1
  57. package/lib/typescript/src/MarkdownTextInput.web.d.ts.map +1 -1
  58. package/lib/typescript/src/MarkdownTextInputDecoratorViewNativeComponent.d.ts +2 -1
  59. package/lib/typescript/src/MarkdownTextInputDecoratorViewNativeComponent.d.ts.map +1 -1
  60. package/lib/typescript/src/index.d.ts +2 -0
  61. package/lib/typescript/src/index.d.ts.map +1 -1
  62. package/lib/typescript/src/parseExpensiMark.d.ts +4 -0
  63. package/lib/typescript/src/parseExpensiMark.d.ts.map +1 -0
  64. package/lib/typescript/src/web/utils/parserUtils.d.ts +1 -1
  65. package/lib/typescript/src/web/utils/parserUtils.d.ts.map +1 -1
  66. package/package.json +13 -10
  67. package/src/MarkdownTextInput.tsx +62 -2
  68. package/src/MarkdownTextInput.web.tsx +23 -15
  69. package/src/MarkdownTextInputDecoratorViewNativeComponent.ts +2 -1
  70. package/src/index.tsx +2 -0
  71. package/src/parseExpensiMark.ts +277 -0
  72. package/src/web/utils/parserUtils.ts +2 -1
  73. package/apple/RCTLiveMarkdownModule.h +0 -16
  74. package/lib/parser/react-native-live-markdown-parser.js +0 -29
  75. package/parser/react-native-live-markdown-parser.js +0 -29
@@ -1,10 +1,18 @@
1
1
  import { TextInput } from 'react-native';
2
2
  import React from 'react';
3
3
  import type { TextInputProps } from 'react-native';
4
+ import type { WorkletRuntime } from 'react-native-reanimated';
5
+ import type { ShareableRef, WorkletFunction } from 'react-native-reanimated/lib/typescript/commonTypes';
4
6
  import type { PartialMarkdownStyle } from './styleUtils';
5
- import type { InlineImagesInputProps } from './commonTypes';
7
+ import type { InlineImagesInputProps, MarkdownRange } from './commonTypes';
8
+ declare global {
9
+ var jsi_setMarkdownRuntime: (runtime: WorkletRuntime) => void;
10
+ var jsi_registerMarkdownWorklet: (shareableWorklet: ShareableRef<WorkletFunction<[string], Range[]>>) => number;
11
+ var jsi_unregisterMarkdownWorklet: (parserId: number) => void;
12
+ }
6
13
  interface MarkdownTextInputProps extends TextInputProps, InlineImagesInputProps {
7
14
  markdownStyle?: PartialMarkdownStyle;
15
+ parser: (value: string) => MarkdownRange[];
8
16
  }
9
17
  type MarkdownTextInput = TextInput & React.Component<MarkdownTextInputProps>;
10
18
  declare const MarkdownTextInput: React.ForwardRefExoticComponent<MarkdownTextInputProps & React.RefAttributes<MarkdownTextInput>>;
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownTextInput.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAe,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAKjD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAM1D,UAAU,sBAAuB,SAAQ,cAAc,EAAE,sBAAsB;IAC7E,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,KAAK,iBAAiB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAuB7E,QAAA,MAAM,iBAAiB,kGAiBrB,CAAC;AAaH,YAAY,EAAC,oBAAoB,IAAI,aAAa,EAAE,sBAAsB,EAAC,CAAC;AAE5E,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"MarkdownTextInput.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAe,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,oDAAoD,CAAC;AAMtG,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAC,sBAAsB,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAEzE,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,sBAAsB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAE9D,IAAI,2BAA2B,EAAE,CAAC,gBAAgB,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC;IAEhH,IAAI,6BAA6B,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAgCD,UAAU,sBAAuB,SAAQ,cAAc,EAAE,sBAAsB;IAC7E,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,EAAE,CAAC;CAC5C;AAED,KAAK,iBAAiB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAuB7E,QAAA,MAAM,iBAAiB,kGAqCrB,CAAC;AAaH,YAAY,EAAC,oBAAoB,IAAI,aAAa,EAAE,sBAAsB,EAAC,CAAC;AAE5E,eAAe,iBAAiB,CAAC"}
@@ -4,9 +4,10 @@ import type { MouseEvent } from 'react';
4
4
  import type { TreeNode } from './web/utils/treeUtils';
5
5
  import './web/MarkdownTextInput.css';
6
6
  import type { MarkdownStyle } from './MarkdownTextInputDecoratorViewNativeComponent';
7
- import type { InlineImagesInputProps } from './commonTypes';
7
+ import type { MarkdownRange, InlineImagesInputProps } from './commonTypes';
8
8
  interface MarkdownTextInputProps extends TextInputProps, InlineImagesInputProps {
9
9
  markdownStyle?: MarkdownStyle;
10
+ parser: (text: string) => MarkdownRange[];
10
11
  onClick?: (e: MouseEvent<HTMLDivElement>) => void;
11
12
  dir?: string;
12
13
  disabled?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownTextInput.web.d.ts","sourceRoot":"","sources":["../../../src/MarkdownTextInput.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EAKT,cAAc,EAKf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAiE,MAAM,OAAO,CA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codegen" />
2
2
  import type { ColorValue, ViewProps } from 'react-native';
3
- import type { Float } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
4
4
  interface MarkdownStyle {
5
5
  syntax: {
6
6
  color: ColorValue;
@@ -71,6 +71,7 @@ interface MarkdownStyle {
71
71
  }
72
72
  interface NativeProps extends ViewProps {
73
73
  markdownStyle: MarkdownStyle;
74
+ parserId: Int32;
74
75
  }
75
76
  declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
76
77
  export default _default;
@@ -1 +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,KAAK,EAAE;QACL,QAAQ,EAAE,KAAK,CAAC;KACjB,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,QAAQ,EAAE,KAAK,CAAC;QAChB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,GAAG,EAAE;QACH,UAAU,EAAE,MAAM,CAAC;QACnB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DecoratorViewNativeComponent.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,EAAE,KAAK,EAAC,MAAM,2CAA2C,CAAC;AAG5E,UAAU,aAAa;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,UAAU,CAAC;KACnB,CAAC;IACF,KAAK,EAAE;QACL,QAAQ,EAAE,KAAK,CAAC;KACjB,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,QAAQ,EAAE,KAAK,CAAC;QAChB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,GAAG,EAAE;QACH,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,KAAK,CAAC;QAChB,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;IACF,aAAa,EAAE;QACb,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,UAAU,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE;QACX,QAAQ,EAAE,KAAK,CAAC;QAChB,SAAS,EAAE,KAAK,CAAC;QACjB,QAAQ,EAAE,KAAK,CAAC;QAChB,SAAS,EAAE,KAAK,CAAC;QACjB,SAAS,EAAE,KAAK,CAAC;QACjB,YAAY,EAAE,KAAK,CAAC;QACpB,YAAY,EAAE,KAAK,CAAC;KACrB,CAAC;IACF,yBAAyB,CAAC,EAAE;QAC1B,eAAe,CAAC,EAAE,UAAU,CAAC;QAC7B,WAAW,CAAC,EAAE,KAAK,CAAC;QACpB,WAAW,CAAC,EAAE,UAAU,CAAC;QACzB,YAAY,CAAC,EAAE,KAAK,CAAC;QACrB,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,MAAM,CAAC,EAAE,KAAK,CAAC;KAChB,CAAC;IACF,gBAAgB,CAAC,EAAE;QACjB,YAAY,CAAC,EAAE,UAAU,CAAC;QAC1B,cAAc,CAAC,EAAE,UAAU,CAAC;QAC5B,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,MAAM,CAAC,EAAE,KAAK,CAAC;QACf,WAAW,CAAC,EAAE,KAAK,CAAC;KACrB,CAAC;CACH;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC;CACjB;;AAED,wBAEG;AAEH,YAAY,EAAC,aAAa,EAAC,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export { default as MarkdownTextInput } from './MarkdownTextInput';
2
2
  export type { MarkdownTextInputProps, MarkdownStyle } from './MarkdownTextInput';
3
+ export type { MarkdownType, MarkdownRange } from './commonTypes';
4
+ export { default as parseExpensiMark } from './parseExpensiMark';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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;AAC/E,YAAY,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { MarkdownRange } from './commonTypes';
2
+ declare function parseExpensiMark(markdown: string): MarkdownRange[];
3
+ export default parseExpensiMark;
4
+ //# sourceMappingURL=parseExpensiMark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseExpensiMark.d.ts","sourceRoot":"","sources":["../../../src/parseExpensiMark.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAe,aAAa,EAAC,MAAM,eAAe,CAAC;AA4P/D,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAkB3D;AAED,eAAe,gBAAgB,CAAC"}
@@ -7,7 +7,7 @@ declare function parseRangesToHTMLNodes(text: string, ranges: MarkdownRange[], i
7
7
  dom: HTMLMarkdownElement;
8
8
  tree: TreeNode;
9
9
  };
10
- declare function updateInputStructure(target: MarkdownTextInputElement, text: string, cursorPositionIndex: number | null, isMultiline?: boolean, markdownStyle?: PartialMarkdownStyle, alwaysMoveCursorToTheEnd?: boolean, shouldForceDOMUpdate?: boolean, shouldScrollIntoView?: boolean, inlineImagesProps?: InlineImagesInputProps): {
10
+ declare function updateInputStructure(parserFunction: (input: string) => MarkdownRange[], target: MarkdownTextInputElement, text: string, cursorPositionIndex: number | null, isMultiline?: boolean, markdownStyle?: PartialMarkdownStyle, alwaysMoveCursorToTheEnd?: boolean, shouldForceDOMUpdate?: boolean, shouldScrollIntoView?: boolean, inlineImagesProps?: InlineImagesInputProps): {
11
11
  text: string;
12
12
  cursorPosition: number;
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"parserUtils.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AAE/F,OAAO,KAAK,EAAW,QAAQ,EAAC,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAG3D,OAAO,KAAK,EAAC,sBAAsB,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AA2I7E,yEAAyE;AACzE,iBAAS,sBAAsB,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EAAE,EACvB,WAAW,UAAO,EAClB,aAAa,GAAE,oBAAyB,EACxC,mBAAmB,UAAQ,EAC3B,YAAY,GAAE,wBAAwB,GAAG,IAAW,EACpD,iBAAiB,GAAE,sBAA2B;;;EA0G/C;AAcD,iBAAS,oBAAoB,CAC3B,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,MAAM,GAAG,IAAI,EAClC,WAAW,UAAO,EAClB,aAAa,GAAE,oBAAyB,EACxC,wBAAwB,UAAQ,EAChC,oBAAoB,UAAQ,EAC5B,oBAAoB,UAAQ,EAC5B,iBAAiB,GAAE,sBAA2B;;;EAsC/C;AAED,OAAO,EAAC,oBAAoB,EAAE,sBAAsB,EAAC,CAAC"}
1
+ {"version":3,"file":"parserUtils.d.ts","sourceRoot":"","sources":["../../../../../src/web/utils/parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AAE/F,OAAO,KAAK,EAAW,QAAQ,EAAC,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAG3D,OAAO,KAAK,EAAC,sBAAsB,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AA2I7E,yEAAyE;AACzE,iBAAS,sBAAsB,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EAAE,EACvB,WAAW,UAAO,EAClB,aAAa,GAAE,oBAAyB,EACxC,mBAAmB,UAAQ,EAC3B,YAAY,GAAE,wBAAwB,GAAG,IAAW,EACpD,iBAAiB,GAAE,sBAA2B;;;EA0G/C;AAcD,iBAAS,oBAAoB,CAC3B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,EAAE,EAClD,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,MAAM,GAAG,IAAI,EAClC,WAAW,UAAO,EAClB,aAAa,GAAE,oBAAyB,EACxC,wBAAwB,UAAQ,EAChC,oBAAoB,UAAQ,EAC5B,oBAAoB,UAAQ,EAC5B,iBAAiB,GAAE,sBAA2B;;;EAsC/C;AAED,OAAO,EAAC,oBAAoB,EAAE,sBAAsB,EAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expensify/react-native-live-markdown",
3
- "version": "0.1.187",
3
+ "version": "0.1.189",
4
4
  "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -10,7 +10,6 @@
10
10
  "files": [
11
11
  "src",
12
12
  "lib",
13
- "parser/react-native-live-markdown-parser.js",
14
13
  "android",
15
14
  "apple",
16
15
  "cpp",
@@ -32,14 +31,14 @@
32
31
  "test": "jest",
33
32
  "typecheck": "tsc --noEmit",
34
33
  "lint": "eslint . --ext .js,.ts,.tsx",
35
- "lint:root": "eslint . --ext .js,.ts,.tsx --ignore-pattern '/parser/**/*' --ignore-pattern '/example/**/*' --ignore-pattern '/WebExample/**/*'",
36
- "lint:parser": "eslint parser --ext .js,.ts,.tsx",
34
+ "lint:root": "eslint . --ext .js,.ts,.tsx --ignore-pattern '/example/**/*' --ignore-pattern '/WebExample/**/*'",
37
35
  "lint:example": "eslint example --ext .js,.ts,.tsx",
38
36
  "lint:WebExample": "eslint WebExample --ext .js,.ts,.tsx",
39
37
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
- "prepare": "bob build && mkdir -p lib/parser && cp parser/react-native-live-markdown-parser.js lib/parser/react-native-live-markdown-parser.js",
38
+ "prepare": "bob build",
41
39
  "build:watch": "nodemon --watch src --ext .ts,.tsx,.css --exec \"rm -f .build_complete && npm run prepare && npm pack && touch .build_complete\"",
42
- "release": "release-it"
40
+ "release": "release-it",
41
+ "postinstall": "patch-package"
43
42
  },
44
43
  "keywords": [
45
44
  "react-native",
@@ -65,7 +64,7 @@
65
64
  "@commitlint/config-conventional": "^17.0.2",
66
65
  "@evilmartians/lefthook": "^1.5.0",
67
66
  "@lwc/eslint-plugin-lwc": "^1.7.2",
68
- "@react-native/eslint-config": "0.75.2",
67
+ "@react-native/eslint-config": "0.75.3",
69
68
  "@release-it/conventional-changelog": "^5.0.0",
70
69
  "@types/jest": "^29.5.14",
71
70
  "@types/react": "~18.2.6",
@@ -85,24 +84,28 @@
85
84
  "eslint-plugin-prettier": "^4.0.0",
86
85
  "eslint-plugin-promise": "^6.1.1",
87
86
  "eslint-plugin-tsdoc": "^0.2.17",
87
+ "expensify-common": "2.0.106",
88
88
  "jest": "^29.6.3",
89
89
  "jest-environment-jsdom": "^29.7.0",
90
90
  "nodemon": "^3.1.3",
91
+ "patch-package": "^8.0.0",
91
92
  "prettier": "2.8.8",
92
93
  "react": "18.3.1",
93
- "react-native": "0.75.2",
94
+ "react-native": "0.75.3",
94
95
  "react-native-builder-bob": "^0.20.0",
96
+ "react-native-reanimated": "3.16.3",
95
97
  "react-native-web": "^0.19.10",
96
98
  "release-it": "^15.0.0",
97
99
  "turbo": "^1.10.7",
98
100
  "typescript": "~5.3.3"
99
101
  },
100
102
  "peerDependencies": {
103
+ "expensify-common": ">=2.0.106",
101
104
  "react": "*",
102
- "react-native": "*"
105
+ "react-native": "*",
106
+ "react-native-reanimated": ">=3.16.3"
103
107
  },
104
108
  "workspaces": [
105
- "./parser",
106
109
  "./example",
107
110
  "./WebExample"
108
111
  ],
@@ -1,19 +1,59 @@
1
1
  import {StyleSheet, TextInput, processColor} from 'react-native';
2
2
  import React from 'react';
3
3
  import type {TextInputProps} from 'react-native';
4
+ import {createWorkletRuntime, makeShareableCloneRecursive} from 'react-native-reanimated';
5
+ import type {WorkletRuntime} from 'react-native-reanimated';
6
+ import type {ShareableRef, WorkletFunction} from 'react-native-reanimated/lib/typescript/commonTypes';
7
+
4
8
  import MarkdownTextInputDecoratorViewNativeComponent from './MarkdownTextInputDecoratorViewNativeComponent';
5
9
  import type {MarkdownStyle} from './MarkdownTextInputDecoratorViewNativeComponent';
6
10
  import NativeLiveMarkdownModule from './NativeLiveMarkdownModule';
7
11
  import {mergeMarkdownStyleWithDefault} from './styleUtils';
8
12
  import type {PartialMarkdownStyle} from './styleUtils';
9
- import type {InlineImagesInputProps} from './commonTypes';
13
+ import type {InlineImagesInputProps, MarkdownRange} from './commonTypes';
14
+
15
+ declare global {
16
+ // eslint-disable-next-line no-var
17
+ var jsi_setMarkdownRuntime: (runtime: WorkletRuntime) => void;
18
+ // eslint-disable-next-line no-var
19
+ var jsi_registerMarkdownWorklet: (shareableWorklet: ShareableRef<WorkletFunction<[string], Range[]>>) => number;
20
+ // eslint-disable-next-line no-var
21
+ var jsi_unregisterMarkdownWorklet: (parserId: number) => void;
22
+ }
10
23
 
11
- if (NativeLiveMarkdownModule) {
24
+ let initialized = false;
25
+ let workletRuntime: WorkletRuntime | undefined;
26
+
27
+ function initializeLiveMarkdownIfNeeded() {
28
+ if (initialized) {
29
+ return;
30
+ }
31
+ if (!NativeLiveMarkdownModule) {
32
+ throw new Error('[react-native-live-markdown] NativeLiveMarkdownModule is not available');
33
+ }
12
34
  NativeLiveMarkdownModule.install();
35
+ if (!global.jsi_setMarkdownRuntime) {
36
+ throw new Error('[react-native-live-markdown] global.jsi_setMarkdownRuntime is not available');
37
+ }
38
+ workletRuntime = createWorkletRuntime('LiveMarkdownRuntime');
39
+ global.jsi_setMarkdownRuntime(workletRuntime);
40
+ initialized = true;
41
+ }
42
+
43
+ function registerParser(parser: (input: string) => MarkdownRange[]): number {
44
+ initializeLiveMarkdownIfNeeded();
45
+ const shareableWorklet = makeShareableCloneRecursive(parser) as ShareableRef<WorkletFunction<[string], Range[]>>;
46
+ const parserId = global.jsi_registerMarkdownWorklet(shareableWorklet);
47
+ return parserId;
48
+ }
49
+
50
+ function unregisterParser(parserId: number) {
51
+ global.jsi_unregisterMarkdownWorklet(parserId);
13
52
  }
14
53
 
15
54
  interface MarkdownTextInputProps extends TextInputProps, InlineImagesInputProps {
16
55
  markdownStyle?: PartialMarkdownStyle;
56
+ parser: (value: string) => MarkdownRange[];
17
57
  }
18
58
 
19
59
  type MarkdownTextInput = TextInput & React.Component<MarkdownTextInputProps>;
@@ -44,6 +84,25 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
44
84
 
45
85
  const markdownStyle = React.useMemo(() => processMarkdownStyle(props.markdownStyle), [props.markdownStyle]);
46
86
 
87
+ if (props.parser === undefined) {
88
+ throw new Error('[react-native-live-markdown] `parser` is undefined');
89
+ }
90
+
91
+ // eslint-disable-next-line no-underscore-dangle
92
+ const workletHash = (props.parser as {__workletHash?: number}).__workletHash;
93
+ if (workletHash === undefined) {
94
+ throw new Error('[react-native-live-markdown] `parser` is not a worklet');
95
+ }
96
+
97
+ const parserId = React.useMemo(() => {
98
+ return registerParser(props.parser);
99
+ // eslint-disable-next-line react-hooks/exhaustive-deps
100
+ }, [workletHash]);
101
+
102
+ React.useEffect(() => {
103
+ return () => unregisterParser(parserId);
104
+ }, [parserId]);
105
+
47
106
  return (
48
107
  <>
49
108
  <TextInput
@@ -53,6 +112,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
53
112
  <MarkdownTextInputDecoratorViewNativeComponent
54
113
  style={IS_FABRIC ? styles.farAway : styles.displayNone}
55
114
  markdownStyle={markdownStyle}
115
+ parserId={parserId}
56
116
  />
57
117
  </>
58
118
  );
@@ -23,14 +23,13 @@ import type {MarkdownStyle} from './MarkdownTextInputDecoratorViewNativeComponen
23
23
  import {getElementHeight, getPlaceholderValue, isEventComposing, normalizeValue, parseInnerHTMLToText} from './web/utils/inputUtils';
24
24
  import {parseToReactDOMStyle, processMarkdownStyle} from './web/utils/webStyleUtils';
25
25
  import {forceRefreshAllImages} from './web/inputElements/inlineImage';
26
- import type {InlineImagesInputProps} from './commonTypes';
27
-
28
- require('../parser/react-native-live-markdown-parser.js');
26
+ import type {MarkdownRange, InlineImagesInputProps} from './commonTypes';
29
27
 
30
28
  const useClientEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
31
29
 
32
30
  interface MarkdownTextInputProps extends TextInputProps, InlineImagesInputProps {
33
31
  markdownStyle?: MarkdownStyle;
32
+ parser: (text: string) => MarkdownRange[];
34
33
  onClick?: (e: MouseEvent<HTMLDivElement>) => void;
35
34
  dir?: string;
36
35
  disabled?: boolean;
@@ -85,6 +84,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
85
84
  numberOfLines,
86
85
  multiline = false,
87
86
  markdownStyle,
87
+ parser,
88
88
  onBlur,
89
89
  onChange,
90
90
  onChangeText,
@@ -111,6 +111,13 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
111
111
  },
112
112
  ref,
113
113
  ) => {
114
+ if (parser === undefined) {
115
+ throw new Error('[react-native-live-markdown] `parser` is undefined');
116
+ }
117
+ if (typeof parser !== 'function') {
118
+ throw new Error('[react-native-live-markdown] `parser` is not a function');
119
+ }
120
+
114
121
  const compositionRef = useRef<boolean>(false);
115
122
  const divRef = useRef<MarkdownTextInputElement | null>(null);
116
123
  const currentlyFocusedField = useRef<HTMLDivElement | null>(null);
@@ -146,6 +153,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
146
153
 
147
154
  const parseText = useCallback(
148
155
  (
156
+ parserFunction: (input: string) => MarkdownRange[],
149
157
  target: MarkdownTextInputElement,
150
158
  text: string | null,
151
159
  customMarkdownStyles: MarkdownStyle,
@@ -161,7 +169,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
161
169
  if (text === null) {
162
170
  return {text: divRef.current.value, cursorPosition: null};
163
171
  }
164
- const parsedText = updateInputStructure(target, text, cursorPosition, multiline, customMarkdownStyles, false, shouldForceDOMUpdate, shouldScrollIntoView, {
172
+ const parsedText = updateInputStructure(parserFunction, target, text, cursorPosition, multiline, customMarkdownStyles, false, shouldForceDOMUpdate, shouldScrollIntoView, {
165
173
  addAuthTokenToImageURLCallback,
166
174
  imagePreviewAuthRequiredURLs,
167
175
  });
@@ -179,10 +187,10 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
179
187
  const processedMarkdownStyle = useMemo(() => {
180
188
  const newMarkdownStyle = processMarkdownStyle(markdownStyle);
181
189
  if (divRef.current) {
182
- parseText(divRef.current, divRef.current.value, newMarkdownStyle, null, false, false);
190
+ parseText(parser, divRef.current, divRef.current.value, newMarkdownStyle, null, false, false);
183
191
  }
184
192
  return newMarkdownStyle;
185
- }, [markdownStyle, parseText]);
193
+ }, [parser, markdownStyle, parseText]);
186
194
 
187
195
  const inputStyles = useMemo(
188
196
  () =>
@@ -208,9 +216,9 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
208
216
  }
209
217
  const item = history.current.undo();
210
218
  const undoValue = item ? item.text : null;
211
- return parseText(target, undoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false);
219
+ return parseText(parser, target, undoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false);
212
220
  },
213
- [parseText, processedMarkdownStyle],
221
+ [parser, parseText, processedMarkdownStyle],
214
222
  );
215
223
 
216
224
  const redo = useCallback(
@@ -223,9 +231,9 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
223
231
  }
224
232
  const item = history.current.redo();
225
233
  const redoValue = item ? item.text : null;
226
- return parseText(target, redoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false);
234
+ return parseText(parser, target, redoValue, processedMarkdownStyle, item ? item.cursorPosition : null, false);
227
235
  },
228
- [parseText, processedMarkdownStyle],
236
+ [parser, parseText, processedMarkdownStyle],
229
237
  );
230
238
 
231
239
  // Placeholder text color logic
@@ -354,7 +362,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
354
362
  newInputUpdate = redo(divRef.current);
355
363
  break;
356
364
  default:
357
- newInputUpdate = parseText(divRef.current, parsedText, processedMarkdownStyle, newCursorPosition, true, !inputType, inputType === 'pasteText');
365
+ newInputUpdate = parseText(parser, divRef.current, parsedText, processedMarkdownStyle, newCursorPosition, true, !inputType, inputType === 'pasteText');
358
366
  }
359
367
  const {text, cursorPosition} = newInputUpdate;
360
368
  updateTextColor(divRef.current, text);
@@ -406,7 +414,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
406
414
 
407
415
  handleContentSizeChange();
408
416
  },
409
- [updateTextColor, updateSelection, onChange, onChangeText, handleContentSizeChange, undo, redo, parseText, processedMarkdownStyle, setEventProps, maxLength],
417
+ [parser, updateTextColor, updateSelection, onChange, onChangeText, handleContentSizeChange, undo, redo, parseText, processedMarkdownStyle, setEventProps, maxLength],
410
418
  );
411
419
 
412
420
  const insertText = useCallback(
@@ -654,17 +662,17 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
654
662
  }
655
663
 
656
664
  if (value === undefined) {
657
- parseText(divRef.current, divRef.current.value, processedMarkdownStyle);
665
+ parseText(parser, divRef.current, divRef.current.value, processedMarkdownStyle);
658
666
  return;
659
667
  }
660
668
  const normalizedValue = normalizeValue(value);
661
669
 
662
670
  divRef.current.value = normalizedValue;
663
- parseText(divRef.current, normalizedValue, processedMarkdownStyle, null, true, false, true);
671
+ parseText(parser, divRef.current, normalizedValue, processedMarkdownStyle, null, true, false, true);
664
672
 
665
673
  updateTextColor(divRef.current, value);
666
674
  },
667
- [multiline, processedMarkdownStyle, value, maxLength],
675
+ [parser, multiline, processedMarkdownStyle, value, maxLength],
668
676
  );
669
677
 
670
678
  useClientEffect(
@@ -1,6 +1,6 @@
1
1
  import type {ColorValue, ViewProps} from 'react-native';
2
2
 
3
- import type {Float} from 'react-native/Libraries/Types/CodegenTypes';
3
+ import type {Float, Int32} from 'react-native/Libraries/Types/CodegenTypes';
4
4
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
5
5
 
6
6
  interface MarkdownStyle {
@@ -74,6 +74,7 @@ interface MarkdownStyle {
74
74
 
75
75
  interface NativeProps extends ViewProps {
76
76
  markdownStyle: MarkdownStyle;
77
+ parserId: Int32;
77
78
  }
78
79
 
79
80
  export default codegenNativeComponent<NativeProps>('MarkdownTextInputDecoratorView', {
package/src/index.tsx CHANGED
@@ -1,2 +1,4 @@
1
1
  export {default as MarkdownTextInput} from './MarkdownTextInput';
2
2
  export type {MarkdownTextInputProps, MarkdownStyle} from './MarkdownTextInput';
3
+ export type {MarkdownType, MarkdownRange} from './commonTypes';
4
+ export {default as parseExpensiMark} from './parseExpensiMark';