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 @@
|
|
|
1
|
+
{"version":3,"file":"inputUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/inputUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAQhG,iBAAS,gBAAgB,CAAC,WAAW,EAAE,UAAU,CAAC,aAAa,GAAG,mBAAmB,WAEpF;AAED,iBAAS,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,UAK3D;AAED,iBAAS,gBAAgB,CACvB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,GAAG,SAAS,UAelC;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,MAAM,UAEpC;AAmCD;;GAEG;AACH,iBAAS,oBAAoB,CAC3B,MAAM,EAAE,wBAAwB,EAChC,cAAc,EAAE,MAAM,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,UAAO,GACjB,MAAM,CAgHR;AAED,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Measures how wide a run of text renders in the input's own font.
|
|
3
|
+
*
|
|
4
|
+
* Block markers are real characters, so how far the containers nested inside them start is a
|
|
5
|
+
* question only the renderer can answer. The native formatters ask their text paint; here the
|
|
6
|
+
* question goes to the browser, through a hidden span carrying the input's font.
|
|
7
|
+
*
|
|
8
|
+
* Reading the span's box forces a layout, so every width is cached under the font it was measured
|
|
9
|
+
* in. Markers repeat -- a document has one `- ` and one `> ` however many lines use them -- so a
|
|
10
|
+
* keystroke normally measures nothing at all.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Binds a measuring function to the font `source` renders in.
|
|
14
|
+
*
|
|
15
|
+
* The font is read on the first measurement rather than up front: a document with no block markers
|
|
16
|
+
* never measures anything, and should not pay for a style recalculation to find that out.
|
|
17
|
+
*/
|
|
18
|
+
declare function createTextMeasurer(source: HTMLElement | null): (text: string) => number;
|
|
19
|
+
type TextMeasurer = ReturnType<typeof createTextMeasurer>;
|
|
20
|
+
export { createTextMeasurer };
|
|
21
|
+
export type { TextMeasurer };
|
|
22
|
+
//# sourceMappingURL=measureUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/measureUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAwDH;;;;;GAKG;AACH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,IAIxB,MAAM,MAAM,KAAG,MAAM,CAwClD;AAED,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEzD,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAC7B,YAAY,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { HTMLMarkdownElement, MarkdownTextInputElement } from "../../MarkdownTextInput.web";
|
|
2
|
+
import type { TreeNode } from "./treeUtils";
|
|
3
|
+
import type { PartialMarkdownStyle } from "../../styleUtils";
|
|
4
|
+
import type { LineLayout } from "./blockLayout";
|
|
5
|
+
import type { TextMeasurer } from "./measureUtils";
|
|
6
|
+
import type { MarkdownRange } from "../../commonTypes";
|
|
7
|
+
type Paragraph = {
|
|
8
|
+
text: string;
|
|
9
|
+
start: number;
|
|
10
|
+
length: number;
|
|
11
|
+
markdownRanges: MarkdownRange[];
|
|
12
|
+
/** Where the containers this line sits in put its text, once they are all placed. */
|
|
13
|
+
layout?: LineLayout;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* For singleline markdown types, the function splits markdown ranges that spread beyond the line length into separate lines.
|
|
17
|
+
* For multiline markdown types (like `pre`), it merges them and corresponding text into one line.
|
|
18
|
+
*/
|
|
19
|
+
declare function normalizeLines(lines: Paragraph[], ranges: MarkdownRange[]): Paragraph[];
|
|
20
|
+
/** Builds HTML DOM structure based on passed text and markdown ranges */
|
|
21
|
+
declare function parseRangesToHTMLNodes(text: string, ranges: MarkdownRange[], isMultiline?: boolean, markdownStyle?: PartialMarkdownStyle, disableInlineStyles?: boolean, measure?: TextMeasurer): {
|
|
22
|
+
dom: HTMLMarkdownElement;
|
|
23
|
+
tree: TreeNode;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A line as it was last rendered: what it was built from, the markup it produced, and its subtree.
|
|
27
|
+
*/
|
|
28
|
+
type CachedLine = {
|
|
29
|
+
signature: string;
|
|
30
|
+
html: string;
|
|
31
|
+
node: TreeNode;
|
|
32
|
+
};
|
|
33
|
+
type LineCache = {
|
|
34
|
+
markdownStyle: PartialMarkdownStyle;
|
|
35
|
+
isMultiline: boolean;
|
|
36
|
+
lines: CachedLine[];
|
|
37
|
+
};
|
|
38
|
+
declare function updateInputStructure(parserFunction: (input: string) => MarkdownRange[], target: MarkdownTextInputElement, text: string, cursorPositionIndex: number | null, isMultiline?: boolean, markdownStyle?: PartialMarkdownStyle, alwaysMoveCursorToTheEnd?: boolean, shouldForceDOMUpdate?: boolean, shouldScrollIntoView?: boolean): {
|
|
39
|
+
text: string;
|
|
40
|
+
cursorPosition: number;
|
|
41
|
+
};
|
|
42
|
+
export { updateInputStructure, parseRangesToHTMLNodes, normalizeLines };
|
|
43
|
+
export type { Paragraph, LineCache };
|
|
44
|
+
//# sourceMappingURL=parserUtils.d.ts.map
|
|
@@ -0,0 +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,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAS5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,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;AA2SD,yEAAyE;AACzE,iBAAS,sBAAsB,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EAAE,EACvB,WAAW,UAAO,EAClB,aAAa,GAAE,oBAAyB,EACxC,mBAAmB,UAAQ,EAC3B,OAAO,GAAE,YAAuC;;;EAyBjD;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,oBAAoB,CAAA;IACnC,WAAW,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AA0QD,iBAAS,oBAAoB,CAC3B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,EAAE,EAClD,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,MAAM,GAAG,IAAI,EAClC,WAAW,UAAO,EAClB,aAAa,GAAE,oBAAyB,EACxC,wBAAwB,UAAQ,EAChC,oBAAoB,UAAQ,EAC5B,oBAAoB,UAAQ;;;EAiD7B;AAED,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,cAAc,EAAE,CAAA;AACvE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HTMLMarkdownElement } from "../../MarkdownTextInput.web";
|
|
2
|
+
import type { MarkdownRange, MarkdownType } from "../../commonTypes";
|
|
3
|
+
type NodeType = MarkdownType | "line" | "text" | "br" | "root";
|
|
4
|
+
type TreeNode = Omit<MarkdownRange, "type"> & {
|
|
5
|
+
element: HTMLMarkdownElement;
|
|
6
|
+
parentNode: TreeNode | null;
|
|
7
|
+
childNodes: TreeNode[];
|
|
8
|
+
type: NodeType;
|
|
9
|
+
orderIndex: string;
|
|
10
|
+
isGeneratingNewline: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare function createRootTreeNode(target: HTMLMarkdownElement, length?: number, start?: number): TreeNode;
|
|
13
|
+
/**
|
|
14
|
+
* @param start Where the node begins in the text, when the caller knows it. A markdown range
|
|
15
|
+
* carries its own offset, and taking it is the only way to be right when ranges do not tile the
|
|
16
|
+
* line -- overlapping emphasis split across lines leaves gaps, and a node placed at wherever its
|
|
17
|
+
* previous sibling happened to end then reports an offset the text never had. Text and line breaks
|
|
18
|
+
* genuinely do follow on from what precedes them, so they still accumulate.
|
|
19
|
+
*/
|
|
20
|
+
declare function addNodeToTree(element: HTMLMarkdownElement, parentTreeNode: TreeNode, type: NodeType, length?: number | null, start?: number | null): TreeNode;
|
|
21
|
+
declare function findHTMLElementInTree(treeRoot: TreeNode, element: HTMLElement): TreeNode | null;
|
|
22
|
+
declare function getTreeNodeByIndex(treeRoot: TreeNode, index: number): TreeNode | null;
|
|
23
|
+
export { addNodeToTree, findHTMLElementInTree, getTreeNodeByIndex, createRootTreeNode };
|
|
24
|
+
export type { TreeNode, NodeType };
|
|
25
|
+
//# sourceMappingURL=treeUtils.d.ts.map
|
|
@@ -0,0 +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;AAE9D,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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TextStyle } from "react-native";
|
|
2
|
+
import type { MarkdownStyle } from "../../MarcusTextInputDecoratorViewNativeComponent";
|
|
3
|
+
declare function processMarkdownStyle(input: MarkdownStyle | undefined): MarkdownStyle;
|
|
4
|
+
declare function parseToReactDOMStyle(style: TextStyle): any;
|
|
5
|
+
declare const idGenerator: Generator<string, void, unknown>;
|
|
6
|
+
export { parseToReactDOMStyle, processMarkdownStyle, idGenerator };
|
|
7
|
+
//# sourceMappingURL=webStyleUtils.d.ts.map
|
|
@@ -0,0 +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;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAA;AAiDtF,iBAAS,oBAAoB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,aAAa,CAE7E;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":"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":"module"}
|
|
@@ -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.js";
|
|
6
|
+
import type { MarkdownRange } from "./commonTypes.js";
|
|
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,iBAAc,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAe,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.js";
|
|
5
|
+
import type { TreeNode } from "./web/utils/treeUtils.js";
|
|
6
|
+
import "./web/MarkdownTextInput.css";
|
|
7
|
+
import type { MarkdownStyle } from "./MarcusTextInputDecoratorViewNativeComponent";
|
|
8
|
+
import type { MarkdownRange } from "./commonTypes.js";
|
|
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,4BAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAAuB,CAAA;AAMrD,OAAO,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAalF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAe,CAAA;AAIlD,UAAU,sBAAuB,SAAQ,cAAc;IACrD,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,aAAa,EAAE,CAAA;IACzC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;IACjD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,UAAU,mBAAoB,SAAQ,KAAK;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,KAAK,iBAAiB,GAAG,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAA;AAE5E,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAcD,KAAK,wBAAwB,GAAG,cAAc,GAC5C,gBAAgB,GAAG;IACjB,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,CAAA;IACpB,kGAAkG;IAClG,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAEH,KAAK,mBAAmB,GAAG,WAAW,GAAG;IACvC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,QAAA,MAAM,iBAAiB,kGAmzBtB,CAAA;AAwBD,eAAe,iBAAiB,CAAA;AAEhC,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,GACpB,CAAA;AAED,iBAAS,iBAAiB,SAIzB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeMarcusModule.d.ts","sourceRoot":"","sources":["../../../../src/NativeMarcusModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG/C,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.js";
|
|
4
|
+
export { parse as parser } from "./parser/index.js";
|
|
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,kBAAe,CAAA;AAChE,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,mBAAU,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MarkdownRange } from "../commonTypes.js";
|
|
2
|
+
declare module "./index" {
|
|
3
|
+
function parse(markdown: string): MarkdownRange[];
|
|
4
|
+
}
|
|
5
|
+
declare global {
|
|
6
|
+
function __parse__micromark(markdown: string): MarkdownRange[];
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,mBAAgB,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.js";
|
|
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,kBAAe,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.js";
|
|
2
|
+
import type { PartialMarkdownStyle } from "../../styleUtils.js";
|
|
3
|
+
import type { TextMeasurer } from "./measureUtils.js";
|
|
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,sBAAmB,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAkB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAgB,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.js";
|
|
2
|
+
import type { LineLayout } from "./blockLayout.js";
|
|
3
|
+
import type { NodeType } from "./treeUtils.js";
|
|
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,qBAAkB,CAAA;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAa,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.js";
|
|
2
|
+
import type { TreeNode } from "./treeUtils.js";
|
|
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,gCAA6B,CAAA;AAG3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAa,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.js";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/inputUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,gCAA6B,CAAA;AAQhG,iBAAS,gBAAgB,CAAC,WAAW,EAAE,UAAU,CAAC,aAAa,GAAG,mBAAmB,WAEpF;AAED,iBAAS,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,UAK3D;AAED,iBAAS,gBAAgB,CACvB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,GAAG,SAAS,UAelC;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,MAAM,UAEpC;AAmCD;;GAEG;AACH,iBAAS,oBAAoB,CAC3B,MAAM,EAAE,wBAAwB,EAChC,cAAc,EAAE,MAAM,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,UAAO,GACjB,MAAM,CAgHR;AAED,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Measures how wide a run of text renders in the input's own font.
|
|
3
|
+
*
|
|
4
|
+
* Block markers are real characters, so how far the containers nested inside them start is a
|
|
5
|
+
* question only the renderer can answer. The native formatters ask their text paint; here the
|
|
6
|
+
* question goes to the browser, through a hidden span carrying the input's font.
|
|
7
|
+
*
|
|
8
|
+
* Reading the span's box forces a layout, so every width is cached under the font it was measured
|
|
9
|
+
* in. Markers repeat -- a document has one `- ` and one `> ` however many lines use them -- so a
|
|
10
|
+
* keystroke normally measures nothing at all.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Binds a measuring function to the font `source` renders in.
|
|
14
|
+
*
|
|
15
|
+
* The font is read on the first measurement rather than up front: a document with no block markers
|
|
16
|
+
* never measures anything, and should not pay for a style recalculation to find that out.
|
|
17
|
+
*/
|
|
18
|
+
declare function createTextMeasurer(source: HTMLElement | null): (text: string) => number;
|
|
19
|
+
type TextMeasurer = ReturnType<typeof createTextMeasurer>;
|
|
20
|
+
export { createTextMeasurer };
|
|
21
|
+
export type { TextMeasurer };
|
|
22
|
+
//# sourceMappingURL=measureUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/web/utils/measureUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAwDH;;;;;GAKG;AACH,iBAAS,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,IAIxB,MAAM,MAAM,KAAG,MAAM,CAwClD;AAED,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEzD,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAC7B,YAAY,EAAE,YAAY,EAAE,CAAA"}
|