react-native-marcus 0.1.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/LICENSE +201 -0
- package/README.md +227 -0
- package/RNMarcus.podspec +78 -0
- package/android/build.gradle +220 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/cpp/CMakeLists.txt +41 -0
- package/android/src/main/cpp/MarkdownParser.cpp +49 -0
- package/android/src/main/cpp/MarkdownParser.h +56 -0
- package/android/src/main/cpp/OnLoad.cpp +17 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusModule.kt +28 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusPackage.kt +31 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextInputDecoratorView.kt +63 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextInputDecoratorViewManager.kt +32 -0
- package/android/src/main/java/app/getbullet/marcus/MarcusTextInputDecoratorViewManagerSpec.kt +21 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownFormatter.kt +333 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownParseResult.kt +12 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownParser.kt +89 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownRange.kt +11 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownStyle.kt +81 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownTextWatcher.kt +17 -0
- package/android/src/main/java/app/getbullet/marcus/MarkdownUtils.kt +84 -0
- package/android/src/main/java/app/getbullet/marcus/ReactLineHeight.java +29 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBackgroundColorSpan.kt +6 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBackgroundSpan.kt +105 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBlockIndentSpan.kt +67 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownBoldSpan.kt +6 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownFontFamilySpan.kt +28 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownFontSizeSpan.kt +7 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownForegroundColorSpan.kt +6 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownGapSpan.kt +57 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownItalicSpan.kt +6 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownLineHeightSpan.kt +21 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownSpan.kt +7 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownStrikethroughSpan.kt +5 -0
- package/android/src/main/java/app/getbullet/marcus/spans/MarkdownUnderlineSpan.kt +5 -0
- package/android/src/main/new_arch/CMakeLists.txt +70 -0
- package/android/src/main/new_arch/RNMarcusSpec.cpp +43 -0
- package/android/src/main/new_arch/RNMarcusSpec.h +36 -0
- package/android/src/main/new_arch/react/renderer/components/RNMarcusSpec/MarcusTextInputDecoratorShadowNode.cpp +218 -0
- package/android/src/main/new_arch/react/renderer/components/RNMarcusSpec/MarcusTextInputDecoratorShadowNode.h +54 -0
- package/android/src/reactNativeVersionPatch/CustomMountingManager/81/app/getbullet/marcus/CustomFabricUIManager.java +156 -0
- package/android/src/reactNativeVersionPatch/CustomMountingManager/latest/app/getbullet/marcus/CustomFabricUIManager.java +130 -0
- package/android/src/test/java/app/getbullet/marcus/MarkdownFormatterTest.kt +205 -0
- package/android/src/test/java/app/getbullet/marcus/RenderModel.kt +78 -0
- package/android/src/test/resources/render-model.txt +583 -0
- package/apple/MarcusModule.h +8 -0
- package/apple/MarcusModule.mm +26 -0
- package/apple/MarcusRange.h +15 -0
- package/apple/MarcusRange.mm +15 -0
- package/apple/MarcusTextInputDecoratorComponentView.h +12 -0
- package/apple/MarcusTextInputDecoratorComponentView.mm +121 -0
- package/apple/MarcusTextInputDecoratorShadowNode.cpp +251 -0
- package/apple/MarcusTextInputDecoratorShadowNode.h +65 -0
- package/apple/MarcusTextInputDecoratorShadowNode.mm +204 -0
- package/apple/MarcusTextInputDecoratorViewManager.h +8 -0
- package/apple/MarcusTextInputDecoratorViewManager.mm +11 -0
- package/apple/MarkdownAdaptiveImageGlyph.swift +44 -0
- package/apple/MarkdownAttributes.h +31 -0
- package/apple/MarkdownAttributes.m +9 -0
- package/apple/MarkdownBackedTextInputDelegate.swift +117 -0
- package/apple/MarkdownDecorator.swift +316 -0
- package/apple/MarkdownFonts.swift +21 -0
- package/apple/MarkdownFormatter+React.swift +51 -0
- package/apple/MarkdownFormatter.swift +509 -0
- package/apple/MarkdownLog.h +10 -0
- package/apple/MarkdownLog.mm +6 -0
- package/apple/MarkdownParser.swift +200 -0
- package/apple/MarkdownSwiftInterop.h +23 -0
- package/apple/MarkdownTextBackground.swift +17 -0
- package/apple/MarkdownTextFieldObserver.swift +90 -0
- package/apple/MarkdownTextLayoutFragment.swift +205 -0
- package/apple/MarkdownTextLayoutManagerDelegate.swift +84 -0
- package/apple/MarkdownTextStorageDelegate.swift +32 -0
- package/apple/MarkdownTextViewObserver.swift +30 -0
- package/apple/RCTMarcusStyle+Codegen.h +18 -0
- package/apple/RCTMarcusStyle+Codegen.mm +64 -0
- package/apple/RCTMarcusStyle.h +41 -0
- package/apple/RCTMarcusStyle.m +5 -0
- package/apple/RCTMarcusUtils.h +26 -0
- package/apple/RCTMarcusUtils.mm +26 -0
- package/apple/RCTTextInput+AdaptiveImageGlyph.h +16 -0
- package/apple/RCTTextInput+AdaptiveImageGlyph.mm +79 -0
- package/apple/RCTTextInputComponentView+Marcus.h +11 -0
- package/apple/RCTTextInputComponentView+Marcus.mm +79 -0
- package/cpp/MarkdownCxx.modulemap +8 -0
- package/cpp/MarkdownGlobal.cpp +48 -0
- package/cpp/MarkdownGlobal.h +33 -0
- package/cpp/MarkdownWorkletParser.cpp +93 -0
- package/cpp/MarkdownWorkletParser.h +45 -0
- package/cpp/RuntimeDecorator.cpp +39 -0
- package/cpp/RuntimeDecorator.h +14 -0
- package/cpp/react/renderer/components/RNMarcusSpec/MarcusTextInputDecoratorState.h +33 -0
- package/cpp/react/renderer/components/RNMarcusSpec/MarcusTextInputDecoratorViewComponentDescriptor.h +17 -0
- package/lib/commonjs/MarcusTextInputDecoratorViewNativeComponent.ts +77 -0
- package/lib/commonjs/MarkdownTextInput.js +99 -0
- package/lib/commonjs/MarkdownTextInput.js.map +1 -0
- package/lib/commonjs/MarkdownTextInput.web.js +618 -0
- package/lib/commonjs/MarkdownTextInput.web.js.map +1 -0
- package/lib/commonjs/NativeMarcusModule.js +9 -0
- package/lib/commonjs/NativeMarcusModule.js.map +1 -0
- package/lib/commonjs/commonTypes.js +2 -0
- package/lib/commonjs/commonTypes.js.map +1 -0
- package/lib/commonjs/global.d.js +2 -0
- package/lib/commonjs/global.d.js.map +1 -0
- package/lib/commonjs/index.js +27 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/parser/index.js +7030 -0
- package/lib/commonjs/parser/index.js.map +7 -0
- package/lib/commonjs/rangeUtils.js +71 -0
- package/lib/commonjs/rangeUtils.js.map +1 -0
- package/lib/commonjs/react-native-web.d.js +2 -0
- package/lib/commonjs/react-native-web.d.js.map +1 -0
- package/lib/commonjs/styleUtils.js +91 -0
- package/lib/commonjs/styleUtils.js.map +1 -0
- package/lib/commonjs/web/InputHistory.js +111 -0
- package/lib/commonjs/web/InputHistory.js.map +1 -0
- package/lib/commonjs/web/MarkdownTextInput.css +72 -0
- package/lib/commonjs/web/utils/blockLayout.js +132 -0
- package/lib/commonjs/web/utils/blockLayout.js.map +1 -0
- package/lib/commonjs/web/utils/blockUtils.js +219 -0
- package/lib/commonjs/web/utils/blockUtils.js.map +1 -0
- package/lib/commonjs/web/utils/browserUtils.js +40 -0
- package/lib/commonjs/web/utils/browserUtils.js.map +1 -0
- package/lib/commonjs/web/utils/cursorUtils.js +157 -0
- package/lib/commonjs/web/utils/cursorUtils.js.map +1 -0
- package/lib/commonjs/web/utils/inputUtils.js +152 -0
- package/lib/commonjs/web/utils/inputUtils.js.map +1 -0
- package/lib/commonjs/web/utils/measureUtils.js +0 -0
- package/lib/commonjs/web/utils/measureUtils.js.map +1 -0
- package/lib/commonjs/web/utils/parserUtils.js +552 -0
- package/lib/commonjs/web/utils/parserUtils.js.map +1 -0
- package/lib/commonjs/web/utils/treeUtils.js +109 -0
- package/lib/commonjs/web/utils/treeUtils.js.map +1 -0
- package/lib/commonjs/web/utils/webStyleUtils.js +59 -0
- package/lib/commonjs/web/utils/webStyleUtils.js.map +1 -0
- package/lib/module/MarcusTextInputDecoratorViewNativeComponent.ts +77 -0
- package/lib/module/MarkdownTextInput.js +94 -0
- package/lib/module/MarkdownTextInput.js.map +1 -0
- package/lib/module/MarkdownTextInput.web.js +612 -0
- package/lib/module/MarkdownTextInput.web.js.map +1 -0
- package/lib/module/NativeMarcusModule.js +5 -0
- package/lib/module/NativeMarcusModule.js.map +1 -0
- package/lib/module/commonTypes.js +2 -0
- package/lib/module/commonTypes.js.map +1 -0
- package/lib/module/global.d.js +2 -0
- package/lib/module/global.d.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/parser/index.js +7029 -0
- package/lib/module/parser/index.js.map +7 -0
- package/lib/module/rangeUtils.js +66 -0
- package/lib/module/rangeUtils.js.map +1 -0
- package/lib/module/react-native-web.d.js +2 -0
- package/lib/module/react-native-web.d.js.map +1 -0
- package/lib/module/styleUtils.js +88 -0
- package/lib/module/styleUtils.js.map +1 -0
- package/lib/module/web/InputHistory.js +106 -0
- package/lib/module/web/InputHistory.js.map +1 -0
- package/lib/module/web/MarkdownTextInput.css +72 -0
- package/lib/module/web/utils/blockLayout.js +128 -0
- package/lib/module/web/utils/blockLayout.js.map +1 -0
- package/lib/module/web/utils/blockUtils.js +210 -0
- package/lib/module/web/utils/blockUtils.js.map +1 -0
- package/lib/module/web/utils/browserUtils.js +36 -0
- package/lib/module/web/utils/browserUtils.js.map +1 -0
- package/lib/module/web/utils/cursorUtils.js +150 -0
- package/lib/module/web/utils/cursorUtils.js.map +1 -0
- package/lib/module/web/utils/inputUtils.js +144 -0
- package/lib/module/web/utils/inputUtils.js.map +1 -0
- package/lib/module/web/utils/measureUtils.js +0 -0
- package/lib/module/web/utils/measureUtils.js.map +1 -0
- package/lib/module/web/utils/parserUtils.js +547 -0
- package/lib/module/web/utils/parserUtils.js.map +1 -0
- package/lib/module/web/utils/treeUtils.js +103 -0
- package/lib/module/web/utils/treeUtils.js.map +1 -0
- package/lib/module/web/utils/webStyleUtils.js +54 -0
- package/lib/module/web/utils/webStyleUtils.js.map +1 -0
- package/lib/typescript/commonjs/e2e/checks.test.d.ts +2 -0
- package/lib/typescript/commonjs/e2e/checks.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/e2e/editing.test.d.ts +2 -0
- package/lib/typescript/commonjs/e2e/editing.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/e2e/helpers.d.ts +23 -0
- package/lib/typescript/commonjs/e2e/helpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/e2e/smoke.test.d.ts +2 -0
- package/lib/typescript/commonjs/e2e/smoke.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/MarcusTextInputDecoratorViewNativeComponent.d.ts +63 -0
- package/lib/typescript/commonjs/src/MarcusTextInputDecoratorViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarkdownTextInput.d.ts +22 -0
- package/lib/typescript/commonjs/src/MarkdownTextInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/MarkdownTextInput.web.d.ts +41 -0
- package/lib/typescript/commonjs/src/MarkdownTextInput.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NativeMarcusModule.d.ts +7 -0
- package/lib/typescript/commonjs/src/NativeMarcusModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/commonTypes.d.ts +10 -0
- package/lib/typescript/commonjs/src/commonTypes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +5 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/parser/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/parser/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/parser/micromark-extension-mentions.d.ts +8 -0
- package/lib/typescript/commonjs/src/parser/micromark-extension-mentions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/rangeUtils.d.ts +6 -0
- package/lib/typescript/commonjs/src/rangeUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/styleUtils.d.ts +8 -0
- package/lib/typescript/commonjs/src/styleUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/InputHistory.d.ts +24 -0
- package/lib/typescript/commonjs/src/web/InputHistory.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/blockLayout.d.ts +41 -0
- package/lib/typescript/commonjs/src/web/utils/blockLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/blockUtils.d.ts +33 -0
- package/lib/typescript/commonjs/src/web/utils/blockUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/browserUtils.d.ts +7 -0
- package/lib/typescript/commonjs/src/web/utils/browserUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/cursorUtils.d.ts +12 -0
- package/lib/typescript/commonjs/src/web/utils/cursorUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/inputUtils.d.ts +12 -0
- package/lib/typescript/commonjs/src/web/utils/inputUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/measureUtils.d.ts +22 -0
- package/lib/typescript/commonjs/src/web/utils/measureUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/parserUtils.d.ts +44 -0
- package/lib/typescript/commonjs/src/web/utils/parserUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/treeUtils.d.ts +25 -0
- package/lib/typescript/commonjs/src/web/utils/treeUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/web/utils/webStyleUtils.d.ts +7 -0
- package/lib/typescript/commonjs/src/web/utils/webStyleUtils.d.ts.map +1 -0
- package/lib/typescript/module/e2e/checks.test.d.ts +2 -0
- package/lib/typescript/module/e2e/checks.test.d.ts.map +1 -0
- package/lib/typescript/module/e2e/editing.test.d.ts +2 -0
- package/lib/typescript/module/e2e/editing.test.d.ts.map +1 -0
- package/lib/typescript/module/e2e/helpers.d.ts +23 -0
- package/lib/typescript/module/e2e/helpers.d.ts.map +1 -0
- package/lib/typescript/module/e2e/smoke.test.d.ts +2 -0
- package/lib/typescript/module/e2e/smoke.test.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/MarcusTextInputDecoratorViewNativeComponent.d.ts +63 -0
- package/lib/typescript/module/src/MarcusTextInputDecoratorViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/MarkdownTextInput.d.ts +22 -0
- package/lib/typescript/module/src/MarkdownTextInput.d.ts.map +1 -0
- package/lib/typescript/module/src/MarkdownTextInput.web.d.ts +41 -0
- package/lib/typescript/module/src/MarkdownTextInput.web.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeMarcusModule.d.ts +7 -0
- package/lib/typescript/module/src/NativeMarcusModule.d.ts.map +1 -0
- package/lib/typescript/module/src/commonTypes.d.ts +10 -0
- package/lib/typescript/module/src/commonTypes.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +5 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/parser/index.d.ts +8 -0
- package/lib/typescript/module/src/parser/index.d.ts.map +1 -0
- package/lib/typescript/module/src/parser/micromark-extension-mentions.d.ts +8 -0
- package/lib/typescript/module/src/parser/micromark-extension-mentions.d.ts.map +1 -0
- package/lib/typescript/module/src/rangeUtils.d.ts +6 -0
- package/lib/typescript/module/src/rangeUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/styleUtils.d.ts +8 -0
- package/lib/typescript/module/src/styleUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/InputHistory.d.ts +24 -0
- package/lib/typescript/module/src/web/InputHistory.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/blockLayout.d.ts +41 -0
- package/lib/typescript/module/src/web/utils/blockLayout.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/blockUtils.d.ts +33 -0
- package/lib/typescript/module/src/web/utils/blockUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/browserUtils.d.ts +7 -0
- package/lib/typescript/module/src/web/utils/browserUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/cursorUtils.d.ts +12 -0
- package/lib/typescript/module/src/web/utils/cursorUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/inputUtils.d.ts +12 -0
- package/lib/typescript/module/src/web/utils/inputUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/measureUtils.d.ts +22 -0
- package/lib/typescript/module/src/web/utils/measureUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/parserUtils.d.ts +44 -0
- package/lib/typescript/module/src/web/utils/parserUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/treeUtils.d.ts +25 -0
- package/lib/typescript/module/src/web/utils/treeUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/web/utils/webStyleUtils.d.ts +7 -0
- package/lib/typescript/module/src/web/utils/webStyleUtils.d.ts.map +1 -0
- package/package.json +167 -0
- package/react-native.config.js +10 -0
- package/src/MarcusTextInputDecoratorViewNativeComponent.ts +77 -0
- package/src/MarkdownTextInput.tsx +139 -0
- package/src/MarkdownTextInput.web.tsx +958 -0
- package/src/NativeMarcusModule.ts +8 -0
- package/src/commonTypes.ts +30 -0
- package/src/global.d.ts +1 -0
- package/src/index.tsx +4 -0
- package/src/parser/index.ts +556 -0
- package/src/parser/micromark-extension-mentions.ts +82 -0
- package/src/rangeUtils.ts +68 -0
- package/src/react-native-web.d.ts +1 -0
- package/src/styleUtils.ts +100 -0
- package/src/web/InputHistory.ts +137 -0
- package/src/web/MarkdownTextInput.css +72 -0
- package/src/web/utils/blockLayout.ts +163 -0
- package/src/web/utils/blockUtils.ts +245 -0
- package/src/web/utils/browserUtils.ts +41 -0
- package/src/web/utils/cursorUtils.ts +204 -0
- package/src/web/utils/inputUtils.ts +206 -0
- package/src/web/utils/measureUtils.ts +0 -0
- package/src/web/utils/parserUtils.ts +813 -0
- package/src/web/utils/treeUtils.ts +149 -0
- package/src/web/utils/webStyleUtils.ts +69 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function createRootTreeNode(target, length = 0, start = 0) {
|
|
4
|
+
return {
|
|
5
|
+
element: target,
|
|
6
|
+
start,
|
|
7
|
+
length,
|
|
8
|
+
parentNode: null,
|
|
9
|
+
childNodes: [],
|
|
10
|
+
type: "root",
|
|
11
|
+
orderIndex: "",
|
|
12
|
+
isGeneratingNewline: false
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param start Where the node begins in the text, when the caller knows it. A markdown range
|
|
18
|
+
* carries its own offset, and taking it is the only way to be right when ranges do not tile the
|
|
19
|
+
* line -- overlapping emphasis split across lines leaves gaps, and a node placed at wherever its
|
|
20
|
+
* previous sibling happened to end then reports an offset the text never had. Text and line breaks
|
|
21
|
+
* genuinely do follow on from what precedes them, so they still accumulate.
|
|
22
|
+
*/
|
|
23
|
+
function addNodeToTree(element, parentTreeNode, type, length = null, start = null) {
|
|
24
|
+
const contentLength = length || (element.nodeName === "BR" || type === "br" ? 1 : element.value?.length) || 0;
|
|
25
|
+
const isGeneratingNewline = type === "line" && !(element.childNodes.length === 1 && element.childNodes[0]?.getAttribute?.("data-type") === "br");
|
|
26
|
+
const parentChildrenCount = parentTreeNode?.childNodes.length || 0;
|
|
27
|
+
let startIndex = parentTreeNode.start;
|
|
28
|
+
if (start !== null) {
|
|
29
|
+
startIndex = start;
|
|
30
|
+
} else if (parentChildrenCount > 0) {
|
|
31
|
+
const lastParentChild = parentTreeNode.childNodes[parentChildrenCount - 1];
|
|
32
|
+
if (lastParentChild) {
|
|
33
|
+
startIndex = lastParentChild.start + lastParentChild.length;
|
|
34
|
+
startIndex += lastParentChild.isGeneratingNewline || element.style.display === "block" ? 1 : 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const item = {
|
|
38
|
+
element,
|
|
39
|
+
parentNode: parentTreeNode,
|
|
40
|
+
childNodes: [],
|
|
41
|
+
start: startIndex,
|
|
42
|
+
length: contentLength,
|
|
43
|
+
type,
|
|
44
|
+
orderIndex: parentTreeNode.parentNode === null ? `${parentChildrenCount}` : `${parentTreeNode.orderIndex},${parentChildrenCount}`,
|
|
45
|
+
isGeneratingNewline
|
|
46
|
+
};
|
|
47
|
+
element.setAttribute("data-id", item.orderIndex);
|
|
48
|
+
parentTreeNode.childNodes.push(item);
|
|
49
|
+
return item;
|
|
50
|
+
}
|
|
51
|
+
function findHTMLElementInTree(treeRoot, element) {
|
|
52
|
+
if (element.hasAttribute?.("contenteditable")) {
|
|
53
|
+
return treeRoot;
|
|
54
|
+
}
|
|
55
|
+
if (!element || !element.hasAttribute?.("data-id")) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const indexes = element.getAttribute("data-id")?.split(",");
|
|
59
|
+
let el = treeRoot;
|
|
60
|
+
while (el && indexes && indexes.length > 0) {
|
|
61
|
+
const index = Number(indexes.shift() || -1);
|
|
62
|
+
if (index < 0) {
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
if (el) {
|
|
66
|
+
el = el.childNodes[index] || null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return el;
|
|
70
|
+
}
|
|
71
|
+
function getTreeNodeByIndex(treeRoot, index) {
|
|
72
|
+
let el = treeRoot;
|
|
73
|
+
let i = 0;
|
|
74
|
+
let newLineGenerated = false;
|
|
75
|
+
if (treeRoot.length === 0) {
|
|
76
|
+
return treeRoot;
|
|
77
|
+
}
|
|
78
|
+
while (el && el.childNodes.length > 0 && i < el.childNodes.length) {
|
|
79
|
+
const child = el.childNodes[i];
|
|
80
|
+
if (!child) {
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
if (index >= child.start && index < child.start + child.length) {
|
|
84
|
+
if (child.childNodes.length === 0) {
|
|
85
|
+
return child;
|
|
86
|
+
}
|
|
87
|
+
el = child;
|
|
88
|
+
i = 0;
|
|
89
|
+
} else if ((child.isGeneratingNewline || newLineGenerated || i === el.childNodes.length - 1) && index === child.start + child.length) {
|
|
90
|
+
newLineGenerated = true;
|
|
91
|
+
if (child.childNodes.length === 0) {
|
|
92
|
+
return child;
|
|
93
|
+
}
|
|
94
|
+
el = child;
|
|
95
|
+
i = 0;
|
|
96
|
+
} else {
|
|
97
|
+
i++;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
export { addNodeToTree, findHTMLElementInTree, getTreeNodeByIndex, createRootTreeNode };
|
|
103
|
+
//# sourceMappingURL=treeUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createRootTreeNode","target","length","start","element","parentNode","childNodes","type","orderIndex","isGeneratingNewline","addNodeToTree","parentTreeNode","contentLength","nodeName","value","getAttribute","parentChildrenCount","startIndex","lastParentChild","style","display","item","setAttribute","push","findHTMLElementInTree","treeRoot","hasAttribute","indexes","split","el","index","Number","shift","getTreeNodeByIndex","i","newLineGenerated","child"],"sourceRoot":"../../../../src","sources":["web/utils/treeUtils.ts"],"mappings":";;AAcA,SAASA,kBAAkBA,CAACC,MAA2B,EAAEC,MAAM,GAAG,CAAC,EAAEC,KA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":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
+
|
|
5
|
+
import { mergeMarkdownStyleWithDefault } from "../../styleUtils.js";
|
|
6
|
+
let createReactDOMStyle;
|
|
7
|
+
try {
|
|
8
|
+
createReactDOMStyle =
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
|
10
|
+
require("react-native-web/dist/exports/StyleSheet/compiler/createReactDOMStyle").default;
|
|
11
|
+
} catch {
|
|
12
|
+
throw new Error("[react-native-marcus] Function `createReactDOMStyle` from react-native-web not found. Please make sure that you are using React Native Web 0.18 or newer.");
|
|
13
|
+
}
|
|
14
|
+
let preprocessStyle;
|
|
15
|
+
try {
|
|
16
|
+
preprocessStyle =
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
|
18
|
+
require("react-native-web/dist/exports/StyleSheet/preprocess").default;
|
|
19
|
+
} catch {
|
|
20
|
+
throw new Error("[react-native-marcus] Function `preprocessStyle` from react-native-web not found.");
|
|
21
|
+
}
|
|
22
|
+
let dangerousStyleValue;
|
|
23
|
+
try {
|
|
24
|
+
dangerousStyleValue =
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
|
26
|
+
require("react-native-web/dist/modules/setValueForStyles/dangerousStyleValue").default;
|
|
27
|
+
} catch {
|
|
28
|
+
throw new Error("[react-native-marcus] Function `dangerousStyleValue` from react-native-web not found.");
|
|
29
|
+
}
|
|
30
|
+
function processUnitsInMarkdownStyle(input) {
|
|
31
|
+
const output = JSON.parse(JSON.stringify(input));
|
|
32
|
+
Object.keys(output).forEach(key => {
|
|
33
|
+
const obj = output[key];
|
|
34
|
+
Object.keys(obj).forEach(prop => {
|
|
35
|
+
obj[prop] = dangerousStyleValue(prop, obj[prop], false);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
return output;
|
|
39
|
+
}
|
|
40
|
+
function processMarkdownStyle(input) {
|
|
41
|
+
return processUnitsInMarkdownStyle(mergeMarkdownStyleWithDefault(input));
|
|
42
|
+
}
|
|
43
|
+
function parseToReactDOMStyle(style) {
|
|
44
|
+
return createReactDOMStyle(preprocessStyle(style));
|
|
45
|
+
}
|
|
46
|
+
function* generateUniqueId() {
|
|
47
|
+
let idCounter = 0;
|
|
48
|
+
while (true) {
|
|
49
|
+
yield `marcus-input-${idCounter++}`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const idGenerator = generateUniqueId();
|
|
53
|
+
export { parseToReactDOMStyle, processMarkdownStyle, idGenerator };
|
|
54
|
+
//# sourceMappingURL=webStyleUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["mergeMarkdownStyleWithDefault","createReactDOMStyle","require","default","Error","preprocessStyle","dangerousStyleValue","processUnitsInMarkdownStyle","input","output","JSON","parse","stringify","Object","keys","forEach","key","obj","prop","processMarkdownStyle","parseToReactDOMStyle","style","generateUniqueId","idCounter","idGenerator"],"sourceRoot":"../../../../src","sources":["web/utils/webStyleUtils.ts"],"mappings":";;AAAA;;AAGA,SAASA,6BAA6B,QAAQ,qBAAkB;AAEhE,IAAIC,mBAAwC;AAC5C,IAAI;EACFA,mBAAmB;EACjB;EACAC,OAAO,CAAC,uEAAuE,CAAC,CAACC,OAAO;AAC5F,CAAC,CAAC,MAAM;EACN,MAAM,IAAIC,KAAK,CACb,2JACF,CAAC;AACH;AAEA,IAAIC,eAAoC;AACxC,IAAI;EACFA,eAAe;EACb;EACAH,OAAO,CAAC,qDAAqD,CAAC,CAACC,OAAO;AAC1E,CAAC,CAAC,MAAM;EACN,MAAM,IAAIC,KAAK,CACb,mFACF,CAAC;AACH;AAEA,IAAIE,mBAAiF;AACrF,IAAI;EACFA,mBAAmB;EACjB;EACAJ,OAAO,CAAC,qEAAqE,CAAC,CAACC,OAAO;AAC1F,CAAC,CAAC,MAAM;EACN,MAAM,IAAIC,KAAK,CACb,uFACF,CAAC;AACH;AAEA,SAASG,2BAA2BA,CAACC,KAAoB,EAAiB;EACxE,MAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACJ,KAAK,CAAC,CAAC;EAEhDK,MAAM,CAACC,IAAI,CAACL,MAAM,CAAC,CAACM,OAAO,CAAEC,GAAG,IAAK;IACnC,MAAMC,GAAG,GAAGR,MAAM,CAACO,GAAG,CAAC;IACvBH,MAAM,CAACC,IAAI,CAACG,GAAG,CAAC,CAACF,OAAO,CAAEG,IAAI,IAAK;MACjCD,GAAG,CAACC,IAAI,CAAC,GAAGZ,mBAAmB,CAACY,IAAI,EAAED,GAAG,CAACC,IAAI,CAAC,EAAE,KAAK,CAAC;IACzD,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOT,MAAM;AACf;AAEA,SAASU,oBAAoBA,CAACX,KAAgC,EAAiB;EAC7E,OAAOD,2BAA2B,CAACP,6BAA6B,CAACQ,KAAK,CAAC,CAAC;AAC1E;AAEA,SAASY,oBAAoBA,CAACC,KAAgB,EAAO;EACnD,OAAOpB,mBAAmB,CAACI,eAAe,CAACgB,KAAK,CAAC,CAAC;AACpD;AAEA,UAAUC,gBAAgBA,CAAA,EAAG;EAC3B,IAAIC,SAAS,GAAG,CAAC;EACjB,OAAO,IAAI,EAAE;IACX,MAAM,gBAAgBA,SAAS,EAAE,EAAE;EACrC;AACF;AAEA,MAAMC,WAAW,GAAGF,gBAAgB,CAAC,CAAC;AAEtC,SAASF,oBAAoB,EAAED,oBAAoB,EAAEK,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.test.d.ts","sourceRoot":"","sources":["../../../../e2e/checks.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editing.test.d.ts","sourceRoot":"","sources":["../../../../e2e/editing.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launches a fresh app and navigates to a harness route.
|
|
3
|
+
*
|
|
4
|
+
* A URL handed to `launchApp` arrives before expo-router has attached its
|
|
5
|
+
* linking listener, and is dropped -- how long a cold launch takes to get
|
|
6
|
+
* there varies, so sleeping first only trades one flake for another. Delivering
|
|
7
|
+
* the URL until the route mounts is what actually holds. Checking before each
|
|
8
|
+
* delivery means a retry can never push a second copy of the screen.
|
|
9
|
+
*/
|
|
10
|
+
export declare function open(path: string): Promise<void>;
|
|
11
|
+
/** The text of an element, whichever platform's attribute shape it arrives in. */
|
|
12
|
+
export declare function textOf(testID: string): Promise<string | undefined>;
|
|
13
|
+
export declare function waitForReady(): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Polls the verdict element until the check reports.
|
|
16
|
+
*
|
|
17
|
+
* Waiting on `toHaveText("ok")` would work, but a failing check would surface
|
|
18
|
+
* as a timeout rather than as the mismatch the harness carefully described. So
|
|
19
|
+
* the wait ends as soon as the verdict is anything final, and the caller
|
|
20
|
+
* asserts on it with Jest.
|
|
21
|
+
*/
|
|
22
|
+
export declare function verdict(timeout?: number): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../e2e/helpers.ts"],"names":[],"mappings":"AAaA;;;;;;;;GAQG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,iBAetC;AAED,kFAAkF;AAClF,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,+BAI1C;AAED,wBAAsB,YAAY,kBAEjC;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,OAAO,SAAS,mBAc7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smoke.test.d.ts","sourceRoot":"","sources":["../../../../e2e/smoke.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ColorValue, ViewProps } from "react-native";
|
|
2
|
+
import type { Float, Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
|
+
interface CodeBlockStyle {
|
|
4
|
+
fontFamily: string;
|
|
5
|
+
fontSize: Float;
|
|
6
|
+
color: ColorValue;
|
|
7
|
+
backgroundColor: ColorValue;
|
|
8
|
+
}
|
|
9
|
+
interface MarkdownStyle {
|
|
10
|
+
syntax: {
|
|
11
|
+
color: ColorValue;
|
|
12
|
+
};
|
|
13
|
+
emoji: {
|
|
14
|
+
fontSize: Float;
|
|
15
|
+
fontFamily: string;
|
|
16
|
+
};
|
|
17
|
+
link: {
|
|
18
|
+
color: ColorValue;
|
|
19
|
+
};
|
|
20
|
+
heading: {
|
|
21
|
+
fontSize: Float;
|
|
22
|
+
scale: Float;
|
|
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
|
+
}
|
|
56
|
+
interface NativeProps extends ViewProps {
|
|
57
|
+
markdownStyle: MarkdownStyle;
|
|
58
|
+
parserId: Int32;
|
|
59
|
+
}
|
|
60
|
+
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
61
|
+
export default _default;
|
|
62
|
+
export type { MarkdownStyle };
|
|
63
|
+
//# sourceMappingURL=MarcusTextInputDecoratorViewNativeComponent.d.ts.map
|
|
@@ -0,0 +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;AAK7E,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,UAAU,CAAA;IACjB,eAAe,EAAE,UAAU,CAAA;CAC5B;AAED,UAAU,aAAa;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,UAAU,CAAA;KAClB,CAAA;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,KAAK,CAAA;QACf,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,UAAU,CAAA;KAClB,CAAA;IACD,OAAO,EAAE;QACP,QAAQ,EAAE,KAAK,CAAA;QAGf,KAAK,EAAE,KAAK,CAAA;KACb,CAAA;IACD,UAAU,EAAE;QACV,WAAW,EAAE,UAAU,CAAA;QACvB,WAAW,EAAE,KAAK,CAAA;QAClB,UAAU,EAAE,KAAK,CAAA;QACjB,WAAW,EAAE,KAAK,CAAA;KACnB,CAAA;IAGD,WAAW,EAAE;QACX,UAAU,EAAE,KAAK,CAAA;QACjB,WAAW,EAAE,KAAK,CAAA;KACnB,CAAA;IACD,aAAa,EAAE;QACb,UAAU,EAAE,KAAK,CAAA;QACjB,WAAW,EAAE,KAAK,CAAA;KACnB,CAAA;IACD,IAAI,EAAE,cAAc,CAAA;IACpB,GAAG,EAAE,cAAc,CAAA;IACnB,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAA;QACjB,eAAe,EAAE,UAAU,CAAA;QAC3B,YAAY,CAAC,EAAE,KAAK,CAAA;KACrB,CAAA;IACD,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAA;QACjB,eAAe,EAAE,UAAU,CAAA;QAC3B,YAAY,CAAC,EAAE,KAAK,CAAA;KACrB,CAAA;IACD,aAAa,EAAE;QACb,KAAK,EAAE,UAAU,CAAA;QACjB,eAAe,EAAE,UAAU,CAAA;QAC3B,YAAY,CAAC,EAAE,KAAK,CAAA;KACrB,CAAA;CACF;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,aAAa,EAAE,aAAa,CAAA;IAC5B,QAAQ,EAAE,KAAK,CAAA;CAChB;;AAED,wBAEE;AAEF,YAAY,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TextInput } from "react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { TextInputProps } from "react-native";
|
|
4
|
+
import type { SerializableRef, WorkletFunction, WorkletRuntime } from "react-native-worklets";
|
|
5
|
+
import type { PartialMarkdownStyle } from "./styleUtils";
|
|
6
|
+
import type { MarkdownRange } from "./commonTypes";
|
|
7
|
+
declare global {
|
|
8
|
+
var jsi_setMarcusRuntime: (runtime: WorkletRuntime) => void;
|
|
9
|
+
var jsi_registerMarcusWorklet: (shareableWorklet: SerializableRef<WorkletFunction<[string], MarkdownRange[]>>) => number;
|
|
10
|
+
var jsi_unregisterMarcusWorklet: (parserId: number) => void;
|
|
11
|
+
}
|
|
12
|
+
declare function getWorkletRuntime(): WorkletRuntime;
|
|
13
|
+
interface MarkdownTextInputProps extends TextInputProps {
|
|
14
|
+
markdownStyle?: PartialMarkdownStyle;
|
|
15
|
+
parser: (value: string) => MarkdownRange[];
|
|
16
|
+
}
|
|
17
|
+
type MarkdownTextInput = TextInput & React.Component<MarkdownTextInputProps>;
|
|
18
|
+
declare const MarkdownTextInput: React.ForwardRefExoticComponent<MarkdownTextInputProps & React.RefAttributes<MarkdownTextInput>>;
|
|
19
|
+
export type { PartialMarkdownStyle as MarkdownStyle, MarkdownTextInputProps };
|
|
20
|
+
export default MarkdownTextInput;
|
|
21
|
+
export { getWorkletRuntime };
|
|
22
|
+
//# sourceMappingURL=MarkdownTextInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownTextInput.d.ts","sourceRoot":"","sources":["../../../../src/MarkdownTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAgB,MAAM,cAAc,CAAA;AAClE,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;AAK7F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,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,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,EAAE,CAAA;CAC3C;AAED,KAAK,iBAAiB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAA;AAuB5E,QAAA,MAAM,iBAAiB,kGAmCtB,CAAA;AAQD,YAAY,EAAE,oBAAoB,IAAI,aAAa,EAAE,sBAAsB,EAAE,CAAA;AAE7E,eAAe,iBAAiB,CAAA;AAEhC,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TextInput, TextInputProps } from "react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { MouseEvent } from "react";
|
|
4
|
+
import type { LineCache } from "./web/utils/parserUtils";
|
|
5
|
+
import type { TreeNode } from "./web/utils/treeUtils";
|
|
6
|
+
import "./web/MarkdownTextInput.css";
|
|
7
|
+
import type { MarkdownStyle } from "./MarcusTextInputDecoratorViewNativeComponent";
|
|
8
|
+
import type { MarkdownRange } from "./commonTypes";
|
|
9
|
+
interface MarkdownTextInputProps extends TextInputProps {
|
|
10
|
+
markdownStyle?: MarkdownStyle;
|
|
11
|
+
parser: (text: string) => MarkdownRange[];
|
|
12
|
+
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
13
|
+
dir?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface MarkdownNativeEvent extends Event {
|
|
17
|
+
inputType?: string;
|
|
18
|
+
isComposing?: boolean;
|
|
19
|
+
keyCode?: number;
|
|
20
|
+
}
|
|
21
|
+
type MarkdownTextInput = TextInput & React.Component<MarkdownTextInputProps>;
|
|
22
|
+
type Selection = {
|
|
23
|
+
start: number;
|
|
24
|
+
end: number;
|
|
25
|
+
};
|
|
26
|
+
type MarkdownTextInputElement = HTMLDivElement & HTMLInputElement & {
|
|
27
|
+
tree: TreeNode;
|
|
28
|
+
uniqueId: string;
|
|
29
|
+
selection: Selection;
|
|
30
|
+
/** What each line was last rendered from, so an update can skip rebuilding the unchanged ones. */
|
|
31
|
+
lineCache?: LineCache;
|
|
32
|
+
};
|
|
33
|
+
type HTMLMarkdownElement = HTMLElement & {
|
|
34
|
+
value: string;
|
|
35
|
+
};
|
|
36
|
+
declare const MarkdownTextInput: React.ForwardRefExoticComponent<MarkdownTextInputProps & React.RefAttributes<MarkdownTextInput>>;
|
|
37
|
+
export default MarkdownTextInput;
|
|
38
|
+
export type { MarkdownNativeEvent, MarkdownTextInputProps, MarkdownTextInputElement, HTMLMarkdownElement, };
|
|
39
|
+
declare function getWorkletRuntime(): void;
|
|
40
|
+
export { getWorkletRuntime };
|
|
41
|
+
//# sourceMappingURL=MarkdownTextInput.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownTextInput.web.d.ts","sourceRoot":"","sources":["../../../../src/MarkdownTextInput.web.tsx"],"names":[],"mappings":"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,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAalF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAIlD,UAAU,sBAAuB,SAAQ,cAAc;IACrD,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,M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,UAAU,IAAK,SAAQ,WAAW;IAChC,OAAO,EAAE,MAAM,OAAO,CAAA;CACvB;;AAED,wBAA4D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type MarkdownType = "bold" | "italic" | "strikethrough" | "emoji" | "mention-here" | "mention-user" | "mention-short" | "mention-report" | "link" | "code" | "pre" | "blockquote" | "list-ordered" | "list-unordered" | "block-prefix" | "heading" | "syntax" | "inline-image" | "codeblock";
|
|
2
|
+
interface MarkdownRange {
|
|
3
|
+
type: MarkdownType;
|
|
4
|
+
start: number;
|
|
5
|
+
length: number;
|
|
6
|
+
depth?: number;
|
|
7
|
+
syntaxType?: "opening" | "closing";
|
|
8
|
+
}
|
|
9
|
+
export type { MarkdownType, MarkdownRange };
|
|
10
|
+
//# sourceMappingURL=commonTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonTypes.d.ts","sourceRoot":"","sources":["../../../../src/commonTypes.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GACb,MAAM,GACN,QAAQ,GACR,eAAe,GACf,OAAO,GACP,cAAc,GACd,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,MAAM,GACN,MAAM,GACN,KAAK,GACL,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,SAAS,GACT,QAAQ,GACR,cAAc,GACd,WAAW,CAAA;AAEf,UAAU,aAAa;IACrB,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CACnC;AAED,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as MarkdownTextInput, getWorkletRuntime } from "./MarkdownTextInput";
|
|
2
|
+
export type { MarkdownTextInputProps, MarkdownStyle } from "./MarkdownTextInput";
|
|
3
|
+
export type { MarkdownType, MarkdownRange } from "./commonTypes";
|
|
4
|
+
export { parse as parser } from "./parser";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,aAAa,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,gBAAgB,CAAA;AA8JjE,OAAO,QAAQ,SAAS,CAAC;IACvB,SAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAAA;CACzD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,SAAS,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAAA;CAC/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"micromark-extension-mentions.d.ts","sourceRoot":"","sources":["../../../../../src/parser/micromark-extension-mentions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAS,MAAM,sBAAsB,CAAA;AAM3E,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,YAAY;QACpB,OAAO,EAAE,SAAS,CAAA;KACnB;CACF;AAOD,wBAAgB,QAAQ,IAAI,SAAS,CAMpC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MarkdownRange } from "./commonTypes";
|
|
2
|
+
declare function getTagPriority(tag: string): 0 | 1 | -1 | 3 | 2;
|
|
3
|
+
declare function sortRanges(ranges: MarkdownRange[]): MarkdownRange[];
|
|
4
|
+
declare function ungroupRanges(ranges: MarkdownRange[]): MarkdownRange[];
|
|
5
|
+
export { getTagPriority, sortRanges, ungroupRanges };
|
|
6
|
+
//# sourceMappingURL=rangeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rangeUtils.d.ts","sourceRoot":"","sources":["../../../../src/rangeUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAoBlD,iBAAS,cAAc,CAAC,GAAG,EAAE,MAAM,sBAelC;AAMD,iBAAS,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,mBAS1C;AAED,iBAAS,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAY/D;AACD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MarkdownStyle } from "./MarcusTextInputDecoratorViewNativeComponent";
|
|
2
|
+
type PartialMarkdownStyle = Partial<{
|
|
3
|
+
[K in keyof MarkdownStyle]: Partial<MarkdownStyle[K]>;
|
|
4
|
+
}>;
|
|
5
|
+
declare function mergeMarkdownStyleWithDefault(input: PartialMarkdownStyle | undefined): MarkdownStyle;
|
|
6
|
+
export type { PartialMarkdownStyle };
|
|
7
|
+
export { mergeMarkdownStyleWithDefault };
|
|
8
|
+
//# sourceMappingURL=styleUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styleUtils.d.ts","sourceRoot":"","sources":["../../../../src/styleUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAElF,KAAK,oBAAoB,GAAG,OAAO,CAAC;KACjC,CAAC,IAAI,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CACtD,CAAC,CAAA;AAyEF,iBAAS,6BAA6B,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS,GAAG,aAAa,CAiB7F;AAED,YAAY,EAAE,oBAAoB,EAAE,CAAA;AAEpC,OAAO,EAAE,6BAA6B,EAAE,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type HistoryItem = {
|
|
2
|
+
text: string;
|
|
3
|
+
cursorPosition: number | null;
|
|
4
|
+
};
|
|
5
|
+
export default class InputHistory {
|
|
6
|
+
depth: number;
|
|
7
|
+
items: HistoryItem[];
|
|
8
|
+
historyIndex: number;
|
|
9
|
+
currentText: string | null;
|
|
10
|
+
timeout: NodeJS.Timeout | null;
|
|
11
|
+
debounceTime: number;
|
|
12
|
+
constructor(depth: number, debounceTime?: number, startingText?: string);
|
|
13
|
+
getCurrentItem(): HistoryItem | null;
|
|
14
|
+
setHistory(newHistory: HistoryItem[]): void;
|
|
15
|
+
setHistoryIndex(index: number): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
throttledAdd(text: string, cursorPosition: number): void;
|
|
18
|
+
stopTimeout(): void;
|
|
19
|
+
add(text: string, cursorPosition: number): void;
|
|
20
|
+
undo(): HistoryItem | null;
|
|
21
|
+
redo(): HistoryItem | null;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=InputHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputHistory.d.ts","sourceRoot":"","sources":["../../../../../src/web/InputHistory.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,KAAK,EAAE,MAAM,CAAA;IAEb,KAAK,EAAE,WAAW,EAAE,CAAA;IAEpB,YAAY,EAAE,MAAM,CAAA;IAEpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAO;IAEjC,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAO;IAErC,YAAY,EAAE,MAAM,CAAA;gBAER,KAAK,EAAE,MAAM,EAAE,YAAY,SAAM,EAAE,YAAY,SAAK;IAOhE,cAAc,IAAI,WAAW,GAAG,IAAI;IAIpC,UAAU,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,IAAI;IAK3C,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIpC,KAAK,IAAI,IAAI;IAKb,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;IAkBxD,WAAW,IAAI,IAAI;IAQnB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;IAqB/C,IAAI,IAAI,WAAW,GAAG,IAAI;IA6B1B,IAAI,IAAI,WAAW,GAAG,IAAI;CAiB3B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { MarkdownRange } from "../../commonTypes";
|
|
2
|
+
import type { PartialMarkdownStyle } from "../../styleUtils";
|
|
3
|
+
import type { TextMeasurer } from "./measureUtils";
|
|
4
|
+
/**
|
|
5
|
+
* Where one line's text sits, and what has to be drawn in the space to its left.
|
|
6
|
+
*
|
|
7
|
+
* The same three numbers the native formatters produce: `firstLineIndent` is `firstLineHeadIndent`
|
|
8
|
+
* on iOS and `getLeadingMargin(true)` on Android, `indent` is the head indent the line resumes at
|
|
9
|
+
* when it wraps, and `ribbons` are the offsets `MarkdownTextLayoutFragment` and
|
|
10
|
+
* `MarkdownBlockIndentSpan` fill a blockquote's bars at.
|
|
11
|
+
*/
|
|
12
|
+
type LineLayout = {
|
|
13
|
+
firstLineIndent: number;
|
|
14
|
+
indent: number;
|
|
15
|
+
ribbons: number[];
|
|
16
|
+
/** Space to open after a marker, so the next container's gutter lands between the two. */
|
|
17
|
+
gaps: Map<number, number>;
|
|
18
|
+
};
|
|
19
|
+
declare function toNumber(value: string | number | undefined | null): number;
|
|
20
|
+
/**
|
|
21
|
+
* Places the containers of every line, left to right -- the web half of `BlockLayout` in
|
|
22
|
+
* `apple/MarkdownFormatter.swift` and `android/.../MarkdownFormatter.kt`, and deliberately the same
|
|
23
|
+
* walk.
|
|
24
|
+
*
|
|
25
|
+
* Each container reserves a gutter and is then followed by its own marker, which is text and so has
|
|
26
|
+
* to be stepped over rather than reserved: the container nested inside it starts after the marker,
|
|
27
|
+
* not in front of it. That is what puts a quote's ribbons after a list bullet, and a list's indent
|
|
28
|
+
* after a quote's `>`.
|
|
29
|
+
*
|
|
30
|
+
* A line continuing a block carries no marker of its own and reuses the one that opened it, which
|
|
31
|
+
* is why this runs across the whole document rather than per line: without it a continuation line
|
|
32
|
+
* would sit a marker's width to the left of the line above and break the block in two.
|
|
33
|
+
*
|
|
34
|
+
* It reads the ranges in the order the parser emits them -- marker, then the container it belongs
|
|
35
|
+
* to -- so it has to run before `sortRanges` rearranges them into the containment order the DOM
|
|
36
|
+
* builder needs.
|
|
37
|
+
*/
|
|
38
|
+
declare function layoutBlocks(text: string, ranges: MarkdownRange[], markdownStyle: PartialMarkdownStyle, measure: TextMeasurer): Map<number, LineLayout>;
|
|
39
|
+
export { layoutBlocks, toNumber };
|
|
40
|
+
export type { LineLayout };
|
|
41
|
+
//# sourceMappingURL=blockLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/blockLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAIlD;;;;;;;GAOG;AACH,KAAK,UAAU,GAAG;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,0FAA0F;IAC1F,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1B,CAAA;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CASnE;AA0BD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,YAAY,CACnB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EAAE,EACvB,aAAa,EAAE,oBAAoB,EACnC,OAAO,EAAE,YAAY,GACpB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CA+EzB;AAED,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAA;AACjC,YAAY,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PartialMarkdownStyle } from "../../styleUtils";
|
|
2
|
+
import type { LineLayout } from "./blockLayout";
|
|
3
|
+
import type { NodeType } from "./treeUtils";
|
|
4
|
+
/**
|
|
5
|
+
* Applies the layout the block walk computed for one line.
|
|
6
|
+
*
|
|
7
|
+
* Everything a container contributes lands here rather than on the container's own span: its gutter
|
|
8
|
+
* is part of the paragraph's indent, and its ribbon is painted behind the whole paragraph. That is
|
|
9
|
+
* how the native formatters do it too, and on the web it is the only placement that works -- a
|
|
10
|
+
* container's span begins before the markers of the containers outside it, so a border drawn on it
|
|
11
|
+
* would sit in front of a bullet that is meant to precede it, and a gutter set on it would open
|
|
12
|
+
* before that bullet rather than after.
|
|
13
|
+
*
|
|
14
|
+
* `padding-left` holds every line of the paragraph at the indent, and the negative `text-indent`
|
|
15
|
+
* pulls the first one back to where its own marker starts -- `firstLineHeadIndent` and `headIndent`,
|
|
16
|
+
* spelled in CSS. A line that wraps, or a line continuing the block with no marker of its own, then
|
|
17
|
+
* lines up with the text above it instead of with the marker.
|
|
18
|
+
*/
|
|
19
|
+
declare function addLineLayout(node: HTMLElement, layout: LineLayout | undefined, markdownStyle: PartialMarkdownStyle): void;
|
|
20
|
+
/**
|
|
21
|
+
* Opens the space a marker holds for the container that follows it.
|
|
22
|
+
*
|
|
23
|
+
* `MarkdownFormatter` kerns the marker's last character; the effect is the same, and it is what
|
|
24
|
+
* puts a nested list's indent between the quote's `>` and the bullet rather than in front of both.
|
|
25
|
+
*/
|
|
26
|
+
declare function addBlockPrefixGap(node: HTMLElement, gap: number | undefined): void;
|
|
27
|
+
declare function addStyleToBlock(targetElement: HTMLElement, type: NodeType, markdownStyle: PartialMarkdownStyle, isMultiline?: boolean): void;
|
|
28
|
+
declare const MULTILINE_MARKDOWN_TYPES: string[];
|
|
29
|
+
declare function isMultilineMarkdownType(type: NodeType): boolean;
|
|
30
|
+
declare function isChildOfMarkdownElement(node: HTMLElement, elementType: NodeType): boolean;
|
|
31
|
+
declare function isChildOfMultilineMarkdownElement(node: HTMLElement): boolean;
|
|
32
|
+
export { addStyleToBlock, addLineLayout, addBlockPrefixGap, isMultilineMarkdownType, isChildOfMarkdownElement, isChildOfMultilineMarkdownElement, MULTILINE_MARKDOWN_TYPES, };
|
|
33
|
+
//# sourceMappingURL=blockUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/blockUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAqB3C;;;;;;;;;;;;;;GAcG;AACH,iBAAS,aAAa,CACpB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,aAAa,EAAE,oBAAoB,QAiCpC;AAED;;;;;GAKG;AACH,iBAAS,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,QAIpE;AAED,iBAAS,eAAe,CACtB,aAAa,EAAE,WAAW,EAC1B,IAAI,EAAE,QAAQ,EACd,aAAa,EAAE,oBAAoB,EACnC,WAAW,UAAO,QAiFnB;AAgCD,QAAA,MAAM,wBAAwB,UAAgB,CAAA;AAE9C,iBAAS,uBAAuB,CAAC,IAAI,EAAE,QAAQ,WAE9C;AAiBD,iBAAS,wBAAwB,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAEnF;AACD,iBAAS,iCAAiC,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAIrE;AAED,OAAO,EACL,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,iCAAiC,EACjC,wBAAwB,GACzB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/browserUtils.ts"],"names":[],"mappings":"AA4BA,QAAA,MAAM,YAAY;;;;CAUjB,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MarkdownTextInputElement } from "../../MarkdownTextInput.web";
|
|
2
|
+
import type { TreeNode } from "./treeUtils";
|
|
3
|
+
declare function setCursorPosition(target: MarkdownTextInputElement, startIndex: number, endIndex?: number | null, shouldScrollIntoView?: boolean): void;
|
|
4
|
+
declare function scrollIntoView(target: MarkdownTextInputElement, node: TreeNode): void;
|
|
5
|
+
declare function moveCursorToEnd(target: HTMLElement): void;
|
|
6
|
+
declare function getCurrentCursorPosition(target: MarkdownTextInputElement): {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
} | null;
|
|
10
|
+
declare function removeSelection(): void;
|
|
11
|
+
export { getCurrentCursorPosition, moveCursorToEnd, setCursorPosition, removeSelection, scrollIntoView, };
|
|
12
|
+
//# sourceMappingURL=cursorUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursorUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/cursorUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAG3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAiB3C,iBAAS,iBAAiB,CACxB,MAAM,EAAE,wBAAwB,EAChC,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAM,GAAG,IAAW,EAC9B,oBAAoB,UAAQ,QA6D7B;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,wBAAwB,EAAE,IAAI,EAAE,QAAQ,QAgDvE;AAED,iBAAS,eAAe,CAAC,MAAM,EAAE,WAAW,QAa3C;AAED,iBAAS,wBAAwB,CAAC,MAAM,EAAE,wBAAwB;;;SAoCjE;AAED,iBAAS,eAAe,SAKvB;AAED,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import type { MarkdownNativeEvent, MarkdownTextInputElement } from "../../MarkdownTextInput.web";
|
|
3
|
+
declare function isEventComposing(nativeEvent: globalThis.KeyboardEvent | MarkdownNativeEvent): boolean;
|
|
4
|
+
declare function getPlaceholderValue(placeholder: string | undefined): string;
|
|
5
|
+
declare function getElementHeight(node: HTMLDivElement, styles: CSSProperties, numberOfLines: number | undefined): string;
|
|
6
|
+
declare function normalizeValue(value: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Parses the HTML structure of a MarkdownTextInputElement to a plain text string. Used for getting the correct value of the input element.
|
|
9
|
+
*/
|
|
10
|
+
declare function parseInnerHTMLToText(target: MarkdownTextInputElement, cursorPosition: number, inputType?: string, isMultiline?: boolean): string;
|
|
11
|
+
export { isEventComposing, getPlaceholderValue, getElementHeight, parseInnerHTMLToText, normalizeValue, };
|
|
12
|
+
//# sourceMappingURL=inputUtils.d.ts.map
|