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,7 +1,7 @@
|
|
|
1
1
|
import type { HTMLMarkdownElement, MarkdownTextInputElement } from "../../MarkdownTextInput.web";
|
|
2
2
|
import type { TreeNode } from "./treeUtils";
|
|
3
|
-
import type {
|
|
4
|
-
import type { LineLayout } from "./blockLayout";
|
|
3
|
+
import type { ResolvedMarkdownStyle } from "../../styleUtils";
|
|
4
|
+
import type { LineLayout, MarkerRendering } from "./blockLayout";
|
|
5
5
|
import type { TextMeasurer } from "./measureUtils";
|
|
6
6
|
import type { MarkdownRange } from "../../commonTypes";
|
|
7
7
|
type Paragraph = {
|
|
@@ -18,7 +18,7 @@ type Paragraph = {
|
|
|
18
18
|
*/
|
|
19
19
|
declare function normalizeLines(lines: Paragraph[], ranges: MarkdownRange[]): Paragraph[];
|
|
20
20
|
/** Builds HTML DOM structure based on passed text and markdown ranges */
|
|
21
|
-
declare function parseRangesToHTMLNodes(text: string, ranges: MarkdownRange[], isMultiline?: boolean, markdownStyle?:
|
|
21
|
+
declare function parseRangesToHTMLNodes(text: string, ranges: MarkdownRange[], isMultiline?: boolean, markdownStyle?: ResolvedMarkdownStyle, disableInlineStyles?: boolean, measure?: TextMeasurer, rendering?: MarkerRendering): {
|
|
22
22
|
dom: HTMLMarkdownElement;
|
|
23
23
|
tree: TreeNode;
|
|
24
24
|
};
|
|
@@ -31,11 +31,11 @@ type CachedLine = {
|
|
|
31
31
|
node: TreeNode;
|
|
32
32
|
};
|
|
33
33
|
type LineCache = {
|
|
34
|
-
markdownStyle:
|
|
34
|
+
markdownStyle: ResolvedMarkdownStyle;
|
|
35
35
|
isMultiline: boolean;
|
|
36
36
|
lines: CachedLine[];
|
|
37
37
|
};
|
|
38
|
-
declare function updateInputStructure(parserFunction: (input: string) => MarkdownRange[], target: MarkdownTextInputElement, text: string, cursorPositionIndex: number | null, isMultiline?: boolean, markdownStyle?:
|
|
38
|
+
declare function updateInputStructure(parserFunction: (input: string) => MarkdownRange[], target: MarkdownTextInputElement, text: string, cursorPositionIndex: number | null, isMultiline?: boolean, markdownStyle?: ResolvedMarkdownStyle, alwaysMoveCursorToTheEnd?: boolean, shouldForceDOMUpdate?: boolean, shouldScrollIntoView?: boolean): {
|
|
39
39
|
text: string;
|
|
40
40
|
cursorPosition: number;
|
|
41
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parserUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAEhG,OAAO,KAAK,EAAY,QAAQ,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"parserUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/parserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAEhG,OAAO,KAAK,EAAY,QAAQ,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAW7D,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAA;AAGpE,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,aAAa,EAAE,CAAA;IAC/B,qFAAqF;IACrF,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB,CAAA;AAmFD;;;GAGG;AACH,iBAAS,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,eA2BlE;AA6XD,yEAAyE;AACzE,iBAAS,sBAAsB,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EAAE,EACvB,WAAW,UAAO,EAClB,aAAa,GAAE,qBAA0B,EACzC,mBAAmB,UAAQ,EAC3B,OAAO,GAAE,YAAuC,EAChD,SAAS,GAAE,eAA+B;;;EA0B3C;AAED;;GAEG;AACH,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,CAAA;CACf,CAAA;AAED,KAAK,SAAS,GAAG;IACf,aAAa,EAAE,qBAAqB,CAAA;IACpC,WAAW,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AA4QD,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,qBAA0B,EACzC,wBAAwB,UAAQ,EAChC,oBAAoB,UAAQ,EAC5B,oBAAoB,UAAQ;;;EAiD7B;AAED,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,cAAc,EAAE,CAAA;AACvE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { HTMLMarkdownElement } from "../../MarkdownTextInput.web";
|
|
2
2
|
import type { MarkdownRange, MarkdownType } from "../../commonTypes";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* `list-item` is the one node with no range behind it: `<ul>` and `<ol>` may hold nothing but
|
|
5
|
+
* `<li>`, so the builder puts one inside each list container and everything the container holds
|
|
6
|
+
* goes in there. It covers exactly what its container does.
|
|
7
|
+
*/
|
|
8
|
+
type NodeType = MarkdownType | "line" | "text" | "br" | "root" | "list-item";
|
|
4
9
|
type TreeNode = Omit<MarkdownRange, "type"> & {
|
|
5
10
|
element: HTMLMarkdownElement;
|
|
6
11
|
parentNode: TreeNode | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/treeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEpE,KAAK,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"treeUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/treeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEpE;;;;GAIG;AACH,KAAK,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,WAAW,CAAA;AAE5E,KAAK,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG;IAC5C,OAAO,EAAE,mBAAmB,CAAA;IAC5B,UAAU,EAAE,QAAQ,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,QAAQ,EAAE,CAAA;IACtB,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,iBAAS,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,EAAE,MAAM,SAAI,EAAE,KAAK,SAAI,GAAG,QAAQ,CAWxF;AAED;;;;;;GAMG;AACH,iBAAS,aAAa,CACpB,OAAO,EAAE,mBAAmB,EAC5B,cAAc,EAAE,QAAQ,EACxB,IAAI,EAAE,QAAQ,EACd,MAAM,GAAE,MAAM,GAAG,IAAW,EAC5B,KAAK,GAAE,MAAM,GAAG,IAAW,YAyC5B;AAED,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,QAAQ,GAAG,IAAI,CAuBxF;AAED,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAqC9E;AAED,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA;AAEvF,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TextStyle } from "react-native";
|
|
2
|
-
import type {
|
|
3
|
-
declare function processMarkdownStyle(input:
|
|
2
|
+
import type { PartialMarkdownStyle, ResolvedMarkdownStyle } from "../../styleUtils";
|
|
3
|
+
declare function processMarkdownStyle(input: PartialMarkdownStyle | undefined): ResolvedMarkdownStyle;
|
|
4
4
|
declare function parseToReactDOMStyle(style: TextStyle): any;
|
|
5
5
|
declare const idGenerator: Generator<string, void, unknown>;
|
|
6
6
|
export { parseToReactDOMStyle, processMarkdownStyle, idGenerator };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webStyleUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/webStyleUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"webStyleUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/webStyleUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAwEnF,iBAAS,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,GAAG,qBAAqB,CAE5F;AAED,iBAAS,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAEnD;AASD,QAAA,MAAM,WAAW,kCAAqB,CAAA;AAEtC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.test.d.ts","sourceRoot":"","sources":["../../../../e2e/links.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ColorValue, ViewProps } from "react-native";
|
|
2
|
+
import type { Float, Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
|
+
import type { MarkdownStyle as TextInputMarkdownStyle } from "./MarcusTextInputDecoratorViewNativeComponent";
|
|
4
|
+
interface MarkdownTextStyle {
|
|
5
|
+
color?: ColorValue;
|
|
6
|
+
fontFamily?: string;
|
|
7
|
+
fontSize?: Float;
|
|
8
|
+
fontStyle?: string;
|
|
9
|
+
fontWeight?: string;
|
|
10
|
+
letterSpacing?: Float;
|
|
11
|
+
lineHeight?: Float;
|
|
12
|
+
textDecorationLine?: string;
|
|
13
|
+
textDecorationColor?: ColorValue;
|
|
14
|
+
textDecorationStyle?: string;
|
|
15
|
+
textShadowColor?: ColorValue;
|
|
16
|
+
textShadowOffset?: {
|
|
17
|
+
width: Float;
|
|
18
|
+
height: Float;
|
|
19
|
+
};
|
|
20
|
+
textShadowRadius?: Float;
|
|
21
|
+
}
|
|
22
|
+
interface MarkdownBoxStyle extends MarkdownTextStyle {
|
|
23
|
+
backgroundColor?: ColorValue;
|
|
24
|
+
borderColor?: ColorValue;
|
|
25
|
+
borderWidth?: Float;
|
|
26
|
+
borderRadius?: Float;
|
|
27
|
+
padding?: Float;
|
|
28
|
+
paddingHorizontal?: Float;
|
|
29
|
+
paddingVertical?: Float;
|
|
30
|
+
margin?: Float;
|
|
31
|
+
marginHorizontal?: Float;
|
|
32
|
+
marginVertical?: Float;
|
|
33
|
+
}
|
|
34
|
+
interface MarkdownHeadingStyle extends MarkdownTextStyle {
|
|
35
|
+
scale?: Float;
|
|
36
|
+
}
|
|
37
|
+
interface MarkdownBlockquoteStyle extends MarkdownTextStyle {
|
|
38
|
+
borderColor?: ColorValue;
|
|
39
|
+
borderWidth?: Float;
|
|
40
|
+
borderRadius?: Float;
|
|
41
|
+
marginStart?: Float;
|
|
42
|
+
paddingStart?: Float;
|
|
43
|
+
}
|
|
44
|
+
interface MarkdownListStyle {
|
|
45
|
+
marginStart?: Float;
|
|
46
|
+
paddingStart?: Float;
|
|
47
|
+
markerScale?: Float;
|
|
48
|
+
markerPadding?: Float;
|
|
49
|
+
marker?: MarkdownTextStyle;
|
|
50
|
+
}
|
|
51
|
+
interface MarkdownEmojiStyle {
|
|
52
|
+
fontSize?: Float;
|
|
53
|
+
fontFamily?: string;
|
|
54
|
+
}
|
|
55
|
+
interface MarkdownStyle {
|
|
56
|
+
syntax: MarkdownTextStyle;
|
|
57
|
+
emoji: MarkdownEmojiStyle;
|
|
58
|
+
link: MarkdownTextStyle;
|
|
59
|
+
strong: MarkdownTextStyle;
|
|
60
|
+
emphasis: MarkdownTextStyle;
|
|
61
|
+
strikethrough: MarkdownTextStyle;
|
|
62
|
+
heading: MarkdownHeadingStyle;
|
|
63
|
+
blockquote: MarkdownBlockquoteStyle;
|
|
64
|
+
orderedList: MarkdownListStyle;
|
|
65
|
+
unorderedList: MarkdownListStyle;
|
|
66
|
+
code: MarkdownBoxStyle;
|
|
67
|
+
pre: MarkdownBoxStyle;
|
|
68
|
+
mention: MarkdownBoxStyle;
|
|
69
|
+
}
|
|
70
|
+
interface MarkdownRangeStruct {
|
|
71
|
+
type: string;
|
|
72
|
+
start: Int32;
|
|
73
|
+
length: Int32;
|
|
74
|
+
depth: Int32;
|
|
75
|
+
}
|
|
76
|
+
interface MarkdownSubstitutionStruct {
|
|
77
|
+
index: Int32;
|
|
78
|
+
text: string;
|
|
79
|
+
}
|
|
80
|
+
interface NativeProps extends ViewProps {
|
|
81
|
+
markdownStyle: MarkdownStyle;
|
|
82
|
+
ranges: ReadonlyArray<MarkdownRangeStruct>;
|
|
83
|
+
substitutions: ReadonlyArray<MarkdownSubstitutionStruct>;
|
|
84
|
+
}
|
|
85
|
+
type Assignable<A extends B, B> = A;
|
|
86
|
+
type StyleMatchesTextInput = [
|
|
87
|
+
Assignable<MarkdownStyle, TextInputMarkdownStyle>,
|
|
88
|
+
Assignable<TextInputMarkdownStyle, MarkdownStyle>
|
|
89
|
+
];
|
|
90
|
+
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
91
|
+
export default _default;
|
|
92
|
+
export type { MarkdownRangeStruct, MarkdownSubstitutionStruct, StyleMatchesTextInput };
|
|
93
|
+
//# sourceMappingURL=MarcusTextDecoratorViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarcusTextDecoratorViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/MarcusTextDecoratorViewNativeComponent.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;AAE7E,OAAO,KAAK,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,+CAA+C,CAAA;AAyB5G,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,E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;AAED,wBAEE;AAEF,YAAY,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,CAAA"}
|
|
@@ -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,O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native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { TextProps } from "react-native";
|
|
4
|
+
import type { PartialMarkdownStyle } from "./styleUtils.js";
|
|
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,iBAAc,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.js";
|
|
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,iBAAc,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,iBAAc,CAAA;AAExD,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,kBAAe,CAAA;AAElE,OAAO,CAAC,M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