react-native-marcus 0.1.1 → 0.2.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.
- package/README.md +220 -63
- package/RNMarcus.podspec +6 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusPackage.kt +2 -1
- package/android/src/main/java/app/getbullet/marcus/MarcusTextDecoratorView.kt +168 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextDecoratorViewManager.kt +38 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextDecoratorViewManagerSpec.kt +19 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextInputDecoratorView.kt +23 -1
- package/android/src/main/java/app/getbullet/marcus/MarkdownBackgroundPainter.kt +147 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownBackgroundPass.kt +19 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownCopy.kt +87 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownFormatter.kt +652 -113
- package/android/src/main/java/app/getbullet/marcus/MarkdownRanges.kt +47 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownStyle.kt +140 -61
- package/android/src/main/java/app/getbullet/marcus/MarkdownUtils.kt +37 -7
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownAbsoluteLineHeightSpan.kt +48 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBackgroundSpan.kt +102 -48
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBlockIndentSpan.kt +22 -4
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBulletSpan.kt +78 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownCodeBlockSpan.kt +177 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownFontStyleSpan.kt +32 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownFontWeightSpan.kt +34 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownGapSpan.kt +24 -11
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownLetterSpacingSpan.kt +32 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownTextShadowSpan.kt +32 -0
- package/android/src/main/new_arch/CMakeLists.txt +17 -0
- package/android/src/main/new_arch/RNMarcusSpec.h +1 -0
- package/android/src/main/new_arch/react/renderer/components/RNMarcusSpec/MarcusTextDecoratorShadowNode.cpp +235 -0
- package/android/src/main/new_arch/react/renderer/components/RNMarcusSpec/MarcusTextDecoratorShadowNode.h +62 -0
- package/android/src/reactNativeVersionPatch/CustomMountingManager/81/app/getbullet/marcus/CustomFabricUIManager.java +22 -3
- package/android/src/reactNativeVersionPatch/CustomMountingManager/latest/app/getbullet/marcus/CustomFabricUIManager.java +22 -3
- package/android/src/test/java/app/getbullet/marcus/MarkdownCopyTest.kt +69 -0
- package/android/src/test/java/app/getbullet/marcus/MarkdownFormatterTest.kt +170 -25
- package/android/src/test/java/app/getbullet/marcus/RenderModel.kt +22 -5
- package/android/src/test/java/app/getbullet/marcus/spans/MarkdownCodeBlockSpanTest.kt +91 -0
- package/android/src/test/resources/render-model.txt +221 -16
- package/apple/MarcusSwizzle.h +25 -0
- package/apple/MarcusTextDecoratorComponentView.h +22 -0
- package/apple/MarcusTextDecoratorComponentView.mm +72 -0
- package/apple/MarcusTextDecoratorShadowNode.h +62 -0
- package/apple/MarcusTextDecoratorShadowNode.mm +192 -0
- package/apple/MarcusTextDecoratorViewManager.h +4 -0
- package/apple/MarcusTextDecoratorViewManager.mm +11 -0
- package/apple/MarcusTextInputDecoratorComponentView.mm +1 -1
- package/apple/MarcusTextInputDecoratorShadowNode.mm +1 -1
- package/apple/MarcusTextLayoutManager.h +40 -0
- package/apple/MarcusTextLayoutManager.mm +173 -0
- package/apple/MarkdownAttributes.h +23 -2
- package/apple/MarkdownAttributes.m +6 -0
- package/apple/MarkdownCopy.swift +63 -0
- package/apple/MarkdownDecorator.swift +2 -2
- package/apple/MarkdownFormatter+React.swift +23 -0
- package/apple/MarkdownFormatter.swift +869 -148
- package/apple/MarkdownParagraphLayoutManager.swift +455 -0
- package/apple/MarkdownSwiftInterop.h +0 -1
- package/apple/MarkdownTextBackground.swift +59 -1
- package/apple/MarkdownTextFieldObserver.swift +2 -2
- package/apple/MarkdownTextLayoutFragment.swift +159 -33
- package/apple/MarkdownTextLayoutManagerDelegate.swift +67 -3
- package/apple/MarkdownTextStorageDelegate.swift +2 -2
- package/apple/MarkdownTextViewObserver.swift +2 -2
- package/apple/MarkdownUtils.swift +38 -0
- package/apple/MarkdownWritingDirection.swift +132 -0
- package/apple/RCTMarcusStyle+Codegen.h +115 -9
- package/apple/RCTMarcusStyle.h +128 -31
- package/apple/RCTMarcusStyle.m +48 -0
- package/apple/RCTParagraphComponentView+Marcus.h +17 -0
- package/apple/RCTParagraphComponentView+Marcus.mm +38 -0
- package/apple/RCTTextInputComponentView+Marcus.mm +1 -25
- package/cpp/react/renderer/components/RNMarcusSpec/MarcusTextDecoratorState.h +37 -0
- package/cpp/react/renderer/components/RNMarcusSpec/MarcusTextDecoratorViewComponentDescriptor.h +17 -0
- package/lib/commonjs/MarcusTextDecoratorViewNativeComponent.ts +199 -0
- package/lib/commonjs/MarcusTextInputDecoratorViewNativeComponent.ts +145 -58
- package/lib/commonjs/MarkdownText.js +330 -0
- package/lib/commonjs/MarkdownText.js.map +1 -0
- package/lib/commonjs/MarkdownText.web.js +529 -0
- package/lib/commonjs/MarkdownText.web.js.map +1 -0
- package/lib/commonjs/MarkdownTextInput.js +22 -27
- package/lib/commonjs/MarkdownTextInput.js.map +1 -1
- package/lib/commonjs/MarkdownTextInput.web.js +12 -7
- package/lib/commonjs/MarkdownTextInput.web.js.map +1 -1
- package/lib/commonjs/atomUtils.js +112 -0
- package/lib/commonjs/atomUtils.js.map +1 -0
- package/lib/commonjs/childrenUtils.js +36 -0
- package/lib/commonjs/childrenUtils.js.map +1 -0
- package/lib/commonjs/index.js +8 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/math/environment.js +69 -0
- package/lib/commonjs/math/environment.js.map +1 -0
- package/lib/commonjs/math/index.js +61 -0
- package/lib/commonjs/math/index.js.map +1 -0
- package/lib/commonjs/math/mathjax.js +548 -0
- package/lib/commonjs/math/mathjax.js.map +1 -0
- package/lib/commonjs/metro.js +172 -0
- package/lib/commonjs/metro.js.map +1 -0
- package/lib/commonjs/parser/index.d.ts +3 -0
- package/lib/commonjs/parser/index.js +450 -42
- package/lib/commonjs/parser/index.js.map +4 -4
- package/lib/commonjs/stripUtils.js +743 -0
- package/lib/commonjs/stripUtils.js.map +1 -0
- package/lib/commonjs/styleUtils.js +194 -23
- package/lib/commonjs/styleUtils.js.map +1 -1
- package/lib/commonjs/web/MarkdownElements.css +67 -0
- package/lib/commonjs/web/MarkdownTextInput.css +9 -7
- package/lib/commonjs/web/utils/blockLayout.js +95 -7
- package/lib/commonjs/web/utils/blockLayout.js.map +1 -1
- package/lib/commonjs/web/utils/blockUtils.js +327 -54
- package/lib/commonjs/web/utils/blockUtils.js.map +1 -1
- package/lib/commonjs/web/utils/elementUtils.js +80 -0
- package/lib/commonjs/web/utils/elementUtils.js.map +1 -0
- package/lib/commonjs/web/utils/parserUtils.js +84 -28
- package/lib/commonjs/web/utils/parserUtils.js.map +1 -1
- package/lib/commonjs/web/utils/treeUtils.js +6 -0
- package/lib/commonjs/web/utils/treeUtils.js.map +1 -1
- package/lib/commonjs/web/utils/webStyleUtils.js +25 -5
- package/lib/commonjs/web/utils/webStyleUtils.js.map +1 -1
- package/lib/module/MarcusTextDecoratorViewNativeComponent.ts +199 -0
- package/lib/module/MarcusTextInputDecoratorViewNativeComponent.ts +145 -58
- package/lib/module/MarkdownText.js +325 -0
- package/lib/module/MarkdownText.js.map +1 -0
- package/lib/module/MarkdownText.web.js +524 -0
- package/lib/module/MarkdownText.web.js.map +1 -0
- package/lib/module/MarkdownTextInput.js +24 -29
- package/lib/module/MarkdownTextInput.js.map +1 -1
- package/lib/module/MarkdownTextInput.web.js +12 -7
- package/lib/module/MarkdownTextInput.web.js.map +1 -1
- package/lib/module/atomUtils.js +106 -0
- package/lib/module/atomUtils.js.map +1 -0
- package/lib/module/childrenUtils.js +33 -0
- package/lib/module/childrenUtils.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/math/environment.js +67 -0
- package/lib/module/math/environment.js.map +1 -0
- package/lib/module/math/index.js +56 -0
- package/lib/module/math/index.js.map +1 -0
- package/lib/module/math/mathjax.js +541 -0
- package/lib/module/math/mathjax.js.map +1 -0
- package/lib/module/metro.js +169 -0
- package/lib/module/metro.js.map +1 -0
- package/lib/module/parser/index.d.ts +3 -0
- package/lib/module/parser/index.js +450 -42
- package/lib/module/parser/index.js.map +4 -4
- package/lib/module/stripUtils.js +739 -0
- package/lib/module/stripUtils.js.map +1 -0
- package/lib/module/styleUtils.js +196 -25
- package/lib/module/styleUtils.js.map +1 -1
- package/lib/module/web/MarkdownElements.css +67 -0
- package/lib/module/web/MarkdownTextInput.css +9 -7
- package/lib/module/web/utils/blockLayout.js +94 -8
- package/lib/module/web/utils/blockLayout.js.map +1 -1
- package/lib/module/web/utils/blockUtils.js +328 -56
- package/lib/module/web/utils/blockUtils.js.map +1 -1
- package/lib/module/web/utils/elementUtils.js +75 -0
- package/lib/module/web/utils/elementUtils.js.map +1 -0
- package/lib/module/web/utils/parserUtils.js +86 -30
- package/lib/module/web/utils/parserUtils.js.map +1 -1
- package/lib/module/web/utils/treeUtils.js +6 -0
- package/lib/module/web/utils/treeUtils.js.map +1 -1
- package/lib/module/web/utils/webStyleUtils.js +25 -5
- package/lib/module/web/utils/webStyleUtils.js.map +1 -1
- package/lib/typescript/commonjs/e2e/links.test.d.ts +2 -0
- package/lib/typescript/commonjs/e2e/links.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarcusTextDecoratorViewNativeComponent.d.ts +93 -0
- package/lib/typescript/commonjs/src/MarcusTextDecoratorViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarcusTextInputDecoratorViewNativeComponent.d.ts +64 -51
- package/lib/typescript/commonjs/src/MarcusTextInputDecoratorViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/MarkdownText.d.ts +127 -0
- package/lib/typescript/commonjs/src/MarkdownText.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarkdownText.web.d.ts +126 -0
- package/lib/typescript/commonjs/src/MarkdownText.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarkdownTextInput.d.ts +23 -1
- package/lib/typescript/commonjs/src/MarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/MarkdownTextInput.web.d.ts +26 -4
- package/lib/typescript/commonjs/src/MarkdownTextInput.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/atomUtils.d.ts +58 -0
- package/lib/typescript/commonjs/src/atomUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/childrenUtils.d.ts +12 -0
- package/lib/typescript/commonjs/src/childrenUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/commonTypes.d.ts +39 -3
- package/lib/typescript/commonjs/src/commonTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/math/environment.d.ts +7 -0
- package/lib/typescript/commonjs/src/math/environment.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/math/index.d.ts +64 -0
- package/lib/typescript/commonjs/src/math/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/math/mathjax.d.ts +63 -0
- package/lib/typescript/commonjs/src/math/mathjax.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/metro.d.ts +59 -0
- package/lib/typescript/commonjs/src/metro.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/parser/index.d.ts +3 -3
- package/lib/typescript/commonjs/src/parser/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/parser/micromark-extension-mentions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/rangeUtils.d.ts +1 -1
- package/lib/typescript/commonjs/src/stripUtils.d.ts +108 -0
- package/lib/typescript/commonjs/src/stripUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/styleUtils.d.ts +62 -4
- package/lib/typescript/commonjs/src/styleUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/blockLayout.d.ts +32 -4
- package/lib/typescript/commonjs/src/web/utils/blockLayout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/blockUtils.d.ts +20 -8
- package/lib/typescript/commonjs/src/web/utils/blockUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/elementUtils.d.ts +37 -0
- package/lib/typescript/commonjs/src/web/utils/elementUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/parserUtils.d.ts +5 -5
- package/lib/typescript/commonjs/src/web/utils/parserUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/treeUtils.d.ts +6 -1
- package/lib/typescript/commonjs/src/web/utils/treeUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/web/utils/webStyleUtils.d.ts +2 -2
- package/lib/typescript/commonjs/src/web/utils/webStyleUtils.d.ts.map +1 -1
- package/lib/typescript/module/e2e/links.test.d.ts +2 -0
- package/lib/typescript/module/e2e/links.test.d.ts.map +1 -0
- package/lib/typescript/module/src/MarcusTextDecoratorViewNativeComponent.d.ts +93 -0
- package/lib/typescript/module/src/MarcusTextDecoratorViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/MarcusTextInputDecoratorViewNativeComponent.d.ts +64 -51
- package/lib/typescript/module/src/MarcusTextInputDecoratorViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/MarkdownText.d.ts +127 -0
- package/lib/typescript/module/src/MarkdownText.d.ts.map +1 -0
- package/lib/typescript/module/src/MarkdownText.web.d.ts +126 -0
- package/lib/typescript/module/src/MarkdownText.web.d.ts.map +1 -0
- package/lib/typescript/module/src/MarkdownTextInput.d.ts +23 -1
- package/lib/typescript/module/src/MarkdownTextInput.d.ts.map +1 -1
- package/lib/typescript/module/src/MarkdownTextInput.web.d.ts +26 -4
- package/lib/typescript/module/src/MarkdownTextInput.web.d.ts.map +1 -1
- package/lib/typescript/module/src/atomUtils.d.ts +58 -0
- package/lib/typescript/module/src/atomUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/childrenUtils.d.ts +12 -0
- package/lib/typescript/module/src/childrenUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/commonTypes.d.ts +39 -3
- package/lib/typescript/module/src/commonTypes.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +2 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/math/environment.d.ts +7 -0
- package/lib/typescript/module/src/math/environment.d.ts.map +1 -0
- package/lib/typescript/module/src/math/index.d.ts +64 -0
- package/lib/typescript/module/src/math/index.d.ts.map +1 -0
- package/lib/typescript/module/src/math/mathjax.d.ts +63 -0
- package/lib/typescript/module/src/math/mathjax.d.ts.map +1 -0
- package/lib/typescript/module/src/metro.d.ts +59 -0
- package/lib/typescript/module/src/metro.d.ts.map +1 -0
- package/lib/typescript/module/src/parser/index.d.ts +3 -3
- package/lib/typescript/module/src/parser/index.d.ts.map +1 -1
- package/lib/typescript/module/src/parser/micromark-extension-mentions.d.ts.map +1 -1
- package/lib/typescript/module/src/rangeUtils.d.ts +1 -1
- package/lib/typescript/module/src/stripUtils.d.ts +108 -0
- package/lib/typescript/module/src/stripUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/styleUtils.d.ts +62 -4
- package/lib/typescript/module/src/styleUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/blockLayout.d.ts +32 -4
- package/lib/typescript/module/src/web/utils/blockLayout.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/blockUtils.d.ts +20 -8
- package/lib/typescript/module/src/web/utils/blockUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/elementUtils.d.ts +37 -0
- package/lib/typescript/module/src/web/utils/elementUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/parserUtils.d.ts +5 -5
- package/lib/typescript/module/src/web/utils/parserUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/treeUtils.d.ts +6 -1
- package/lib/typescript/module/src/web/utils/treeUtils.d.ts.map +1 -1
- package/lib/typescript/module/src/web/utils/webStyleUtils.d.ts +2 -2
- package/lib/typescript/module/src/web/utils/webStyleUtils.d.ts.map +1 -1
- package/package.json +29 -2
- package/react-native.config.js +8 -1
- package/src/MarcusTextDecoratorViewNativeComponent.ts +199 -0
- package/src/MarcusTextInputDecoratorViewNativeComponent.ts +145 -58
- package/src/MarkdownText.tsx +472 -0
- package/src/MarkdownText.web.tsx +668 -0
- package/src/MarkdownTextInput.tsx +42 -38
- package/src/MarkdownTextInput.web.tsx +36 -13
- package/src/atomUtils.ts +112 -0
- package/src/childrenUtils.ts +39 -0
- package/src/commonTypes.ts +69 -9
- package/src/index.tsx +2 -1
- package/src/math/environment.ts +68 -0
- package/src/math/index.ts +78 -0
- package/src/math/mathjax.ts +604 -0
- package/src/metro.ts +238 -0
- package/src/parser/index.ts +175 -10
- package/src/parser/micromark-extension-mentions.ts +104 -11
- package/src/stripUtils.ts +919 -0
- package/src/styleUtils.ts +290 -26
- package/src/web/MarkdownElements.css +67 -0
- package/src/web/MarkdownTextInput.css +9 -7
- package/src/web/utils/blockLayout.ts +124 -14
- package/src/web/utils/blockUtils.ts +365 -59
- package/src/web/utils/elementUtils.ts +87 -0
- package/src/web/utils/parserUtils.ts +119 -31
- package/src/web/utils/treeUtils.ts +6 -1
- package/src/web/utils/webStyleUtils.ts +32 -8
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBackgroundColorSpan.kt +0 -6
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBoldSpan.kt +0 -6
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownItalicSpan.kt +0 -6
- package/apple/RCTMarcusStyle+Codegen.mm +0 -64
- package/apple/RCTMarcusUtils.h +0 -26
- package/apple/RCTMarcusUtils.mm +0 -26
|
@@ -1,57 +1,70 @@
|
|
|
1
1
|
import type { ColorValue, ViewProps } from "react-native";
|
|
2
2
|
import type { Float, Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
interface MarkdownTextStyle {
|
|
4
|
+
color?: ColorValue;
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
fontSize?: Float;
|
|
7
|
+
fontStyle?: string;
|
|
8
|
+
fontWeight?: string;
|
|
9
|
+
letterSpacing?: Float;
|
|
10
|
+
lineHeight?: Float;
|
|
11
|
+
textDecorationLine?: string;
|
|
12
|
+
textDecorationColor?: ColorValue;
|
|
13
|
+
textDecorationStyle?: string;
|
|
14
|
+
textShadowColor?: ColorValue;
|
|
15
|
+
textShadowOffset?: {
|
|
16
|
+
width: Float;
|
|
17
|
+
height: Float;
|
|
18
|
+
};
|
|
19
|
+
textShadowRadius?: Float;
|
|
20
|
+
}
|
|
21
|
+
interface MarkdownBoxStyle extends MarkdownTextStyle {
|
|
22
|
+
backgroundColor?: ColorValue;
|
|
23
|
+
borderColor?: ColorValue;
|
|
24
|
+
borderWidth?: Float;
|
|
25
|
+
borderRadius?: Float;
|
|
26
|
+
padding?: Float;
|
|
27
|
+
paddingHorizontal?: Float;
|
|
28
|
+
paddingVertical?: Float;
|
|
29
|
+
margin?: Float;
|
|
30
|
+
marginHorizontal?: Float;
|
|
31
|
+
marginVertical?: Float;
|
|
32
|
+
}
|
|
33
|
+
interface MarkdownHeadingStyle extends MarkdownTextStyle {
|
|
34
|
+
scale?: Float;
|
|
35
|
+
}
|
|
36
|
+
interface MarkdownBlockquoteStyle extends MarkdownTextStyle {
|
|
37
|
+
borderColor?: ColorValue;
|
|
38
|
+
borderWidth?: Float;
|
|
39
|
+
borderRadius?: Float;
|
|
40
|
+
marginStart?: Float;
|
|
41
|
+
paddingStart?: Float;
|
|
42
|
+
}
|
|
43
|
+
interface MarkdownListStyle {
|
|
44
|
+
marginStart?: Float;
|
|
45
|
+
paddingStart?: Float;
|
|
46
|
+
markerScale?: Float;
|
|
47
|
+
markerPadding?: Float;
|
|
48
|
+
marker?: MarkdownTextStyle;
|
|
49
|
+
}
|
|
50
|
+
interface MarkdownEmojiStyle {
|
|
51
|
+
fontSize?: Float;
|
|
52
|
+
fontFamily?: string;
|
|
8
53
|
}
|
|
9
54
|
interface MarkdownStyle {
|
|
10
|
-
syntax:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
blockquote: {
|
|
25
|
-
borderColor: ColorValue;
|
|
26
|
-
borderWidth: Float;
|
|
27
|
-
marginLeft: Float;
|
|
28
|
-
paddingLeft: Float;
|
|
29
|
-
};
|
|
30
|
-
orderedList: {
|
|
31
|
-
marginLeft: Float;
|
|
32
|
-
paddingLeft: Float;
|
|
33
|
-
};
|
|
34
|
-
unorderedList: {
|
|
35
|
-
marginLeft: Float;
|
|
36
|
-
paddingLeft: Float;
|
|
37
|
-
};
|
|
38
|
-
code: CodeBlockStyle;
|
|
39
|
-
pre: CodeBlockStyle;
|
|
40
|
-
mentionHere: {
|
|
41
|
-
color: ColorValue;
|
|
42
|
-
backgroundColor: ColorValue;
|
|
43
|
-
borderRadius?: Float;
|
|
44
|
-
};
|
|
45
|
-
mentionUser: {
|
|
46
|
-
color: ColorValue;
|
|
47
|
-
backgroundColor: ColorValue;
|
|
48
|
-
borderRadius?: Float;
|
|
49
|
-
};
|
|
50
|
-
mentionReport: {
|
|
51
|
-
color: ColorValue;
|
|
52
|
-
backgroundColor: ColorValue;
|
|
53
|
-
borderRadius?: Float;
|
|
54
|
-
};
|
|
55
|
+
syntax: MarkdownTextStyle;
|
|
56
|
+
emoji: MarkdownEmojiStyle;
|
|
57
|
+
link: MarkdownTextStyle;
|
|
58
|
+
strong: MarkdownTextStyle;
|
|
59
|
+
emphasis: MarkdownTextStyle;
|
|
60
|
+
strikethrough: MarkdownTextStyle;
|
|
61
|
+
heading: MarkdownHeadingStyle;
|
|
62
|
+
blockquote: MarkdownBlockquoteStyle;
|
|
63
|
+
orderedList: MarkdownListStyle;
|
|
64
|
+
unorderedList: MarkdownListStyle;
|
|
65
|
+
code: MarkdownBoxStyle;
|
|
66
|
+
pre: MarkdownBoxStyle;
|
|
67
|
+
mention: MarkdownBoxStyle;
|
|
55
68
|
}
|
|
56
69
|
interface NativeProps extends ViewProps {
|
|
57
70
|
markdownStyle: MarkdownStyle;
|
|
@@ -59,5 +72,5 @@ interface NativeProps extends ViewProps {
|
|
|
59
72
|
}
|
|
60
73
|
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
61
74
|
export default _default;
|
|
62
|
-
export type { MarkdownStyle };
|
|
75
|
+
export type { MarkdownStyle, MarkdownTextStyle, MarkdownEmojiStyle, MarkdownBoxStyle, MarkdownHeadingStyle, MarkdownBlockquoteStyle, MarkdownListStyle, };
|
|
63
76
|
//# sourceMappingURL=MarcusTextInputDecoratorViewNativeComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarcusTextInputDecoratorViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/MarcusTextInputDecoratorViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEzD,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAA;
|
|
1
|
+
{"version":3,"file":"MarcusTextInputDecoratorViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/MarcusTextInputDecoratorViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEzD,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAA;AAmB7E,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,KAAK,CAAA;IAGrB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAG3B,mBAAmB,CAAC,EAAE,UAAU,CAAA;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,eAAe,CAAC,EAAE,UAAU,CAAA;IAC5B,gBAAgB,CAAC,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,KAAK,CAAA;KAAE,CAAA;IAClD,gBAAgB,CAAC,EAAE,KAAK,CAAA;CACzB;AAmBD,UAAU,gBAAiB,SAAQ,iBAAiB;IAClD,eAAe,CAAC,EAAE,UAAU,CAAA;IAC5B,WAAW,CAAC,EAAE,UAAU,CAAA;IACxB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,OAAO,CAAC,EAAE,KAAK,CAAA;IACf,iBAAiB,CAAC,EAAE,KAAK,CAAA;IACzB,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,gBAAgB,CAAC,EAAE,KAAK,CAAA;IACxB,cAAc,CAAC,EAAE,KAAK,CAAA;CACvB;AAED,UAAU,oBAAqB,SAAQ,iBAAiB;IAGtD,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAUD,UAAU,uBAAwB,SAAQ,iBAAiB;IACzD,WAAW,CAAC,EAAE,UAAU,CAAA;IACxB,WAAW,CAAC,EAAE,KAAK,CAAA;IAGnB,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,CAAA;CACrB;AAeD,UAAU,iBAAiB;IACzB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,CAAA;IAGpB,WAAW,CAAC,EAAE,KAAK,CAAA;IAEnB,aAAa,CAAC,EAAE,KAAK,CAAA;IACrB,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAC3B;AAKD,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,iBAAiB,CAAA;IACzB,KAAK,EAAE,kBAAkB,CAAA;IACzB,IAAI,EAAE,iBAAiB,CAAA;IACvB,MAAM,EAAE,iBAAiB,CAAA;IACzB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,aAAa,EAAE,iBAAiB,CAAA;IAChC,OAAO,EAAE,oBAAoB,CAAA;IAC7B,UAAU,EAAE,uBAAuB,CAAA;IACnC,WAAW,EAAE,iBAAiB,CAAA;IAC9B,aAAa,EAAE,iBAAiB,CAAA;IAChC,IAAI,EAAE,gBAAgB,CAAA;IACtB,GAAG,EAAE,gBAAgB,CAAA;IAGrB,OAAO,EAAE,gBAAgB,CAAA;CAC1B;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,aAAa,EAAE,aAAa,CAAA;IAC5B,QAAQ,EAAE,KAAK,CAAA;CAChB;;AAED,wBAEE;AAEF,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,GAClB,CAAA"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Text } from "react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { TextProps } from "react-native";
|
|
4
|
+
import type { PartialMarkdownStyle } from "./styleUtils";
|
|
5
|
+
/**
|
|
6
|
+
* What to show in place of an image.
|
|
7
|
+
*
|
|
8
|
+
* Must return a single view with a definite width and height, or nothing: the
|
|
9
|
+
* text layout has to know how much room to leave before it can lay the line
|
|
10
|
+
* out, and markdown carries no dimensions. Anything that reports no size --
|
|
11
|
+
* a bare `Image` with a remote source, most obviously -- measures zero and
|
|
12
|
+
* disappears.
|
|
13
|
+
*
|
|
14
|
+
* The alt text is passed through rather than used: what it is good for, an
|
|
15
|
+
* accessibility label most of all, is a question only the caller can answer.
|
|
16
|
+
*
|
|
17
|
+
* `inline` says whether the image shares its line with anything else, which is
|
|
18
|
+
* usually what decides how big it should be: alone on a line it is a figure,
|
|
19
|
+
* and in the middle of a sentence it is a badge. A block marker does not count
|
|
20
|
+
* as company, and another image does.
|
|
21
|
+
*
|
|
22
|
+
* Every string is always a string: an image written without a title is handed
|
|
23
|
+
* an empty one rather than nothing, so a caller never has to tell the two
|
|
24
|
+
* apart.
|
|
25
|
+
*/
|
|
26
|
+
type RenderEmbed = (uri: string, alt: string, title: string, inline: boolean) => React.ReactElement | null | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* What to draw an SVG with.
|
|
29
|
+
*
|
|
30
|
+
* Handed a complete SVG document and the box it belongs in, and expected to
|
|
31
|
+
* return a view of exactly that size. There is deliberately nothing else in the
|
|
32
|
+
* signature: everything a picture needs -- the colour, the glyph outlines, the
|
|
33
|
+
* baseline it sits on -- is either inside the XML already or has been taken
|
|
34
|
+
* care of by the time this is called, so `<SvgXml xml={xml} width={width}
|
|
35
|
+
* height={height} />` is the whole of a correct implementation.
|
|
36
|
+
*
|
|
37
|
+
* It exists because a renderer for SVG is a dependency, and which one is not
|
|
38
|
+
* this library's business: `react-native-svg` on native, whatever you like on
|
|
39
|
+
* the web.
|
|
40
|
+
*
|
|
41
|
+
* Returning nothing leaves the drawing out, and the span it stood for still
|
|
42
|
+
* costs its one character either way.
|
|
43
|
+
*/
|
|
44
|
+
type RenderSVG = (xml: string, width: number, height: number) => React.ReactElement | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* What to do when a link is pressed.
|
|
47
|
+
*
|
|
48
|
+
* The label is the text the link was rendered as, which is all a reader saw of
|
|
49
|
+
* it: the destination is not in the document any more. Reference links are not
|
|
50
|
+
* covered -- their destination is written somewhere else and is not resolved
|
|
51
|
+
* yet -- so they render as links and do nothing.
|
|
52
|
+
*
|
|
53
|
+
* Opening the URL is deliberately not done for you: what a link means is the
|
|
54
|
+
* application's to decide, and a message from a stranger is the last place to
|
|
55
|
+
* hand an arbitrary URL to `Linking.openURL` without looking at it first.
|
|
56
|
+
*
|
|
57
|
+
* Every string is always a string: a link written without a title is handed an
|
|
58
|
+
* empty one rather than nothing.
|
|
59
|
+
*/
|
|
60
|
+
type OnLinkPress = (uri: string, label: string, title: string) => void;
|
|
61
|
+
interface MarkdownTextProps extends TextProps {
|
|
62
|
+
markdownStyle?: PartialMarkdownStyle;
|
|
63
|
+
/**
|
|
64
|
+
* GFM's strikethrough (`~~a~~`) and bare autolinks (`www.example.com`).
|
|
65
|
+
*
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
gfm?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* `@name` mentions, which no flavour of markdown has a notion of.
|
|
71
|
+
*
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
mention?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* LaTeX between double dollar signs: `$$x^2$$` inline, and the same on lines
|
|
77
|
+
* of its own for a block.
|
|
78
|
+
*
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
math?: boolean;
|
|
82
|
+
renderEmbed?: RenderEmbed;
|
|
83
|
+
/**
|
|
84
|
+
* What to draw a maths span with. Nothing is drawn without it, and `$$x^2$$`
|
|
85
|
+
* is left on the screen as it was written.
|
|
86
|
+
*/
|
|
87
|
+
renderSVG?: RenderSVG;
|
|
88
|
+
/**
|
|
89
|
+
* The language a drawn equation is read out in, as the speech engine names
|
|
90
|
+
* it: `af`, `ca`, `da`, `de`, `en`, `es`, `fr`, `hi`, `it`, `ko`, `nb`, `nn`
|
|
91
|
+
* or `sv`.
|
|
92
|
+
*
|
|
93
|
+
* What a document is written in and what its reader speaks are two different
|
|
94
|
+
* questions, and only the application knows the answer to the second, so this
|
|
95
|
+
* is usually whatever the rest of the interface is translated into. It
|
|
96
|
+
* changes only how the maths is *said*: the prose around it is read in the
|
|
97
|
+
* language it was written in, and the drawing itself is the same picture in
|
|
98
|
+
* every language.
|
|
99
|
+
*
|
|
100
|
+
* The rules for one language are around 300KB, so only the ones named in
|
|
101
|
+
* `withMath(config, { locales })` are in the bundle. A language that is not
|
|
102
|
+
* is read in English, with a warning in the console saying which line of
|
|
103
|
+
* Metro config would fix it.
|
|
104
|
+
*
|
|
105
|
+
* @default "en"
|
|
106
|
+
*/
|
|
107
|
+
mathAccessibilityLocale?: string;
|
|
108
|
+
onLinkPress?: OnLinkPress;
|
|
109
|
+
}
|
|
110
|
+
type MarkdownText = Text & React.Component<MarkdownTextProps>;
|
|
111
|
+
/**
|
|
112
|
+
* `Text`, with the markdown in its content rendered rather than shown.
|
|
113
|
+
*
|
|
114
|
+
* The syntax is removed in JavaScript before the text ever reaches the shadow
|
|
115
|
+
* tree, so what gets measured, drawn, selected, copied and read out is the
|
|
116
|
+
* finished prose. What is left over -- which run is bold, where a quote starts
|
|
117
|
+
* -- is handed to the native decorator as ranges over that stripped string, and
|
|
118
|
+
* styled by the same formatter the input uses, so a message and the composer it
|
|
119
|
+
* was typed in agree by construction.
|
|
120
|
+
*
|
|
121
|
+
* List markers are the exception that stays: `1.` numbers an item and `-`
|
|
122
|
+
* stands in for a bullet, so they are laid out rather than removed.
|
|
123
|
+
*/
|
|
124
|
+
declare const MarkdownText: React.ForwardRefExoticComponent<MarkdownTextProps & React.RefAttributes<MarkdownText>>;
|
|
125
|
+
export type { MarkdownTextProps, OnLinkPress, RenderEmbed, RenderSVG };
|
|
126
|
+
export default MarkdownText;
|
|
127
|
+
//# sourceMappingURL=MarkdownText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownText.d.ts","sourceRoot":"","sources":["../../../../src/MarkdownText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAQ,MAAM,cAAc,CAAA;AACrD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAQ7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAUxD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,KAAK,WAAW,GAAG,CACjB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,KACZ,KAAK,CAAC,YAAY,GAAG,IAAI,GAAG,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,SAAS,GAAG,CACf,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,KAAK,CAAC,YAAY,GAAG,IAAI,GAAG,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,KAAK,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;AAEtE,UAAU,iBAAkB,SAAQ,SAAS;IAC3C,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,KAAK,YAAY,GAAG,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;AAsJ7D;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,YAAY,wFAgKhB,CAAA;AAQF,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;AAEtE,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Text } from "react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { TextProps } from "react-native";
|
|
4
|
+
import "./web/MarkdownElements.css";
|
|
5
|
+
import type { PartialMarkdownStyle } from "./styleUtils";
|
|
6
|
+
/**
|
|
7
|
+
* What to show in place of an image.
|
|
8
|
+
*
|
|
9
|
+
* The native contract asks for a view with a definite size, because the text
|
|
10
|
+
* layout has to know how much room to leave before it lays the line out. The
|
|
11
|
+
* web has no such requirement -- the browser reflows around whatever turns up
|
|
12
|
+
* -- but the same callback runs on both, so write it for the stricter one.
|
|
13
|
+
*
|
|
14
|
+
* `inline` says whether the image shares its line with anything else, which is
|
|
15
|
+
* usually what decides how big it should be: alone on a line it is a figure,
|
|
16
|
+
* and in the middle of a sentence it is a badge. A block marker does not count
|
|
17
|
+
* as company, and another image does.
|
|
18
|
+
*
|
|
19
|
+
* Every string is always a string: an image written without a title is handed
|
|
20
|
+
* an empty one rather than nothing, so a caller never has to tell the two
|
|
21
|
+
* apart.
|
|
22
|
+
*/
|
|
23
|
+
type RenderEmbed = (uri: string, alt: string, title: string, inline: boolean) => React.ReactElement | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* What to draw an SVG with.
|
|
26
|
+
*
|
|
27
|
+
* Handed a complete SVG document and the box it belongs in, and expected to
|
|
28
|
+
* return a view of exactly that size. There is deliberately nothing else in the
|
|
29
|
+
* signature: everything a picture needs -- the colour, the glyph outlines, the
|
|
30
|
+
* baseline it sits on -- is either inside the XML already or has been taken
|
|
31
|
+
* care of by the time this is called, so `<SvgXml xml={xml} width={width}
|
|
32
|
+
* height={height} />` is the whole of a correct implementation.
|
|
33
|
+
*
|
|
34
|
+
* It exists because a renderer for SVG is a dependency, and which one is not
|
|
35
|
+
* this library's business: `react-native-svg` on native, whatever you like on
|
|
36
|
+
* the web.
|
|
37
|
+
*
|
|
38
|
+
* Returning nothing leaves the drawing out, and the span it stood for still
|
|
39
|
+
* costs its one character either way.
|
|
40
|
+
*/
|
|
41
|
+
type RenderSVG = (xml: string, width: number, height: number) => React.ReactElement | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* What to do when a link is pressed.
|
|
44
|
+
*
|
|
45
|
+
* The label is the text the link was rendered as, which is all a reader saw of
|
|
46
|
+
* it: the destination is not in the document any more. Reference links are not
|
|
47
|
+
* covered -- their destination is written somewhere else and is not resolved
|
|
48
|
+
* yet -- so they render as links and do nothing.
|
|
49
|
+
*
|
|
50
|
+
* Opening the URL is deliberately not done for you: what a link means is the
|
|
51
|
+
* application's to decide, and a message from a stranger is the last place to
|
|
52
|
+
* hand an arbitrary URL to `Linking.openURL` without looking at it first.
|
|
53
|
+
*
|
|
54
|
+
* Every string is always a string: a link written without a title is handed an
|
|
55
|
+
* empty one rather than nothing.
|
|
56
|
+
*/
|
|
57
|
+
type OnLinkPress = (uri: string, label: string, title: string) => void;
|
|
58
|
+
interface MarkdownTextProps extends TextProps {
|
|
59
|
+
markdownStyle?: PartialMarkdownStyle;
|
|
60
|
+
/**
|
|
61
|
+
* GFM's strikethrough (`~~a~~`) and bare autolinks (`www.example.com`).
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
gfm?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* `@name` mentions, which no flavour of markdown has a notion of.
|
|
68
|
+
*
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
mention?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* LaTeX between double dollar signs: `$$x^2$$` inline, and the same on lines
|
|
74
|
+
* of its own for a block.
|
|
75
|
+
*
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
math?: boolean;
|
|
79
|
+
renderEmbed?: RenderEmbed;
|
|
80
|
+
/**
|
|
81
|
+
* What to draw a maths span with. Nothing is drawn without it, and `$$x^2$$`
|
|
82
|
+
* is left on the screen as it was written.
|
|
83
|
+
*/
|
|
84
|
+
renderSVG?: RenderSVG;
|
|
85
|
+
/**
|
|
86
|
+
* The language a drawn equation is read out in, as the speech engine names
|
|
87
|
+
* it: `af`, `ca`, `da`, `de`, `en`, `es`, `fr`, `hi`, `it`, `ko`, `nb`, `nn`
|
|
88
|
+
* or `sv`.
|
|
89
|
+
*
|
|
90
|
+
* What a document is written in and what its reader speaks are two different
|
|
91
|
+
* questions, and only the application knows the answer to the second, so this
|
|
92
|
+
* is usually whatever the rest of the interface is translated into. It
|
|
93
|
+
* changes only how the maths is *said*: the prose around it is read in the
|
|
94
|
+
* language it was written in, and the drawing itself is the same picture in
|
|
95
|
+
* every language.
|
|
96
|
+
*
|
|
97
|
+
* The rules for one language are around 300KB, so only the ones named in
|
|
98
|
+
* `withMath(config, { locales })` are in the bundle. A language that is not
|
|
99
|
+
* is read in English, with a warning in the console saying which line of
|
|
100
|
+
* Metro config would fix it.
|
|
101
|
+
*
|
|
102
|
+
* @default "en"
|
|
103
|
+
*/
|
|
104
|
+
mathAccessibilityLocale?: string;
|
|
105
|
+
onLinkPress?: OnLinkPress;
|
|
106
|
+
}
|
|
107
|
+
type MarkdownText = Text & React.Component<MarkdownTextProps>;
|
|
108
|
+
/**
|
|
109
|
+
* `Text`, with the markdown in its content rendered rather than shown.
|
|
110
|
+
*
|
|
111
|
+
* Built by the same DOM builder the input uses, from the same ranges, so a message and the composer
|
|
112
|
+
* it was typed in agree by construction -- which on the web means agreeing about indents, about
|
|
113
|
+
* ribbons drawn as background layers, and about the marker widths those are measured from. The only
|
|
114
|
+
* difference is the input, where the syntax is still there to be edited.
|
|
115
|
+
*
|
|
116
|
+
* Rendered as a real `Text` whose children are then replaced. React only ever writes the stripped
|
|
117
|
+
* string into the host element -- a lone string child is set with `textContent`, never as a node it
|
|
118
|
+
* holds on to -- so the effect below is free to put the built markup there instead, and a render
|
|
119
|
+
* that changes the text simply wipes it and lets the effect rebuild before the frame is painted.
|
|
120
|
+
* Rendering the plain string rather than nothing also means a prerendered page carries the prose:
|
|
121
|
+
* `expo export` runs every route through Node, where there is no DOM to build markup with.
|
|
122
|
+
*/
|
|
123
|
+
declare const MarkdownText: React.ForwardRefExoticComponent<MarkdownTextProps & React.RefAttributes<MarkdownText>>;
|
|
124
|
+
export type { MarkdownTextProps, OnLinkPress, RenderEmbed, RenderSVG };
|
|
125
|
+
export default MarkdownText;
|
|
126
|
+
//# sourceMappingURL=MarkdownText.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownText.web.d.ts","sourceRoot":"","sources":["../../../../src/MarkdownText.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,4BAA4B,CAAA;AAUnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAIxD;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,WAAW,GAAG,CACjB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,KACZ,KAAK,CAAC,YAAY,GAAG,IAAI,GAAG,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,SAAS,GAAG,CACf,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,KAAK,CAAC,YAAY,GAAG,IAAI,GAAG,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,KAAK,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;AAEtE,UAAU,iBAAkB,SAAQ,SAAS;IAC3C,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED,KAAK,YAAY,GAAG,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;AA6J7D;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,YAAY,wFAsWhB,CAAA;AAEF,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;AAEtE,eAAe,YAAY,CAAA"}
|
|
@@ -12,7 +12,29 @@ declare global {
|
|
|
12
12
|
declare function getWorkletRuntime(): WorkletRuntime;
|
|
13
13
|
interface MarkdownTextInputProps extends TextInputProps {
|
|
14
14
|
markdownStyle?: PartialMarkdownStyle;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* GFM's strikethrough (`~~a~~`) and bare autolinks (`www.example.com`).
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
gfm?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* `@name` mentions, which no flavour of markdown has a notion of.
|
|
23
|
+
*
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
mention?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* LaTeX between double dollar signs: `$$x^2$$` inline, and the same on lines
|
|
29
|
+
* of its own for a block.
|
|
30
|
+
*
|
|
31
|
+
* An input shows what was typed, so the maths stays as written -- what this
|
|
32
|
+
* turns on is recognising it, which greys the dollars as the markup they are
|
|
33
|
+
* and leaves the TeX between them alone.
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
math?: boolean;
|
|
16
38
|
}
|
|
17
39
|
type MarkdownTextInput = TextInput & React.Component<MarkdownTextInputProps>;
|
|
18
40
|
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,EAAc,SAAS,
|
|
1
|
+
{"version":3,"file":"MarkdownTextInput.d.ts","sourceRoot":"","sources":["../../../../src/MarkdownTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAI7F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAExD,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,eAAe,CAAA;AAElE,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,oBAAoB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAA;IAE3D,IAAI,yBAAyB,EAAE,CAC7B,gBAAgB,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,KAC1E,MAAM,CAAA;IAEX,IAAI,2BAA2B,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5D;AAKD,iBAAS,iBAAiB,IAAI,cAAc,CAO3C;AA8BD,UAAU,sBAAuB,SAAQ,cAAc;IACrD,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,KAAK,iBAAiB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAA;AAE5E,QAAA,MAAM,iBAAiB,kGAsCtB,CAAA;AAQD,YAAY,EAAE,oBAAoB,IAAI,aAAa,EAAE,sBAAsB,EAAE,CAAA;AAE7E,eAAe,iBAAiB,CAAA;AAEhC,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -3,12 +3,34 @@ import React from "react";
|
|
|
3
3
|
import type { MouseEvent } from "react";
|
|
4
4
|
import type { LineCache } from "./web/utils/parserUtils";
|
|
5
5
|
import type { TreeNode } from "./web/utils/treeUtils";
|
|
6
|
+
import "./web/MarkdownElements.css";
|
|
6
7
|
import "./web/MarkdownTextInput.css";
|
|
7
|
-
import type {
|
|
8
|
-
import type { MarkdownRange } from "./commonTypes";
|
|
8
|
+
import type { PartialMarkdownStyle } from "./styleUtils";
|
|
9
9
|
interface MarkdownTextInputProps extends TextInputProps {
|
|
10
|
-
markdownStyle?:
|
|
11
|
-
|
|
10
|
+
markdownStyle?: PartialMarkdownStyle;
|
|
11
|
+
/**
|
|
12
|
+
* GFM's strikethrough (`~~a~~`) and bare autolinks (`www.example.com`).
|
|
13
|
+
*
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
gfm?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* `@name` mentions, which no flavour of markdown has a notion of.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
mention?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* LaTeX between double dollar signs: `$$x^2$$` inline, and the same on lines
|
|
25
|
+
* of its own for a block.
|
|
26
|
+
*
|
|
27
|
+
* An input shows what was typed, so the maths stays as written -- what this
|
|
28
|
+
* turns on is recognising it, which greys the dollars as the markup they are
|
|
29
|
+
* and leaves the TeX between them alone.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
math?: boolean;
|
|
12
34
|
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
13
35
|
dir?: string;
|
|
14
36
|
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,CAAA;AACrB,OAAO,KAAmE,MAAM,OAAO,CAAA;AACvF,OAAO,KAAK,EAKV,UAAU,EAKX,MAAM,OAAO,CAAA;AAGd,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAMrD,OAAO,
|
|
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,CAAA;AACrB,OAAO,KAAmE,MAAM,OAAO,CAAA;AACvF,OAAO,KAAK,EAKV,UAAU,EAKX,MAAM,OAAO,CAAA;AAGd,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAMrD,OAAO,4BAA4B,CAAA;AACnC,OAAO,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAyB,MAAM,cAAc,CAAA;AAkB/E,UAAU,sBAAuB,SAAQ,cAAc;IACrD,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;IACjD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,UAAU,mBAAoB,SAAQ,KAAK;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,KAAK,iBAAiB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAA;AAE5E,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAcD,KAAK,wBAAwB,GAAG,cAAc,GAC5C,gBAAgB,GAAG;IACjB,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,kGAAkG;IAClG,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAEH,KAAK,mBAAmB,GAAG,WAAW,GAAG;IACvC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,QAAA,MAAM,iBAAiB,kGAkzBtB,CAAA;AAwBD,eAAe,iBAAiB,CAAA;AAEhC,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,GACpB,CAAA;AAED,iBAAS,iBAAiB,SAIzB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { MarkdownEmbed, MarkdownMath, StrippedMarkdown } from "./stripUtils";
|
|
2
|
+
type Atom = ({
|
|
3
|
+
kind: "embed";
|
|
4
|
+
} & MarkdownEmbed) | ({
|
|
5
|
+
kind: "math";
|
|
6
|
+
} & MarkdownMath);
|
|
7
|
+
/**
|
|
8
|
+
* How a maths span is said out loud, or nothing for one that cannot be said.
|
|
9
|
+
*
|
|
10
|
+
* Passed in rather than imported so that this module knows nothing about
|
|
11
|
+
* typesetting: it is `./math`'s `speakMath` at both call sites, and a display
|
|
12
|
+
* with no maths backend passes one that always declines.
|
|
13
|
+
*/
|
|
14
|
+
type SpeakMath = (tex: string, display: boolean, locale?: string) => string | null;
|
|
15
|
+
declare const NO_ATOMS: Atom[];
|
|
16
|
+
/**
|
|
17
|
+
* Every placeholder in the stripped text, in the order it stands there.
|
|
18
|
+
*
|
|
19
|
+
* Sorting is enough to interleave the two kinds correctly: each index is a
|
|
20
|
+
* distinct character in the same string, so no two atoms can share one.
|
|
21
|
+
*/
|
|
22
|
+
declare function atomsOf(markdown: StrippedMarkdown): Atom[];
|
|
23
|
+
/**
|
|
24
|
+
* The text as it should be read out, with every placeholder written back out
|
|
25
|
+
* as what it stands for.
|
|
26
|
+
*
|
|
27
|
+
* A drawing costs exactly one character in the string the platform lays out --
|
|
28
|
+
* U+FFFC, the object replacement character -- and there is nothing in that
|
|
29
|
+
* character for a screen reader to say. An image's `alt` is its accessible name
|
|
30
|
+
* by every spec there is, and left empty it declares the image decorative, so
|
|
31
|
+
* it is used as written. A maths span is read as what was drawn, which is what
|
|
32
|
+
* `speak` answers; the TeX behind it is the fallback, because an expression
|
|
33
|
+
* read out as its source is still better than a sentence with a hole in it.
|
|
34
|
+
*
|
|
35
|
+
* `locale` is the language the maths is said in, and is passed straight
|
|
36
|
+
* through: the prose around it is in whatever language it was written in, and
|
|
37
|
+
* nothing here can or should change that.
|
|
38
|
+
*/
|
|
39
|
+
declare function describeAtoms(markdown: StrippedMarkdown, speak: SpeakMath, locale?: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* What a placeholder puts on the clipboard, which is the markdown it was
|
|
42
|
+
* written as.
|
|
43
|
+
*
|
|
44
|
+
* A copy of rendered text is plain text: `**bold**` comes off the screen as
|
|
45
|
+
* "bold", because that is what a copy of styled text has always been. A drawing
|
|
46
|
+
* has no plain text at all -- it is one U+FFFC, which pastes as a box -- and
|
|
47
|
+
* the source is the only honest thing to put there. Written back out with its
|
|
48
|
+
* dollar signs, a copied paragraph is markdown again and goes back into an
|
|
49
|
+
* editor as the document it came from.
|
|
50
|
+
*
|
|
51
|
+
* An image copies as nothing, the way an `<img>` does on the web: its alt text
|
|
52
|
+
* describes the picture for someone who cannot see it, and pasting a
|
|
53
|
+
* description where a picture was is not what anyone asked for.
|
|
54
|
+
*/
|
|
55
|
+
declare function sourceOf(atom: Atom): string;
|
|
56
|
+
export type { Atom, SpeakMath };
|
|
57
|
+
export { NO_ATOMS, atomsOf, describeAtoms, sourceOf };
|
|
58
|
+
//# sourceMappingURL=atomUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomUtils.d.ts","sourceRoot":"","sources":["../../../../src/atomUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AASjF,KAAK,IAAI,GAAG,CAAC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAAC,GAAG,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAAC,CAAA;AAEnF;;;;;;GAMG;AACH,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;AAElF,QAAA,MAAM,QAAQ,EAAE,IAAI,EAAO,CAAA;AAE3B;;;;;GAKG;AACH,iBAAS,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,EAAE,CAkBnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,iBAAS,aAAa,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAkB5F;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAQpC;AAED,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AAE/B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Flattens children into the string they render as, or null if they are not
|
|
4
|
+
* text.
|
|
5
|
+
*
|
|
6
|
+
* Only strings and numbers are markdown. An element child is content there are
|
|
7
|
+
* no parser offsets for and no way to strip syntax out of, so a subtree
|
|
8
|
+
* containing one renders unformatted rather than half formatted.
|
|
9
|
+
*/
|
|
10
|
+
declare function flattenText(children: React.ReactNode): string | null;
|
|
11
|
+
export { flattenText };
|
|
12
|
+
//# sourceMappingURL=childrenUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"childrenUtils.d.ts","sourceRoot":"","sources":["../../../../src/childrenUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;;;;GAOG;AACH,iBAAS,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,GAAG,IAAI,CAI7D;AAwBD,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,10 +1,46 @@
|
|
|
1
|
-
type MarkdownType = "
|
|
1
|
+
type MarkdownType = "strong" | "emphasis" | "strikethrough" | "emoji" | "mention" | "link" | "label" | "alt" | "title" | "code" | "pre" | "blockquote" | "list-ordered" | "list-unordered" | "block-prefix" | "heading" | "syntax" | "image" | "codeblock" | "math" | "math-block" | "language";
|
|
2
2
|
interface MarkdownRange {
|
|
3
3
|
type: MarkdownType;
|
|
4
4
|
start: number;
|
|
5
5
|
length: number;
|
|
6
6
|
depth?: number;
|
|
7
|
-
syntaxType?: "opening" | "closing";
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* What the parser recognises beyond CommonMark.
|
|
10
|
+
*
|
|
11
|
+
* Every one of them is off unless it is asked for. Each changes what an
|
|
12
|
+
* ordinary character means -- a tilde, an `@`, a dollar sign -- and a document
|
|
13
|
+
* written somewhere else, by someone who never heard of this library, is the
|
|
14
|
+
* one place where guessing at that is least recoverable. They are the whole of
|
|
15
|
+
* the parser's configuration: a caller chooses a flavour, not a parser, and the
|
|
16
|
+
* components take these as props of their own.
|
|
17
|
+
*/
|
|
18
|
+
interface ParserOptions {
|
|
19
|
+
/**
|
|
20
|
+
* GFM's strikethrough (`~~a~~`) and bare autolinks (`www.example.com`).
|
|
21
|
+
*
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
gfm?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* `@name` mentions, which no flavour of markdown has a notion of.
|
|
27
|
+
*
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
mention?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* LaTeX between double dollar signs: `$$x^2$$` inline, and the same on lines
|
|
33
|
+
* of its own for a block.
|
|
34
|
+
*
|
|
35
|
+
* Two dollars, never one: `$5 and $6` is a price list in every document that
|
|
36
|
+
* has ever been written, and single-dollar maths would quietly turn it into a
|
|
37
|
+
* picture of the word "and".
|
|
38
|
+
*
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
math?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** A parser, as the components hold one: text in, ranges out. */
|
|
44
|
+
type MarkdownParser = (markdown: string) => MarkdownRange[];
|
|
45
|
+
export type { MarkdownType, MarkdownRange, ParserOptions, MarkdownParser };
|
|
10
46
|
//# sourceMappingURL=commonTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonTypes.d.ts","sourceRoot":"","sources":["../../../../src/commonTypes.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GACb,
|
|
1
|
+
{"version":3,"file":"commonTypes.d.ts","sourceRoot":"","sources":["../../../../src/commonTypes.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GACb,QAAQ,GACR,UAAU,GACV,eAAe,GACf,OAAO,GAIP,SAAS,GACT,MAAM,GAIN,OAAO,GAKP,KAAK,GAIL,OAAO,GACP,MAAM,GACN,KAAK,GACL,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,SAAS,GACT,QAAQ,GACR,OAAO,GACP,WAAW,GAIX,MAAM,GAEN,YAAY,GAGZ,UAAU,CAAA;AAEd,UAAU,aAAa;IACrB,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;GASG;AACH,UAAU,aAAa;IACrB;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,iEAAiE;AACjE,KAAK,cAAc,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,aAAa,EAAE,CAAA;AAE3D,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as MarkdownTextInput, getWorkletRuntime } from "./MarkdownTextInput";
|
|
2
2
|
export type { MarkdownTextInputProps, MarkdownStyle } from "./MarkdownTextInput";
|
|
3
|
+
export { default as MarkdownText } from "./MarkdownText";
|
|
4
|
+
export type { MarkdownTextProps, OnLinkPress, RenderEmbed, RenderSVG } from "./MarkdownText";
|
|
3
5
|
export type { MarkdownType, MarkdownRange } from "./commonTypes";
|
|
4
|
-
export { parse as parser } from "./parser";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACrF,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAChF,YAAY,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACrF,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC5F,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA"}
|