@peteai/presentation-editor 0.0.6 → 0.0.8

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 (330) hide show
  1. package/README.md +38 -38
  2. package/dist/components/editor/active-layers-buttons.svelte +56 -0
  3. package/dist/components/editor/active-layers.svelte +237 -0
  4. package/dist/components/editor/active-layers.svelte.d.ts +8 -0
  5. package/dist/components/{presentation-editor/cognition-slides.d.ts → editor/cognition-pages.d.ts} +1 -1
  6. package/dist/components/{presentation-editor/cognition-slides.js → editor/cognition-pages.js} +1 -1
  7. package/dist/components/{presentation-editor → editor}/cursor-tooltip.svelte +6 -2
  8. package/dist/components/editor/cursor-tooltip.svelte.d.ts +7 -0
  9. package/dist/components/{presentation-editor → editor}/dragged.svelte +7 -3
  10. package/dist/components/editor/dragged.svelte.d.ts +7 -0
  11. package/dist/components/{presentation-editor/presentation-editor.svelte → editor/editor.svelte} +64 -61
  12. package/dist/components/editor/editor.svelte.d.ts +4 -0
  13. package/dist/components/editor/editor.svelte.js +1169 -0
  14. package/dist/components/editor/header.svelte +62 -0
  15. package/dist/components/editor/header.svelte.d.ts +7 -0
  16. package/dist/components/{presentation-editor → editor}/hotkeys.svelte +48 -16
  17. package/dist/components/editor/index.d.ts +3 -0
  18. package/dist/components/editor/index.js +3 -0
  19. package/dist/components/{presentation-editor → editor}/layers/active-background-border.svelte +2 -2
  20. package/dist/components/{presentation-editor → editor}/layers/active-layer-border.svelte +5 -8
  21. package/dist/components/editor/layers/buttons/border-button/border-button-colors.svelte +59 -0
  22. package/dist/components/editor/layers/buttons/border-button/border-button-colors.svelte.d.ts +9 -0
  23. package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/border-button.svelte +47 -65
  24. package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/corner-radius-button.svelte +24 -28
  25. package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/flip-button.svelte +11 -12
  26. package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/opacity-button.svelte +33 -44
  27. package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/corner-scale-control.svelte +27 -32
  28. package/dist/components/editor/layers/controls/group-resize-control/group-resize-control.svelte +418 -0
  29. package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/rotate-control.svelte +33 -34
  30. package/dist/components/editor/layers/controls/rotate-control/rotate-control.svelte.d.ts +6 -0
  31. package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte +22 -26
  32. package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/side-scale-control.svelte +13 -15
  33. package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/side-scale-control.svelte.d.ts +2 -2
  34. package/dist/components/editor/layers/index.d.ts +10 -0
  35. package/dist/components/{presentation-editor → editor}/layers/index.js +8 -5
  36. package/dist/components/{presentation-editor → editor}/layers/layer-button.svelte +14 -8
  37. package/dist/components/{presentation-editor → editor}/layers/layer-thumb-wrapper.svelte +5 -6
  38. package/dist/components/{presentation-editor → editor}/layers/layer-wrapper.svelte +46 -57
  39. package/dist/components/editor/layers/types/background/background-content-image.svelte +36 -0
  40. package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-buttons.svelte +6 -6
  41. package/dist/components/editor/layers/types/background/background-layer-content.svelte +21 -0
  42. package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-content.svelte.d.ts +2 -2
  43. package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer.svelte +7 -9
  44. package/dist/components/editor/layers/types/group/group-child-wrapper.svelte +44 -0
  45. package/dist/components/editor/layers/types/group/group-child-wrapper.svelte.d.ts +9 -0
  46. package/dist/components/editor/layers/types/group/group-layer-content.svelte +45 -0
  47. package/dist/components/editor/layers/types/group/group-layer-content.svelte.d.ts +9 -0
  48. package/dist/components/editor/layers/types/group/group-layer.svelte +33 -0
  49. package/dist/components/editor/layers/types/group/group-layer.svelte.d.ts +8 -0
  50. package/dist/components/editor/layers/types/group/index.d.ts +3 -0
  51. package/dist/components/editor/layers/types/group/index.js +3 -0
  52. package/dist/components/editor/layers/types/image/controls/image-rotate-control/image-rotate-control.svelte +120 -0
  53. package/dist/components/editor/layers/types/image/controls/image-rotate-control/image-rotate-control.svelte.d.ts +8 -0
  54. package/dist/components/editor/layers/types/image/controls/image-rotate-control/index.d.ts +2 -0
  55. package/dist/components/editor/layers/types/image/controls/image-rotate-control/index.js +4 -0
  56. package/dist/components/editor/layers/types/image/controls/image-scale-control/image-scale-control.svelte +154 -0
  57. package/dist/components/editor/layers/types/image/controls/image-scale-control/image-scale-control.svelte.d.ts +91 -0
  58. package/dist/components/editor/layers/types/image/controls/image-scale-control/index.d.ts +2 -0
  59. package/dist/components/editor/layers/types/image/controls/image-scale-control/index.js +4 -0
  60. package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte +10 -13
  61. package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte +15 -12
  62. package/dist/components/editor/layers/types/image/image-layer-crop.svelte +182 -0
  63. package/dist/components/editor/layers/types/image/image-layer-crop.svelte.d.ts +10 -0
  64. package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte +24 -14
  65. package/dist/components/editor/layers/types/image/index.d.ts +4 -0
  66. package/dist/components/editor/layers/types/image/index.js +4 -0
  67. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/alignment-button.svelte +13 -14
  68. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/alignment-button.svelte.d.ts +2 -2
  69. package/dist/components/editor/layers/types/text/buttons/bold-button/bold-button.svelte +65 -0
  70. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/bold-button.svelte.d.ts +2 -2
  71. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/case-button.svelte +24 -30
  72. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/case-button.svelte.d.ts +2 -2
  73. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/color-button.svelte +4 -4
  74. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/color-button.svelte.d.ts +2 -2
  75. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/font-family-button.svelte +4 -4
  76. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/font-family-button.svelte.d.ts +2 -2
  77. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/font-size-button.svelte +33 -40
  78. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/font-size-button.svelte.d.ts +2 -2
  79. package/dist/components/editor/layers/types/text/buttons/italic-button/italic-button.svelte +65 -0
  80. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/italic-button.svelte.d.ts +2 -2
  81. package/dist/components/editor/layers/types/text/buttons/list-button/list-button.svelte +113 -0
  82. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/list-button.svelte.d.ts +2 -2
  83. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/strikethrough-button.svelte +10 -11
  84. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/strikethrough-button.svelte.d.ts +2 -2
  85. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/underline-button.svelte +10 -11
  86. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/underline-button.svelte.d.ts +2 -2
  87. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/utils.d.ts +2 -0
  88. package/dist/components/editor/layers/types/text/editor/utils.js +166 -0
  89. package/dist/components/editor/layers/types/text/extensions/list/index.d.ts +3 -0
  90. package/dist/components/editor/layers/types/text/extensions/list/index.js +3 -0
  91. package/dist/components/editor/layers/types/text/extensions/list/list.d.ts +67 -0
  92. package/dist/components/editor/layers/types/text/extensions/list/list.js +237 -0
  93. package/dist/components/editor/layers/types/text/extensions/list-item/index.d.ts +3 -0
  94. package/dist/components/editor/layers/types/text/extensions/list-item/index.js +3 -0
  95. package/dist/components/editor/layers/types/text/extensions/list-item/list-item.d.ts +13 -0
  96. package/dist/components/editor/layers/types/text/extensions/list-item/list-item.js +262 -0
  97. package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/index.d.ts +3 -0
  98. package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/index.js +3 -0
  99. package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/list-item-paragraph.d.ts +14 -0
  100. package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/list-item-paragraph.js +27 -0
  101. package/dist/components/editor/layers/types/text/extensions/paragraph/index.d.ts +3 -0
  102. package/dist/components/editor/layers/types/text/extensions/paragraph/index.js +3 -0
  103. package/dist/components/editor/layers/types/text/extensions/paragraph/paragraph.d.ts +6 -0
  104. package/dist/components/editor/layers/types/text/extensions/paragraph/paragraph.js +28 -0
  105. package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/index.d.ts +3 -0
  106. package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/index.js +3 -0
  107. package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/preserve-formatting-on-clear.d.ts +2 -0
  108. package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/preserve-formatting-on-clear.js +74 -0
  109. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/text-transform.js +1 -4
  110. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions.js +13 -23
  111. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/html-content.svelte +0 -9
  112. package/dist/components/editor/layers/types/text/index.d.ts +5 -0
  113. package/dist/components/editor/layers/types/text/index.js +5 -0
  114. package/dist/components/{presentation-editor/layers/types/html/html-layer-content.svelte → editor/layers/types/text/text-layer-content.svelte} +2 -2
  115. package/dist/components/editor/layers/types/text/text-layer-content.svelte.d.ts +9 -0
  116. package/dist/components/editor/layers/types/text/text-layer-edit.svelte +114 -0
  117. package/dist/components/editor/layers/types/text/text-layer-edit.svelte.d.ts +9 -0
  118. package/dist/components/editor/layers/types/text/text-layer.svelte +125 -0
  119. package/dist/components/editor/layers/types/text/text-layer.svelte.d.ts +7 -0
  120. package/dist/components/{presentation-editor → editor}/layers/utils.d.ts +32 -24
  121. package/dist/components/{presentation-editor → editor}/layers/utils.js +152 -102
  122. package/dist/components/{presentation-editor → editor}/menu/background-menu-content.svelte +24 -24
  123. package/dist/components/{presentation-editor → editor}/menu/background-menu-content.svelte.d.ts +4 -4
  124. package/dist/components/{presentation-editor → editor}/menu/layer-menu-content.svelte +62 -38
  125. package/dist/components/{presentation-editor/menu/slide-menu-content.svelte → editor/menu/page-menu-content.svelte} +19 -19
  126. package/dist/components/editor/menu/page-menu-content.svelte.d.ts +9 -0
  127. package/dist/components/{presentation-editor/slide-editor.svelte → editor/page-editor.svelte} +30 -25
  128. package/dist/components/editor/page-editor.svelte.d.ts +7 -0
  129. package/dist/components/{presentation-editor/slide-inner.svelte → editor/page-inner.svelte} +5 -5
  130. package/dist/components/{presentation-editor/sidebar/sidebar.svelte.d.ts → editor/page-inner.svelte.d.ts} +3 -3
  131. package/dist/components/editor/page.svelte +69 -0
  132. package/dist/components/editor/page.svelte.d.ts +4 -0
  133. package/dist/components/editor/pages-navigation/page-preview.svelte +36 -0
  134. package/dist/components/editor/pages-navigation/page-preview.svelte.d.ts +8 -0
  135. package/dist/components/{presentation-editor/slides-navigation/slide-preview.svelte → editor/pages-navigation/pages-navigation-item.svelte} +21 -41
  136. package/dist/components/editor/pages-navigation/pages-navigation-item.svelte.d.ts +11 -0
  137. package/dist/components/{presentation-editor/slides-navigation/slides-navigation.svelte → editor/pages-navigation/pages-navigation.svelte} +26 -21
  138. package/dist/components/editor/pages-navigation/pages-navigation.svelte.d.ts +7 -0
  139. package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-color.svelte +1 -1
  140. package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte +2 -2
  141. package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar.svelte +92 -89
  142. package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar-button.svelte +3 -3
  143. package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar.svelte +34 -39
  144. package/dist/components/editor/sidebar/image-crop-sidebar.svelte +112 -0
  145. package/dist/components/editor/sidebar/image-crop-sidebar.svelte.d.ts +7 -0
  146. package/dist/components/{presentation-editor/sidebar/position-slidebar.svelte → editor/sidebar/position-sidebar.svelte} +26 -20
  147. package/dist/components/editor/sidebar/position-sidebar.svelte.d.ts +3 -0
  148. package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab-button.svelte +5 -5
  149. package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab.svelte +5 -5
  150. package/dist/components/{presentation-editor → editor}/sidebar/sidebar-uploads-tab.svelte +4 -4
  151. package/dist/components/{presentation-editor → editor}/sidebar/sidebar-wrapper.svelte +6 -4
  152. package/dist/components/{presentation-editor → editor}/sidebar/sidebar.svelte +17 -10
  153. package/dist/components/editor/sidebar/sidebar.svelte.d.ts +7 -0
  154. package/dist/components/{presentation-editor → editor}/sidebar/uploads-image.svelte +3 -3
  155. package/dist/components/editor/types.d.ts +283 -0
  156. package/dist/components/{presentation-editor → editor}/utils.d.ts +14 -6
  157. package/dist/components/{presentation-editor → editor}/utils.js +98 -63
  158. package/dist/components/ui/color-picker/color-picker.svelte +2 -2
  159. package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte +2 -2
  160. package/dist/components/ui/context-menu/context-menu-radio-item.svelte +1 -1
  161. package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +1 -1
  162. package/dist/components/ui/dialog/dialog-content.svelte +3 -3
  163. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +3 -3
  164. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +2 -2
  165. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
  166. package/dist/components/ui/dropdown-menu/index.d.ts +1 -0
  167. package/dist/components/ui/slider/slider.svelte +28 -20
  168. package/dist/index.d.ts +12 -6
  169. package/dist/index.js +5 -3
  170. package/package.json +42 -38
  171. package/dist/components/presentation-editor/active-layers-buttons.svelte +0 -53
  172. package/dist/components/presentation-editor/active-layers.svelte +0 -181
  173. package/dist/components/presentation-editor/active-layers.svelte.d.ts +0 -3
  174. package/dist/components/presentation-editor/cursor-tooltip.svelte.d.ts +0 -18
  175. package/dist/components/presentation-editor/dragged.svelte.d.ts +0 -18
  176. package/dist/components/presentation-editor/header.svelte +0 -54
  177. package/dist/components/presentation-editor/header.svelte.d.ts +0 -18
  178. package/dist/components/presentation-editor/index.d.ts +0 -2
  179. package/dist/components/presentation-editor/index.js +0 -2
  180. package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte +0 -337
  181. package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte.d.ts +0 -3
  182. package/dist/components/presentation-editor/layers/index.d.ts +0 -9
  183. package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte +0 -41
  184. package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte +0 -19
  185. package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte +0 -71
  186. package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte +0 -71
  187. package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte +0 -90
  188. package/dist/components/presentation-editor/layers/types/html/editor/utils.js +0 -88
  189. package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.d.ts +0 -3
  190. package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.js +0 -3
  191. package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.d.ts +0 -47
  192. package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.js +0 -74
  193. package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte.d.ts +0 -9
  194. package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte +0 -103
  195. package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte.d.ts +0 -8
  196. package/dist/components/presentation-editor/layers/types/html/html-layer.svelte +0 -105
  197. package/dist/components/presentation-editor/layers/types/html/html-layer.svelte.d.ts +0 -7
  198. package/dist/components/presentation-editor/layers/types/html/index.d.ts +0 -5
  199. package/dist/components/presentation-editor/layers/types/html/index.js +0 -5
  200. package/dist/components/presentation-editor/layers/types/image/index.d.ts +0 -3
  201. package/dist/components/presentation-editor/layers/types/image/index.js +0 -3
  202. package/dist/components/presentation-editor/menu/slide-menu-content.svelte.d.ts +0 -9
  203. package/dist/components/presentation-editor/presentation-editor.svelte.d.ts +0 -4
  204. package/dist/components/presentation-editor/presentation-editor.svelte.js +0 -813
  205. package/dist/components/presentation-editor/sidebar/position-slidebar.svelte.d.ts +0 -18
  206. package/dist/components/presentation-editor/slide-editor.svelte.d.ts +0 -7
  207. package/dist/components/presentation-editor/slide-inner.svelte.d.ts +0 -18
  208. package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte.d.ts +0 -11
  209. package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte.d.ts +0 -3
  210. package/dist/components/presentation-editor/types.d.ts +0 -158
  211. /package/dist/components/{presentation-editor → editor}/active-layers-buttons.svelte.d.ts +0 -0
  212. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient-def.svelte +0 -0
  213. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient-def.svelte.d.ts +0 -0
  214. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient.svelte +0 -0
  215. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient.svelte.d.ts +0 -0
  216. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator.svelte +0 -0
  217. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator.svelte.d.ts +0 -0
  218. /package/dist/components/{presentation-editor → editor}/color-indicator/index.d.ts +0 -0
  219. /package/dist/components/{presentation-editor → editor}/color-indicator/index.js +0 -0
  220. /package/dist/components/{presentation-editor → editor}/fonts.d.ts +0 -0
  221. /package/dist/components/{presentation-editor → editor}/fonts.js +0 -0
  222. /package/dist/components/{presentation-editor → editor}/hotkeys.svelte.d.ts +0 -0
  223. /package/dist/components/{presentation-editor → editor}/layers/active-background-border.svelte.d.ts +0 -0
  224. /package/dist/components/{presentation-editor → editor}/layers/active-layer-border.svelte.d.ts +0 -0
  225. /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/border-button.svelte.d.ts +0 -0
  226. /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/index.d.ts +0 -0
  227. /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/index.js +0 -0
  228. /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/corner-radius-button.svelte.d.ts +0 -0
  229. /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/index.d.ts +0 -0
  230. /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/index.js +0 -0
  231. /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/flip-button.svelte.d.ts +0 -0
  232. /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/index.d.ts +0 -0
  233. /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/index.js +0 -0
  234. /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/index.d.ts +0 -0
  235. /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/index.js +0 -0
  236. /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/opacity-button.svelte.d.ts +0 -0
  237. /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/corner-scale-control.svelte.d.ts +0 -0
  238. /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/index.d.ts +0 -0
  239. /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/index.js +0 -0
  240. /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/group-resize-control.svelte.d.ts +0 -0
  241. /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/index.d.ts +0 -0
  242. /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/index.js +0 -0
  243. /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/index.d.ts +0 -0
  244. /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/index.js +0 -0
  245. /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/index.d.ts +0 -0
  246. /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/index.js +0 -0
  247. /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte.d.ts +0 -0
  248. /package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/index.d.ts +0 -0
  249. /package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/index.js +0 -0
  250. /package/dist/components/{presentation-editor → editor}/layers/layer-button.svelte.d.ts +0 -0
  251. /package/dist/components/{presentation-editor → editor}/layers/layer-thumb-wrapper.svelte.d.ts +0 -0
  252. /package/dist/components/{presentation-editor → editor}/layers/layer-wrapper.svelte.d.ts +0 -0
  253. /package/dist/components/{presentation-editor → editor}/layers/types/background/background-content-image.svelte.d.ts +0 -0
  254. /package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-buttons.svelte.d.ts +0 -0
  255. /package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer.svelte.d.ts +0 -0
  256. /package/dist/components/{presentation-editor → editor}/layers/types/background/index.d.ts +0 -0
  257. /package/dist/components/{presentation-editor → editor}/layers/types/background/index.js +0 -0
  258. /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte.d.ts +0 -0
  259. /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte.d.ts +0 -0
  260. /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte.d.ts +0 -0
  261. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/index.d.ts +0 -0
  262. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/index.js +0 -0
  263. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/index.d.ts +0 -0
  264. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/index.js +0 -0
  265. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/index.d.ts +0 -0
  266. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/index.js +0 -0
  267. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/index.d.ts +0 -0
  268. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/index.js +0 -0
  269. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/index.d.ts +0 -0
  270. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/index.js +0 -0
  271. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/index.d.ts +0 -0
  272. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/index.js +0 -0
  273. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/index.d.ts +0 -0
  274. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/index.js +0 -0
  275. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/index.d.ts +0 -0
  276. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/index.js +0 -0
  277. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/index.d.ts +0 -0
  278. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/index.js +0 -0
  279. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/index.d.ts +0 -0
  280. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/index.js +0 -0
  281. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/Editor.d.ts +0 -0
  282. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/Editor.js +0 -0
  283. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/createEditor.d.ts +0 -0
  284. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/createEditor.js +0 -0
  285. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/editor-content.svelte +0 -0
  286. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/editor-content.svelte.d.ts +0 -0
  287. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/index.d.ts +0 -0
  288. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/index.js +0 -0
  289. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/types.d.ts +0 -0
  290. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/types.js +0 -0
  291. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor.css +0 -0
  292. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/font-family.d.ts +0 -0
  293. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/font-family.js +0 -0
  294. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/index.d.ts +0 -0
  295. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/index.js +0 -0
  296. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/font-size.d.ts +0 -0
  297. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/font-size.js +0 -0
  298. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/index.d.ts +0 -0
  299. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/index.js +0 -0
  300. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/index.d.ts +0 -0
  301. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/index.js +0 -0
  302. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/line-height.d.ts +0 -0
  303. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/line-height.js +0 -0
  304. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/index.d.ts +0 -0
  305. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/index.js +0 -0
  306. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/selection.d.ts +0 -0
  307. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/selection.js +0 -0
  308. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/index.d.ts +0 -0
  309. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/index.js +0 -0
  310. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/text-transform.d.ts +0 -0
  311. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions.d.ts +0 -0
  312. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/html-content.svelte.d.ts +0 -0
  313. /package/dist/components/{presentation-editor → editor}/menu/layer-menu-content.svelte.d.ts +0 -0
  314. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-color.svelte.d.ts +0 -0
  315. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte.d.ts +0 -0
  316. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar.svelte.d.ts +0 -0
  317. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/index.d.ts +0 -0
  318. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/index.js +0 -0
  319. /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar-button.svelte.d.ts +0 -0
  320. /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar.svelte.d.ts +0 -0
  321. /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/index.d.ts +0 -0
  322. /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/index.js +0 -0
  323. /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab-button.svelte.d.ts +0 -0
  324. /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab.svelte.d.ts +0 -0
  325. /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-uploads-tab.svelte.d.ts +0 -0
  326. /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-wrapper.svelte.d.ts +0 -0
  327. /package/dist/components/{presentation-editor → editor}/sidebar/uploads-image.svelte.d.ts +0 -0
  328. /package/dist/components/{presentation-editor → editor}/snapping-guides.svelte +0 -0
  329. /package/dist/components/{presentation-editor → editor}/snapping-guides.svelte.d.ts +0 -0
  330. /package/dist/components/{presentation-editor → editor}/types.js +0 -0
package/README.md CHANGED
@@ -31,8 +31,8 @@ interface BaseLayer {
31
31
  sortOrder: number;
32
32
  }
33
33
 
34
- interface HtmlLayer extends BaseLayer {
35
- type: 'html';
34
+ interface TextLayer extends BaseLayer {
35
+ type: 'text';
36
36
  scale: number | null;
37
37
  html: JSONContent;
38
38
  }
@@ -54,9 +54,9 @@ interface ImageLayer extends BaseLayer, LayerBorder {
54
54
  flipY: boolean;
55
55
  }
56
56
 
57
- type Layer = HtmlLayer | ImageLayer;
57
+ type Layer = TextLayer | ImageLayer;
58
58
 
59
- type Slide = {
59
+ type Page = {
60
60
  id: string;
61
61
  backgroundColor: string | null;
62
62
  layers: Layer[];
@@ -66,9 +66,9 @@ type Slide = {
66
66
 
67
67
  ### Html editor
68
68
 
69
- PresentationEditor is using `Tiptap` editor for `HtmlLayer` content editing.
69
+ PresentationEditor is using `Tiptap` editor for `TextLayer` content editing.
70
70
 
71
- `JSONContent` type provided by `@tiptap/core` is used for html content of `HtmlLayer` to store data in json format.
71
+ `JSONContent` type provided by `@tiptap/core` is used for html content of `TextLayer` to store data in json format.
72
72
 
73
73
  ## Settings
74
74
 
@@ -81,22 +81,22 @@ interface BaseOptions {
81
81
  height?: number;
82
82
  generateId?: () => string;
83
83
  onImageUpload?: (file: File) => Promise<Image>;
84
- onLayerAdd?: (slideId: string, layer: Layer) => Promise<Layer>;
85
- onLayerUpdate?: (slideId: string, layerId: string, layerType: string, changes: object) => void;
86
- onLayerRemove?: (slideId: string, layerId: string, layerType: string) => Promise<void>;
84
+ onLayerAdd?: (pageId: string, layer: Layer) => Promise<Layer>;
85
+ onLayerUpdate?: (pageId: string, layerId: string, layerType: string, changes: object) => void;
86
+ onLayerRemove?: (pageId: string, layerId: string, layerType: string) => Promise<void>;
87
87
  }
88
88
 
89
89
  interface MultipleModeOption extends BaseOptions {
90
90
  mode?: 'multiple';
91
- slides?: Slide[];
92
- onSlideAdd?: (slide: Slide) => Promise<Slide>;
93
- onSlideUpdate?: (slideId: string, changes: object) => void;
94
- onSlideRemove?: (slideId: string) => Promise<void>;
91
+ pages?: Page[];
92
+ onPageAdd?: (page: Page) => Promise<Page>;
93
+ onPageUpdate?: (pageId: string, changes: object) => void;
94
+ onPageRemove?: (pageId: string) => Promise<void>;
95
95
  }
96
96
 
97
97
  interface SingleModeOption extends BaseOptions {
98
98
  mode: 'single';
99
- slide?: Slide;
99
+ page?: Page;
100
100
  }
101
101
 
102
102
  export type PresentationEditorOptions = MultipleModeOption | SingleModeOption;
@@ -109,82 +109,82 @@ import { createEditor } from '@peteai/presentation-editor';
109
109
 
110
110
  // images list
111
111
  const images: Image[];
112
- // slides list
113
- const slides: Slide[];
112
+ // pages list
113
+ const pages: Page[];
114
114
 
115
115
  const editor = new createEditor({
116
116
  target: document.querySelector('.target'),
117
117
  props: {
118
- // function for new slides and layers ids generation
118
+ // function for new pages and layers ids generation
119
119
  generateId: () => crypto.randomUUID(),
120
120
  images,
121
- slides,
121
+ pages,
122
122
  onImageUpload: async (file) => {
123
123
  // called when user uploads image
124
124
  // callback to store file and return Image
125
125
  // which will be added to the images list
126
- // new ImageLayer gonna be created if image file was dropped on slide
126
+ // new ImageLayer gonna be created if image file was dropped on page
127
127
  // ...
128
128
  return image;
129
129
  },
130
- onSlideAdd: async (slide) => {
131
- // called when new slide is added
132
- // expect Slide to be returned to overwrite newly created slide
130
+ onPageAdd: async (page) => {
131
+ // called when new page is added
132
+ // expect Page to be returned to overwrite newly created page
133
133
  },
134
- onSlideUpdate: async (slideId, values) => {
135
- // called when slide is updated
134
+ onPageUpdate: async (pageId, values) => {
135
+ // called when page is updated
136
136
  },
137
- onSlideRemove: async (slideId) => {
138
- // called when slide is removed
137
+ onPageRemove: async (pageId) => {
138
+ // called when page is removed
139
139
  },
140
- onLayerAdd: async (slideId, layer) => {
140
+ onLayerAdd: async (pageId, layer) => {
141
141
  // called when new layer is added
142
142
  // expect Layer to be returned to overwrite newly created layer
143
143
  },
144
- onLayerUpdate: async (slideId, layerId, layerType, values) => {
144
+ onLayerUpdate: async (pageId, layerId, layerType, values) => {
145
145
  // called when layer is updated
146
146
  },
147
- onLayerRemove: async (slideId, layerId, layerType) => {
147
+ onLayerRemove: async (pageId, layerId, layerType) => {
148
148
  // called when layer is removed
149
149
  },
150
150
  },
151
151
  });
152
152
  ```
153
153
 
154
- ## Single Slide Mode
154
+ ## Single Page Mode
155
155
 
156
156
  ```typescript
157
157
  import { createEditor } from '@peteai/presentation-editor';
158
158
 
159
159
  // images list
160
160
  const images: Image[];
161
- // slides list
162
- const slide: Slide;
161
+ // pages list
162
+ const page: Page;
163
163
 
164
164
  const editor = new createEditor({
165
165
  target: document.querySelector('.target'),
166
166
  props: {
167
167
  mode: 'single',
168
- // function for new slides and layers ids generation
168
+ // function for new pages and layers ids generation
169
169
  generateId: () => crypto.randomUUID(),
170
170
  images,
171
- slide,
171
+ page,
172
172
  onImageUpload: async (file) => {
173
173
  // called when user uploads image
174
174
  // callback to store file and return Image
175
175
  // which will be added to the images list
176
- // new ImageLayer gonna be created if image file was dropped on slide
176
+ // new ImageLayer gonna be created if image file was dropped on page
177
177
  // ...
178
178
  return image;
179
179
  },
180
- onLayerAdd: async (slideId, layer) => {
180
+ onLayerAdd: async (pageId, layer) => {
181
181
  // called when new layer is added
182
182
  // expect Layer to be returned to overwrite newly created layer
183
183
  },
184
- onLayerUpdate: async (slideId, layerId, layerType, values) => {
184
+ onLayerUpdate: async (pageId, layerId, layerType, values) => {
185
185
  // called when layer is updated
186
186
  },
187
- onLayerRemove: async (slideId, layerId, layerType) => {
187
+ onLayerRemove: async (pageId, layerId, layerType) => {
188
188
  // called when layer is removed
189
189
  },
190
190
  },
@@ -0,0 +1,56 @@
1
+ <script lang="ts">
2
+ import { Separator } from '../ui/separator/index.js';
3
+ import { BorderButton } from './layers/buttons/border-button/index.js';
4
+ import { CornerRadiusButton } from './layers/buttons/corner-radius-button/index.js';
5
+ import { FlipButton } from './layers/buttons/flip-button/index.js';
6
+ import { OpacityButton } from './layers/buttons/opacity-button/index.js';
7
+ import { AlignmentButton } from './layers/types/text/buttons/alignment-button/index.js';
8
+ import { BoldButton } from './layers/types/text/buttons/bold-button/index.js';
9
+ import { CaseButton } from './layers/types/text/buttons/case-button/index.js';
10
+ import { ColorButton } from './layers/types/text/buttons/color-button/index.js';
11
+ import { FontFamilyButton } from './layers/types/text/buttons/font-family-button/index.js';
12
+ import { FontSizeButton } from './layers/types/text/buttons/font-size-button/index.js';
13
+ import { ItalicButton } from './layers/types/text/buttons/italic-button/index.js';
14
+ import { ListButton } from './layers/types/text/buttons/list-button/index.js';
15
+ import { StrikethroughButton } from './layers/types/text/buttons/strikethrough-button/index.js';
16
+ import { UnderlineButton } from './layers/types/text/buttons/underline-button/index.js';
17
+ import { getEditorContext } from './editor.svelte.js';
18
+
19
+ const editor = getEditorContext();
20
+
21
+ let imageLayers = $derived(
22
+ editor.selectedSimpleLayersNotLocked.filter((layer) => layer.type === 'image'),
23
+ );
24
+ let textLayers = $derived(
25
+ editor.selectedSimpleLayersNotLocked.filter((layer) => layer.type === 'text'),
26
+ );
27
+ </script>
28
+
29
+ {#if editor.activeLayers.length}
30
+ {#if imageLayers.length}
31
+ <Separator orientation="vertical" />
32
+ <BorderButton bind:layers={imageLayers} />
33
+ <CornerRadiusButton bind:layers={imageLayers} />
34
+ {#if textLayers.length === 0}
35
+ <Separator orientation="vertical" />
36
+ <FlipButton bind:layers={imageLayers} />
37
+ {/if}
38
+ {/if}
39
+ {#if textLayers.length}
40
+ <Separator orientation="vertical" />
41
+ <FontFamilyButton bind:layers={textLayers} />
42
+ <FontSizeButton bind:layers={textLayers} />
43
+ <ColorButton bind:layers={textLayers} />
44
+ <BoldButton bind:layers={textLayers} />
45
+ <ItalicButton bind:layers={textLayers} />
46
+ <UnderlineButton bind:layers={textLayers} />
47
+ <StrikethroughButton bind:layers={textLayers} />
48
+ <CaseButton bind:layers={textLayers} />
49
+ <AlignmentButton bind:layers={textLayers} />
50
+ <ListButton bind:layers={textLayers} />
51
+ {/if}
52
+ {#if editor.selectedLayersNotLocked.length}
53
+ <Separator orientation="vertical" />
54
+ <OpacityButton bind:layers={editor.selectedLayersNotLocked} />
55
+ {/if}
56
+ {/if}
@@ -0,0 +1,237 @@
1
+ <script lang="ts">
2
+ import { getEditorContext } from './editor.svelte.js';
3
+ import {
4
+ calculateGroupRotatedBoundingBox,
5
+ calculateRelativeRects,
6
+ isRotatedVertically,
7
+ } from './layers/utils.js';
8
+ import { SideScaleControl } from './layers/controls/side-scale-control/index.js';
9
+ import { SideResizeControl } from './layers/controls/side-resize-control/index.js';
10
+ import { GroupResizeControl } from './layers/controls/group-resize-control/index.js';
11
+ import { CornerScaleControl } from './layers/controls/corner-scale-control/index.js';
12
+ import { RotateControl } from './layers/controls/rotate-control/index.js';
13
+ import { ImageLayerCrop, TextLayerEdit } from './layers/index.js';
14
+ import type { GroupLayer, ImageLayer, Layer, TextLayer } from './types.js';
15
+
16
+ interface Props {
17
+ viewportRef: HTMLDivElement;
18
+ wrapperRef: HTMLDivElement;
19
+ pageRef: HTMLDivElement;
20
+ }
21
+ const { viewportRef, wrapperRef, pageRef }: Props = $props();
22
+
23
+ const editor = getEditorContext();
24
+
25
+ let textLayerEditData: { layer: TextLayer; groupLayer?: GroupLayer } | undefined = $derived.by(
26
+ () => {
27
+ if (editor.activeAction?.type === 'edit') {
28
+ if (editor.activeSelection.type === 'root-layers') {
29
+ if (editor.activeLayers.length === 1) {
30
+ const layer = editor.activeLayers[0];
31
+ if (editor.activeAction.id == layer.id && layer.type === 'text') {
32
+ return { layer };
33
+ }
34
+ }
35
+ } else if (editor.activeSelection.type === 'child-layer') {
36
+ if (editor.activeGroupAndChild) {
37
+ const { childLayer, groupLayer } = editor.activeGroupAndChild;
38
+ if (editor.activeAction.id == childLayer.id && childLayer.type === 'text') {
39
+ return { layer: childLayer, groupLayer };
40
+ }
41
+ }
42
+ }
43
+ }
44
+ },
45
+ );
46
+
47
+ let imageLayerCropData: { layer: ImageLayer } | undefined = $derived.by(() => {
48
+ if (editor.imageCropLayer) {
49
+ return { layer: editor.imageCropLayer };
50
+ }
51
+ });
52
+
53
+ const group = $derived.by(() => {
54
+ if (editor.activeSelection.type === 'background') {
55
+ return {
56
+ bbox: {
57
+ x: 0,
58
+ y: 0,
59
+ width: editor.width,
60
+ height: editor.height,
61
+ rotate: 0,
62
+ scale: 1,
63
+ },
64
+ padding: 3,
65
+ items: [],
66
+ };
67
+ } else if (editor.activeGroupAndChild) {
68
+ const { groupLayer, childLayer } = editor.activeGroupAndChild;
69
+ return {
70
+ bbox: groupLayer,
71
+ padding: 0,
72
+ items: [
73
+ {
74
+ ...childLayer,
75
+ ...{
76
+ x: childLayer.x * groupLayer.scale,
77
+ y: childLayer.y * groupLayer.scale,
78
+ width: childLayer.width * groupLayer.scale,
79
+ height: childLayer.height * groupLayer.scale,
80
+ },
81
+ },
82
+ ],
83
+ };
84
+ } else if (editor.activeLayers.length === 1) {
85
+ return {
86
+ bbox: editor.activeLayers[0],
87
+ padding: 0,
88
+ items: [],
89
+ };
90
+ } else if (editor.activeLayers.length > 1) {
91
+ const bbox = calculateGroupRotatedBoundingBox(editor.activeLayers, editor.activeGroupRotate);
92
+ const items = calculateRelativeRects(bbox, editor.activeLayers);
93
+
94
+ return { bbox, padding: 0, items };
95
+ }
96
+ });
97
+ /**
98
+ * Determines if resizing should be forbidden based on the rotation of the group and its layers.
99
+ *
100
+ * @param {Layer[]} layers - The layers to check.
101
+ * @param {number} groupRotate - The rotation of the group in degrees.
102
+ * @returns {(boolean|string)} - Returns 'horizontal' or 'vertical' if resizing should be forbidden in that direction, otherwise returns false.
103
+ */
104
+ const getConstrainedResizeAxis = (layers: Layer[], groupRotate: number) => {
105
+ // Check if all active layers are of type 'text'
106
+ const textLayersOnly = layers.every((layer) =>
107
+ layer.type === 'group'
108
+ ? editor.findGroupChildren(editor.activePage, layer.id).every((l) => l.type === 'text')
109
+ : layer.type === 'text',
110
+ );
111
+ if (!textLayersOnly) return false; // If not all layers are 'text', resizing is not forbidden
112
+
113
+ const textLayersRotations = editor.activeLayers.flatMap((layer) =>
114
+ layer.type === 'group'
115
+ ? editor.findGroupChildren(editor.activePage, layer.id).map((l) => l.rotate + layer.rotate)
116
+ : layer.rotate,
117
+ );
118
+
119
+ // Calculate the rotation of the first layer relative to the group rotation
120
+ const firstLayerRelativeRotate = textLayersRotations[0] - groupRotate;
121
+ // Determine if the first layer is rotated vertically
122
+ const firstLayerRotatedVertically = isRotatedVertically(firstLayerRelativeRotate);
123
+
124
+ // Check if all layers have the same rotation direction relative to the group rotation
125
+ const allLayersHaveSameRotationDirection = textLayersRotations.every(
126
+ (rotate) => isRotatedVertically(rotate - groupRotate) === firstLayerRotatedVertically,
127
+ );
128
+ if (!allLayersHaveSameRotationDirection) return false; // If not all layers have the same rotation direction, resizing is not forbidden
129
+
130
+ // Based on the rotation direction, determine the direction in which resizing should be forbidden
131
+ return firstLayerRotatedVertically ? 'horizontal' : 'vertical';
132
+ };
133
+ </script>
134
+
135
+ {#if textLayerEditData}
136
+ <TextLayerEdit {...textLayerEditData} />
137
+ {/if}
138
+
139
+ {#if imageLayerCropData}
140
+ <ImageLayerCrop {...imageLayerCropData} {viewportRef} {wrapperRef} {pageRef} />
141
+ {:else if group}
142
+ <div
143
+ class="pointer-events-none absolute left-0 top-0 h-full w-full"
144
+ style:width={`${group.bbox.width * group.bbox.scale * editor.zoom + group.padding * 2}px`}
145
+ style:height={`${group.bbox.height * group.bbox.scale * editor.zoom + group.padding * 2}px`}
146
+ style:transform={`translate(${group.bbox.x * editor.zoom - group.padding}px, ${group.bbox.y * editor.zoom - group.padding}px) rotate(${group.bbox.rotate}deg)`}
147
+ >
148
+ {#if !group.items.length}
149
+ <div
150
+ class="border-primary absolute -inset-px border-2"
151
+ style:box-shadow="0 0 0 1px hsla(0, 0%, 100%, .07), inset 0 0 0 1px hsla(0, 0%, 100%, .07)"
152
+ ></div>
153
+ {:else}
154
+ <div class="group-border absolute -inset-px"></div>
155
+ {#each group.items as item}
156
+ <div
157
+ class="border-primary absolute -left-px -top-px border-2"
158
+ style:box-shadow="0 0 0 1px hsla(0, 0%, 100%, .07), inset 0 0 0 1px hsla(0, 0%, 100%, .07)"
159
+ style:width={`${item.width * item.scale * editor.zoom + 2}px`}
160
+ style:height={`${item.height * item.scale * editor.zoom + 2}px`}
161
+ style:transform={`translate(${item.x * editor.zoom}px, ${item.y * editor.zoom}px) rotate(${item.rotate}deg)`}
162
+ ></div>
163
+ {/each}
164
+ {/if}
165
+
166
+ {#if editor.activeLayers.length > 0 && !editor.activePage.locked && !editor.activeLayers.some((l) => l.locked)}
167
+ <div class="h-full w-full outline-none transition-opacity duration-300">
168
+ <div class="flex h-full w-full items-center justify-center">
169
+ {#if editor.activeLayers.length === 1 && editor.activeLayers[0].type === 'text'}
170
+ {@const layer = editor.activeLayers[0]}
171
+ <SideScaleControl origin="left" {layer} />
172
+ <SideScaleControl origin="right" {layer} />
173
+ {:else if editor.activeLayers.length === 1 && editor.activeLayers[0].type === 'image'}
174
+ {@const layer = editor.activeLayers[0]}
175
+ <SideResizeControl origin="left" {layer} />
176
+ <SideResizeControl origin="right" {layer} />
177
+ <SideResizeControl origin="top" {layer} />
178
+ <SideResizeControl origin="bottom" {layer} />
179
+ {:else}
180
+ {@const constrainedResizeAxis = getConstrainedResizeAxis(
181
+ editor.activeLayers,
182
+ group.bbox.rotate,
183
+ )}
184
+ {#if constrainedResizeAxis !== 'horizontal'}
185
+ <GroupResizeControl origin="left" />
186
+ <GroupResizeControl origin="right" />
187
+ {/if}
188
+ {#if constrainedResizeAxis !== 'vertical'}
189
+ <GroupResizeControl origin="top" />
190
+ <GroupResizeControl origin="bottom" />
191
+ {/if}
192
+ {/if}
193
+ <CornerScaleControl origin="bottom-right" />
194
+ <CornerScaleControl origin="bottom-left" />
195
+ <CornerScaleControl origin="top-right" />
196
+ <CornerScaleControl origin="top-left" />
197
+ <RotateControl {pageRef} />
198
+ </div>
199
+ </div>
200
+ {/if}
201
+ </div>
202
+ {/if}
203
+
204
+ <style>
205
+ .group-border {
206
+ background-image:
207
+ linear-gradient(90deg, #fff 60%, rgba(53, 71, 90, 0.2) 0),
208
+ linear-gradient(180deg, #fff 60%, rgba(53, 71, 90, 0.2) 0),
209
+ linear-gradient(90deg, #fff 60%, rgba(53, 71, 90, 0.2) 0),
210
+ linear-gradient(180deg, #fff 60%, rgba(53, 71, 90, 0.2) 0),
211
+ linear-gradient(90deg, rgba(57, 76, 96, 0.15), rgba(57, 76, 96, 0.15)),
212
+ linear-gradient(180deg, rgba(57, 76, 96, 0.15), rgba(57, 76, 96, 0.15)),
213
+ linear-gradient(90deg, rgba(57, 76, 96, 0.15), rgba(57, 76, 96, 0.15)),
214
+ linear-gradient(180deg, rgba(57, 76, 96, 0.15), rgba(57, 76, 96, 0.15));
215
+ background-position:
216
+ top,
217
+ 100%,
218
+ bottom,
219
+ 0,
220
+ center 2px,
221
+ calc(100% - 2px),
222
+ center calc(100% - 2px),
223
+ 2px;
224
+ background-repeat:
225
+ repeat-x, repeat-y, repeat-x, repeat-y, no-repeat, no-repeat, no-repeat, no-repeat;
226
+ background-size:
227
+ 6px 2px,
228
+ 2px 6px,
229
+ 6px 2px,
230
+ 2px 6px,
231
+ calc(100% - 6px) 1px,
232
+ 1px calc(100% - 4px),
233
+ calc(100% - 6px) 1px,
234
+ 1px calc(100% - 4px);
235
+ box-shadow: 0 0 0 1px rgba(57, 76, 96, 0.15);
236
+ }
237
+ </style>
@@ -0,0 +1,8 @@
1
+ interface Props {
2
+ viewportRef: HTMLDivElement;
3
+ wrapperRef: HTMLDivElement;
4
+ pageRef: HTMLDivElement;
5
+ }
6
+ declare const ActiveLayers: import("svelte").Component<Props, {}, "">;
7
+ type ActiveLayers = ReturnType<typeof ActiveLayers>;
8
+ export default ActiveLayers;
@@ -4,7 +4,7 @@ export declare const cognitionImages: {
4
4
  width: number;
5
5
  height: number;
6
6
  }[];
7
- export declare const cognitionSlides: ({
7
+ export declare const cognitionPages: ({
8
8
  slide_layout_plan: string;
9
9
  type: string;
10
10
  headline: string;
@@ -25,7 +25,7 @@ export const cognitionImages = [
25
25
  height: 800,
26
26
  },
27
27
  ];
28
- export const cognitionSlides = [
28
+ export const cognitionPages = [
29
29
  {
30
30
  slide_layout_plan: "For the first slide, I want to introduce the topic and provide a brief overview of what's to come. A title slide is appropriate here, with a headline that clearly indicates the subject matter and a subheadline that gives some additional context. The image should reflect the high-level topic of AI in acquiring banks. This slide sets the stage for the deeper dive into the statistics and insights that will be covered in subsequent slides.",
31
31
  type: 'title',
@@ -1,8 +1,12 @@
1
1
  <script lang="ts">
2
2
  import * as Tooltip from '../ui/tooltip/index.js';
3
- import { getPresentationEditorContext } from './presentation-editor.svelte.js';
3
+ import type { Editor } from './editor.svelte.js';
4
4
 
5
- const editor = getPresentationEditorContext();
5
+ interface Props {
6
+ editor: Editor;
7
+ }
8
+
9
+ const { editor }: Props = $props();
6
10
  </script>
7
11
 
8
12
  {#if editor.activeAction?.tooltip}
@@ -0,0 +1,7 @@
1
+ import type { Editor } from './editor.svelte.js';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const CursorTooltip: import("svelte").Component<Props, {}, "">;
6
+ type CursorTooltip = ReturnType<typeof CursorTooltip>;
7
+ export default CursorTooltip;
@@ -1,8 +1,12 @@
1
1
  <script lang="ts">
2
- import { HtmlContent } from './layers/types/html/index.js';
3
- import { getPresentationEditorContext } from './presentation-editor.svelte.js';
2
+ import { HtmlContent } from './layers/types/text/index.js';
3
+ import type { Editor } from './editor.svelte.js';
4
4
 
5
- const editor = getPresentationEditorContext();
5
+ interface Props {
6
+ editor: Editor;
7
+ }
8
+
9
+ const { editor }: Props = $props();
6
10
  </script>
7
11
 
8
12
  {#if editor.dragged}
@@ -0,0 +1,7 @@
1
+ import type { Editor } from './editor.svelte.js';
2
+ interface Props {
3
+ editor: Editor;
4
+ }
5
+ declare const Dragged: import("svelte").Component<Props, {}, "">;
6
+ type Dragged = ReturnType<typeof Dragged>;
7
+ export default Dragged;