react-native-photo-video-editor 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.
Files changed (162) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/CONTRIBUTING.md +101 -0
  3. package/LICENSE +20 -0
  4. package/PhotoVideoEditor.podspec +23 -0
  5. package/README.md +53 -0
  6. package/android/build.gradle +61 -0
  7. package/android/src/main/AndroidManifest.xml +12 -0
  8. package/android/src/main/java/com/photovideoeditor/PhotoVideoEditorModule.kt +126 -0
  9. package/android/src/main/java/com/photovideoeditor/PhotoVideoEditorPackage.kt +31 -0
  10. package/android/src/main/java/com/photovideoeditor/editor/PhotoVideoEditorActivity.kt +2521 -0
  11. package/android/src/main/java/com/photovideoeditor/editor/README.md +5 -0
  12. package/android/src/main/java/com/photovideoeditor/files/SourceResolver.kt +29 -0
  13. package/android/src/main/java/com/photovideoeditor/media/BitmapSampling.kt +11 -0
  14. package/android/src/main/java/com/photovideoeditor/model/EditorRequest.kt +3 -0
  15. package/android/src/main/java/com/photovideoeditor/photo/export/PhotoExporter.kt +201 -0
  16. package/android/src/main/java/com/photovideoeditor/photo/render/OverlayGeometry.kt +22 -0
  17. package/android/src/main/java/com/photovideoeditor/photo/render/PhotoAdjustmentRenderer.kt +160 -0
  18. package/android/src/main/java/com/photovideoeditor/photo/render/PhotoAdjustments.kt +55 -0
  19. package/android/src/main/java/com/photovideoeditor/photo/render/PhotoEditSession.kt +121 -0
  20. package/android/src/main/java/com/photovideoeditor/photo/render/PhotoFilterPresets.kt +64 -0
  21. package/android/src/main/java/com/photovideoeditor/photo/render/PhotoLayer.kt +54 -0
  22. package/android/src/main/java/com/photovideoeditor/photo/render/PhotoLayerRenderer.kt +108 -0
  23. package/android/src/main/java/com/photovideoeditor/photo/render/PhotoLayerStack.kt +60 -0
  24. package/android/src/main/java/com/photovideoeditor/photo/render/PhotoTransformState.kt +52 -0
  25. package/android/src/main/java/com/photovideoeditor/photo/ui/CropOverlayView.kt +168 -0
  26. package/android/src/main/java/com/photovideoeditor/photo/ui/FilterThumbnailLoader.kt +57 -0
  27. package/android/src/main/java/com/photovideoeditor/photo/ui/LayerOverlayView.kt +202 -0
  28. package/android/src/main/java/com/photovideoeditor/photo/ui/PhotoPreviewRenderCoordinator.kt +57 -0
  29. package/android/src/main/java/com/photovideoeditor/photo/ui/ZoomableImageView.kt +96 -0
  30. package/android/src/main/java/com/photovideoeditor/stickers/OnlineStickerSheet.kt +310 -0
  31. package/android/src/main/java/com/photovideoeditor/stickers/OpenMojiCatalog.kt +172 -0
  32. package/android/src/main/java/com/photovideoeditor/stickers/RemoteImageLoader.kt +110 -0
  33. package/android/src/main/java/com/photovideoeditor/ui/DesignTokens.kt +93 -0
  34. package/android/src/main/java/com/photovideoeditor/ui/components/EditorComponents.kt +119 -0
  35. package/android/src/main/java/com/photovideoeditor/validation/EditorRequestValidator.kt +11 -0
  36. package/android/src/main/java/com/photovideoeditor/video/cache/TimelineThumbnailRepository.kt +130 -0
  37. package/android/src/main/java/com/photovideoeditor/video/export/VideoExporter.kt +319 -0
  38. package/android/src/main/java/com/photovideoeditor/video/render/VideoClip.kt +20 -0
  39. package/android/src/main/java/com/photovideoeditor/video/render/VideoEditSession.kt +136 -0
  40. package/android/src/main/java/com/photovideoeditor/video/render/VideoThumbnailGenerator.kt +31 -0
  41. package/android/src/main/java/com/photovideoeditor/video/render/VideoTransformState.kt +48 -0
  42. package/android/src/main/java/com/photovideoeditor/video/ui/TrimRangeView.kt +104 -0
  43. package/android/src/main/res/drawable/ic_add.xml +9 -0
  44. package/android/src/main/res/drawable/ic_arrow_back.xml +9 -0
  45. package/android/src/main/res/drawable/ic_aspect_ratio.xml +9 -0
  46. package/android/src/main/res/drawable/ic_auto_fix_high.xml +9 -0
  47. package/android/src/main/res/drawable/ic_check.xml +9 -0
  48. package/android/src/main/res/drawable/ic_chevron_left.xml +9 -0
  49. package/android/src/main/res/drawable/ic_chevron_right.xml +9 -0
  50. package/android/src/main/res/drawable/ic_close.xml +9 -0
  51. package/android/src/main/res/drawable/ic_compare.xml +9 -0
  52. package/android/src/main/res/drawable/ic_content_copy.xml +9 -0
  53. package/android/src/main/res/drawable/ic_content_cut.xml +9 -0
  54. package/android/src/main/res/drawable/ic_crop.xml +9 -0
  55. package/android/src/main/res/drawable/ic_crop_square.xml +9 -0
  56. package/android/src/main/res/drawable/ic_delete.xml +9 -0
  57. package/android/src/main/res/drawable/ic_drag_indicator.xml +9 -0
  58. package/android/src/main/res/drawable/ic_face.xml +9 -0
  59. package/android/src/main/res/drawable/ic_filter_center_focus.xml +9 -0
  60. package/android/src/main/res/drawable/ic_flare.xml +9 -0
  61. package/android/src/main/res/drawable/ic_format_size.xml +9 -0
  62. package/android/src/main/res/drawable/ic_fullscreen.xml +9 -0
  63. package/android/src/main/res/drawable/ic_layers.xml +9 -0
  64. package/android/src/main/res/drawable/ic_light_mode.xml +9 -0
  65. package/android/src/main/res/drawable/ic_lock.xml +9 -0
  66. package/android/src/main/res/drawable/ic_magic_button.xml +9 -0
  67. package/android/src/main/res/drawable/ic_movie.xml +9 -0
  68. package/android/src/main/res/drawable/ic_opacity.xml +9 -0
  69. package/android/src/main/res/drawable/ic_palette.xml +9 -0
  70. package/android/src/main/res/drawable/ic_photo_filter.xml +9 -0
  71. package/android/src/main/res/drawable/ic_redo.xml +9 -0
  72. package/android/src/main/res/drawable/ic_rotate_90_degrees_ccw.xml +9 -0
  73. package/android/src/main/res/drawable/ic_rotate_left.xml +9 -0
  74. package/android/src/main/res/drawable/ic_rotate_right.xml +9 -0
  75. package/android/src/main/res/drawable/ic_sentiment_satisfied.xml +9 -0
  76. package/android/src/main/res/drawable/ic_share.xml +9 -0
  77. package/android/src/main/res/drawable/ic_speed.xml +9 -0
  78. package/android/src/main/res/drawable/ic_straighten.xml +9 -0
  79. package/android/src/main/res/drawable/ic_title.xml +9 -0
  80. package/android/src/main/res/drawable/ic_tune.xml +9 -0
  81. package/android/src/main/res/drawable/ic_undo.xml +9 -0
  82. package/android/src/main/res/drawable/ic_visibility_off.xml +9 -0
  83. package/android/src/main/res/drawable/ic_wallpaper.xml +9 -0
  84. package/android/src/main/res/values/styles.xml +10 -0
  85. package/docs/api.md +9 -0
  86. package/docs/architecture.md +9 -0
  87. package/docs/customization.md +18 -0
  88. package/docs/development.md +21 -0
  89. package/docs/formats.md +27 -0
  90. package/docs/performance.md +3 -0
  91. package/docs/permissions.md +3 -0
  92. package/docs/photo-editor.md +41 -0
  93. package/docs/roadmap.md +12 -0
  94. package/docs/technology-decisions.md +17 -0
  95. package/docs/video-editor.md +76 -0
  96. package/ios/Editor/DesignTokens.swift +75 -0
  97. package/ios/Editor/PhotoVideoEditorOutcome.swift +9 -0
  98. package/ios/Editor/PhotoVideoEditorViewController.swift +2064 -0
  99. package/ios/Editor/README.md +5 -0
  100. package/ios/Editor/UI/EditorComponents.swift +138 -0
  101. package/ios/Files/SourceResolver.swift +13 -0
  102. package/ios/Models/EditorRequest.swift +3 -0
  103. package/ios/Photo/Export/PhotoExporter.swift +144 -0
  104. package/ios/Photo/Rendering/OverlayGeometry.swift +22 -0
  105. package/ios/Photo/Rendering/PhotoAdjustmentRenderer.swift +141 -0
  106. package/ios/Photo/Rendering/PhotoAdjustments.swift +57 -0
  107. package/ios/Photo/Rendering/PhotoEditSession.swift +121 -0
  108. package/ios/Photo/Rendering/PhotoFilterPresets.swift +45 -0
  109. package/ios/Photo/Rendering/PhotoLayer.swift +59 -0
  110. package/ios/Photo/Rendering/PhotoLayerRenderer.swift +94 -0
  111. package/ios/Photo/Rendering/PhotoLayerStack.swift +60 -0
  112. package/ios/Photo/Rendering/PhotoTransformState.swift +49 -0
  113. package/ios/Photo/Rendering/PixelBuffer.swift +68 -0
  114. package/ios/Photo/UI/CropOverlayView.swift +161 -0
  115. package/ios/Photo/UI/LayerOverlayView.swift +176 -0
  116. package/ios/Photo/UI/ZoomableImageView.swift +79 -0
  117. package/ios/PhotoVideoEditor.mm +20 -0
  118. package/ios/PhotoVideoEditor.swift +70 -0
  119. package/ios/Stickers/OnlineStickerSheetViewController.swift +418 -0
  120. package/ios/Stickers/OpenMojiCatalog.swift +188 -0
  121. package/ios/Stickers/RemoteImageLoader.swift +127 -0
  122. package/ios/Validation/EditorRequestValidator.swift +9 -0
  123. package/ios/Video/Cache/TimelineThumbnailRepository.swift +148 -0
  124. package/ios/Video/Export/VideoExporter.swift +275 -0
  125. package/ios/Video/Render/VideoClip.swift +21 -0
  126. package/ios/Video/Render/VideoEditSession.swift +99 -0
  127. package/ios/Video/Render/VideoThumbnailGenerator.swift +25 -0
  128. package/ios/Video/Render/VideoTransformState.swift +23 -0
  129. package/ios/Video/UI/TrimRangeView.swift +91 -0
  130. package/lib/module/NativePhotoVideoEditor.js +5 -0
  131. package/lib/module/NativePhotoVideoEditor.js.map +1 -0
  132. package/lib/module/errors.js +29 -0
  133. package/lib/module/errors.js.map +1 -0
  134. package/lib/module/events.js +27 -0
  135. package/lib/module/events.js.map +1 -0
  136. package/lib/module/index.js +91 -0
  137. package/lib/module/index.js.map +1 -0
  138. package/lib/module/package.json +1 -0
  139. package/lib/module/project.js +4 -0
  140. package/lib/module/project.js.map +1 -0
  141. package/lib/module/types.js +2 -0
  142. package/lib/module/types.js.map +1 -0
  143. package/lib/typescript/package.json +1 -0
  144. package/lib/typescript/src/NativePhotoVideoEditor.d.ts +11 -0
  145. package/lib/typescript/src/NativePhotoVideoEditor.d.ts.map +1 -0
  146. package/lib/typescript/src/errors.d.ts +11 -0
  147. package/lib/typescript/src/errors.d.ts.map +1 -0
  148. package/lib/typescript/src/events.d.ts +5 -0
  149. package/lib/typescript/src/events.d.ts.map +1 -0
  150. package/lib/typescript/src/index.d.ts +15 -0
  151. package/lib/typescript/src/index.d.ts.map +1 -0
  152. package/lib/typescript/src/project.d.ts +24 -0
  153. package/lib/typescript/src/project.d.ts.map +1 -0
  154. package/lib/typescript/src/types.d.ts +108 -0
  155. package/lib/typescript/src/types.d.ts.map +1 -0
  156. package/package.json +154 -0
  157. package/src/NativePhotoVideoEditor.ts +12 -0
  158. package/src/errors.ts +78 -0
  159. package/src/events.ts +43 -0
  160. package/src/index.ts +123 -0
  161. package/src/project.ts +17 -0
  162. package/src/types.ts +121 -0
@@ -0,0 +1,25 @@
1
+ import AVFoundation
2
+ import UIKit
3
+
4
+ /// Extracts a fixed number of evenly spaced thumbnails for the trim strip.
5
+ /// Call off the main thread — `copyCGImage` decodes synchronously per frame.
6
+ enum VideoThumbnailGenerator {
7
+ static func generate(asset: AVAsset, durationMs: Int64, count: Int = 12) -> [UIImage] {
8
+ guard durationMs > 0 else { return [] }
9
+ let generator = AVAssetImageGenerator(asset: asset)
10
+ generator.appliesPreferredTrackTransform = true
11
+ generator.requestedTimeToleranceBefore = .zero
12
+ generator.requestedTimeToleranceAfter = .zero
13
+
14
+ let stepMs = durationMs / Int64(count)
15
+ var images: [UIImage] = []
16
+ for index in 0..<count {
17
+ let timeMs = index * Int(stepMs) + Int(stepMs) / 2
18
+ let time = CMTime(value: Int64(timeMs), timescale: 1000)
19
+ if let cgImage = try? generator.copyCGImage(at: time, actualTime: nil) {
20
+ images.append(UIImage(cgImage: cgImage))
21
+ }
22
+ }
23
+ return images
24
+ }
25
+ }
@@ -0,0 +1,23 @@
1
+ import CoreGraphics
2
+
3
+ /// Non-destructive video edit state that applies globally across the whole
4
+ /// multi-clip timeline (Milestone 7) — trim now lives per clip on `VideoClip`
5
+ /// instead of here, mirroring `VideoTransformState.kt`. `coverFrameMs` is a
6
+ /// position on the composed timeline (which, on iOS, is exactly
7
+ /// `session.player.currentTime()` since the preview player plays a single
8
+ /// `AVMutableComposition` concatenating every clip — see `VideoEditSession`).
9
+ struct VideoTransformState: Equatable {
10
+ var rotationDegrees: Int = 0
11
+ var aspectRatio: CGFloat?
12
+ var coverFrameMs: Int64 = 0
13
+ /// Preview-only for now: cycled via the Speed tool. Export does not yet honor this — see docs/video-editor.md.
14
+ var speed: Float = 1
15
+
16
+ mutating func rotateRight() { rotationDegrees = (rotationDegrees + 90) % 360 }
17
+
18
+ private static let speedSteps: [Float] = [0.5, 1, 1.5, 2]
19
+ mutating func cycleSpeed() {
20
+ let currentIndex = Self.speedSteps.firstIndex(of: speed) ?? 1
21
+ speed = Self.speedSteps[(currentIndex + 1) % Self.speedSteps.count]
22
+ }
23
+ }
@@ -0,0 +1,91 @@
1
+ import UIKit
2
+
3
+ /// Dual-handle trim range selector drawn over a horizontal thumbnail strip.
4
+ /// `startFraction`/`endFraction` are fractions (0...1) of the video's total
5
+ /// duration; a minimum gap between them is enforced so a trim can never
6
+ /// collapse to (or past) zero length. Mirrors `TrimRangeView.kt`.
7
+ final class TrimRangeView: UIView {
8
+ var thumbnails: [UIImage] = [] { didSet { setNeedsDisplay() } }
9
+ private(set) var startFraction: CGFloat = 0
10
+ private(set) var endFraction: CGFloat = 1
11
+ var minDurationFraction: CGFloat = 0.02
12
+ var onRangeChanged: ((_ start: CGFloat, _ end: CGFloat) -> Void)?
13
+
14
+ private let handleWidth: CGFloat = 28
15
+ private var activeHandle: Handle = .none
16
+
17
+ private enum Handle { case none, start, end }
18
+
19
+ override init(frame: CGRect) {
20
+ super.init(frame: frame)
21
+ backgroundColor = .clear
22
+ isOpaque = false
23
+ }
24
+
25
+ required init?(coder: NSCoder) { nil }
26
+
27
+ func setRange(start: CGFloat, end: CGFloat) {
28
+ startFraction = min(max(start, 0), 1)
29
+ endFraction = min(max(end, startFraction), 1)
30
+ setNeedsDisplay()
31
+ }
32
+
33
+ override func draw(_ rect: CGRect) {
34
+ guard let ctx = UIGraphicsGetCurrentContext() else { return }
35
+ let w = bounds.width
36
+ let h = bounds.height
37
+ guard w > 0, h > 0 else { return }
38
+
39
+ if thumbnails.isEmpty {
40
+ ctx.setFillColor(UIColor.darkGray.cgColor)
41
+ ctx.fill(bounds)
42
+ } else {
43
+ let thumbWidth = w / CGFloat(thumbnails.count)
44
+ for (index, image) in thumbnails.enumerated() {
45
+ image.draw(in: CGRect(x: CGFloat(index) * thumbWidth, y: 0, width: thumbWidth, height: h))
46
+ }
47
+ }
48
+
49
+ let startX = startFraction * w
50
+ let endX = endFraction * w
51
+ ctx.setFillColor(UIColor.black.withAlphaComponent(0.63).cgColor)
52
+ ctx.fill(CGRect(x: 0, y: 0, width: startX, height: h))
53
+ ctx.fill(CGRect(x: endX, y: 0, width: w - endX, height: h))
54
+
55
+ ctx.setStrokeColor(UIColor.white.cgColor)
56
+ ctx.setLineWidth(3)
57
+ ctx.stroke(CGRect(x: startX, y: 0, width: endX - startX, height: h))
58
+
59
+ ctx.setFillColor(UIColor.white.cgColor)
60
+ ctx.fill(CGRect(x: startX - handleWidth / 2, y: 0, width: handleWidth, height: h))
61
+ ctx.fill(CGRect(x: endX - handleWidth / 2, y: 0, width: handleWidth, height: h))
62
+ }
63
+
64
+ override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
65
+ guard bounds.width > 0, let point = touches.first?.location(in: self) else { return }
66
+ let startX = startFraction * bounds.width
67
+ let endX = endFraction * bounds.width
68
+ if abs(point.x - startX) < handleWidth {
69
+ activeHandle = .start
70
+ } else if abs(point.x - endX) < handleWidth {
71
+ activeHandle = .end
72
+ } else {
73
+ activeHandle = .none
74
+ }
75
+ }
76
+
77
+ override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
78
+ guard activeHandle != .none, bounds.width > 0, let point = touches.first?.location(in: self) else { return }
79
+ let fraction = min(max(point.x / bounds.width, 0), 1)
80
+ switch activeHandle {
81
+ case .start: startFraction = min(fraction, endFraction - minDurationFraction)
82
+ case .end: endFraction = max(fraction, startFraction + minDurationFraction)
83
+ case .none: return
84
+ }
85
+ setNeedsDisplay()
86
+ onRangeChanged?(startFraction, endFraction)
87
+ }
88
+
89
+ override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { activeHandle = .none }
90
+ override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) { activeHandle = .none }
91
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('PhotoVideoEditor');
5
+ //# sourceMappingURL=NativePhotoVideoEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativePhotoVideoEditor.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAUlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,kBAAkB,CAAC","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ /** Stable error codes exposed across Android and iOS. */
4
+
5
+ const codes = new Set(['E_INVALID_OPTIONS', 'E_INVALID_URI', 'E_UNSUPPORTED_MEDIA_TYPE', 'E_SOURCE_NOT_FOUND', 'E_SOURCE_UNREADABLE', 'E_UNSUPPORTED_FORMAT', 'E_EDITOR_ALREADY_OPEN', 'E_EDITOR_UNAVAILABLE', 'E_EDITOR_CANCELLED', 'E_EXPORT_FAILED', 'E_EXPORT_IN_PROGRESS', 'E_EXPORT_CANCELLED', 'E_INSUFFICIENT_STORAGE', 'E_OUT_OF_MEMORY', 'E_CODEC_UNAVAILABLE', 'E_PROJECT_INVALID', 'E_PROJECT_VERSION_UNSUPPORTED', 'E_PERMISSION_DENIED', 'E_INTERNAL']);
6
+
7
+ /** Error thrown by every public asynchronous operation. */
8
+ export class PhotoVideoEditorError extends Error {
9
+ /** Stable machine-readable code. */
10
+ /** Sanitized original native metadata, when available. */
11
+ constructor(code, message, native) {
12
+ super(message);
13
+ this.name = 'PhotoVideoEditorError';
14
+ this.code = code;
15
+ this.native = native;
16
+ }
17
+ }
18
+
19
+ /** Converts unknown native rejection values to the stable public error class. */
20
+ export function normalizeEditorError(error) {
21
+ if (error instanceof PhotoVideoEditorError) return error;
22
+ const value = typeof error === 'object' && error !== null ? error : {};
23
+ const code = typeof value.code === 'string' && codes.has(value.code) ? value.code : 'E_INTERNAL';
24
+ const message = typeof value.message === 'string' && value.message.trim() ? value.message : 'The native editor failed unexpectedly.';
25
+ return new PhotoVideoEditorError(code, message, {
26
+ code: value.code
27
+ });
28
+ }
29
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["codes","Set","PhotoVideoEditorError","Error","constructor","code","message","native","name","normalizeEditorError","error","value","has","trim"],"sourceRoot":"../../src","sources":["errors.ts"],"mappings":";;AAAA;;AAsBA,MAAMA,KAAK,GAAG,IAAIC,GAAG,CAA4B,CAC/C,mBAAmB,EACnB,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,+BAA+B,EAC/B,qBAAqB,EACrB,YAAY,CACb,CAAC;;AAEF;AACA,OAAO,MAAMC,qBAAqB,SAASC,KAAK,CAAC;EAC/C;EACA;EACAC,WAAWA,CACTC,IAA+B,EAC/BC,OAAe,EACfC,MAAgB,EAChB;IACA,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,uBAAuB;IACnC,IAAI,CAACH,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACE,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA,OAAO,SAASE,oBAAoBA,CAACC,KAAc,EAAyB;EAC1E,IAAIA,KAAK,YAAYR,qBAAqB,EAAE,OAAOQ,KAAK;EACxD,MAAMC,KAAK,GACT,OAAOD,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,GACtCA,KAAK,GACN,CAAC,CAAC;EACR,MAAML,IAAI,GACR,OAAOM,KAAK,CAACN,IAAI,KAAK,QAAQ,IAC9BL,KAAK,CAACY,GAAG,CAACD,KAAK,CAACN,IAAiC,CAAC,GAC7CM,KAAK,CAACN,IAAI,GACX,YAAY;EAClB,MAAMC,OAAO,GACX,OAAOK,KAAK,CAACL,OAAO,KAAK,QAAQ,IAAIK,KAAK,CAACL,OAAO,CAACO,IAAI,CAAC,CAAC,GACrDF,KAAK,CAACL,OAAO,GACb,wCAAwC;EAC9C,OAAO,IAAIJ,qBAAqB,CAACG,IAAI,EAAEC,OAAO,EAAE;IAAED,IAAI,EAAEM,KAAK,CAACN;EAAK,CAAC,CAAC;AACvE","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ import NativePhotoVideoEditor from "./NativePhotoVideoEditor.js";
4
+ import { PhotoVideoEditorError } from "./errors.js";
5
+ export function addEditorEventListener(listener) {
6
+ if (typeof listener !== 'function') throw new PhotoVideoEditorError('E_INVALID_OPTIONS', 'Editor listener must be a function.');
7
+ return NativePhotoVideoEditor.onEditorEvent(payload => {
8
+ try {
9
+ listener(JSON.parse(payload));
10
+ } catch {
11
+ /* malformed native event */
12
+ }
13
+ });
14
+ }
15
+
16
+ /** Subscribes to real native export updates. Milestone one emits none. */
17
+ export function addExportProgressListener(listener) {
18
+ if (typeof listener !== 'function') throw new PhotoVideoEditorError('E_INVALID_OPTIONS', 'Progress listener must be a function.');
19
+ return NativePhotoVideoEditor.onExportProgress(payload => {
20
+ try {
21
+ listener(JSON.parse(payload));
22
+ } catch {
23
+ /* Ignore malformed native events. */
24
+ }
25
+ });
26
+ }
27
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativePhotoVideoEditor","PhotoVideoEditorError","addEditorEventListener","listener","onEditorEvent","payload","JSON","parse","addExportProgressListener","onExportProgress"],"sourceRoot":"../../src","sources":["events.ts"],"mappings":";;AAAA,OAAOA,sBAAsB,MAAM,6BAA0B;AAC7D,SAASC,qBAAqB,QAAQ,aAAU;AAQhD,OAAO,SAASC,sBAAsBA,CACpCC,QAA6B,EACT;EACpB,IAAI,OAAOA,QAAQ,KAAK,UAAU,EAChC,MAAM,IAAIF,qBAAqB,CAC7B,mBAAmB,EACnB,qCACF,CAAC;EACH,OAAOD,sBAAsB,CAACI,aAAa,CAAEC,OAAO,IAAK;IACvD,IAAI;MACFF,QAAQ,CAACG,IAAI,CAACC,KAAK,CAACF,OAAO,CAAgB,CAAC;IAC9C,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ,CAAC,CAAC;AACJ;;AAEA;AACA,OAAO,SAASG,yBAAyBA,CACvCL,QAA8C,EAC1B;EACpB,IAAI,OAAOA,QAAQ,KAAK,UAAU,EAChC,MAAM,IAAIF,qBAAqB,CAC7B,mBAAmB,EACnB,uCACF,CAAC;EACH,OAAOD,sBAAsB,CAACS,gBAAgB,CAAEJ,OAAO,IAAK;IAC1D,IAAI;MACFF,QAAQ,CAACG,IAAI,CAACC,KAAK,CAACF,OAAO,CAAwB,CAAC;IACtD,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ import NativePhotoVideoEditor from "./NativePhotoVideoEditor.js";
4
+ import { PhotoVideoEditorError, normalizeEditorError } from "./errors.js";
5
+ export { addEditorEventListener, addExportProgressListener } from "./events.js";
6
+ export { PhotoVideoEditorError } from "./errors.js";
7
+ export { EDITOR_PROJECT_SCHEMA_VERSION } from "./project.js";
8
+ const mediaTypes = new Set(['photo', 'video']);
9
+ const qualities = new Set(['low', 'medium', 'high', 'original']);
10
+ const imageFormats = new Set(['jpeg', 'png', 'webp']);
11
+ const videoFormats = new Set(['mp4', 'mov']);
12
+ const defaultFeatures = {
13
+ crop: true,
14
+ rotate: true,
15
+ trim: true,
16
+ filters: true,
17
+ text: true,
18
+ stickers: true,
19
+ overlays: true,
20
+ onlineStickers: true
21
+ };
22
+ function invalid(message) {
23
+ throw new PhotoVideoEditorError('E_INVALID_OPTIONS', message);
24
+ }
25
+ function positive(value, name) {
26
+ if (value !== undefined && (!Number.isFinite(value) || value <= 0)) invalid(`${name} must be a positive number.`);
27
+ }
28
+ function normalizeOptions(input) {
29
+ if (!input || typeof input !== 'object' || !input.source || typeof input.source !== 'object') invalid('options.source is required.');
30
+ if (typeof input.source.uri !== 'string' || !input.source.uri.trim()) throw new PhotoVideoEditorError('E_INVALID_URI', 'source.uri must be a non-empty string.');
31
+ if (!mediaTypes.has(input.source.type)) throw new PhotoVideoEditorError('E_UNSUPPORTED_MEDIA_TYPE', 'source.type must be photo or video.');
32
+ const output = input.export ?? {};
33
+ if (output.quality !== undefined && !qualities.has(output.quality)) invalid('export.quality is unsupported.');
34
+ if (output.imageFormat !== undefined && !imageFormats.has(output.imageFormat)) invalid('export.imageFormat is unsupported.');
35
+ if (output.videoFormat !== undefined && !videoFormats.has(output.videoFormat)) invalid('export.videoFormat is unsupported.');
36
+ positive(output.maxWidth, 'export.maxWidth');
37
+ positive(output.maxHeight, 'export.maxHeight');
38
+ positive(output.videoBitrate, 'export.videoBitrate');
39
+ positive(output.frameRate, 'export.frameRate');
40
+ if (input.source.type === 'photo' && output.videoFormat !== undefined) invalid('videoFormat is only valid for video sources.');
41
+ if (input.source.type === 'video' && output.imageFormat !== undefined) invalid('imageFormat is only valid for photo sources.');
42
+ const features = {
43
+ ...defaultFeatures,
44
+ ...input.features
45
+ };
46
+ if (input.source.type === 'photo') {
47
+ features.trim = false;
48
+ }
49
+ return {
50
+ ...input,
51
+ source: {
52
+ ...input.source,
53
+ uri: input.source.uri.trim()
54
+ },
55
+ features,
56
+ export: {
57
+ quality: 'high',
58
+ preserveMetadata: true,
59
+ ...output
60
+ },
61
+ saveToGallery: input.saveToGallery ?? false
62
+ };
63
+ }
64
+
65
+ /** Opens the full-screen native editor selected by source.type. */
66
+ export async function openEditor(options) {
67
+ try {
68
+ return JSON.parse(await NativePhotoVideoEditor.openEditor(JSON.stringify(normalizeOptions(options))));
69
+ } catch (error) {
70
+ throw normalizeEditorError(error);
71
+ }
72
+ }
73
+ export function openPhotoEditor(options) {
74
+ return openEditor(options);
75
+ }
76
+ export function openVideoEditor(options) {
77
+ return openEditor(options);
78
+ }
79
+ /** Requests cancellation. Returns false in milestone one because no export job exists. */
80
+ export async function cancelExport(jobId) {
81
+ try {
82
+ return await NativePhotoVideoEditor.cancelExport(jobId ?? null);
83
+ } catch (error) {
84
+ throw normalizeEditorError(error);
85
+ }
86
+ }
87
+ /** Returns whether the linked native module is available on this device. */
88
+ export function isAvailable() {
89
+ return NativePhotoVideoEditor.isAvailable();
90
+ }
91
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativePhotoVideoEditor","PhotoVideoEditorError","normalizeEditorError","addEditorEventListener","addExportProgressListener","EDITOR_PROJECT_SCHEMA_VERSION","mediaTypes","Set","qualities","imageFormats","videoFormats","defaultFeatures","crop","rotate","trim","filters","text","stickers","overlays","onlineStickers","invalid","message","positive","value","name","undefined","Number","isFinite","normalizeOptions","input","source","uri","has","type","output","export","quality","imageFormat","videoFormat","maxWidth","maxHeight","videoBitrate","frameRate","features","preserveMetadata","saveToGallery","openEditor","options","JSON","parse","stringify","error","openPhotoEditor","openVideoEditor","cancelExport","jobId","isAvailable"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,sBAAsB,MAAM,6BAA0B;AAC7D,SAASC,qBAAqB,EAAEC,oBAAoB,QAAQ,aAAU;AAYtE,SAASC,sBAAsB,EAAEC,yBAAyB,QAAQ,aAAU;AAC5E,SAASH,qBAAqB,QAAQ,aAAU;AAEhD,SAASI,6BAA6B,QAAQ,cAAW;AAGzD,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACzD,MAAMC,SAAS,GAAG,IAAID,GAAG,CAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAC/E,MAAME,YAAY,GAAG,IAAIF,GAAG,CAAoB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACxE,MAAMG,YAAY,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,GAAG,CAACjB,IAAI,CAAC;IAAE,CAAC;IACzD6B,QAAQ;IACRR,MAAM,EAAE;MAAEC,OAAO,EAAE,MAAM;MAAEQ,gBAAgB,EAAE,IAAI;MAAE,GAAGV;IAAO,CAAC;IAC9DW,aAAa,EAAEhB,KAAK,CAACgB,aAAa,IAAI;EACxC,CAAC;AACH;;AAEA;AACA,OAAO,eAAeC,UAAUA,CAC9BC,OAAsB,EACC;EACvB,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CACf,MAAMjD,sBAAsB,CAAC8C,UAAU,CACrCE,IAAI,CAACE,SAAS,CAACtB,gBAAgB,CAACmB,OAAO,CAAC,CAC1C,CACF,CAAC;EACH,CAAC,CAAC,OAAOI,KAAK,EAAE;IACd,MAAMjD,oBAAoB,CAACiD,KAAK,CAAC;EACnC;AACF;AACA,OAAO,SAASC,eAAeA,CAC7BL,OAA2B,EACJ;EACvB,OAAOD,UAAU,CAACC,OAAO,CAAC;AAC5B;AACA,OAAO,SAASM,eAAeA,CAC7BN,OAA2B,EACJ;EACvB,OAAOD,UAAU,CAACC,OAAO,CAAC;AAC5B;AACA;AACA,OAAO,eAAeO,YAAYA,CAACC,KAAc,EAAoB;EACnE,IAAI;IACF,OAAO,MAAMvD,sBAAsB,CAACsD,YAAY,CAACC,KAAK,IAAI,IAAI,CAAC;EACjE,CAAC,CAAC,OAAOJ,KAAK,EAAE;IACd,MAAMjD,oBAAoB,CAACiD,KAAK,CAAC;EACnC;AACF;AACA;AACA,OAAO,SAASK,WAAWA,CAAA,EAAY;EACrC,OAAOxD,sBAAsB,CAACwD,WAAW,CAAC,CAAC;AAC7C","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export const EDITOR_PROJECT_SCHEMA_VERSION = 1;
4
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EDITOR_PROJECT_SCHEMA_VERSION"],"sourceRoot":"../../src","sources":["project.ts"],"mappings":";;AACA,OAAO,MAAMA,6BAA6B,GAAG,CAAU","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,11 @@
1
+ import type { CodegenTypes, TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ openEditor(request: string): Promise<string>;
4
+ cancelExport(jobId: string | null): Promise<boolean>;
5
+ isAvailable(): boolean;
6
+ readonly onExportProgress: CodegenTypes.EventEmitter<string>;
7
+ readonly onEditorEvent: CodegenTypes.EventEmitter<string>;
8
+ }
9
+ declare const _default: Spec;
10
+ export default _default;
11
+ //# sourceMappingURL=NativePhotoVideoEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativePhotoVideoEditor.d.ts","sourceRoot":"","sources":["../../../src/NativePhotoVideoEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,WAAW,IAAI,OAAO,CAAC;IACvB,QAAQ,CAAC,gBAAgB,EAAE,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7D,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;CAC3D;;AAED,wBAA0E"}
@@ -0,0 +1,11 @@
1
+ /** Stable error codes exposed across Android and iOS. */
2
+ export type PhotoVideoEditorErrorCode = 'E_INVALID_OPTIONS' | 'E_INVALID_URI' | 'E_UNSUPPORTED_MEDIA_TYPE' | 'E_SOURCE_NOT_FOUND' | 'E_SOURCE_UNREADABLE' | 'E_UNSUPPORTED_FORMAT' | 'E_EDITOR_ALREADY_OPEN' | 'E_EDITOR_UNAVAILABLE' | 'E_EDITOR_CANCELLED' | 'E_EXPORT_FAILED' | 'E_EXPORT_IN_PROGRESS' | 'E_EXPORT_CANCELLED' | 'E_INSUFFICIENT_STORAGE' | 'E_OUT_OF_MEMORY' | 'E_CODEC_UNAVAILABLE' | 'E_PROJECT_INVALID' | 'E_PROJECT_VERSION_UNSUPPORTED' | 'E_PERMISSION_DENIED' | 'E_INTERNAL';
3
+ /** Error thrown by every public asynchronous operation. */
4
+ export declare class PhotoVideoEditorError extends Error {
5
+ /** Stable machine-readable code. */ readonly code: PhotoVideoEditorErrorCode;
6
+ /** Sanitized original native metadata, when available. */ readonly native?: unknown;
7
+ constructor(code: PhotoVideoEditorErrorCode, message: string, native?: unknown);
8
+ }
9
+ /** Converts unknown native rejection values to the stable public error class. */
10
+ export declare function normalizeEditorError(error: unknown): PhotoVideoEditorError;
11
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,MAAM,yBAAyB,GACjC,mBAAmB,GACnB,eAAe,GACf,0BAA0B,GAC1B,oBAAoB,GACpB,qBAAqB,GACrB,sBAAsB,GACtB,uBAAuB,GACvB,sBAAsB,GACtB,oBAAoB,GACpB,iBAAiB,GACjB,sBAAsB,GACtB,oBAAoB,GACpB,wBAAwB,GACxB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,+BAA+B,GAC/B,qBAAqB,GACrB,YAAY,CAAC;AAwBjB,2DAA2D;AAC3D,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,oCAAoC,CAAC,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IAC9E,0DAA0D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;gBAEnF,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO;CAOnB;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAgB1E"}
@@ -0,0 +1,5 @@
1
+ import type { EditorEventListener, EditorSubscription, ExportProgressEvent } from './types.js';
2
+ export declare function addEditorEventListener(listener: EditorEventListener): EditorSubscription;
3
+ /** Subscribes to real native export updates. Milestone one emits none. */
4
+ export declare function addExportProgressListener(listener: (event: ExportProgressEvent) => void): EditorSubscription;
5
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,YAAS,CAAC;AAEjB,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,CAapB;AAED,0EAA0E;AAC1E,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAC7C,kBAAkB,CAapB"}
@@ -0,0 +1,15 @@
1
+ import type { EditorOptions, EditorResult, PhotoEditorOptions, VideoEditorOptions } from './types.js';
2
+ export { addEditorEventListener, addExportProgressListener } from './events.js';
3
+ export { PhotoVideoEditorError } from './errors.js';
4
+ export type * from './types.js';
5
+ export { EDITOR_PROJECT_SCHEMA_VERSION } from './project.js';
6
+ export type { EditorProject } from './project.js';
7
+ /** Opens the full-screen native editor selected by source.type. */
8
+ export declare function openEditor(options: EditorOptions): Promise<EditorResult>;
9
+ export declare function openPhotoEditor(options: PhotoEditorOptions): Promise<EditorResult>;
10
+ export declare function openVideoEditor(options: VideoEditorOptions): Promise<EditorResult>;
11
+ /** Requests cancellation. Returns false in milestone one because no export job exists. */
12
+ export declare function cancelExport(jobId?: string): Promise<boolean>;
13
+ /** Returns whether the linked native module is available on this device. */
14
+ export declare function isAvailable(): boolean;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EAIZ,kBAAkB,EAElB,kBAAkB,EACnB,MAAM,YAAS,CAAC;AAEjB,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,aAAU,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAU,CAAC;AACjD,mBAAmB,YAAS,CAAC;AAC7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAW,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,cAAW,CAAC;AAsE/C,mEAAmE;AACnE,wBAAsB,UAAU,CAC9B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAUvB;AACD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAEvB;AACD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAEvB;AACD,0FAA0F;AAC1F,wBAAsB,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAMnE;AACD,4EAA4E;AAC5E,wBAAgB,WAAW,IAAI,OAAO,CAErC"}
@@ -0,0 +1,24 @@
1
+ import type { EditorSource, ExportOptions } from './types.js';
2
+ export declare const EDITOR_PROJECT_SCHEMA_VERSION: 1;
3
+ export interface EditorProject {
4
+ schemaVersion: typeof EDITOR_PROJECT_SCHEMA_VERSION;
5
+ id: string;
6
+ source: EditorSource;
7
+ canvas: {
8
+ width: number;
9
+ height: number;
10
+ backgroundColor: string;
11
+ durationMs?: number;
12
+ };
13
+ tracks: Array<{
14
+ id: string;
15
+ items: string[];
16
+ }>;
17
+ adjustments: Record<string, number>;
18
+ exportDefaults: ExportOptions;
19
+ metadata: {
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ };
23
+ }
24
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAS,CAAC;AAC3D,eAAO,MAAM,6BAA6B,EAAG,CAAU,CAAC;AACxD,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,OAAO,6BAA6B,CAAC;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,MAAM,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,cAAc,EAAE,aAAa,CAAC;IAC9B,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD"}
@@ -0,0 +1,108 @@
1
+ /** Kind of local media supplied to the editor. */
2
+ export type MediaType = 'photo' | 'video';
3
+ /** Requested export quality preset. */
4
+ export type ExportQuality = 'low' | 'medium' | 'high' | 'original';
5
+ /** Supported photo output container. */
6
+ export type ImageExportFormat = 'jpeg' | 'png' | 'webp';
7
+ /** Supported video output container. */
8
+ export type VideoExportFormat = 'mp4' | 'mov';
9
+ /** Lifecycle state reported by future export jobs. */
10
+ export type EditorStatus = 'idle' | 'preparing' | 'editing' | 'exporting' | 'completed' | 'cancelled' | 'failed';
11
+ /** A local file or platform content URI. Remote URLs are not supported. */
12
+ export interface EditorSource {
13
+ /** Local file/content URI. */ uri: string;
14
+ /** Media kind. */ type: MediaType;
15
+ /** Optional MIME type hint. */ mimeType?: string;
16
+ /** Optional display filename. */ fileName?: string;
17
+ }
18
+ /** Feature switches. Video-only switches are normalized off for photos. */
19
+ export interface EditorFeatures {
20
+ /** Enables cropping. */ crop?: boolean;
21
+ /** Enables rotation. */ rotate?: boolean;
22
+ /** Enables video trimming. */ trim?: boolean;
23
+ /** Enables filters. */ filters?: boolean;
24
+ /** Enables text overlays. */ text?: boolean;
25
+ /** Enables stickers (built-in, consumer-supplied, and user-uploaded). */ stickers?: boolean;
26
+ /** Enables the user-uploaded image overlay tool. */ overlays?: boolean;
27
+ /** Enables browsing/downloading free stickers from the internet (OpenMoji). Disable to prevent any network calls. */ onlineStickers?: boolean;
28
+ }
29
+ /** Future native editor appearance options. */
30
+ export interface EditorTheme {
31
+ /** CSS-style primary color. */ primaryColor?: string;
32
+ /** Editor background color. */ backgroundColor?: string;
33
+ /** Toolbar color. */ toolbarColor?: string;
34
+ /** Foreground text color. */ textColor?: string;
35
+ /** Status bar content style. */ statusBarStyle?: 'light' | 'dark';
36
+ }
37
+ /** Export preferences. The milestone-one placeholder does not export media. */
38
+ export interface ExportOptions {
39
+ /** Quality preset. */ quality?: ExportQuality;
40
+ /** Photo output format; photo sources only. */ imageFormat?: ImageExportFormat;
41
+ /** Video output format; video sources only. */ videoFormat?: VideoExportFormat;
42
+ /** Maximum output width in pixels; must be positive. */ maxWidth?: number;
43
+ /** Maximum output height in pixels; must be positive. */ maxHeight?: number;
44
+ /** Video bitrate in bits per second; must be positive. */ videoBitrate?: number;
45
+ /** Video frame rate in frames per second; must be positive. */ frameRate?: number;
46
+ /** Whether future exports should retain safe metadata. */ preserveMetadata?: boolean;
47
+ }
48
+ /** A consumer-provided font for text layers. Licensing is the consumer's responsibility. */
49
+ export interface FontAsset {
50
+ /** Font family name used to select this font from a text layer. */ family: string;
51
+ /** Local file URI of the font file (e.g. .ttf/.otf). */ uri: string;
52
+ }
53
+ /** A consumer-provided sticker image, selectable from the Stickers tool. */
54
+ export interface StickerAsset {
55
+ /** Stable identifier, echoed back on layers created from this asset. */ id: string;
56
+ /** Local file/content URI of the sticker image. */ uri: string;
57
+ }
58
+ /** Options accepted by {@link openEditor}. */
59
+ export interface EditorOptions {
60
+ /** Required local input. */ source: EditorSource;
61
+ /** Enabled tools. */ features?: EditorFeatures;
62
+ /** Native UI theme. */ theme?: EditorTheme;
63
+ /** Export preferences. */ export?: ExportOptions;
64
+ /** Requests saving to the gallery. Currently ignored by the placeholder. */ saveToGallery?: boolean;
65
+ /** Consumer-provided stickers offered by the Stickers tool, in addition to the small built-in set and end-user uploads. */ stickerAssets?: StickerAsset[];
66
+ /** Consumer-provided fonts selectable from the Text tool. */ fonts?: FontAsset[];
67
+ }
68
+ export interface PhotoEditorOptions extends Omit<EditorOptions, 'source'> {
69
+ source: EditorSource & {
70
+ type: 'photo';
71
+ };
72
+ }
73
+ export interface VideoEditorOptions extends Omit<EditorOptions, 'source'> {
74
+ source: EditorSource & {
75
+ type: 'video';
76
+ };
77
+ }
78
+ export type EditorEventType = 'editorOpened' | 'editorReady' | 'selectionChanged' | 'projectChanged' | 'exportStarted' | 'exportProgress' | 'exportCompleted' | 'exportCancelled' | 'editorClosed' | 'error';
79
+ export interface EditorEvent {
80
+ type: EditorEventType;
81
+ projectId?: string;
82
+ jobId?: string;
83
+ progress?: number;
84
+ status?: EditorStatus;
85
+ }
86
+ export type EditorEventListener = (event: EditorEvent) => void;
87
+ /** Result from the native editor contract. */
88
+ export interface EditorResult {
89
+ /** Local output URI. */ uri: string;
90
+ /** Output media kind. */ type: MediaType;
91
+ /** MIME type when known. */ mimeType?: string;
92
+ /** Width in pixels when known. */ width?: number;
93
+ /** Height in pixels when known. */ height?: number;
94
+ /** Video duration in milliseconds when known. */ duration?: number;
95
+ /** File size in bytes when known. */ fileSize?: number;
96
+ /** True only when editing was cancelled. */ cancelled: boolean;
97
+ }
98
+ /** Export progress. Progress is between 0 and 1. */
99
+ export interface ExportProgressEvent {
100
+ /** Export job identifier. */ jobId: string;
101
+ /** Fraction complete, from 0 to 1. */ progress: number;
102
+ /** Current lifecycle state. */ status: EditorStatus;
103
+ }
104
+ /** Removable event subscription. */
105
+ export interface EditorSubscription {
106
+ /** Stops future callbacks; safe to call repeatedly. */ remove(): void;
107
+ }
108
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAC1C,uCAAuC;AACvC,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AACnE,wCAAwC;AACxC,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AACxD,wCAAwC;AACxC,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,CAAC;AAC9C,sDAAsD;AACtD,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,WAAW,GACX,SAAS,GACT,WAAW,GACX,WAAW,GACX,WAAW,GACX,QAAQ,CAAC;AAEb,2EAA2E;AAC3E,MAAM,WAAW,YAAY;IAC3B,8BAA8B,CAAC,GAAG,EAAE,MAAM,CAAC;IAC3C,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC;IACnC,+BAA+B,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClD,iCAAiC,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrD;AACD,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC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