@apollohg/react-native-rich-text-editor-code-highlighting 2.0.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.
Files changed (29) hide show
  1. package/LICENSE +160 -0
  2. package/NativeEditorCodeHighlighting.podspec +24 -0
  3. package/README.md +47 -0
  4. package/RUST-STANDARD-LIBRARY-NOTICES.html +8266 -0
  5. package/THIRD_PARTY_NOTICES.md +18451 -0
  6. package/android/build.gradle +25 -0
  7. package/android/consumer-rules.pro +1 -0
  8. package/android/src/main/AndroidManifest.xml +1 -0
  9. package/android/src/main/java/com/apollohg/editor/highlighting/NativeCodeHighlightingModule.kt +17 -0
  10. package/android/src/main/java/com/apollohg/editor/highlighting/SyntectHighlightingProvider.kt +23 -0
  11. package/android/src/main/java/uniffi/native_editor_highlighting/native_editor_highlighting.kt +1259 -0
  12. package/android/src/main/jniLibs/arm64-v8a/libnative_editor_highlighting.so +0 -0
  13. package/android/src/main/jniLibs/armeabi-v7a/libnative_editor_highlighting.so +0 -0
  14. package/android/src/main/jniLibs/x86/libnative_editor_highlighting.so +0 -0
  15. package/android/src/main/jniLibs/x86_64/libnative_editor_highlighting.so +0 -0
  16. package/dist/index.d.ts +7 -0
  17. package/dist/index.js +25 -0
  18. package/expo-module.config.json +10 -0
  19. package/ios/Generated_highlighting.swift +728 -0
  20. package/ios/NativeCodeHighlightingModule.swift +14 -0
  21. package/ios/NativeEditorHighlighting.xcframework/Info.plist +44 -0
  22. package/ios/NativeEditorHighlighting.xcframework/ios-arm64/libnative_editor_highlighting.a +0 -0
  23. package/ios/NativeEditorHighlighting.xcframework/ios-arm64_x86_64-simulator/libnative_editor_highlighting.a +0 -0
  24. package/ios/SyntectHighlightingProvider.swift +12 -0
  25. package/ios/native_editor_highlightingFFI/module.modulemap +7 -0
  26. package/ios/native_editor_highlightingFFI/native_editor_highlightingFFI.h +551 -0
  27. package/package.json +49 -0
  28. package/scripts/verify-package.mjs +19 -0
  29. package/src/index.ts +41 -0
@@ -0,0 +1,7 @@
1
+ import type { CodeHighlightingAddon } from '@apollohg/react-native-rich-text-editor';
2
+ export declare const codeHighlightingThemes: readonly ["base16-ocean.dark", "base16-eighties.dark", "base16-mocha.dark", "base16-ocean.light", "InspiredGitHub", "Solarized (dark)", "Solarized (light)"];
3
+ export type CodeHighlightingTheme = (typeof codeHighlightingThemes)[number];
4
+ export interface CodeHighlightingOptions {
5
+ readonly theme: CodeHighlightingTheme;
6
+ }
7
+ export declare function createCodeHighlightingAddon(options: CodeHighlightingOptions): CodeHighlightingAddon;
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ const nativeModule = requireNativeModule('NativeCodeHighlighting');
3
+ if (nativeModule.initialize() !== 1) {
4
+ throw new Error('Code highlighting requires native provider interface version 1. Rebuild the app.');
5
+ }
6
+ export const codeHighlightingThemes = Object.freeze([
7
+ 'base16-ocean.dark',
8
+ 'base16-eighties.dark',
9
+ 'base16-mocha.dark',
10
+ 'base16-ocean.light',
11
+ 'InspiredGitHub',
12
+ 'Solarized (dark)',
13
+ 'Solarized (light)',
14
+ ]);
15
+ export function createCodeHighlightingAddon(options) {
16
+ if (!options || !codeHighlightingThemes.includes(options.theme)) {
17
+ throw new Error('Unsupported code-highlighting theme. Use a name from codeHighlightingThemes.');
18
+ }
19
+ return Object.freeze({
20
+ id: 'code-highlighting',
21
+ version: 1,
22
+ capability: 'code-highlighting',
23
+ options: Object.freeze({ provider: 'syntect', theme: options.theme }),
24
+ });
25
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "platforms": ["ios", "android"],
3
+ "ios": {
4
+ "modules": ["NativeCodeHighlightingModule"],
5
+ "podspecPath": "./NativeEditorCodeHighlighting.podspec"
6
+ },
7
+ "android": {
8
+ "modules": ["com.apollohg.editor.highlighting.NativeCodeHighlightingModule"]
9
+ }
10
+ }