@adminide-stack/yantra-mobile 12.0.128 → 12.0.129-alpha.1

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 (360) hide show
  1. package/lib/compute.js +57 -1
  2. package/lib/compute.js.map +1 -1
  3. package/lib/features/agent-chat/NativeAgentChat.js +3 -2
  4. package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
  5. package/lib/features/apps/AppsCatalog.js +10 -0
  6. package/lib/features/apps/AppsCatalog.js.map +1 -1
  7. package/lib/features/apps/mobileAppCatalog.js +11 -0
  8. package/lib/features/apps/mobileAppCatalog.js.map +1 -1
  9. package/lib/features/canvas/AudioEditorExperience.js +448 -105
  10. package/lib/features/canvas/AudioEditorExperience.js.map +1 -1
  11. package/lib/features/canvas/CanvasAgentChatPane.js +33 -14
  12. package/lib/features/canvas/CanvasAgentChatPane.js.map +1 -1
  13. package/lib/features/canvas/CanvasBoardsGrid.js +493 -41
  14. package/lib/features/canvas/CanvasBoardsGrid.js.map +1 -1
  15. package/lib/features/canvas/CanvasChatResultCard.js.map +1 -1
  16. package/lib/features/canvas/CanvasEditToolsPanel.js +37 -1
  17. package/lib/features/canvas/CanvasEditToolsPanel.js.map +1 -1
  18. package/lib/features/canvas/CanvasExperience.js +237 -22
  19. package/lib/features/canvas/CanvasExperience.js.map +1 -1
  20. package/lib/features/canvas/CanvasGeneratePanel.js +119 -26
  21. package/lib/features/canvas/CanvasGeneratePanel.js.map +1 -1
  22. package/lib/features/canvas/CanvasLooksPanel.js +17 -6
  23. package/lib/features/canvas/CanvasLooksPanel.js.map +1 -1
  24. package/lib/features/canvas/CanvasTasksPanel.js +18 -1
  25. package/lib/features/canvas/CanvasTasksPanel.js.map +1 -1
  26. package/lib/features/canvas/DesignCategoryGallery.js +423 -0
  27. package/lib/features/canvas/DesignCategoryGallery.js.map +1 -0
  28. package/lib/features/canvas/ImageEditorExperience.js +763 -187
  29. package/lib/features/canvas/ImageEditorExperience.js.map +1 -1
  30. package/lib/features/canvas/SetStudioExperience.js +199 -11
  31. package/lib/features/canvas/SetStudioExperience.js.map +1 -1
  32. package/lib/features/canvas/VideoEditorExperience.js +59 -40
  33. package/lib/features/canvas/VideoEditorExperience.js.map +1 -1
  34. package/lib/features/canvas/VideoGeneratorExperience.js +134 -34
  35. package/lib/features/canvas/VideoGeneratorExperience.js.map +1 -1
  36. package/lib/features/canvas/aiEdit.js +4 -2
  37. package/lib/features/canvas/aiEdit.js.map +1 -1
  38. package/lib/features/canvas/audioEditor/AudioWaveform.js +96 -0
  39. package/lib/features/canvas/audioEditor/AudioWaveform.js.map +1 -0
  40. package/lib/features/canvas/audioEditor/audioPeaks.js +93 -0
  41. package/lib/features/canvas/audioEditor/audioPeaks.js.map +1 -0
  42. package/lib/features/canvas/canvasTaskSync.js +34 -7
  43. package/lib/features/canvas/canvasTaskSync.js.map +1 -1
  44. package/lib/features/canvas/canvasTasks.js +23 -3
  45. package/lib/features/canvas/canvasTasks.js.map +1 -1
  46. package/lib/features/canvas/canvasTheme.js +10 -24
  47. package/lib/features/canvas/canvasTheme.js.map +1 -1
  48. package/lib/features/canvas/canvasUi.js +1 -1
  49. package/lib/features/canvas/canvasUi.js.map +1 -1
  50. package/lib/features/canvas/createTiles.js +17 -9
  51. package/lib/features/canvas/createTiles.js.map +1 -1
  52. package/lib/features/canvas/deepLinks.js +35 -5
  53. package/lib/features/canvas/deepLinks.js.map +1 -1
  54. package/lib/features/canvas/designCatalog.js +165 -0
  55. package/lib/features/canvas/designCatalog.js.map +1 -0
  56. package/lib/features/canvas/designCategories.js +262 -0
  57. package/lib/features/canvas/designCategories.js.map +1 -0
  58. package/lib/features/canvas/editorControls.js +406 -0
  59. package/lib/features/canvas/editorControls.js.map +1 -0
  60. package/lib/features/canvas/generationModels.js +5 -3
  61. package/lib/features/canvas/generationModels.js.map +1 -1
  62. package/lib/features/canvas/generationTasks.js +162 -0
  63. package/lib/features/canvas/generationTasks.js.map +1 -0
  64. package/lib/features/canvas/generator/BottomSheet.js +167 -0
  65. package/lib/features/canvas/generator/BottomSheet.js.map +1 -0
  66. package/lib/features/canvas/generator/BusinessCardChatCard.js +155 -0
  67. package/lib/features/canvas/generator/BusinessCardChatCard.js.map +1 -0
  68. package/lib/features/canvas/generator/DirectorSheet.js +163 -0
  69. package/lib/features/canvas/generator/DirectorSheet.js.map +1 -0
  70. package/lib/features/canvas/generator/ReframePreview.js +122 -0
  71. package/lib/features/canvas/generator/ReframePreview.js.map +1 -0
  72. package/lib/features/canvas/generator/RunLogCard.js +119 -0
  73. package/lib/features/canvas/generator/RunLogCard.js.map +1 -0
  74. package/lib/features/canvas/generator/ShotPanel.js +261 -0
  75. package/lib/features/canvas/generator/ShotPanel.js.map +1 -0
  76. package/lib/features/canvas/generator/businessCardWidget.js +117 -0
  77. package/lib/features/canvas/generator/businessCardWidget.js.map +1 -0
  78. package/lib/features/canvas/generator/cameraVocabulary.js +142 -0
  79. package/lib/features/canvas/generator/cameraVocabulary.js.map +1 -0
  80. package/lib/features/canvas/generator/cinematicVocabulary.js +416 -0
  81. package/lib/features/canvas/generator/cinematicVocabulary.js.map +1 -0
  82. package/lib/features/canvas/generator/direction.js +41 -0
  83. package/lib/features/canvas/generator/direction.js.map +1 -0
  84. package/lib/features/canvas/generator/reframeGeometry.js +108 -0
  85. package/lib/features/canvas/generator/reframeGeometry.js.map +1 -0
  86. package/lib/features/canvas/generator/runLog.js +71 -0
  87. package/lib/features/canvas/generator/runLog.js.map +1 -0
  88. package/lib/features/canvas/generator/shot.js +133 -0
  89. package/lib/features/canvas/generator/shot.js.map +1 -0
  90. package/lib/features/canvas/generator/useShotSpec.js +87 -0
  91. package/lib/features/canvas/generator/useShotSpec.js.map +1 -0
  92. package/lib/features/canvas/home/HeroComposer.js +214 -0
  93. package/lib/features/canvas/home/HeroComposer.js.map +1 -0
  94. package/lib/features/canvas/home/HeroMonitor.js +225 -0
  95. package/lib/features/canvas/home/HeroMonitor.js.map +1 -0
  96. package/lib/features/canvas/home/LookDetail.js +185 -0
  97. package/lib/features/canvas/home/LookDetail.js.map +1 -0
  98. package/lib/features/canvas/home/LoopingVideo.js +37 -0
  99. package/lib/features/canvas/home/LoopingVideo.js.map +1 -0
  100. package/lib/features/canvas/home/TemplatesGallery.js +253 -0
  101. package/lib/features/canvas/home/TemplatesGallery.js.map +1 -0
  102. package/lib/features/canvas/home/heroShots.js +100 -0
  103. package/lib/features/canvas/home/heroShots.js.map +1 -0
  104. package/lib/features/canvas/homeWork.js +62 -3
  105. package/lib/features/canvas/homeWork.js.map +1 -1
  106. package/lib/features/canvas/imageEditor/ImageMarkup.js +195 -0
  107. package/lib/features/canvas/imageEditor/ImageMarkup.js.map +1 -0
  108. package/lib/features/canvas/imageEditor/imageEditOps.js +367 -0
  109. package/lib/features/canvas/imageEditor/imageEditOps.js.map +1 -0
  110. package/lib/features/canvas/nativeViewerRegistry.js.map +1 -1
  111. package/lib/features/canvas/rankedCatalogSearch.js +375 -0
  112. package/lib/features/canvas/rankedCatalogSearch.js.map +1 -0
  113. package/lib/features/canvas/recorder/CameraRecorderExperience.js +68 -20
  114. package/lib/features/canvas/recorder/CameraRecorderExperience.js.map +1 -1
  115. package/lib/features/canvas/recorder/RecordingReview.js +272 -0
  116. package/lib/features/canvas/recorder/RecordingReview.js.map +1 -0
  117. package/lib/features/canvas/recorder/RecordingsList.js +179 -0
  118. package/lib/features/canvas/recorder/RecordingsList.js.map +1 -0
  119. package/lib/features/canvas/recorder/recorderOps.js +99 -0
  120. package/lib/features/canvas/recorder/recorderOps.js.map +1 -0
  121. package/lib/features/canvas/seedanceShowcase.js +314 -0
  122. package/lib/features/canvas/seedanceShowcase.js.map +1 -0
  123. package/lib/features/canvas/serverTasks.js +149 -15
  124. package/lib/features/canvas/serverTasks.js.map +1 -1
  125. package/lib/features/canvas/sessionRenewal.js +114 -0
  126. package/lib/features/canvas/sessionRenewal.js.map +1 -0
  127. package/lib/features/canvas/set/SetViewportWebView.js +34 -1
  128. package/lib/features/canvas/set/SetViewportWebView.js.map +1 -1
  129. package/lib/features/canvas/set/agent/setTurn.js +4 -2
  130. package/lib/features/canvas/set/agent/setTurn.js.map +1 -1
  131. package/lib/features/canvas/set/setPresets.js +85 -0
  132. package/lib/features/canvas/set/setPresets.js.map +1 -0
  133. package/lib/features/canvas/set/setProject.js +4 -1
  134. package/lib/features/canvas/set/setProject.js.map +1 -1
  135. package/lib/features/canvas/studioCatalog.js +59 -4
  136. package/lib/features/canvas/studioCatalog.js.map +1 -1
  137. package/lib/features/canvas/studioLooks.js +31 -4
  138. package/lib/features/canvas/studioLooks.js.map +1 -1
  139. package/lib/features/canvas/surfaceIndex.js +1 -14
  140. package/lib/features/canvas/surfaceIndex.js.map +1 -1
  141. package/lib/features/canvas/templateSearch.js +489 -0
  142. package/lib/features/canvas/templateSearch.js.map +1 -0
  143. package/lib/features/canvas/useCanvasSession.js +28 -6
  144. package/lib/features/canvas/useCanvasSession.js.map +1 -1
  145. package/lib/features/canvas/useStudioCatalogTemplates.js +41 -5
  146. package/lib/features/canvas/useStudioCatalogTemplates.js.map +1 -1
  147. package/lib/features/canvas/videoEditor/EditorPanels.js +531 -0
  148. package/lib/features/canvas/videoEditor/EditorPanels.js.map +1 -0
  149. package/lib/features/canvas/videoEditor/agent/AgentCutPane.js +48 -4
  150. package/lib/features/canvas/videoEditor/agent/AgentCutPane.js.map +1 -1
  151. package/lib/features/canvas/videoEditor/agent/agentLoop.js +2 -0
  152. package/lib/features/canvas/videoEditor/agent/agentLoop.js.map +1 -1
  153. package/lib/features/canvas/videoEditor/agent/brainClient.js +97 -27
  154. package/lib/features/canvas/videoEditor/agent/brainClient.js.map +1 -1
  155. package/lib/features/canvas/videoEditor/agent/cutTools.js +707 -3
  156. package/lib/features/canvas/videoEditor/agent/cutTools.js.map +1 -1
  157. package/lib/features/canvas/videoEditor/audioServices.js +165 -0
  158. package/lib/features/canvas/videoEditor/audioServices.js.map +1 -0
  159. package/lib/features/canvas/videoEditor/captions.js +144 -0
  160. package/lib/features/canvas/videoEditor/captions.js.map +1 -0
  161. package/lib/features/canvas/videoEditor/compileTimeline.js +24 -16
  162. package/lib/features/canvas/videoEditor/compileTimeline.js.map +1 -1
  163. package/lib/features/canvas/videoEditor/editorModel.js +12 -2
  164. package/lib/features/canvas/videoEditor/editorModel.js.map +1 -1
  165. package/lib/features/canvas/videoEditor/exportTask.js +89 -7
  166. package/lib/features/canvas/videoEditor/exportTask.js.map +1 -1
  167. package/lib/features/canvas/videoEditor/layers.js +117 -0
  168. package/lib/features/canvas/videoEditor/layers.js.map +1 -0
  169. package/lib/features/canvas/videoEditor/remoteMediaClient.js +45 -18
  170. package/lib/features/canvas/videoEditor/remoteMediaClient.js.map +1 -1
  171. package/lib/features/canvas/videoEditor/renderTimeline.js +18 -6
  172. package/lib/features/canvas/videoEditor/renderTimeline.js.map +1 -1
  173. package/lib/features/canvas/videoEditor/revoice.js +138 -0
  174. package/lib/features/canvas/videoEditor/revoice.js.map +1 -0
  175. package/lib/features/canvas/videoEditor/storageUpload.js +34 -0
  176. package/lib/features/canvas/videoEditor/storageUpload.js.map +1 -0
  177. package/lib/features/canvas/videoEditor/textMotion.js +109 -0
  178. package/lib/features/canvas/videoEditor/textMotion.js.map +1 -0
  179. package/lib/features/canvas/videoEditor/transitions.js +31 -0
  180. package/lib/features/canvas/videoEditor/transitions.js.map +1 -0
  181. package/lib/features/chat/TemplatesChatCards.js +8 -3
  182. package/lib/features/chat/TemplatesChatCards.js.map +1 -1
  183. package/lib/features/design/DesignEditorExperience.js +674 -644
  184. package/lib/features/design/DesignEditorExperience.js.map +1 -1
  185. package/lib/features/design/DesignExperience.js +285 -538
  186. package/lib/features/design/DesignExperience.js.map +1 -1
  187. package/lib/features/design/designCore.js +2 -212
  188. package/lib/features/design/designCore.js.map +1 -1
  189. package/lib/features/design/designIndex.js +1 -50
  190. package/lib/features/design/designIndex.js.map +1 -1
  191. package/lib/features/design/doc/aiDesign.js +247 -0
  192. package/lib/features/design/doc/aiDesign.js.map +1 -0
  193. package/lib/features/design/doc/artifacts.js +280 -0
  194. package/lib/features/design/doc/artifacts.js.map +1 -0
  195. package/lib/features/design/doc/chart.js +98 -0
  196. package/lib/features/design/doc/chart.js.map +1 -0
  197. package/lib/features/design/doc/crop.js +104 -0
  198. package/lib/features/design/doc/crop.js.map +1 -0
  199. package/lib/features/design/doc/curve.js +49 -0
  200. package/lib/features/design/doc/curve.js.map +1 -0
  201. package/lib/features/design/doc/docOps.js +397 -0
  202. package/lib/features/design/doc/docOps.js.map +1 -0
  203. package/lib/features/design/doc/findReplace.js +112 -0
  204. package/lib/features/design/doc/findReplace.js.map +1 -0
  205. package/lib/features/design/doc/fonts.js +79 -0
  206. package/lib/features/design/doc/fonts.js.map +1 -0
  207. package/lib/features/design/doc/frames.js +17 -0
  208. package/lib/features/design/doc/frames.js.map +1 -0
  209. package/lib/features/design/doc/geometry.js +133 -0
  210. package/lib/features/design/doc/geometry.js.map +1 -0
  211. package/lib/features/design/doc/imageAdjust.js +203 -0
  212. package/lib/features/design/doc/imageAdjust.js.map +1 -0
  213. package/lib/features/design/doc/legacyDoc.js +107 -0
  214. package/lib/features/design/doc/legacyDoc.js.map +1 -0
  215. package/lib/features/design/doc/newDoc.js +335 -0
  216. package/lib/features/design/doc/newDoc.js.map +1 -0
  217. package/lib/features/design/doc/pageRange.js +17 -0
  218. package/lib/features/design/doc/pageRange.js.map +1 -0
  219. package/lib/features/design/doc/pathScale.js +68 -0
  220. package/lib/features/design/doc/pathScale.js.map +1 -0
  221. package/lib/features/design/doc/qr.js +62 -0
  222. package/lib/features/design/doc/qr.js.map +1 -0
  223. package/lib/features/design/doc/shapes.js +366 -0
  224. package/lib/features/design/doc/shapes.js.map +1 -0
  225. package/lib/features/design/doc/sizes.js +230 -0
  226. package/lib/features/design/doc/sizes.js.map +1 -0
  227. package/lib/features/design/doc/textEffects.js +134 -0
  228. package/lib/features/design/doc/textEffects.js.map +1 -0
  229. package/lib/features/design/doc/textLayout.js +182 -0
  230. package/lib/features/design/doc/textLayout.js.map +1 -0
  231. package/lib/features/design/doc/types.js +30 -0
  232. package/lib/features/design/doc/types.js.map +1 -0
  233. package/lib/features/design/editor/AiPanel.js +194 -0
  234. package/lib/features/design/editor/AiPanel.js.map +1 -0
  235. package/lib/features/design/editor/ChartDataPanel.js +182 -0
  236. package/lib/features/design/editor/ChartDataPanel.js.map +1 -0
  237. package/lib/features/design/editor/CropOverlay.js +199 -0
  238. package/lib/features/design/editor/CropOverlay.js.map +1 -0
  239. package/lib/features/design/editor/DesignCanvas.js +363 -0
  240. package/lib/features/design/editor/DesignCanvas.js.map +1 -0
  241. package/lib/features/design/editor/ExportSheet.js +123 -0
  242. package/lib/features/design/editor/ExportSheet.js.map +1 -0
  243. package/lib/features/design/editor/FindReplacePanel.js +93 -0
  244. package/lib/features/design/editor/FindReplacePanel.js.map +1 -0
  245. package/lib/features/design/editor/ImageTools.js +188 -0
  246. package/lib/features/design/editor/ImageTools.js.map +1 -0
  247. package/lib/features/design/editor/LayerTools.js +485 -0
  248. package/lib/features/design/editor/LayerTools.js.map +1 -0
  249. package/lib/features/design/editor/PageStrip.js +203 -0
  250. package/lib/features/design/editor/PageStrip.js.map +1 -0
  251. package/lib/features/design/editor/Slideshow.js +97 -0
  252. package/lib/features/design/editor/Slideshow.js.map +1 -0
  253. package/lib/features/design/editor/ToolPanels.js +695 -0
  254. package/lib/features/design/editor/ToolPanels.js.map +1 -0
  255. package/lib/features/design/editor/controls.js +630 -0
  256. package/lib/features/design/editor/controls.js.map +1 -0
  257. package/lib/features/design/editor/useDesignSave.js +91 -0
  258. package/lib/features/design/editor/useDesignSave.js.map +1 -0
  259. package/lib/features/design/export/exportDesign.js +170 -0
  260. package/lib/features/design/export/exportDesign.js.map +1 -0
  261. package/lib/features/design/export/pdf.js +143 -0
  262. package/lib/features/design/export/pdf.js.map +1 -0
  263. package/lib/features/design/home/DesignHome.js +688 -0
  264. package/lib/features/design/home/DesignHome.js.map +1 -0
  265. package/lib/features/design/home/studioHome.js +61 -0
  266. package/lib/features/design/home/studioHome.js.map +1 -0
  267. package/lib/features/design/pickDesignImage.js +60 -0
  268. package/lib/features/design/pickDesignImage.js.map +1 -0
  269. package/lib/features/design/render/DesignPageView.js +69 -0
  270. package/lib/features/design/render/DesignPageView.js.map +1 -0
  271. package/lib/features/design/render/PageCapture.js +288 -0
  272. package/lib/features/design/render/PageCapture.js.map +1 -0
  273. package/lib/features/design/render/TextMeasure.js +115 -0
  274. package/lib/features/design/render/TextMeasure.js.map +1 -0
  275. package/lib/features/design/render/fontRegistry.js +110 -0
  276. package/lib/features/design/render/fontRegistry.js.map +1 -0
  277. package/lib/features/design/render/layers.js +392 -0
  278. package/lib/features/design/render/layers.js.map +1 -0
  279. package/lib/features/design/render/svg.js +35 -0
  280. package/lib/features/design/render/svg.js.map +1 -0
  281. package/lib/features/design/render/svgParts.js +435 -0
  282. package/lib/features/design/render/svgParts.js.map +1 -0
  283. package/lib/features/design/surface/BoardScreen.js +529 -0
  284. package/lib/features/design/surface/BoardScreen.js.map +1 -0
  285. package/lib/features/design/surface/CompareView.js +138 -0
  286. package/lib/features/design/surface/CompareView.js.map +1 -0
  287. package/lib/features/design/surface/CreationScreen.js +294 -0
  288. package/lib/features/design/surface/CreationScreen.js.map +1 -0
  289. package/lib/features/design/surface/DesignAgentChatPane.js +444 -0
  290. package/lib/features/design/surface/DesignAgentChatPane.js.map +1 -0
  291. package/lib/features/design/surface/DesignBoards.js +441 -0
  292. package/lib/features/design/surface/DesignBoards.js.map +1 -0
  293. package/lib/features/design/surface/DesignPreview.js +159 -0
  294. package/lib/features/design/surface/DesignPreview.js.map +1 -0
  295. package/lib/features/design/surface/DesignSurfaceExperience.js +80 -0
  296. package/lib/features/design/surface/DesignSurfaceExperience.js.map +1 -0
  297. package/lib/features/design/surface/FullScreenPreview.js +59 -0
  298. package/lib/features/design/surface/FullScreenPreview.js.map +1 -0
  299. package/lib/features/design/surface/NewSystemDialog.js +122 -0
  300. package/lib/features/design/surface/NewSystemDialog.js.map +1 -0
  301. package/lib/features/design/surface/PickerSheet.js +175 -0
  302. package/lib/features/design/surface/PickerSheet.js.map +1 -0
  303. package/lib/features/design/surface/TemplatesGallery.js +156 -0
  304. package/lib/features/design/surface/TemplatesGallery.js.map +1 -0
  305. package/lib/features/design/surface/WetPaint.js +140 -0
  306. package/lib/features/design/surface/WetPaint.js.map +1 -0
  307. package/lib/features/design/surface/agentTurn.js +229 -0
  308. package/lib/features/design/surface/agentTurn.js.map +1 -0
  309. package/lib/features/design/surface/designBoard.js +218 -0
  310. package/lib/features/design/surface/designBoard.js.map +1 -0
  311. package/lib/features/design/surface/designChannel.js +186 -0
  312. package/lib/features/design/surface/designChannel.js.map +1 -0
  313. package/lib/features/design/surface/designChat.js +141 -0
  314. package/lib/features/design/surface/designChat.js.map +1 -0
  315. package/lib/features/design/surface/designConnector.js +266 -0
  316. package/lib/features/design/surface/designConnector.js.map +1 -0
  317. package/lib/features/design/surface/designDocument.js +40 -0
  318. package/lib/features/design/surface/designDocument.js.map +1 -0
  319. package/lib/features/design/surface/designExport.js +55 -0
  320. package/lib/features/design/surface/designExport.js.map +1 -0
  321. package/lib/features/design/surface/designLinks.js +64 -0
  322. package/lib/features/design/surface/designLinks.js.map +1 -0
  323. package/lib/features/design/surface/designPalette.js +24 -0
  324. package/lib/features/design/surface/designPalette.js.map +1 -0
  325. package/lib/features/design/surface/designRun.js +161 -0
  326. package/lib/features/design/surface/designRun.js.map +1 -0
  327. package/lib/features/design/surface/designTheme.js +119 -0
  328. package/lib/features/design/surface/designTheme.js.map +1 -0
  329. package/lib/features/design/surface/execStream.js +206 -0
  330. package/lib/features/design/surface/execStream.js.map +1 -0
  331. package/lib/features/design/surface/metaball.js +48 -0
  332. package/lib/features/design/surface/metaball.js.map +1 -0
  333. package/lib/features/design/surface/pickReferenceFiles.js +35 -0
  334. package/lib/features/design/surface/pickReferenceFiles.js.map +1 -0
  335. package/lib/features/design/surface/useDesignSurface.js +379 -0
  336. package/lib/features/design/surface/useDesignSurface.js.map +1 -0
  337. package/lib/features/docs/DocBlockRow.js +336 -0
  338. package/lib/features/docs/DocBlockRow.js.map +1 -0
  339. package/lib/features/docs/DocsEditorExperience.js +949 -0
  340. package/lib/features/docs/DocsEditorExperience.js.map +1 -0
  341. package/lib/features/docs/DocsToolbar.js +247 -0
  342. package/lib/features/docs/DocsToolbar.js.map +1 -0
  343. package/lib/features/docs/blocks.js +560 -0
  344. package/lib/features/docs/blocks.js.map +1 -0
  345. package/lib/features/docs/docArtifacts.js +129 -0
  346. package/lib/features/docs/docArtifacts.js.map +1 -0
  347. package/lib/features/docs/docEdits.js +201 -0
  348. package/lib/features/docs/docEdits.js.map +1 -0
  349. package/lib/features/docs/docExport.js +235 -0
  350. package/lib/features/docs/docExport.js.map +1 -0
  351. package/lib/features/docs/docShare.js +62 -0
  352. package/lib/features/docs/docShare.js.map +1 -0
  353. package/lib/features/links/openInApp.js +38 -2
  354. package/lib/features/links/openInApp.js.map +1 -1
  355. package/lib/routes.json +54 -0
  356. package/lib/screens/DesignNative/index.js +35 -0
  357. package/lib/screens/DesignNative/index.js.map +1 -0
  358. package/package.json +4 -4
  359. package/lib/features/design/exportDesign.js +0 -133
  360. package/lib/features/design/exportDesign.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useState,useCallback,useMemo,useRef}from'react';import {View,ScrollView,Text,StyleSheet,PanResponder,TextInput}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {Image}from'expo-image';import {KeyboardAwareScreen,KeyboardLiftSpacer}from'../../components/KeyboardComposerDock.js';import {dismissKeyboard}from'../../utils/keyboardController.js';import {resizeFrame}from'../canvas/canvasCore.js';import {useCanvasTheme,themedStyles}from'../canvas/canvasTheme.js';import {Pressable,pressedStyle,SPACE,HIT,RADIUS,TYPE}from'../canvas/canvasUi.js';import {replaceLayer,addLayer,newImageLayer,nextZ,layerPaintOrder,bringLayerToFront,sendLayerToBack,duplicateLayer,removeLayer,newTextLayer,newShapeLayer,TSHIRT_COLORS,DESIGN_SWATCHES,TSHIRT_PRINT_AREA}from'./designCore.js';var __defProp = Object.defineProperty;
1
+ import {jsxs,jsx}from'react/jsx-runtime';import {useReducer,useState,useRef,useEffect,useCallback}from'react';import {useWindowDimensions,Alert,View,TextInput,Text,KeyboardAvoidingView,ActivityIndicator,Platform,StyleSheet}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {useCanvasTheme,themedStyles}from'../canvas/canvasTheme.js';import {Pressable,RADIUS,SPACE,TYPE}from'../canvas/canvasUi.js';import {useSafeInsets}from'../canvas/withRemoteSafeArea.js';import {picturesToPaint,paintPicture}from'./doc/aiDesign.js';import {editorReducer,initEditorState,currentPage,selectedLayer,makeImageLayer,makeStickerLayer,makeChartLayer,makeShapeLayer,makeTextLayer,makeTextBox}from'./doc/docOps.js';import {qrMatrix,qrPath}from'./doc/qr.js';import {defaultPrintSpec,catalogToDoc,catalogKind,templatePagesFor}from'./doc/newDoc.js';import {snapAspect}from'./doc/sizes.js';import {rebaseRuns}from'./doc/textLayout.js';import {newLayerId,designTitle}from'./doc/types.js';import {writePngToCache,exportDesign}from'./export/exportDesign.js';import {AiPanel}from'./editor/AiPanel.js';import {CropOverlay}from'./editor/CropOverlay.js';import {DesignCanvas}from'./editor/DesignCanvas.js';import {EditorSheet}from'./editor/controls.js';import {ExportSheet}from'./editor/ExportSheet.js';import {FindReplacePanel}from'./editor/FindReplacePanel.js';import {toolTitle,LayerToolPanel,SelectionToolbar}from'./editor/LayerTools.js';import {chooseAction,PageStrip}from'./editor/PageStrip.js';import {Slideshow}from'./editor/Slideshow.js';import {PageCapture}from'./render/PageCapture.js';import {DOCK_TOOLS,TemplatesPanel,ElementsPanel,TextPanel,BrandPanel,DetailsPanel,AssetsPanel}from'./editor/ToolPanels.js';import {useDesignSave}from'./editor/useDesignSave.js';var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -17,708 +17,738 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const DOCK_H = 64;
21
+ function statusLabel(status) {
22
+ switch (status) {
23
+ case "saving":
24
+ return "Saving\u2026";
25
+ case "saved":
26
+ return "Saved";
27
+ case "error":
28
+ return "Not saved";
29
+ case "offline":
30
+ return "Not signed in";
31
+ default:
32
+ return "";
33
+ }
34
+ }
20
35
  function DesignEditorExperience({
21
- doc,
22
- onChange,
23
- onClose,
24
- onExport,
25
- onPickLocalMedia,
26
- canvasImages = []
36
+ doc: initialDoc,
37
+ kind,
38
+ opened,
39
+ index,
40
+ sessionId,
41
+ loadCatalog,
42
+ readTemplate,
43
+ pickImage,
44
+ uploadFile,
45
+ runCarousel,
46
+ onClose
27
47
  }) {
28
- var _a;
48
+ var _a, _b, _c, _d;
29
49
  const theme = useCanvasTheme();
30
50
  const styles = makeStyles(theme);
31
- const [pageIndex, setPageIndex] = useState(0);
32
- const [selectedId, setSelectedId] = useState(null);
33
- const [dock, setDock] = useState("add");
34
- const [imagePicker, setImagePicker] = useState(false);
35
- const [canvasSize, setCanvasSize] = useState({
36
- width: 0,
37
- height: 0
51
+ const insets = useSafeInsets();
52
+ const {
53
+ width,
54
+ height
55
+ } = useWindowDimensions();
56
+ const [state, dispatch] = useReducer(editorReducer, initialDoc, initEditorState);
57
+ const {
58
+ doc
59
+ } = state;
60
+ const page = (_a = currentPage(state)) != null ? _a : doc.pages[0];
61
+ const layer = (_b = selectedLayer(state)) != null ? _b : null;
62
+ const save = useDesignSave({
63
+ doc,
64
+ index,
65
+ kind,
66
+ opened,
67
+ sessionId
38
68
  });
39
- const page = doc.pages[Math.min(pageIndex, doc.pages.length - 1)];
40
- const selected = (_a = page.layers.find((l) => l.id === selectedId)) != null ? _a : null;
41
- const setPage = useCallback((next) => {
42
- onChange(__spreadProps(__spreadValues({}, doc), {
43
- pages: doc.pages.map((p) => p.id === next.id ? next : p)
44
- }));
45
- }, [doc, onChange]);
46
- const updateLayer = useCallback((layer) => setPage(replaceLayer(page, layer)), [page, setPage]);
47
- const scale = useMemo(() => {
48
- if (!canvasSize.width || !canvasSize.height) return 0;
49
- return Math.min((canvasSize.width - 32) / page.width, (canvasSize.height - 32) / page.height);
50
- }, [canvasSize, page.width, page.height]);
51
- const addAndSelect = useCallback((layer) => {
52
- setPage(addLayer(page, layer));
53
- setSelectedId(layer.id);
54
- setDock("style");
55
- }, [page, setPage]);
56
- const handleAddImage = useCallback(async () => {
57
- if (onPickLocalMedia) {
69
+ const [dockTool, setDockTool] = useState(null);
70
+ const [layerTool, setLayerTool] = useState(null);
71
+ const [editingTextId, setEditingTextId] = useState(null);
72
+ const [busy, setBusy] = useState(null);
73
+ const [extra, setExtra] = useState(null);
74
+ const [exporting, setExporting] = useState(null);
75
+ const [cropping, setCropping] = useState(null);
76
+ const [presenting, setPresenting] = useState(false);
77
+ const capture = useRef(null);
78
+ const stateRef = useRef(state);
79
+ stateRef.current = state;
80
+ const mounted = useRef(true);
81
+ useEffect(() => () => {
82
+ mounted.current = false;
83
+ }, []);
84
+ const pageIndex = Math.max(0, doc.pages.findIndex((p) => p.id === page.id));
85
+ const sheetH = Math.round(Math.min(height * 0.46, 420));
86
+ const select = useCallback((layerId) => {
87
+ dispatch({
88
+ type: "select",
89
+ layerId
90
+ });
91
+ setLayerTool(null);
92
+ if (layerId) {
93
+ setDockTool(null);
94
+ setExtra(null);
95
+ }
96
+ }, []);
97
+ const patch = useCallback((layerId, p, coalesce) => dispatch({
98
+ type: "patchLayer",
99
+ pageId: page.id,
100
+ layerId,
101
+ patch: p,
102
+ coalesce
103
+ }), [page.id]);
104
+ const addLayer = useCallback((l) => {
105
+ dispatch({
106
+ type: "addLayer",
107
+ pageId: page.id,
108
+ layer: l
109
+ });
110
+ setDockTool(null);
111
+ }, [page.id]);
112
+ const close = useCallback(async () => {
113
+ setEditingTextId(null);
114
+ await save.flush();
115
+ onClose();
116
+ }, [save, onClose]);
117
+ const placePicture = useCallback((picked) => {
118
+ if ((layer == null ? void 0 : layer.kind) === "image" && !layer.locked) {
119
+ patch(layer.id, {
120
+ src: picked.src,
121
+ crop: void 0,
122
+ imageStatus: "ready",
123
+ uploaded: true
124
+ });
125
+ setDockTool(null);
126
+ return;
127
+ }
128
+ const size = picked.width && picked.height ? {
129
+ width: picked.width,
130
+ height: picked.height
131
+ } : null;
132
+ addLayer(makeImageLayer(picked.src, doc.pageWidth, doc.pageHeight, size));
133
+ }, [layer, patch, addLayer, doc.pageWidth, doc.pageHeight]);
134
+ const pickAndPlace = useCallback(async () => {
135
+ if (!pickImage) return;
136
+ setBusy("Uploading photo\u2026");
137
+ try {
138
+ const picked = await pickImage();
139
+ if (picked) placePicture(picked);
140
+ } catch (err) {
141
+ Alert.alert("Could not add the photo", err instanceof Error ? err.message : "Try again.");
142
+ } finally {
143
+ setBusy(null);
144
+ }
145
+ }, [pickImage, placePicture]);
146
+ const setBrandKit = useCallback((kit) => dispatch({
147
+ type: "patchDoc",
148
+ patch: {
149
+ brandKit: kit
150
+ }
151
+ }), []);
152
+ const addLogo = useCallback(async () => {
153
+ var _a2, _b2;
154
+ if (!pickImage) return;
155
+ setBusy("Uploading logo\u2026");
156
+ try {
157
+ const picked = await pickImage();
158
+ if (picked) {
159
+ const kit = (_b2 = doc.brandKit) != null ? _b2 : {
160
+ colors: [],
161
+ fonts: (_a2 = doc.fontPair) != null ? _a2 : {
162
+ display: "Inter",
163
+ body: "Inter"
164
+ },
165
+ logos: []
166
+ };
167
+ setBrandKit(__spreadProps(__spreadValues({}, kit), {
168
+ logos: [...kit.logos.filter((l) => l !== picked.src), picked.src]
169
+ }));
170
+ }
171
+ } catch (err) {
172
+ Alert.alert("Could not add the logo", err instanceof Error ? err.message : "Try again.");
173
+ } finally {
174
+ setBusy(null);
175
+ }
176
+ }, [pickImage, doc.brandKit, doc.fontPair, setBrandKit]);
177
+ const applyTemplate = useCallback(async (card) => {
178
+ if (!readTemplate) return;
179
+ setBusy("Opening template\u2026");
180
+ let template = null;
181
+ try {
182
+ template = await readTemplate(card.id);
183
+ } catch (e) {
184
+ template = null;
185
+ } finally {
186
+ setBusy(null);
187
+ }
188
+ if (!template) {
189
+ Alert.alert("Template unavailable", "That template could not be opened. Try another.");
190
+ return;
191
+ }
192
+ const t = template;
193
+ const empty = doc.pages.every((p) => {
194
+ var _a2, _b2;
195
+ return !((_a2 = p.layers) == null ? void 0 : _a2.length) && ((_b2 = p.background) == null ? void 0 : _b2.kind) !== "image";
196
+ });
197
+ const replace = () => {
198
+ const next = catalogToDoc(t);
199
+ save.setKind(catalogKind(t));
200
+ dispatch({
201
+ type: "replaceDoc",
202
+ doc: __spreadProps(__spreadValues(__spreadValues({}, next), doc.title ? {
203
+ title: doc.title
204
+ } : {}), {
205
+ brandKit: doc.brandKit
206
+ })
207
+ });
208
+ setDockTool(null);
209
+ };
210
+ const addPages = () => {
211
+ dispatch({
212
+ type: "insertPages",
213
+ afterId: page.id,
214
+ pages: templatePagesFor(t)
215
+ });
216
+ setDockTool(null);
217
+ };
218
+ if (empty) {
219
+ replace();
220
+ return;
221
+ }
222
+ Alert.alert(t.title, "Use this template for the whole design, or add its pages after this one?", [{
223
+ text: "Add pages",
224
+ onPress: addPages
225
+ }, {
226
+ text: "Replace design",
227
+ style: "destructive",
228
+ onPress: replace
229
+ }, {
230
+ text: "Cancel",
231
+ style: "cancel"
232
+ }]);
233
+ }, [readTemplate, doc, page.id, save]);
234
+ const resize = useCallback((size) => {
235
+ var _a2;
236
+ return dispatch({
237
+ type: "patchDoc",
238
+ patch: {
239
+ pageWidth: size.width,
240
+ pageHeight: size.height,
241
+ aspectRatio: snapAspect(size.width, size.height),
242
+ print: size.trimMm ? __spreadProps(__spreadValues({}, (_a2 = doc.print) != null ? _a2 : defaultPrintSpec()), {
243
+ trimMm: size.trimMm
244
+ }) : void 0
245
+ }
246
+ });
247
+ }, [doc.print]);
248
+ const hostBytes = useCallback(async (b64, mime, stem) => {
249
+ if (!uploadFile) return `data:${mime};base64,${b64}`;
250
+ const ext = mime.includes("jpeg") ? "jpg" : mime.includes("webp") ? "webp" : "png";
251
+ return uploadFile(await writePngToCache(`${stem}-${Date.now()}.${ext}`, b64));
252
+ }, [uploadFile]);
253
+ const paintPage = useCallback(async (pageId) => {
254
+ var _a2, _b2, _c2, _d2;
255
+ if (!runCarousel) return;
256
+ const find = () => stateRef.current.doc.pages.find((p) => p.id === pageId);
257
+ const start = find();
258
+ if (!start) return;
259
+ for (const job of picturesToPaint(start)) {
260
+ if (!mounted.current) return;
261
+ const now = find();
262
+ if (!now) return;
263
+ const pages = stateRef.current.doc.pages;
264
+ const at = pages.findIndex((p) => p.id === pageId);
265
+ const prompt = job.target === "background" ? (_b2 = (_a2 = now.background) == null ? void 0 : _a2.imagePrompt) != null ? _b2 : "" : job.prompt;
266
+ const mark = (status, src) => {
267
+ var _a3;
268
+ const cur = find();
269
+ if (!cur) return;
270
+ if (job.target === "background") {
271
+ dispatch({
272
+ type: "replacePage",
273
+ silent: true,
274
+ page: __spreadProps(__spreadValues({}, cur), {
275
+ background: __spreadValues(__spreadProps(__spreadValues({}, (_a3 = cur.background) != null ? _a3 : {
276
+ kind: "image"
277
+ }), {
278
+ imageStatus: status
279
+ }), src ? {
280
+ src
281
+ } : {})
282
+ })
283
+ });
284
+ } else {
285
+ dispatch({
286
+ type: "patchLayer",
287
+ silent: true,
288
+ pageId,
289
+ layerId: job.layerId,
290
+ patch: __spreadValues({
291
+ imageStatus: status
292
+ }, src ? {
293
+ src,
294
+ uploaded: true
295
+ } : {})
296
+ });
297
+ }
298
+ };
299
+ mark("generating");
58
300
  try {
59
- const picked = await onPickLocalMedia();
60
- const image = picked.find((p) => p.type === "image");
61
- if (image) addAndSelect(newImageLayer(image.src, nextZ(page)));
62
- return;
301
+ const pic = await paintPicture(runCarousel, {
302
+ prompt,
303
+ pageIndex: at + 1,
304
+ totalPages: pages.length,
305
+ aspectRatio: stateRef.current.doc.aspectRatio
306
+ });
307
+ const src = (_d2 = pic.url) != null ? _d2 : await hostBytes((_c2 = pic.dataBase64) != null ? _c2 : "", pic.mimeType, "ai-picture");
308
+ mark("ready", src);
63
309
  } catch (e) {
310
+ mark("error");
64
311
  }
65
312
  }
66
- setImagePicker(true);
67
- }, [onPickLocalMedia, addAndSelect, page]);
68
- return /* @__PURE__ */ jsxs(KeyboardAwareScreen, { style: styles.root, testID: "design-editor", children: [
69
- /* @__PURE__ */ jsxs(View, { style: styles.header, children: [
313
+ }, [runCarousel, hostBytes]);
314
+ const onAiCreated = useCallback((pages, design) => {
315
+ const current = stateRef.current.doc;
316
+ const empty = current.pages.every((p) => {
317
+ var _a2, _b2;
318
+ return !((_a2 = p.layers) == null ? void 0 : _a2.length) && ((_b2 = p.background) == null ? void 0 : _b2.kind) !== "image";
319
+ });
320
+ if (empty) {
321
+ dispatch({
322
+ type: "patchDoc",
323
+ patch: {
324
+ pages,
325
+ palette: design.palette,
326
+ fontPair: design.fontPair
327
+ }
328
+ });
329
+ dispatch({
330
+ type: "select",
331
+ pageId: pages[0].id,
332
+ layerId: null
333
+ });
334
+ } else {
335
+ dispatch({
336
+ type: "insertPages",
337
+ afterId: page.id,
338
+ pages
339
+ });
340
+ }
341
+ setDockTool(null);
342
+ void (async () => {
343
+ for (const p of pages) await paintPage(p.id);
344
+ })();
345
+ }, [page.id, paintPage]);
346
+ const onAiEdited = useCallback((edited) => {
347
+ dispatch({
348
+ type: "replacePage",
349
+ page: edited
350
+ });
351
+ setDockTool(null);
352
+ void paintPage(edited.id);
353
+ }, [paintPage]);
354
+ const addSticker = useCallback((emoji) => addLayer(makeStickerLayer(emoji, doc.pageWidth, doc.pageHeight)), [addLayer, doc.pageWidth, doc.pageHeight]);
355
+ const applyFrame = useCallback((d) => {
356
+ if ((layer == null ? void 0 : layer.kind) === "image" && !layer.locked) {
357
+ patch(layer.id, {
358
+ clipPath: d
359
+ });
360
+ return;
361
+ }
362
+ if (!d) return;
363
+ const w = 0.4;
364
+ const h = w * doc.pageWidth / doc.pageHeight;
365
+ const frame = {
366
+ id: newLayerId(),
367
+ kind: "image",
368
+ prompt: "",
369
+ src: null,
370
+ imageStatus: "empty",
371
+ replaceable: true,
372
+ clipPath: d,
373
+ x: (1 - w) / 2,
374
+ y: (1 - h) / 2,
375
+ w,
376
+ h
377
+ };
378
+ addLayer(frame);
379
+ }, [layer, patch, addLayer, doc.pageWidth, doc.pageHeight]);
380
+ const addQr = useCallback(async (text, style) => {
381
+ if (!capture.current) throw new Error("The QR code could not be drawn.");
382
+ let matrix;
383
+ try {
384
+ matrix = qrMatrix(text);
385
+ } catch (err) {
386
+ throw err instanceof Error && /newer version/.test(err.message) ? err : new Error("That is too long for a QR code.");
387
+ }
388
+ const side = matrix.size + style.margin * 2;
389
+ const d = qrPath(matrix, style.margin);
390
+ const png = await capture.current.captureSvg((svg) => /* @__PURE__ */ jsxs(svg.G, { children: [
391
+ /* @__PURE__ */ jsx(svg.Rect, { x: 0, y: 0, width: side, height: side, fill: style.background }),
392
+ /* @__PURE__ */ jsx(svg.Path, { d, fill: style.foreground })
393
+ ] }), side, side, 1200);
394
+ const src = await hostBytes(png, "image/png", "qr-code");
395
+ const w = 0.3;
396
+ const h = w * doc.pageWidth / doc.pageHeight;
397
+ addLayer(__spreadProps(__spreadValues({}, makeImageLayer(src, doc.pageWidth, doc.pageHeight, null)), {
398
+ x: (1 - w) / 2,
399
+ y: (1 - h) / 2,
400
+ w,
401
+ h
402
+ }));
403
+ }, [hostBytes, addLayer, doc.pageWidth, doc.pageHeight]);
404
+ const runExport = useCallback(async (choice) => {
405
+ const cap = capture.current;
406
+ if (!cap) return;
407
+ setExporting("Preparing\u2026");
408
+ try {
409
+ const result = await exportDesign({
410
+ doc,
411
+ pages: choice.pageIndices.map((i) => doc.pages[i]).filter(Boolean),
412
+ format: choice.format,
413
+ scale: choice.scale,
414
+ capture: (pg, px) => cap.capture(pg, px),
415
+ onProgress: (label) => mounted.current && setExporting(label)
416
+ });
417
+ if (result !== "cancelled" && mounted.current) setExtra(null);
418
+ } catch (err) {
419
+ Alert.alert("Could not download", err instanceof Error ? err.message : "Try again.");
420
+ } finally {
421
+ if (mounted.current) setExporting(null);
422
+ }
423
+ }, [doc]);
424
+ const openMore = useCallback(() => {
425
+ setEditingTextId(null);
426
+ chooseAction("Design", [{
427
+ id: "export",
428
+ label: "Download"
429
+ }, {
430
+ id: "present",
431
+ label: "Present"
432
+ }, {
433
+ id: "find",
434
+ label: "Find and replace"
435
+ }], (id) => {
436
+ setDockTool(null);
437
+ setLayerTool(null);
438
+ if (id === "present") setPresenting(true);
439
+ else setExtra(id);
440
+ });
441
+ }, []);
442
+ const editing = editingTextId ? (_c = page.layers) == null ? void 0 : _c.find((l) => l.id === editingTextId && l.kind === "text") : void 0;
443
+ const openTool = useCallback((tool) => {
444
+ setLayerTool((prev) => prev === tool ? null : tool);
445
+ setDockTool(null);
446
+ setExtra(null);
447
+ }, []);
448
+ const cropLayer = cropping ? (_d = page.layers) == null ? void 0 : _d.find((l) => l.id === cropping && l.kind === "image") : void 0;
449
+ const sheet = (() => {
450
+ var _a2, _b2;
451
+ if (editing) {
452
+ return /* @__PURE__ */ jsxs(View, { style: styles.textSheet, children: [
453
+ /* @__PURE__ */ jsx(TextInput, { value: editing.content, onChangeText: (content) => patch(editing.id, __spreadValues({
454
+ content
455
+ }, editing.runs ? {
456
+ runs: rebaseRuns(editing.content, content, editing.runs)
457
+ } : {}), `text:${editing.id}`), multiline: true, autoFocus: true, style: styles.textInput, placeholder: "Type your text", placeholderTextColor: theme.edInk3 }),
458
+ /* @__PURE__ */ jsx(Pressable, { onPress: () => setEditingTextId(null), style: styles.doneButton, accessibilityRole: "button", children: /* @__PURE__ */ jsx(Text, { style: styles.doneLabel, children: "Done" }) })
459
+ ] });
460
+ }
461
+ if (layerTool) {
462
+ return /* @__PURE__ */ jsx(EditorSheet, { title: toolTitle(layerTool), onClose: () => setLayerTool(null), height: sheetH, children: /* @__PURE__ */ jsx(LayerToolPanel, { tool: layerTool, doc, page, layer, patch: (p, coalesce) => layer && patch(layer.id, p, coalesce), arrange: (move) => layer && dispatch({
463
+ type: "reorderLayer",
464
+ pageId: page.id,
465
+ layerId: layer.id,
466
+ move
467
+ }), setBackground: (background, coalesce) => dispatch({
468
+ type: "setBackground",
469
+ pageId: page.id,
470
+ background,
471
+ coalesce: coalesce ? `bg:${page.id}` : void 0
472
+ }) }) });
473
+ }
474
+ if (extra) {
475
+ return /* @__PURE__ */ jsx(EditorSheet, { title: extra === "export" ? "Download" : "Find and replace", onClose: () => setExtra(null), height: sheetH, children: extra === "export" ? /* @__PURE__ */ jsx(ExportSheet, { doc, pageIndex, busy: exporting, onExport: (c) => void runExport(c) }) : /* @__PURE__ */ jsx(FindReplacePanel, { doc, onReveal: (pageId, layerId) => dispatch({
476
+ type: "select",
477
+ pageId,
478
+ layerId
479
+ }), onReplace: (next) => dispatch({
480
+ type: "patchDoc",
481
+ patch: {
482
+ pages: next.pages
483
+ }
484
+ }) }) });
485
+ }
486
+ if (dockTool) {
487
+ const title2 = (_b2 = (_a2 = DOCK_TOOLS.find((t) => t.id === dockTool)) == null ? void 0 : _a2.label) != null ? _b2 : "";
488
+ return /* @__PURE__ */ jsx(EditorSheet, { title: title2, onClose: () => setDockTool(null), height: sheetH, children: dockTool === "ai" ? /* @__PURE__ */ jsx(AiPanel, { doc, page, pageIndex, run: runCarousel, onCreated: onAiCreated, onEdited: onAiEdited }) : dockTool === "templates" ? /* @__PURE__ */ jsx(TemplatesPanel, { doc, load: loadCatalog, onPick: (card) => void applyTemplate(card), width }) : dockTool === "elements" ? /* @__PURE__ */ jsx(ElementsPanel, { onShape: (shape) => addLayer(makeShapeLayer(shape, doc.palette)), onChart: (chart) => addLayer(makeChartLayer(chart, doc.palette)), onPhoto: pickImage ? () => void pickAndPlace() : void 0, onSticker: addSticker, onFrame: applyFrame, frameCurrent: (layer == null ? void 0 : layer.kind) === "image" ? layer.clipPath : void 0, onQr: addQr }) : dockTool === "text" ? /* @__PURE__ */ jsx(TextPanel, { doc, onTextBox: () => {
489
+ var _a3;
490
+ const fonts = (_a3 = doc.brandKit) == null ? void 0 : _a3.fonts;
491
+ const text = makeTextBox();
492
+ addLayer(fonts ? __spreadProps(__spreadValues({}, text), {
493
+ fontFamily: fonts[text.fontToken]
494
+ }) : text);
495
+ }, onAdd: (preset) => {
496
+ var _a3;
497
+ const fonts = (_a3 = doc.brandKit) == null ? void 0 : _a3.fonts;
498
+ const text = makeTextLayer(preset);
499
+ addLayer(fonts ? __spreadProps(__spreadValues({}, text), {
500
+ fontFamily: fonts[text.fontToken]
501
+ }) : text);
502
+ } }) : dockTool === "brand" ? /* @__PURE__ */ jsx(BrandPanel, { doc, onBrandKit: setBrandKit, onPlaceLogo: (src) => placePicture({
503
+ src
504
+ }), onAddLogo: pickImage ? () => void addLogo() : void 0 }) : dockTool === "details" ? /* @__PURE__ */ jsx(DetailsPanel, { doc, page, onRename: (title3) => dispatch({
505
+ type: "patchDoc",
506
+ patch: {
507
+ title: title3 || void 0
508
+ }
509
+ }), onResize: resize, onPage: (p) => dispatch({
510
+ type: "patchDoc",
511
+ patch: {
512
+ pages: doc.pages.map((pg) => pg.id === page.id ? __spreadValues(__spreadValues({}, pg), p) : pg)
513
+ }
514
+ }) }) : /* @__PURE__ */ jsx(AssetsPanel, { doc, width, onUpload: pickImage ? () => void pickAndPlace() : void 0, uploading: Boolean(busy), onPlace: (src) => placePicture({
515
+ src
516
+ }), replacing: (layer == null ? void 0 : layer.kind) === "image" }) });
517
+ }
518
+ return null;
519
+ })();
520
+ const title = designTitle(doc) || "Untitled design";
521
+ return /* @__PURE__ */ jsxs(KeyboardAvoidingView, { style: [styles.root, {
522
+ paddingTop: insets.top
523
+ }], behavior: Platform.OS === "ios" ? "padding" : void 0, children: [
524
+ /* @__PURE__ */ jsxs(View, { style: styles.topBar, children: [
525
+ /* @__PURE__ */ jsx(Pressable, { onPress: () => void close(), hitSlop: 10, style: styles.topButton, accessibilityRole: "button", accessibilityLabel: "Back", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-left", size: 28, color: theme.edInk }) }),
526
+ /* @__PURE__ */ jsxs(Pressable, { onPress: () => setDockTool("details"), style: styles.titleWrap, accessibilityRole: "button", accessibilityLabel: "Rename design", children: [
527
+ /* @__PURE__ */ jsx(Text, { style: styles.title, numberOfLines: 1, children: title }),
528
+ /* @__PURE__ */ jsx(Text, { style: [styles.status, save.status === "error" && {
529
+ color: theme.edDanger
530
+ }], numberOfLines: 1, children: save.status === "error" && save.error ? save.error : statusLabel(save.status) })
531
+ ] }),
532
+ /* @__PURE__ */ jsx(Pressable, { onPress: () => dispatch({
533
+ type: "undo"
534
+ }), disabled: !state.past.length, hitSlop: 8, style: [styles.topButton, !state.past.length && styles.disabled], accessibilityRole: "button", accessibilityLabel: "Undo", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "undo", size: 22, color: theme.edInk }) }),
535
+ /* @__PURE__ */ jsx(Pressable, { onPress: () => dispatch({
536
+ type: "redo"
537
+ }), disabled: !state.future.length, hitSlop: 8, style: [styles.topButton, !state.future.length && styles.disabled], accessibilityRole: "button", accessibilityLabel: "Redo", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "redo", size: 22, color: theme.edInk }) }),
70
538
  /* @__PURE__ */ jsx(Pressable, { onPress: () => {
71
- dismissKeyboard();
72
- onClose();
73
- }, style: ({
74
- pressed
75
- }) => [styles.headerButton, pressedStyle(pressed)], accessibilityRole: "button", accessibilityLabel: "Close editor", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "close", size: 22, color: theme.edInk }) }),
76
- doc.pages.length > 1 ? /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles.headerMiddleScroll, contentContainerStyle: styles.pageChips, children: doc.pages.map((p, i) => /* @__PURE__ */ jsx(Pressable, { onPress: () => {
77
- setPageIndex(i);
78
- setSelectedId(null);
79
- }, style: [styles.pageChip, i === pageIndex && styles.pageChipActive], children: /* @__PURE__ */ jsx(Text, { style: [styles.pageChipLabel, i === pageIndex && styles.pageChipLabelActive], children: p.name }) }, p.id)) }) : /* @__PURE__ */ jsx(Text, { style: styles.headerTitle, numberOfLines: 1, children: doc.title || "Design" }),
80
- /* @__PURE__ */ jsx(Pressable, { onPress: () => onExport(doc), style: ({
81
- pressed
82
- }) => [styles.headerButton, pressedStyle(pressed)], accessibilityRole: "button", accessibilityLabel: "Export design", children: /* @__PURE__ */ jsx(View, { style: styles.exportButton, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "check", size: 20, color: theme.primaryForeground }) }) })
539
+ setEditingTextId(null);
540
+ setDockTool(null);
541
+ setLayerTool(null);
542
+ setExtra("export");
543
+ }, hitSlop: 8, style: styles.topButton, accessibilityRole: "button", accessibilityLabel: "Download", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "tray-arrow-down", size: 22, color: theme.edInk }) }),
544
+ /* @__PURE__ */ jsx(Pressable, { onPress: openMore, hitSlop: 8, style: styles.topButton, accessibilityRole: "button", accessibilityLabel: "More", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "dots-horizontal", size: 22, color: theme.edInk }) })
83
545
  ] }),
84
- /* @__PURE__ */ jsx(View, { style: styles.canvasArea, onLayout: (e) => setCanvasSize(e.nativeEvent.layout), onTouchStart: dismissKeyboard, children: scale > 0 ? /* @__PURE__ */ jsxs(Pressable, { style: [styles.page, {
85
- width: page.width * scale,
86
- height: page.height * scale,
87
- backgroundColor: page.background
88
- }], onPress: () => setSelectedId(null), children: [
89
- /* @__PURE__ */ jsx(PageChrome, { doc, page, pageIndex, scale }),
90
- layerPaintOrder(page.layers).map((layer) => /* @__PURE__ */ jsx(LayerView, { layer, scale, selected: layer.id === selectedId, onSelect: () => setSelectedId(layer.id), onCommit: updateLayer }, layer.id))
91
- ] }) : null }),
92
- selected ? /* @__PURE__ */ jsxs(View, { style: styles.inspector, children: [
93
- /* @__PURE__ */ jsx(IconButton, { name: "flip-to-front", onPress: () => setPage(bringLayerToFront(page, selected.id)) }),
94
- /* @__PURE__ */ jsx(IconButton, { name: "flip-to-back", onPress: () => setPage(sendLayerToBack(page, selected.id)) }),
95
- /* @__PURE__ */ jsx(IconButton, { name: "content-copy", onPress: () => setPage(duplicateLayer(page, selected.id)) }),
96
- /* @__PURE__ */ jsx(View, { style: styles.inspectorSpacer }),
97
- /* @__PURE__ */ jsx(Text, { style: styles.inspectorLabel, children: "Opacity" }),
98
- /* @__PURE__ */ jsx(IconButton, { name: "minus", onPress: () => updateLayer(__spreadProps(__spreadValues({}, selected), {
99
- opacity: Math.max(0.1, +(selected.opacity - 0.1).toFixed(2))
100
- })) }),
101
- /* @__PURE__ */ jsxs(Text, { style: styles.inspectorValue, children: [
102
- Math.round(selected.opacity * 100),
103
- "%"
104
- ] }),
105
- /* @__PURE__ */ jsx(IconButton, { name: "plus", onPress: () => updateLayer(__spreadProps(__spreadValues({}, selected), {
106
- opacity: Math.min(1, +(selected.opacity + 0.1).toFixed(2))
107
- })) }),
108
- /* @__PURE__ */ jsx(View, { style: styles.inspectorSpacer }),
109
- /* @__PURE__ */ jsx(IconButton, { name: "trash-can-outline", color: theme.edDanger, onPress: () => {
110
- setPage(removeLayer(page, selected.id));
111
- setSelectedId(null);
112
- } })
113
- ] }) : null,
114
- /* @__PURE__ */ jsxs(View, { style: styles.dockPanel, children: [
115
- dock === "add" ? /* @__PURE__ */ jsxs(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles.hScroll, contentContainerStyle: styles.addRow, children: [
116
- /* @__PURE__ */ jsx(AddButton, { icon: "format-text", label: "Text", onPress: () => addAndSelect(newTextLayer("Tap to edit", nextZ(page))) }),
117
- /* @__PURE__ */ jsx(AddButton, { icon: "square-rounded-outline", label: "Rectangle", onPress: () => addAndSelect(newShapeLayer("rect", nextZ(page))) }),
118
- /* @__PURE__ */ jsx(AddButton, { icon: "minus", label: "Line", onPress: () => addAndSelect(newShapeLayer("line", nextZ(page))) }),
119
- /* @__PURE__ */ jsx(AddButton, { icon: "image-outline", label: "Image", onPress: () => void handleAddImage() })
120
- ] }) : null,
121
- dock === "style" && (selected == null ? void 0 : selected.type) === "text" ? /* @__PURE__ */ jsx(TextStylePanel, { layer: selected, onChange: updateLayer }) : null,
122
- dock === "style" && (selected == null ? void 0 : selected.type) === "shape" ? /* @__PURE__ */ jsx(SwatchRow, { value: selected.fill, onPick: (fill) => updateLayer(__spreadProps(__spreadValues({}, selected), {
123
- fill
124
- })) }) : null,
125
- dock === "style" && (selected == null ? void 0 : selected.type) === "image" ? /* @__PURE__ */ jsx(Text, { style: styles.panelHint, children: "Drag to move \xB7 corner handle resizes" }) : null,
126
- dock === "style" && !selected ? /* @__PURE__ */ jsx(Text, { style: styles.panelHint, children: "Select a layer to style it" }) : null,
127
- dock === "page" ? /* @__PURE__ */ jsxs(View, { children: [
128
- /* @__PURE__ */ jsx(Text, { style: styles.panelLabel, children: doc.kind === "tshirt" ? "Shirt colour" : "Page background" }),
129
- /* @__PURE__ */ jsx(SwatchRow, { swatches: doc.kind === "tshirt" ? TSHIRT_COLORS : DESIGN_SWATCHES, value: page.background, onPick: (background) => setPage(__spreadProps(__spreadValues({}, page), {
130
- background
131
- })) })
132
- ] }) : null,
133
- dock === "layers" ? /* @__PURE__ */ jsxs(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles.hScroll, contentContainerStyle: styles.addRow, children: [
134
- layerPaintOrder(page.layers).slice().reverse().map((layer) => /* @__PURE__ */ jsxs(Pressable, { onPress: () => setSelectedId(layer.id), style: [styles.layerChip, layer.id === selectedId && styles.layerChipActive], children: [
135
- /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: layer.type === "text" ? "format-text" : layer.type === "image" ? "image-outline" : "square-rounded-outline", size: 14, color: layer.id === selectedId ? theme.edOnInk : theme.edInk2 }),
136
- /* @__PURE__ */ jsx(Text, { style: [styles.layerChipLabel, layer.id === selectedId && styles.layerChipLabelActive], numberOfLines: 1, children: layer.type === "text" ? layer.text.slice(0, 14) || "Text" : layer.type })
137
- ] }, layer.id)),
138
- page.layers.length === 0 ? /* @__PURE__ */ jsx(Text, { style: styles.panelHint, children: "No layers yet" }) : null
546
+ /* @__PURE__ */ jsxs(View, { style: styles.canvasArea, children: [
547
+ /* @__PURE__ */ jsx(DesignCanvas, { doc, page, selectedId: state.layerId, editingId: editingTextId, onSelect: select, onPatch: (layerId, p, coalesce) => patch(layerId, p, coalesce), onEditText: (layerId) => {
548
+ setEditingTextId(layerId);
549
+ setLayerTool(null);
550
+ setDockTool(null);
551
+ } }),
552
+ cropLayer ? /* @__PURE__ */ jsx(CropOverlay, { doc, layer: cropLayer, onCancel: () => setCropping(null), onDone: (p) => {
553
+ patch(cropLayer.id, p);
554
+ setCropping(null);
555
+ } }) : null,
556
+ /* @__PURE__ */ jsx(PageCapture, { ref: capture, doc }),
557
+ busy ? /* @__PURE__ */ jsxs(View, { pointerEvents: "none", style: styles.busy, children: [
558
+ /* @__PURE__ */ jsx(ActivityIndicator, { color: "#fff" }),
559
+ /* @__PURE__ */ jsx(Text, { style: styles.busyLabel, children: busy })
139
560
  ] }) : null
140
561
  ] }),
141
- /* @__PURE__ */ jsx(View, { style: styles.dock, children: [["add", "plus-box-outline", "Add"], ["style", "palette-outline", "Style"], ["page", "file-outline", "Page"], ["layers", "layers-outline", "Layers"]].map(([tab, icon, label]) => /* @__PURE__ */ jsxs(Pressable, { onPress: () => setDock(tab), style: styles.dockTab, accessibilityRole: "tab", children: [
142
- /* @__PURE__ */ jsx(View, { style: [styles.dockPill, dock === tab && styles.dockPillActive], children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: icon, size: 22, color: dock === tab ? theme.edInk : theme.edInk3 }) }),
143
- /* @__PURE__ */ jsx(Text, { style: [styles.dockLabel, dock === tab && styles.dockLabelActive], children: label })
144
- ] }, tab)) }),
145
- imagePicker ? /* @__PURE__ */ jsx(View, { style: styles.pickerOverlay, children: /* @__PURE__ */ jsxs(View, { style: styles.pickerCard, children: [
146
- /* @__PURE__ */ jsxs(View, { style: styles.pickerHead, children: [
147
- /* @__PURE__ */ jsx(Text, { style: styles.pickerTitle, children: "Add an image" }),
148
- /* @__PURE__ */ jsx(Pressable, { onPress: () => setImagePicker(false), style: ({
149
- pressed
150
- }) => [styles.pickerDismiss, pressedStyle(pressed)], children: /* @__PURE__ */ jsx(Text, { style: styles.pickerDismissLabel, children: "Cancel" }) })
151
- ] }),
152
- /* @__PURE__ */ jsx(Text, { style: styles.panelHint, children: canvasImages.length ? "From your canvases:" : onPickLocalMedia ? "No images on your canvases yet." : "Photo library needs an app update - images from your canvases work now." }),
153
- /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles.hScroll, contentContainerStyle: styles.pickerRow, children: canvasImages.map((src) => /* @__PURE__ */ jsx(Pressable, { onPress: () => {
154
- setImagePicker(false);
155
- addAndSelect(newImageLayer(src, nextZ(page)));
156
- }, children: /* @__PURE__ */ jsx(Image, { source: {
157
- uri: src
158
- }, style: styles.pickerThumb, contentFit: "cover" }) }, src)) })
159
- ] }) }) : null,
160
- /* @__PURE__ */ jsx(KeyboardLiftSpacer, {})
161
- ] });
162
- }
163
- function PageChrome({
164
- doc,
165
- page,
166
- pageIndex,
167
- scale
168
- }) {
169
- const styles = makeStyles(useCanvasTheme());
170
- if (doc.kind === "tshirt") {
171
- const area = TSHIRT_PRINT_AREA;
172
- return /* @__PURE__ */ jsxs(View, { pointerEvents: "none", style: StyleSheet.absoluteFill, children: [
173
- /* @__PURE__ */ jsx(View, { style: [styles.tshirtNeck, {
174
- left: page.width * scale * 0.38,
175
- width: page.width * scale * 0.24,
176
- height: page.height * scale * 0.055,
177
- borderRadius: page.width * scale * 0.12
178
- }] }),
179
- /* @__PURE__ */ jsx(View, { style: [styles.printArea, {
180
- left: page.width * area.x * scale,
181
- top: page.height * area.y * scale,
182
- width: page.width * area.width * scale,
183
- height: page.height * area.height * scale
184
- }] }),
185
- /* @__PURE__ */ jsx(Text, { style: [styles.chromeHint, {
186
- top: page.height * (area.y + area.height) * scale + 6
187
- }], children: "Print area" })
188
- ] });
189
- }
190
- if (doc.kind === "postcard" && pageIndex === 1) {
191
- const w = page.width * scale;
192
- const h = page.height * scale;
193
- return /* @__PURE__ */ jsxs(View, { pointerEvents: "none", style: StyleSheet.absoluteFill, children: [
194
- /* @__PURE__ */ jsx(View, { style: [styles.postDivider, {
195
- left: w * 0.55,
196
- top: h * 0.12,
197
- height: h * 0.76
198
- }] }),
199
- [0.3, 0.45, 0.6].map((frac) => /* @__PURE__ */ jsx(View, { style: [styles.postAddressLine, {
200
- left: w * 0.62,
201
- right: w * 0.06,
202
- top: h * frac
203
- }] }, frac)),
204
- /* @__PURE__ */ jsx(View, { style: [styles.postStamp, {
205
- right: w * 0.06,
206
- top: h * 0.08,
207
- width: w * 0.1,
208
- height: w * 0.12
209
- }] })
210
- ] });
211
- }
212
- return null;
213
- }
214
- function LayerView({
215
- layer,
216
- scale,
217
- selected,
218
- onSelect,
219
- onCommit
220
- }) {
221
- const theme = useCanvasTheme();
222
- const styles = makeStyles(theme);
223
- const [live, setLive] = useState(null);
224
- const gestureBase = useRef({
225
- x: 0,
226
- y: 0,
227
- width: 0,
228
- height: 0
229
- });
230
- const liveRef = useRef(null);
231
- const setLiveBoth = (f) => {
232
- liveRef.current = f;
233
- setLive(f);
234
- };
235
- const current = useRef({
236
- layer,
237
- scale,
238
- onSelect,
239
- onCommit
240
- });
241
- current.current = {
242
- layer,
243
- scale,
244
- onSelect,
245
- onCommit
246
- };
247
- const commitLive = () => {
248
- if (liveRef.current) current.current.onCommit(__spreadValues(__spreadValues({}, current.current.layer), liveRef.current));
249
- setLiveBoth(null);
250
- };
251
- const grabFrame = () => {
252
- const l = current.current.layer;
253
- gestureBase.current = {
254
- x: l.x,
255
- y: l.y,
256
- width: l.width,
257
- height: l.height
258
- };
259
- };
260
- const drag = useRef(PanResponder.create({
261
- onStartShouldSetPanResponder: () => true,
262
- onMoveShouldSetPanResponder: (_e, g) => Math.abs(g.dx) + Math.abs(g.dy) > 4,
263
- onPanResponderGrant: () => {
264
- current.current.onSelect();
265
- grabFrame();
266
- },
267
- onPanResponderMove: (_e, g) => {
268
- const b = gestureBase.current;
269
- const s = current.current.scale;
270
- setLiveBoth(__spreadProps(__spreadValues({}, b), {
271
- x: b.x + g.dx / s,
272
- y: b.y + g.dy / s
273
- }));
274
- },
275
- onPanResponderRelease: commitLive,
276
- onPanResponderTerminate: () => setLiveBoth(null)
277
- }));
278
- const resize = useRef(PanResponder.create({
279
- onStartShouldSetPanResponder: () => true,
280
- onPanResponderGrant: grabFrame,
281
- onPanResponderMove: (_e, g) => {
282
- const s = current.current.scale;
283
- setLiveBoth(resizeFrame(gestureBase.current, "br", g.dx / s, g.dy / s));
284
- },
285
- onPanResponderRelease: commitLive,
286
- onPanResponderTerminate: () => setLiveBoth(null)
287
- }));
288
- const frame = live != null ? live : layer;
289
- const box = {
290
- left: frame.x * scale,
291
- top: frame.y * scale,
292
- width: frame.width * scale,
293
- height: frame.height * scale,
294
- opacity: layer.opacity
295
- };
296
- return /* @__PURE__ */ jsxs(View, __spreadProps(__spreadValues({ style: [styles.layer, box] }, selected ? drag.current.panHandlers : {}), { children: [
297
- layer.type === "image" ? /* @__PURE__ */ jsx(Image, { source: {
298
- uri: layer.src
299
- }, style: StyleSheet.absoluteFill, contentFit: "fill" }) : layer.type === "shape" ? /* @__PURE__ */ jsx(View, { style: [StyleSheet.absoluteFill, {
300
- backgroundColor: layer.fill,
301
- borderRadius: layer.cornerRadius * scale
302
- }] }) : /* @__PURE__ */ jsx(Text, { style: {
303
- fontSize: layer.fontSize * scale,
304
- color: layer.color,
305
- fontWeight: layer.bold ? "700" : "400",
306
- textAlign: layer.align,
307
- width: "100%"
308
- }, numberOfLines: 0, children: layer.text }),
309
- !selected ? /* @__PURE__ */ jsx(Pressable, { style: StyleSheet.absoluteFill, onPress: onSelect }) : /* @__PURE__ */ jsxs(Fragment, { children: [
310
- /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: styles.selection }),
311
- /* @__PURE__ */ jsx(View, __spreadProps(__spreadValues({ style: styles.handle }, resize.current.panHandlers), { children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "arrow-expand", size: 11, color: "#ffffff" }) }))
562
+ presenting ? /* @__PURE__ */ jsx(Slideshow, { doc, startIndex: pageIndex, onClose: () => setPresenting(false) }) : null,
563
+ cropLayer ? /* @__PURE__ */ jsx(View, { style: {
564
+ height: insets.bottom
565
+ } }) : sheet ? /* @__PURE__ */ jsx(View, { style: {
566
+ height: editing ? void 0 : sheetH
567
+ }, children: sheet }) : /* @__PURE__ */ jsxs(View, { style: {
568
+ paddingBottom: insets.bottom
569
+ }, children: [
570
+ /* @__PURE__ */ jsx(SelectionToolbar, { doc, page, layer, tool: layerTool, layerActions: {
571
+ patch: (p, coalesce) => layer && patch(layer.id, p, coalesce),
572
+ duplicate: () => layer && dispatch({
573
+ type: "duplicateLayer",
574
+ pageId: page.id,
575
+ layerId: layer.id
576
+ }),
577
+ remove: () => layer && dispatch({
578
+ type: "deleteLayer",
579
+ pageId: page.id,
580
+ layerId: layer.id
581
+ }),
582
+ arrange: (move) => layer && dispatch({
583
+ type: "reorderLayer",
584
+ pageId: page.id,
585
+ layerId: layer.id,
586
+ move
587
+ }),
588
+ editText: () => layer && setEditingTextId(layer.id),
589
+ replaceImage: () => pickImage ? void pickAndPlace() : setDockTool("assets"),
590
+ openTool,
591
+ crop: () => {
592
+ if ((layer == null ? void 0 : layer.kind) === "image" && layer.src) {
593
+ setLayerTool(null);
594
+ setCropping(layer.id);
595
+ }
596
+ }
597
+ }, pageActions: {
598
+ openTool,
599
+ addPage: () => dispatch({
600
+ type: "addPage",
601
+ afterId: page.id
602
+ }),
603
+ duplicatePage: () => dispatch({
604
+ type: "duplicatePage",
605
+ pageId: page.id
606
+ }),
607
+ deletePage: () => dispatch({
608
+ type: "deletePage",
609
+ pageId: page.id
610
+ })
611
+ } }),
612
+ /* @__PURE__ */ jsx(PageStrip, { doc, pageId: page.id, onSelect: (pageId) => {
613
+ dispatch({
614
+ type: "select",
615
+ pageId,
616
+ layerId: null
617
+ });
618
+ setLayerTool(null);
619
+ }, onAdd: () => dispatch({
620
+ type: "addPage",
621
+ afterId: page.id
622
+ }), onAction: (pageId, action) => {
623
+ if (action === "duplicate") dispatch({
624
+ type: "duplicatePage",
625
+ pageId
626
+ });
627
+ else if (action === "delete") dispatch({
628
+ type: "deletePage",
629
+ pageId
630
+ });
631
+ else dispatch({
632
+ type: "movePage",
633
+ pageId,
634
+ dir: action === "left" ? -1 : 1
635
+ });
636
+ }, onMove: (pageId, to) => dispatch({
637
+ type: "movePageTo",
638
+ pageId,
639
+ index: to
640
+ }) }),
641
+ /* @__PURE__ */ jsx(View, { style: styles.dock, children: DOCK_TOOLS.map((tool) => /* @__PURE__ */ jsxs(Pressable, { onPress: () => {
642
+ setDockTool(tool.id);
643
+ setLayerTool(null);
644
+ setExtra(null);
645
+ }, style: styles.dockItem, accessibilityRole: "button", accessibilityLabel: tool.label, children: [
646
+ /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: tool.icon, size: 22, color: theme.edInk2 }),
647
+ /* @__PURE__ */ jsx(Text, { style: styles.dockLabel, children: tool.label })
648
+ ] }, tool.id)) })
312
649
  ] })
313
- ] }));
314
- }
315
- function TextStylePanel({
316
- layer,
317
- onChange
318
- }) {
319
- const theme = useCanvasTheme();
320
- const styles = makeStyles(theme);
321
- return /* @__PURE__ */ jsxs(View, { children: [
322
- /* @__PURE__ */ jsx(TextInput, { style: styles.textInput, value: layer.text, onChangeText: (text) => onChange(__spreadProps(__spreadValues({}, layer), {
323
- text
324
- })), placeholder: "Your text", placeholderTextColor: theme.edInk3, multiline: true }),
325
- /* @__PURE__ */ jsxs(View, { style: styles.textControls, children: [
326
- /* @__PURE__ */ jsx(IconButton, { name: "format-font-size-decrease", onPress: () => onChange(__spreadProps(__spreadValues({}, layer), {
327
- fontSize: Math.max(16, layer.fontSize - 8)
328
- })) }),
329
- /* @__PURE__ */ jsx(Text, { style: styles.inspectorValue, children: layer.fontSize }),
330
- /* @__PURE__ */ jsx(IconButton, { name: "format-font-size-increase", onPress: () => onChange(__spreadProps(__spreadValues({}, layer), {
331
- fontSize: Math.min(400, layer.fontSize + 8)
332
- })) }),
333
- /* @__PURE__ */ jsx(IconButton, { name: "format-bold", active: layer.bold, onPress: () => onChange(__spreadProps(__spreadValues({}, layer), {
334
- bold: !layer.bold
335
- })) }),
336
- ["left", "center", "right"].map((align) => /* @__PURE__ */ jsx(IconButton, { name: `format-align-${align}`, active: layer.align === align, onPress: () => onChange(__spreadProps(__spreadValues({}, layer), {
337
- align
338
- })) }, align))
339
- ] }),
340
- /* @__PURE__ */ jsx(SwatchRow, { value: layer.color, onPick: (color) => onChange(__spreadProps(__spreadValues({}, layer), {
341
- color
342
- })) })
343
650
  ] });
344
651
  }
345
- function SwatchRow({
346
- swatches = DESIGN_SWATCHES,
347
- value,
348
- onPick
349
- }) {
350
- const styles = makeStyles(useCanvasTheme());
351
- return /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles.hScroll, contentContainerStyle: styles.swatchRow, children: swatches.map((color) => /* @__PURE__ */ jsx(Pressable, { onPress: () => onPick(color), style: [styles.swatch, {
352
- backgroundColor: color
353
- }, value === color && styles.swatchActive], accessibilityRole: "button", accessibilityLabel: `Colour ${color}` }, color)) });
354
- }
355
- function AddButton({
356
- icon,
357
- label,
358
- onPress
359
- }) {
360
- const theme = useCanvasTheme();
361
- const styles = makeStyles(theme);
362
- return /* @__PURE__ */ jsxs(Pressable, { onPress, style: ({
363
- pressed
364
- }) => [styles.addButton, pressedStyle(pressed)], accessibilityRole: "button", children: [
365
- /* @__PURE__ */ jsx(View, { style: styles.addIcon, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: icon, size: 22, color: theme.edInk }) }),
366
- /* @__PURE__ */ jsx(Text, { style: styles.addButtonLabel, children: label })
367
- ] });
368
- }
369
- function IconButton({
370
- name,
371
- color,
372
- active,
373
- onPress
374
- }) {
375
- const theme = useCanvasTheme();
376
- const styles = makeStyles(theme);
377
- const ink = color != null ? color : active === false ? theme.edInk3 : theme.edInk2;
378
- return /* @__PURE__ */ jsx(Pressable, { onPress, hitSlop: 4, style: ({
379
- pressed
380
- }) => [styles.iconButton, active && styles.iconButtonActive, pressedStyle(pressed)], accessibilityRole: "button", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name, size: 20, color: active ? theme.edInk : ink }) });
381
- }
382
- const STAGE = "#0c0c0f";
383
652
  const makeStyles = themedStyles((theme) => StyleSheet.create({
384
653
  root: {
385
654
  flex: 1,
386
655
  backgroundColor: theme.edBg
387
656
  },
388
- header: {
657
+ topBar: {
389
658
  flexDirection: "row",
390
659
  alignItems: "center",
391
- gap: SPACE.sm,
392
- minHeight: 56,
660
+ gap: SPACE.xs,
393
661
  paddingHorizontal: SPACE.sm,
394
- backgroundColor: theme.edPanel,
662
+ // The shared studio and editor bar: 44pt on phones, 36pt controls.
663
+ height: 44,
395
664
  borderBottomWidth: StyleSheet.hairlineWidth,
396
- borderBottomColor: theme.edLine
665
+ borderColor: theme.edLine,
666
+ backgroundColor: theme.edPanel
397
667
  },
398
- headerButton: {
399
- width: HIT,
400
- height: HIT,
401
- borderRadius: HIT / 2,
402
- alignItems: "center",
403
- justifyContent: "center"
404
- },
405
- headerTitle: __spreadProps(__spreadValues({}, TYPE.title), {
406
- flex: 1,
407
- textAlign: "center",
408
- color: theme.edInk
409
- }),
410
- headerMiddleScroll: {
411
- flexGrow: 0,
412
- flexShrink: 1,
413
- marginHorizontal: "auto"
414
- },
415
- exportButton: {
668
+ topButton: {
416
669
  width: 36,
417
670
  height: 36,
418
- borderRadius: 18,
419
- backgroundColor: theme.primary,
420
671
  alignItems: "center",
421
672
  justifyContent: "center"
422
673
  },
423
- pageChips: {
424
- flexDirection: "row",
425
- alignItems: "center",
426
- gap: SPACE.xs + 2
427
- },
428
- pageChip: {
429
- minHeight: 32,
430
- paddingHorizontal: SPACE.md + 2,
431
- borderRadius: RADIUS.pill,
432
- alignItems: "center",
433
- justifyContent: "center",
434
- backgroundColor: theme.edRaised
674
+ disabled: {
675
+ opacity: 0.3
435
676
  },
436
- pageChipActive: {
437
- backgroundColor: theme.edInk
677
+ titleWrap: {
678
+ flex: 1,
679
+ paddingHorizontal: SPACE.xs
438
680
  },
439
- pageChipLabel: __spreadProps(__spreadValues({}, TYPE.label), {
440
- color: theme.edInk2
681
+ title: __spreadProps(__spreadValues({}, TYPE.title), {
682
+ color: theme.edInk
683
+ }),
684
+ status: __spreadProps(__spreadValues({}, TYPE.caption), {
685
+ color: theme.edInk3
441
686
  }),
442
- pageChipLabelActive: {
443
- color: theme.edOnInk
444
- },
445
687
  canvasArea: {
446
688
  flex: 1,
447
- alignItems: "center",
448
- justifyContent: "center",
449
- backgroundColor: STAGE
450
- },
451
- page: {
452
- borderRadius: 4,
453
- overflow: "hidden"
689
+ backgroundColor: theme.edWell
454
690
  },
455
- layer: {
456
- position: "absolute"
457
- },
458
- selection: __spreadProps(__spreadValues({}, StyleSheet.absoluteFillObject), {
459
- borderWidth: 1.5,
460
- borderColor: theme.info,
461
- borderRadius: 2
462
- }),
463
- handle: {
464
- position: "absolute",
465
- right: -12,
466
- bottom: -12,
467
- width: 24,
468
- height: 24,
469
- borderRadius: 12,
470
- backgroundColor: theme.info,
471
- borderWidth: 2,
472
- borderColor: "#ffffff",
473
- alignItems: "center",
474
- justifyContent: "center"
475
- },
476
- // Guides draw on the design's own page colour, so their ink is fixed, not themed.
477
- printArea: {
478
- position: "absolute",
479
- borderWidth: 1.5,
480
- borderStyle: "dashed",
481
- borderColor: "rgba(148,148,160,0.9)",
482
- borderRadius: 6
483
- },
484
- tshirtNeck: {
485
- position: "absolute",
486
- top: 0,
487
- borderBottomWidth: 2,
488
- borderColor: "rgba(148,148,160,0.6)"
489
- },
490
- chromeHint: {
691
+ busy: {
491
692
  position: "absolute",
492
693
  alignSelf: "center",
493
- fontSize: 11,
494
- fontWeight: "600",
495
- color: "rgba(148,148,160,0.95)"
496
- },
497
- postDivider: {
498
- position: "absolute",
499
- width: 1.5,
500
- backgroundColor: "rgba(20,20,20,0.22)"
501
- },
502
- postAddressLine: {
503
- position: "absolute",
504
- height: 1.5,
505
- backgroundColor: "rgba(20,20,20,0.16)"
506
- },
507
- postStamp: {
508
- position: "absolute",
509
- borderWidth: 1.5,
510
- borderStyle: "dashed",
511
- borderColor: "rgba(20,20,20,0.22)",
512
- borderRadius: 4
513
- },
514
- inspector: {
694
+ top: SPACE.lg,
515
695
  flexDirection: "row",
516
696
  alignItems: "center",
517
- gap: SPACE.xs,
518
- paddingHorizontal: SPACE.sm,
519
- paddingVertical: SPACE.xs,
520
- backgroundColor: theme.edPanel,
521
- borderTopWidth: StyleSheet.hairlineWidth,
522
- borderTopColor: theme.edLine
523
- },
524
- inspectorSpacer: {
525
- flex: 1
526
- },
527
- inspectorLabel: __spreadProps(__spreadValues({}, TYPE.caption), {
528
- color: theme.edInk3
529
- }),
530
- inspectorValue: __spreadProps(__spreadValues({}, TYPE.label), {
531
- color: theme.edInk,
532
- minWidth: 40,
533
- textAlign: "center",
534
- fontVariant: ["tabular-nums"]
535
- }),
536
- iconButton: {
537
- width: 40,
538
- height: 40,
539
- borderRadius: RADIUS.pill,
540
- alignItems: "center",
541
- justifyContent: "center"
542
- },
543
- iconButtonActive: {
544
- backgroundColor: theme.edRaisedHi
545
- },
546
- dockPanel: {
547
- minHeight: 84,
548
- justifyContent: "center",
697
+ gap: SPACE.sm,
549
698
  paddingHorizontal: SPACE.lg,
550
- paddingVertical: SPACE.md,
551
- backgroundColor: theme.edPanel,
552
- borderTopWidth: StyleSheet.hairlineWidth,
553
- borderTopColor: theme.edLine
554
- },
555
- hScroll: {
556
- flexGrow: 0
557
- },
558
- addRow: {
559
- flexDirection: "row",
560
- alignItems: "center",
561
- gap: SPACE.md
562
- },
563
- addButton: {
564
- alignItems: "center",
565
- gap: SPACE.xs + 2,
566
- minWidth: 64
567
- },
568
- addIcon: {
569
- width: 48,
570
- height: 48,
571
- borderRadius: RADIUS.md,
572
- alignItems: "center",
573
- justifyContent: "center",
574
- backgroundColor: theme.edRaised
575
- },
576
- addButtonLabel: {
577
- fontSize: 11,
578
- lineHeight: 14,
579
- fontWeight: "500",
580
- color: theme.edInk2
581
- },
582
- panelHint: __spreadProps(__spreadValues({}, TYPE.caption), {
583
- color: theme.edInk3,
584
- paddingVertical: SPACE.sm
585
- }),
586
- panelLabel: __spreadProps(__spreadValues({}, TYPE.label), {
587
- color: theme.edInk2,
588
- marginBottom: SPACE.sm
589
- }),
590
- swatchRow: {
591
- flexDirection: "row",
592
- alignItems: "center",
593
- gap: SPACE.md,
594
- paddingVertical: SPACE.xs + 2
595
- },
596
- swatch: {
597
- width: 32,
598
- height: 32,
599
- borderRadius: 16,
600
- borderWidth: 1,
601
- borderColor: theme.edLineHi
602
- },
603
- swatchActive: {
604
- borderWidth: 3,
605
- borderColor: theme.edInk
606
- },
607
- textInput: {
608
- backgroundColor: theme.edRaised,
609
- borderRadius: RADIUS.md,
610
- paddingHorizontal: SPACE.md,
611
- paddingVertical: SPACE.sm + 2,
612
- color: theme.edInk,
613
- fontSize: 15,
614
- maxHeight: 84
615
- },
616
- textControls: {
617
- flexDirection: "row",
618
- alignItems: "center",
619
- gap: SPACE.xs,
620
- marginTop: SPACE.sm
621
- },
622
- layerChip: {
623
- flexDirection: "row",
624
- alignItems: "center",
625
- gap: SPACE.xs + 2,
626
- minHeight: 36,
627
- paddingHorizontal: SPACE.md,
699
+ paddingVertical: SPACE.sm,
628
700
  borderRadius: RADIUS.pill,
629
- backgroundColor: theme.edRaised
701
+ backgroundColor: "rgba(15,23,42,0.86)"
630
702
  },
631
- layerChipActive: {
632
- backgroundColor: theme.edInk
633
- },
634
- layerChipLabel: __spreadProps(__spreadValues({}, TYPE.caption), {
635
- color: theme.edInk2,
636
- maxWidth: 110
703
+ busyLabel: __spreadProps(__spreadValues({}, TYPE.label), {
704
+ color: "#fff"
637
705
  }),
638
- layerChipLabelActive: {
639
- color: theme.edOnInk,
640
- fontWeight: "600"
641
- },
642
706
  dock: {
643
707
  flexDirection: "row",
644
- justifyContent: "space-around",
645
- paddingTop: SPACE.sm,
646
- paddingBottom: SPACE.sm,
647
- backgroundColor: theme.edPanel,
708
+ height: DOCK_H,
648
709
  borderTopWidth: StyleSheet.hairlineWidth,
649
- borderTopColor: theme.edLine
650
- },
651
- dockTab: {
652
- alignItems: "center",
653
- gap: 2,
654
- minWidth: 64,
655
- minHeight: HIT
710
+ borderColor: theme.edLine,
711
+ backgroundColor: theme.edPanel
656
712
  },
657
- dockPill: {
658
- width: 56,
659
- height: 30,
660
- borderRadius: RADIUS.pill,
713
+ dockItem: {
714
+ flex: 1,
661
715
  alignItems: "center",
662
- justifyContent: "center"
663
- },
664
- dockPillActive: {
665
- backgroundColor: theme.edRaisedHi
666
- },
667
- dockLabel: {
668
- fontSize: 11,
669
- lineHeight: 14,
670
- fontWeight: "500",
671
- color: theme.edInk3
672
- },
673
- dockLabelActive: {
674
- color: theme.edInk,
675
- fontWeight: "600"
716
+ justifyContent: "center",
717
+ gap: 2
676
718
  },
677
- pickerOverlay: __spreadProps(__spreadValues({}, StyleSheet.absoluteFillObject), {
678
- backgroundColor: "rgba(0,0,0,0.5)",
679
- justifyContent: "flex-end"
719
+ dockLabel: __spreadProps(__spreadValues({}, TYPE.caption), {
720
+ fontSize: 10,
721
+ color: theme.edInk2
680
722
  }),
681
- pickerCard: {
682
- width: "100%",
683
- backgroundColor: theme.edPanel,
684
- borderTopLeftRadius: RADIUS.xl,
685
- borderTopRightRadius: RADIUS.xl,
686
- paddingHorizontal: SPACE.lg,
687
- paddingTop: SPACE.xs,
688
- paddingBottom: SPACE.xl,
689
- gap: SPACE.xs
690
- },
691
- pickerHead: {
723
+ textSheet: {
692
724
  flexDirection: "row",
693
- alignItems: "center",
694
- minHeight: 52,
695
- borderBottomWidth: StyleSheet.hairlineWidth,
696
- borderBottomColor: theme.edLine,
697
- marginBottom: SPACE.xs
725
+ alignItems: "flex-end",
726
+ gap: SPACE.sm,
727
+ padding: SPACE.md,
728
+ backgroundColor: theme.edPanel,
729
+ borderTopWidth: StyleSheet.hairlineWidth,
730
+ borderColor: theme.edLine
698
731
  },
699
- pickerTitle: __spreadProps(__spreadValues({}, TYPE.title), {
732
+ textInput: __spreadValues({
700
733
  flex: 1,
701
- color: theme.edInk
702
- }),
703
- pickerRow: {
704
- flexDirection: "row",
705
- gap: SPACE.sm + 2,
706
- paddingVertical: SPACE.sm
707
- },
708
- pickerThumb: {
709
- width: 88,
710
- height: 88,
734
+ minHeight: 44,
735
+ maxHeight: 140,
711
736
  borderRadius: RADIUS.md,
712
- backgroundColor: theme.edRaised
713
- },
714
- pickerDismiss: {
715
- minHeight: HIT,
716
737
  paddingHorizontal: SPACE.md,
738
+ paddingTop: SPACE.sm,
739
+ paddingBottom: SPACE.sm,
740
+ backgroundColor: theme.edRaised,
741
+ color: theme.edInk
742
+ }, TYPE.body),
743
+ doneButton: {
744
+ height: 44,
745
+ paddingHorizontal: SPACE.lg,
746
+ borderRadius: RADIUS.pill,
747
+ backgroundColor: theme.edAccent,
717
748
  alignItems: "center",
718
749
  justifyContent: "center"
719
750
  },
720
- pickerDismissLabel: __spreadProps(__spreadValues({}, TYPE.label), {
721
- fontSize: 15,
722
- color: theme.edInk2
751
+ doneLabel: __spreadProps(__spreadValues({}, TYPE.label), {
752
+ color: theme.edOnInk
723
753
  })
724
754
  }));export{DesignEditorExperience};//# sourceMappingURL=DesignEditorExperience.js.map