@peteai/presentation-editor 0.0.6 → 0.0.7

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 (310) hide show
  1. package/README.md +38 -38
  2. package/dist/components/editor/active-layers-buttons.svelte +56 -0
  3. package/dist/components/{presentation-editor → editor}/active-layers.svelte +89 -48
  4. package/dist/components/{presentation-editor/cognition-slides.d.ts → editor/cognition-pages.d.ts} +1 -1
  5. package/dist/components/{presentation-editor/cognition-slides.js → editor/cognition-pages.js} +1 -1
  6. package/dist/components/{presentation-editor → editor}/cursor-tooltip.svelte +6 -2
  7. package/dist/components/editor/cursor-tooltip.svelte.d.ts +7 -0
  8. package/dist/components/{presentation-editor → editor}/dragged.svelte +7 -3
  9. package/dist/components/editor/dragged.svelte.d.ts +7 -0
  10. package/dist/components/{presentation-editor/presentation-editor.svelte → editor/editor.svelte} +53 -48
  11. package/dist/components/editor/editor.svelte.d.ts +4 -0
  12. package/dist/components/editor/editor.svelte.js +1167 -0
  13. package/dist/components/{presentation-editor → editor}/header.svelte +11 -7
  14. package/dist/components/editor/header.svelte.d.ts +7 -0
  15. package/dist/components/{presentation-editor → editor}/hotkeys.svelte +41 -16
  16. package/dist/components/editor/index.d.ts +3 -0
  17. package/dist/components/editor/index.js +3 -0
  18. package/dist/components/{presentation-editor → editor}/layers/active-background-border.svelte +2 -2
  19. package/dist/components/{presentation-editor → editor}/layers/active-layer-border.svelte +5 -8
  20. package/dist/components/editor/layers/buttons/border-button/border-button-colors.svelte +59 -0
  21. package/dist/components/editor/layers/buttons/border-button/border-button-colors.svelte.d.ts +9 -0
  22. package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/border-button.svelte +47 -65
  23. package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/corner-radius-button.svelte +24 -28
  24. package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/flip-button.svelte +11 -12
  25. package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/opacity-button.svelte +32 -38
  26. package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/corner-scale-control.svelte +27 -32
  27. package/dist/components/editor/layers/controls/group-resize-control/group-resize-control.svelte +418 -0
  28. package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/rotate-control.svelte +27 -34
  29. package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte +9 -13
  30. package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/side-scale-control.svelte +13 -15
  31. package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/side-scale-control.svelte.d.ts +2 -2
  32. package/dist/components/{presentation-editor → editor}/layers/index.d.ts +3 -2
  33. package/dist/components/{presentation-editor → editor}/layers/index.js +6 -3
  34. package/dist/components/{presentation-editor → editor}/layers/layer-button.svelte +14 -8
  35. package/dist/components/{presentation-editor → editor}/layers/layer-thumb-wrapper.svelte +5 -6
  36. package/dist/components/{presentation-editor → editor}/layers/layer-wrapper.svelte +46 -57
  37. package/dist/components/{presentation-editor → editor}/layers/types/background/background-content-image.svelte +2 -2
  38. package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-buttons.svelte +6 -6
  39. package/dist/components/editor/layers/types/background/background-layer-content.svelte +21 -0
  40. package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-content.svelte.d.ts +2 -2
  41. package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer.svelte +5 -7
  42. package/dist/components/editor/layers/types/group/group-child-wrapper.svelte +44 -0
  43. package/dist/components/editor/layers/types/group/group-child-wrapper.svelte.d.ts +9 -0
  44. package/dist/components/editor/layers/types/group/group-layer-content.svelte +45 -0
  45. package/dist/components/editor/layers/types/group/group-layer-content.svelte.d.ts +9 -0
  46. package/dist/components/editor/layers/types/group/group-layer.svelte +33 -0
  47. package/dist/components/editor/layers/types/group/group-layer.svelte.d.ts +8 -0
  48. package/dist/components/editor/layers/types/group/index.d.ts +3 -0
  49. package/dist/components/editor/layers/types/group/index.js +3 -0
  50. package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte +10 -13
  51. package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte +14 -11
  52. package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte +8 -14
  53. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/alignment-button.svelte +13 -14
  54. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/alignment-button.svelte.d.ts +2 -2
  55. package/dist/components/editor/layers/types/text/buttons/bold-button/bold-button.svelte +65 -0
  56. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/bold-button.svelte.d.ts +2 -2
  57. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/case-button.svelte +24 -30
  58. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/case-button.svelte.d.ts +2 -2
  59. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/color-button.svelte +4 -4
  60. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/color-button.svelte.d.ts +2 -2
  61. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/font-family-button.svelte +4 -4
  62. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/font-family-button.svelte.d.ts +2 -2
  63. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/font-size-button.svelte +33 -40
  64. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/font-size-button.svelte.d.ts +2 -2
  65. package/dist/components/editor/layers/types/text/buttons/italic-button/italic-button.svelte +65 -0
  66. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/italic-button.svelte.d.ts +2 -2
  67. package/dist/components/editor/layers/types/text/buttons/list-button/list-button.svelte +113 -0
  68. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/list-button.svelte.d.ts +2 -2
  69. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/strikethrough-button.svelte +10 -11
  70. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/strikethrough-button.svelte.d.ts +2 -2
  71. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/underline-button.svelte +10 -11
  72. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/underline-button.svelte.d.ts +2 -2
  73. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/utils.d.ts +2 -0
  74. package/dist/components/editor/layers/types/text/editor/utils.js +166 -0
  75. package/dist/components/editor/layers/types/text/extensions/list/index.d.ts +3 -0
  76. package/dist/components/editor/layers/types/text/extensions/list/index.js +3 -0
  77. package/dist/components/editor/layers/types/text/extensions/list/list.d.ts +67 -0
  78. package/dist/components/editor/layers/types/text/extensions/list/list.js +237 -0
  79. package/dist/components/editor/layers/types/text/extensions/list-item/index.d.ts +3 -0
  80. package/dist/components/editor/layers/types/text/extensions/list-item/index.js +3 -0
  81. package/dist/components/editor/layers/types/text/extensions/list-item/list-item.d.ts +13 -0
  82. package/dist/components/editor/layers/types/text/extensions/list-item/list-item.js +264 -0
  83. package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/index.d.ts +3 -0
  84. package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/index.js +3 -0
  85. package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/list-item-paragraph.d.ts +14 -0
  86. package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/list-item-paragraph.js +27 -0
  87. package/dist/components/editor/layers/types/text/extensions/paragraph/index.d.ts +3 -0
  88. package/dist/components/editor/layers/types/text/extensions/paragraph/index.js +3 -0
  89. package/dist/components/editor/layers/types/text/extensions/paragraph/paragraph.d.ts +6 -0
  90. package/dist/components/editor/layers/types/text/extensions/paragraph/paragraph.js +28 -0
  91. package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/index.d.ts +3 -0
  92. package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/index.js +3 -0
  93. package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/preserve-formatting-on-clear.d.ts +2 -0
  94. package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/preserve-formatting-on-clear.js +74 -0
  95. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/text-transform.js +1 -4
  96. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions.js +13 -23
  97. package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/html-content.svelte +0 -9
  98. package/dist/components/editor/layers/types/text/index.d.ts +5 -0
  99. package/dist/components/editor/layers/types/text/index.js +5 -0
  100. package/dist/components/{presentation-editor/layers/types/html/html-layer-content.svelte → editor/layers/types/text/text-layer-content.svelte} +2 -2
  101. package/dist/components/editor/layers/types/text/text-layer-content.svelte.d.ts +9 -0
  102. package/dist/components/editor/layers/types/text/text-layer-edit.svelte +114 -0
  103. package/dist/components/editor/layers/types/text/text-layer-edit.svelte.d.ts +9 -0
  104. package/dist/components/editor/layers/types/text/text-layer.svelte +125 -0
  105. package/dist/components/editor/layers/types/text/text-layer.svelte.d.ts +7 -0
  106. package/dist/components/{presentation-editor → editor}/layers/utils.d.ts +9 -16
  107. package/dist/components/{presentation-editor → editor}/layers/utils.js +65 -68
  108. package/dist/components/{presentation-editor → editor}/menu/background-menu-content.svelte +24 -24
  109. package/dist/components/{presentation-editor → editor}/menu/background-menu-content.svelte.d.ts +4 -4
  110. package/dist/components/{presentation-editor → editor}/menu/layer-menu-content.svelte +62 -38
  111. package/dist/components/{presentation-editor/menu/slide-menu-content.svelte → editor/menu/page-menu-content.svelte} +19 -19
  112. package/dist/components/editor/menu/page-menu-content.svelte.d.ts +9 -0
  113. package/dist/components/{presentation-editor/slide-editor.svelte → editor/page-editor.svelte} +25 -24
  114. package/dist/components/editor/page-editor.svelte.d.ts +7 -0
  115. package/dist/components/{presentation-editor/slide-inner.svelte → editor/page-inner.svelte} +5 -5
  116. package/dist/components/{presentation-editor/sidebar/sidebar.svelte.d.ts → editor/page-inner.svelte.d.ts} +3 -3
  117. package/dist/components/editor/page.svelte +69 -0
  118. package/dist/components/editor/page.svelte.d.ts +4 -0
  119. package/dist/components/editor/pages-navigation/page-preview.svelte +36 -0
  120. package/dist/components/editor/pages-navigation/page-preview.svelte.d.ts +8 -0
  121. package/dist/components/{presentation-editor/slides-navigation/slide-preview.svelte → editor/pages-navigation/pages-navigation-item.svelte} +21 -41
  122. package/dist/components/editor/pages-navigation/pages-navigation-item.svelte.d.ts +11 -0
  123. package/dist/components/{presentation-editor/slides-navigation/slides-navigation.svelte → editor/pages-navigation/pages-navigation.svelte} +26 -21
  124. package/dist/components/editor/pages-navigation/pages-navigation.svelte.d.ts +7 -0
  125. package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-color.svelte +1 -1
  126. package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte +2 -2
  127. package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar.svelte +92 -89
  128. package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar-button.svelte +3 -3
  129. package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar.svelte +34 -39
  130. package/dist/components/{presentation-editor/sidebar/position-slidebar.svelte → editor/sidebar/position-sidebar.svelte} +28 -20
  131. package/dist/components/editor/sidebar/position-sidebar.svelte.d.ts +3 -0
  132. package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab-button.svelte +5 -5
  133. package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab.svelte +5 -5
  134. package/dist/components/{presentation-editor → editor}/sidebar/sidebar-uploads-tab.svelte +4 -4
  135. package/dist/components/{presentation-editor → editor}/sidebar/sidebar-wrapper.svelte +6 -4
  136. package/dist/components/{presentation-editor → editor}/sidebar/sidebar.svelte +11 -7
  137. package/dist/components/editor/sidebar/sidebar.svelte.d.ts +7 -0
  138. package/dist/components/{presentation-editor → editor}/sidebar/uploads-image.svelte +3 -3
  139. package/dist/components/editor/types.d.ts +282 -0
  140. package/dist/components/{presentation-editor → editor}/utils.d.ts +14 -6
  141. package/dist/components/{presentation-editor → editor}/utils.js +97 -63
  142. package/dist/components/ui/color-picker/color-picker.svelte +2 -2
  143. package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte +2 -2
  144. package/dist/components/ui/context-menu/context-menu-radio-item.svelte +1 -1
  145. package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +1 -1
  146. package/dist/components/ui/dialog/dialog-content.svelte +3 -3
  147. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +3 -3
  148. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +2 -2
  149. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
  150. package/dist/components/ui/dropdown-menu/index.d.ts +1 -0
  151. package/dist/components/ui/slider/slider.svelte +28 -20
  152. package/dist/index.d.ts +12 -6
  153. package/dist/index.js +5 -3
  154. package/package.json +42 -38
  155. package/dist/components/presentation-editor/active-layers-buttons.svelte +0 -53
  156. package/dist/components/presentation-editor/cursor-tooltip.svelte.d.ts +0 -18
  157. package/dist/components/presentation-editor/dragged.svelte.d.ts +0 -18
  158. package/dist/components/presentation-editor/header.svelte.d.ts +0 -18
  159. package/dist/components/presentation-editor/index.d.ts +0 -2
  160. package/dist/components/presentation-editor/index.js +0 -2
  161. package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte +0 -337
  162. package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte +0 -19
  163. package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte +0 -71
  164. package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte +0 -71
  165. package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte +0 -90
  166. package/dist/components/presentation-editor/layers/types/html/editor/utils.js +0 -88
  167. package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.d.ts +0 -3
  168. package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.js +0 -3
  169. package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.d.ts +0 -47
  170. package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.js +0 -74
  171. package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte.d.ts +0 -9
  172. package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte +0 -103
  173. package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte.d.ts +0 -8
  174. package/dist/components/presentation-editor/layers/types/html/html-layer.svelte +0 -105
  175. package/dist/components/presentation-editor/layers/types/html/html-layer.svelte.d.ts +0 -7
  176. package/dist/components/presentation-editor/layers/types/html/index.d.ts +0 -5
  177. package/dist/components/presentation-editor/layers/types/html/index.js +0 -5
  178. package/dist/components/presentation-editor/menu/slide-menu-content.svelte.d.ts +0 -9
  179. package/dist/components/presentation-editor/presentation-editor.svelte.d.ts +0 -4
  180. package/dist/components/presentation-editor/presentation-editor.svelte.js +0 -813
  181. package/dist/components/presentation-editor/sidebar/position-slidebar.svelte.d.ts +0 -18
  182. package/dist/components/presentation-editor/slide-editor.svelte.d.ts +0 -7
  183. package/dist/components/presentation-editor/slide-inner.svelte.d.ts +0 -18
  184. package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte.d.ts +0 -11
  185. package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte.d.ts +0 -3
  186. package/dist/components/presentation-editor/types.d.ts +0 -158
  187. /package/dist/components/{presentation-editor → editor}/active-layers-buttons.svelte.d.ts +0 -0
  188. /package/dist/components/{presentation-editor → editor}/active-layers.svelte.d.ts +0 -0
  189. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient-def.svelte +0 -0
  190. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient-def.svelte.d.ts +0 -0
  191. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient.svelte +0 -0
  192. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient.svelte.d.ts +0 -0
  193. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator.svelte +0 -0
  194. /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator.svelte.d.ts +0 -0
  195. /package/dist/components/{presentation-editor → editor}/color-indicator/index.d.ts +0 -0
  196. /package/dist/components/{presentation-editor → editor}/color-indicator/index.js +0 -0
  197. /package/dist/components/{presentation-editor → editor}/fonts.d.ts +0 -0
  198. /package/dist/components/{presentation-editor → editor}/fonts.js +0 -0
  199. /package/dist/components/{presentation-editor → editor}/hotkeys.svelte.d.ts +0 -0
  200. /package/dist/components/{presentation-editor → editor}/layers/active-background-border.svelte.d.ts +0 -0
  201. /package/dist/components/{presentation-editor → editor}/layers/active-layer-border.svelte.d.ts +0 -0
  202. /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/border-button.svelte.d.ts +0 -0
  203. /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/index.d.ts +0 -0
  204. /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/index.js +0 -0
  205. /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/corner-radius-button.svelte.d.ts +0 -0
  206. /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/index.d.ts +0 -0
  207. /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/index.js +0 -0
  208. /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/flip-button.svelte.d.ts +0 -0
  209. /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/index.d.ts +0 -0
  210. /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/index.js +0 -0
  211. /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/index.d.ts +0 -0
  212. /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/index.js +0 -0
  213. /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/opacity-button.svelte.d.ts +0 -0
  214. /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/corner-scale-control.svelte.d.ts +0 -0
  215. /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/index.d.ts +0 -0
  216. /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/index.js +0 -0
  217. /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/group-resize-control.svelte.d.ts +0 -0
  218. /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/index.d.ts +0 -0
  219. /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/index.js +0 -0
  220. /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/index.d.ts +0 -0
  221. /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/index.js +0 -0
  222. /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/rotate-control.svelte.d.ts +0 -0
  223. /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/index.d.ts +0 -0
  224. /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/index.js +0 -0
  225. /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte.d.ts +0 -0
  226. /package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/index.d.ts +0 -0
  227. /package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/index.js +0 -0
  228. /package/dist/components/{presentation-editor → editor}/layers/layer-button.svelte.d.ts +0 -0
  229. /package/dist/components/{presentation-editor → editor}/layers/layer-thumb-wrapper.svelte.d.ts +0 -0
  230. /package/dist/components/{presentation-editor → editor}/layers/layer-wrapper.svelte.d.ts +0 -0
  231. /package/dist/components/{presentation-editor → editor}/layers/types/background/background-content-image.svelte.d.ts +0 -0
  232. /package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-buttons.svelte.d.ts +0 -0
  233. /package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer.svelte.d.ts +0 -0
  234. /package/dist/components/{presentation-editor → editor}/layers/types/background/index.d.ts +0 -0
  235. /package/dist/components/{presentation-editor → editor}/layers/types/background/index.js +0 -0
  236. /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte.d.ts +0 -0
  237. /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte.d.ts +0 -0
  238. /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte.d.ts +0 -0
  239. /package/dist/components/{presentation-editor → editor}/layers/types/image/index.d.ts +0 -0
  240. /package/dist/components/{presentation-editor → editor}/layers/types/image/index.js +0 -0
  241. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/index.d.ts +0 -0
  242. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/index.js +0 -0
  243. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/index.d.ts +0 -0
  244. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/index.js +0 -0
  245. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/index.d.ts +0 -0
  246. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/index.js +0 -0
  247. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/index.d.ts +0 -0
  248. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/index.js +0 -0
  249. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/index.d.ts +0 -0
  250. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/index.js +0 -0
  251. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/index.d.ts +0 -0
  252. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/index.js +0 -0
  253. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/index.d.ts +0 -0
  254. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/index.js +0 -0
  255. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/index.d.ts +0 -0
  256. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/index.js +0 -0
  257. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/index.d.ts +0 -0
  258. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/index.js +0 -0
  259. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/index.d.ts +0 -0
  260. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/index.js +0 -0
  261. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/Editor.d.ts +0 -0
  262. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/Editor.js +0 -0
  263. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/createEditor.d.ts +0 -0
  264. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/createEditor.js +0 -0
  265. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/editor-content.svelte +0 -0
  266. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/editor-content.svelte.d.ts +0 -0
  267. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/index.d.ts +0 -0
  268. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/index.js +0 -0
  269. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/types.d.ts +0 -0
  270. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/types.js +0 -0
  271. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor.css +0 -0
  272. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/font-family.d.ts +0 -0
  273. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/font-family.js +0 -0
  274. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/index.d.ts +0 -0
  275. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/index.js +0 -0
  276. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/font-size.d.ts +0 -0
  277. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/font-size.js +0 -0
  278. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/index.d.ts +0 -0
  279. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/index.js +0 -0
  280. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/index.d.ts +0 -0
  281. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/index.js +0 -0
  282. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/line-height.d.ts +0 -0
  283. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/line-height.js +0 -0
  284. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/index.d.ts +0 -0
  285. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/index.js +0 -0
  286. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/selection.d.ts +0 -0
  287. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/selection.js +0 -0
  288. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/index.d.ts +0 -0
  289. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/index.js +0 -0
  290. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/text-transform.d.ts +0 -0
  291. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions.d.ts +0 -0
  292. /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/html-content.svelte.d.ts +0 -0
  293. /package/dist/components/{presentation-editor → editor}/menu/layer-menu-content.svelte.d.ts +0 -0
  294. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-color.svelte.d.ts +0 -0
  295. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte.d.ts +0 -0
  296. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar.svelte.d.ts +0 -0
  297. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/index.d.ts +0 -0
  298. /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/index.js +0 -0
  299. /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar-button.svelte.d.ts +0 -0
  300. /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar.svelte.d.ts +0 -0
  301. /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/index.d.ts +0 -0
  302. /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/index.js +0 -0
  303. /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab-button.svelte.d.ts +0 -0
  304. /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab.svelte.d.ts +0 -0
  305. /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-uploads-tab.svelte.d.ts +0 -0
  306. /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-wrapper.svelte.d.ts +0 -0
  307. /package/dist/components/{presentation-editor → editor}/sidebar/uploads-image.svelte.d.ts +0 -0
  308. /package/dist/components/{presentation-editor → editor}/snapping-guides.svelte +0 -0
  309. /package/dist/components/{presentation-editor → editor}/snapping-guides.svelte.d.ts +0 -0
  310. /package/dist/components/{presentation-editor → editor}/types.js +0 -0
@@ -1,337 +0,0 @@
1
- <script lang="ts" module>
2
- import { tv, type VariantProps } from 'tailwind-variants';
3
- import type { Layer } from '../../../types.js';
4
-
5
- const sideResizeControlVariants = tv({
6
- slots: {
7
- base: 'group absolute flex flex-col items-center justify-center pointer-events-none',
8
- handler: 'absolute pointer-events-auto',
9
- grip: 'rounded-sm bg-white group-active:bg-primary group-hover:bg-primary transition-colors',
10
- cursor: '',
11
- },
12
- variants: {
13
- origin: {
14
- right: {
15
- base: '-left-4 w-8 h-full',
16
- handler: '-translate-x-2 w-4 h-full',
17
- grip: 'w-1.5 h-4',
18
- cursor: 'cursor-ew-resize',
19
- },
20
- left: {
21
- base: '-right-4 w-8 h-full',
22
- handler: 'translate-x-2 w-4 h-full',
23
- grip: 'w-1.5 h-4',
24
- cursor: 'cursor-ew-resize',
25
- },
26
- top: {
27
- base: '-bottom-4 w-full h-8',
28
- handler: 'translate-y-2 w-full h-4',
29
- grip: 'w-4 h-1.5',
30
- cursor: 'cursor-ns-resize',
31
- },
32
- bottom: {
33
- base: '-top-4 w-full h-8',
34
- handler: '-translate-y-2 w-full h-4',
35
- grip: 'w-4 h-1.5',
36
- cursor: 'cursor-ns-resize',
37
- },
38
- },
39
- },
40
- });
41
-
42
- type Variants = VariantProps<typeof sideResizeControlVariants>;
43
-
44
- interface Props extends Omit<Variants, 'origin'>, Required<Pick<Variants, 'origin'>> {}
45
- </script>
46
-
47
- <script lang="ts">
48
- import { tick } from 'svelte';
49
- import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
50
- import { cn } from '../../../../../utils.js';
51
- import {
52
- calculateGroupRotatedBoundingBox,
53
- calculateLayerTransform,
54
- calculateNewPosition,
55
- calculateNewSize,
56
- degToRad,
57
- getRotatedBoundingBox,
58
- rotatePoint,
59
- type Transform,
60
- } from '../../utils.js';
61
-
62
- let { origin }: Props = $props();
63
-
64
- const type = `${origin}-origin-resize`;
65
-
66
- const editor = getPresentationEditorContext();
67
-
68
- const { base, handler, grip, cursor } = sideResizeControlVariants({ origin });
69
-
70
- let initial: {
71
- clientX: number;
72
- clientY: number;
73
- bbox: Transform;
74
- layers: (Layer & { state: Layer })[];
75
- } | null = null;
76
- let isChanged = false;
77
- const actionId = editor.generateId();
78
-
79
- const onMouseDown = (e: MouseEvent) => {
80
- if (e.button !== 0) return;
81
- e.preventDefault();
82
- e.stopPropagation();
83
- console.log(type, 'mousedown', e);
84
-
85
- isChanged = false;
86
- initial = {
87
- clientX: e.clientX,
88
- clientY: e.clientY,
89
- bbox: calculateGroupRotatedBoundingBox(
90
- editor.activeLayers.map(calculateLayerTransform),
91
- editor.activeGroupRotate,
92
- ),
93
- layers: editor.activeLayers.map((layer) => ({ ...layer, state: layer })),
94
- };
95
- editor.activeAction = {
96
- id: actionId,
97
- type,
98
- cursor: cursor(),
99
- };
100
- addEventListener('mousemove', onMouseMove);
101
- addEventListener('mouseup', onMouseUp);
102
- };
103
-
104
- const onMouseUp = (e: MouseEvent) => {
105
- console.log(type, 'mouseup', e);
106
- removeEventListener('mousemove', onMouseMove);
107
- removeEventListener('mouseup', onMouseUp);
108
-
109
- if (editor.activeAction?.id !== actionId) return;
110
- editor.activeAction = null;
111
- if (!initial || !isChanged) return;
112
-
113
- editor.historyPush({
114
- type: 'layersGroup',
115
- actions: initial.layers.map((layerWithState) => {
116
- const { state, ...layer } = layerWithState;
117
- if (editor.isLayerOutOfBounds(state)) {
118
- return {
119
- type: 'layersRemove',
120
- slideId: editor.activeSlide.id,
121
- layers: [layer],
122
- };
123
- } else {
124
- return {
125
- type: 'layer',
126
- slideId: editor.activeSlide.id,
127
- layer: { id: layer.id, type: layer.type },
128
- undo: {
129
- x: layer.x,
130
- y: layer.y,
131
- width: layer.width,
132
- height: layer.height,
133
- ...(layer.type === 'image' && {
134
- scale: layer.scale,
135
- offsetX: layer.offsetX,
136
- offsetY: layer.offsetY,
137
- }),
138
- },
139
- redo: {
140
- x: state.x,
141
- y: state.y,
142
- width: state.width,
143
- height: state.height,
144
- ...(state.type === 'image' && {
145
- scale: state.scale,
146
- offsetX: state.offsetX,
147
- offsetY: state.offsetY,
148
- }),
149
- },
150
- };
151
- }
152
- }),
153
- });
154
- };
155
-
156
- const onMouseMove = async (e: MouseEvent) => {
157
- if (!initial || editor.activeAction?.id !== actionId) return;
158
-
159
- const groupBbox = initial.bbox;
160
- const groupAngle = degToRad(groupBbox.rotate);
161
- const xDiff = (e.clientX - initial.clientX) / editor.zoom;
162
- const yDiff = (e.clientY - initial.clientY) / editor.zoom;
163
- const adjustedXDiff = xDiff * Math.cos(groupAngle) + yDiff * Math.sin(groupAngle);
164
- const adjustedYDiff = -xDiff * Math.sin(groupAngle) + yDiff * Math.cos(groupAngle);
165
-
166
- let groupNewWidth = groupBbox.width;
167
- let groupNewHeight = groupBbox.height;
168
- const minSize = 10;
169
- if (origin === 'left') {
170
- groupNewWidth = Math.max(groupBbox.width + adjustedXDiff, minSize);
171
- } else if (origin === 'top') {
172
- groupNewHeight = Math.max(groupBbox.height + adjustedYDiff, minSize);
173
- } else if (origin === 'right') {
174
- groupNewWidth = Math.max(groupBbox.width - adjustedXDiff, minSize);
175
- } else if (origin === 'bottom') {
176
- groupNewHeight = Math.max(groupBbox.height - adjustedYDiff, minSize);
177
- }
178
-
179
- isChanged = groupNewWidth !== groupBbox.width || groupNewHeight !== groupBbox.height;
180
-
181
- const { newX: groupNewX, newY: groupNewY } = calculateNewPosition(
182
- origin,
183
- initial.bbox,
184
- groupNewWidth,
185
- groupNewHeight,
186
- );
187
-
188
- const widthScale = groupNewWidth / groupBbox.width;
189
- const heightScale = groupNewHeight / groupBbox.height;
190
-
191
- const groupCenter = {
192
- x: groupBbox.x + groupBbox.width / 2,
193
- y: groupBbox.y + groupBbox.height / 2,
194
- };
195
- const groupNewCenter = { x: groupNewX + groupNewWidth / 2, y: groupNewY + groupNewHeight / 2 };
196
- // calculate rotated points relative to new group center
197
- const groupCenterRotated = rotatePoint(groupCenter, groupNewCenter, -groupAngle);
198
-
199
- await Promise.all(
200
- initial.layers.map(async (layer) => {
201
- const { width, height, x, y, rotate } = calculateLayerTransform(layer);
202
- const center = { x: x + width / 2, y: y + height / 2 };
203
- const centerRotated = rotatePoint(center, groupNewCenter, -groupAngle);
204
- const newCenterRotated = {
205
- x: groupNewCenter.x + (centerRotated.x - groupCenterRotated.x) * widthScale,
206
- y: groupNewCenter.y + (centerRotated.y - groupCenterRotated.y) * heightScale,
207
- };
208
-
209
- // rotate relative to the bbox
210
- const rotateRelative = rotate - groupBbox.rotate;
211
-
212
- const isHorizontal = origin === 'left' || origin === 'right';
213
- const bboxScale = isHorizontal ? widthScale : heightScale;
214
- const newSize = calculateNewSize(width, height, rotateRelative, bboxScale, isHorizontal);
215
-
216
- const scale = layer.scale || 1;
217
-
218
- let newWidth = newSize.width;
219
- let newHeight = newSize.height;
220
- let newScale = scale;
221
-
222
- if (layer.type === 'html') {
223
- if (newSize.scaled === 'height') {
224
- newHeight = layer.height * scale;
225
- } else {
226
- Object.assign(layer.state, {
227
- width: newWidth / scale,
228
- });
229
- await tick();
230
-
231
- const layerContent = document.getElementById(`layer-content-${layer.id}`);
232
- if (layerContent) {
233
- newHeight = layerContent.offsetHeight * scale;
234
- }
235
- }
236
- }
237
-
238
- if (newWidth < minSize) {
239
- newWidth = minSize;
240
- }
241
- if (newHeight < minSize) {
242
- newHeight = minSize;
243
- }
244
-
245
- const bboxRotated = getRotatedBoundingBox(
246
- centerRotated,
247
- newWidth,
248
- newHeight,
249
- rotateRelative,
250
- );
251
-
252
- if (origin === 'left' || origin === 'right') {
253
- const minX = groupNewX + bboxRotated.width / 2;
254
- const maxX = groupNewX + groupNewWidth - bboxRotated.width / 2;
255
- newCenterRotated.x =
256
- origin === 'left'
257
- ? Math.max(Math.min(newCenterRotated.x, maxX), minX)
258
- : Math.min(Math.max(newCenterRotated.x, minX), maxX);
259
- } else {
260
- const minY = groupNewY + bboxRotated.height / 2;
261
- const maxY = groupNewY + groupNewHeight - bboxRotated.height / 2;
262
- newCenterRotated.y =
263
- origin === 'top'
264
- ? Math.max(Math.min(newCenterRotated.y, maxY), minY)
265
- : Math.min(Math.max(newCenterRotated.y, minY), maxY);
266
- }
267
-
268
- let newCenter = rotatePoint(newCenterRotated, groupNewCenter, degToRad(groupBbox.rotate));
269
-
270
- if (layer.type === 'image') {
271
- const offsetX = layer.offsetX || 0;
272
- const offsetY = layer.offsetY || 0;
273
-
274
- const { image } = layer;
275
-
276
- let newOffsetX = offsetX;
277
- let newOffsetY = offsetY;
278
-
279
- if (newSize.scaled === 'width') {
280
- const maxOffsetDiff = Math.min(offsetX, image.width - offsetX - layer.width);
281
- const maxWidth = (layer.width + Math.max(maxOffsetDiff, 0) * 2) * scale;
282
- if (newWidth > maxWidth) {
283
- newScale *= newWidth / maxWidth;
284
- newOffsetX = offsetX - maxOffsetDiff;
285
- newOffsetY += ((layer.image.height / 2 - offsetY) * (newScale - scale)) / newScale;
286
- } else {
287
- newOffsetX += (layer.width - newWidth / newScale) / 2;
288
- }
289
- } else {
290
- const maxOffsetDiff = Math.min(offsetY, image.height - offsetY - layer.height);
291
- const maxHeight = (layer.height + Math.max(maxOffsetDiff, 0) * 2) * scale;
292
- if (newHeight > maxHeight) {
293
- newScale *= newHeight / maxHeight;
294
- newOffsetY = offsetY - maxOffsetDiff;
295
- newOffsetX += ((layer.image.width / 2 - offsetX) * (newScale - scale)) / newScale;
296
- } else {
297
- newOffsetY += (layer.height - newHeight / newScale) / 2;
298
- }
299
- }
300
-
301
- Object.assign(layer.state, {
302
- x: newCenter.x - newWidth / 2,
303
- y: newCenter.y - newHeight / 2,
304
- width: newWidth / newScale,
305
- height: newHeight / newScale,
306
- scale: newScale,
307
- offsetX: newOffsetX,
308
- offsetY: newOffsetY,
309
- });
310
- } else {
311
- Object.assign(layer.state, {
312
- x: newCenter.x - newWidth / 2,
313
- y: newCenter.y - newHeight / 2,
314
- width: newWidth / newScale,
315
- height: newHeight / newScale,
316
- scale: newScale,
317
- });
318
- }
319
- }),
320
- );
321
-
322
- editor.activeAction.tooltip = {
323
- x: e.clientX,
324
- y: e.clientY,
325
- text: `w: ${Math.round(groupNewWidth)} h: ${Math.round(groupNewHeight)}`,
326
- };
327
- };
328
- </script>
329
-
330
- <div class={base()}>
331
- <!-- svelte-ignore a11y_no_static_element_interactions -->
332
- <div class={cn(handler(), cursor())} onmousedown={onMouseDown}></div>
333
- <div
334
- class={grip()}
335
- style:box-shadow="0 0 4px 1px rgba(57,76,96,.15), 0 0 0 1px rgba(43,59,74,.3)"
336
- ></div>
337
- </div>
@@ -1,19 +0,0 @@
1
- <script lang="ts">
2
- import type { Slide } from '../../../types.js';
3
- import { ColorIndicator } from '../../../color-indicator/index.js';
4
- import BackgroundContentImage from './background-content-image.svelte';
5
-
6
- interface Props {
7
- slide: Slide;
8
- thumbScale?: number;
9
- }
10
-
11
- let { slide, thumbScale }: Props = $props();
12
-
13
- let backgroundColor = $derived(slide.backgroundColor || '#ffffff');
14
- </script>
15
-
16
- <ColorIndicator color={backgroundColor} />
17
- {#if slide.backgroundImage}
18
- <BackgroundContentImage backgroundImage={slide.backgroundImage} {thumbScale} />
19
- {/if}
@@ -1,71 +0,0 @@
1
- <script lang="ts">
2
- import BoldIcon from 'lucide-svelte/icons/bold';
3
- import { Toggle } from '../../../../../../ui/toggle/index.js';
4
- import type { HtmlLayer } from '../../../../../types.js';
5
- import { getPresentationEditorContext } from '../../../../../presentation-editor.svelte.js';
6
- import { createEditorNotReactive } from '../../editor/utils.js';
7
- import { applyHtmlToLayer } from '../../../../utils.js';
8
-
9
- interface Props {
10
- layers: HtmlLayer[];
11
- }
12
-
13
- let { layers = $bindable() }: Props = $props();
14
-
15
- const editor = getPresentationEditorContext();
16
-
17
- const { htmlEditor } = editor;
18
-
19
- const editorNotReactive = createEditorNotReactive();
20
-
21
- const isActive = $derived.by(() => {
22
- if (editor.activeAction?.type === 'edit') {
23
- return $htmlEditor.isActive('bold');
24
- } else {
25
- return layers.every((layer) => {
26
- editorNotReactive.chain().setContent(layer.html).selectAll().run();
27
- return editorNotReactive.isActive('bold');
28
- });
29
- }
30
- });
31
-
32
- const setValue = async (value: boolean) => {
33
- if (editor.activeAction?.type === 'edit') {
34
- if (value) {
35
- $htmlEditor.chain().focus().setBold().run();
36
- } else {
37
- $htmlEditor.chain().focus().unsetBold().run();
38
- }
39
- } else {
40
- editor.historyPush({
41
- type: 'layersGroup',
42
- actions: await Promise.all(
43
- layers.map(async (layer) => {
44
- let chain = editorNotReactive.chain().setContent(layer.html).selectAll();
45
- if (value) {
46
- chain = chain.setBold();
47
- } else {
48
- chain = chain.unsetBold();
49
- }
50
- chain.run();
51
-
52
- const undo = { html: layer.html, x: layer.x, y: layer.y, height: layer.height };
53
- const redo = await applyHtmlToLayer(layer, editorNotReactive.getJSON());
54
-
55
- return {
56
- type: 'layer',
57
- slideId: editor.activeSlide.id,
58
- layer: { id: layer.id, type: layer.type },
59
- undo,
60
- redo,
61
- };
62
- }),
63
- ),
64
- });
65
- }
66
- };
67
- </script>
68
-
69
- <Toggle size="xs" pressed={isActive} onPressedChange={(val) => setValue(val)}>
70
- <BoldIcon class="h-6 w-6" />
71
- </Toggle>
@@ -1,71 +0,0 @@
1
- <script lang="ts">
2
- import ItalicIcon from 'lucide-svelte/icons/italic';
3
- import { Toggle } from '../../../../../../ui/toggle/index.js';
4
- import type { HtmlLayer } from '../../../../../types.js';
5
- import { getPresentationEditorContext } from '../../../../../presentation-editor.svelte.js';
6
- import { createEditorNotReactive } from '../../editor/utils.js';
7
- import { applyHtmlToLayer } from '../../../../utils.js';
8
-
9
- interface Props {
10
- layers: HtmlLayer[];
11
- }
12
-
13
- let { layers = $bindable() }: Props = $props();
14
-
15
- const editor = getPresentationEditorContext();
16
-
17
- const { htmlEditor } = editor;
18
-
19
- const editorNotReactive = createEditorNotReactive();
20
-
21
- const isActive = $derived.by(() => {
22
- if (editor.activeAction?.type === 'edit') {
23
- return $htmlEditor.isActive('italic');
24
- } else {
25
- return layers.every((layer) => {
26
- editorNotReactive.chain().setContent(layer.html).selectAll().run();
27
- return editorNotReactive.isActive('italic');
28
- });
29
- }
30
- });
31
-
32
- const setValue = async (value: boolean) => {
33
- if (editor.activeAction?.type === 'edit') {
34
- if (value) {
35
- $htmlEditor.chain().focus().setItalic().run();
36
- } else {
37
- $htmlEditor.chain().focus().unsetItalic().run();
38
- }
39
- } else {
40
- editor.historyPush({
41
- type: 'layersGroup',
42
- actions: await Promise.all(
43
- layers.map(async (layer) => {
44
- let chain = editorNotReactive.chain().setContent(layer.html).selectAll();
45
- if (value) {
46
- chain = chain.setItalic();
47
- } else {
48
- chain = chain.unsetItalic();
49
- }
50
- chain.run();
51
-
52
- const undo = { html: layer.html, x: layer.x, y: layer.y, height: layer.height };
53
- const redo = await applyHtmlToLayer(layer, editorNotReactive.getJSON());
54
-
55
- return {
56
- type: 'layer',
57
- slideId: editor.activeSlide.id,
58
- layer: { id: layer.id, type: layer.type },
59
- undo,
60
- redo,
61
- };
62
- }),
63
- ),
64
- });
65
- }
66
- };
67
- </script>
68
-
69
- <Toggle size="xs" pressed={isActive} onPressedChange={(val) => setValue(val)}>
70
- <ItalicIcon class="h-6 w-6" />
71
- </Toggle>
@@ -1,90 +0,0 @@
1
- <script lang="ts">
2
- import BulletListIcon from 'lucide-svelte/icons/list';
3
- import OrderedListIcon from 'lucide-svelte/icons/list-ordered';
4
- import { Toggle } from '../../../../../../ui/toggle/index.js';
5
- import { getPresentationEditorContext } from '../../../../../presentation-editor.svelte.js';
6
- import type { HtmlLayer } from '../../../../../types.js';
7
- import type { Editor } from '../../editor/index.js';
8
- import { createEditorNotReactive } from '../../editor/utils.js';
9
- import { applyHtmlToLayer } from '../../../../utils.js';
10
-
11
- interface Props {
12
- layers: HtmlLayer[];
13
- }
14
-
15
- let { layers = $bindable() }: Props = $props();
16
-
17
- const editor = getPresentationEditorContext();
18
-
19
- const { htmlEditor } = editor;
20
-
21
- type ListType = 'bulletList' | 'orderedList';
22
-
23
- const editorNotReactive = createEditorNotReactive();
24
-
25
- const getListType = (editor: Editor): ListType | false => {
26
- const listTypes: ListType[] = ['bulletList', 'orderedList'];
27
- for (let type of listTypes) {
28
- if (editor.isActive(type)) {
29
- return type;
30
- }
31
- }
32
- return false;
33
- };
34
-
35
- const currentListType = $derived.by(() => {
36
- if (editor.activeAction?.type === 'edit') {
37
- return getListType($htmlEditor);
38
- } else {
39
- const set = new Set<ListType | false>();
40
- layers.forEach((layer) => {
41
- editorNotReactive.chain().setContent(layer.html).selectAll().run();
42
- set.add(getListType(editorNotReactive));
43
- });
44
- return set.size > 1 ? false : Array.from(set)[0];
45
- }
46
- });
47
-
48
- const setNextListType = (editor: Editor, type: ListType | false) => {
49
- !type
50
- ? editor.commands.toggleBulletList()
51
- : type === 'bulletList'
52
- ? editor.commands.toggleOrderedList()
53
- : editor.commands.toggleUnstyledList();
54
- };
55
-
56
- const switchListType = async () => {
57
- if (editor.activeAction?.type === 'edit') {
58
- setNextListType($htmlEditor, currentListType);
59
- } else {
60
- editor.historyPush({
61
- type: 'layersGroup',
62
- actions: await Promise.all(
63
- layers.map(async (layer) => {
64
- editorNotReactive.chain().setContent(layer.html).selectAll().run();
65
- setNextListType(editorNotReactive, currentListType);
66
-
67
- const undo = { html: layer.html, x: layer.x, y: layer.y, height: layer.height };
68
- const redo = await applyHtmlToLayer(layer, editorNotReactive.getJSON());
69
-
70
- return {
71
- type: 'layer',
72
- slideId: editor.activeSlide.id,
73
- layer: { id: layer.id, type: layer.type },
74
- undo,
75
- redo,
76
- };
77
- }),
78
- ),
79
- });
80
- }
81
- };
82
- </script>
83
-
84
- <Toggle size="xs" pressed={!!currentListType} onPressedChange={switchListType}>
85
- {#if currentListType === 'orderedList'}
86
- <OrderedListIcon class="h-6 w-6" />
87
- {:else}
88
- <BulletListIcon class="h-6 w-6" />
89
- {/if}
90
- </Toggle>
@@ -1,88 +0,0 @@
1
- import {} from '@tiptap/core';
2
- import { Editor } from './Editor.js';
3
- import { extensions } from '../extensions.js';
4
- export const DEFAULT_COLOR = '#000000';
5
- export const createEditorNotReactive = (content) => {
6
- return new Editor({
7
- extensions,
8
- injectCSS: false,
9
- content,
10
- });
11
- };
12
- export const extractSelectionFonts = (editor) => {
13
- const selection = editor.view.state.selection;
14
- const set = new Set();
15
- editor.view.state.doc.nodesBetween(selection.from, selection.to, (node) => {
16
- if (node.attrs.fontFamily) {
17
- set.add(node.attrs.fontFamily);
18
- }
19
- });
20
- return Array.from(set);
21
- };
22
- export const extractNodeFonts = (content, set = new Set()) => {
23
- if (content.type !== 'text') {
24
- if (content.attrs?.fontFamily) {
25
- set.add(content.attrs.fontFamily);
26
- }
27
- content.content?.forEach((content) => extractNodeFonts(content, set));
28
- }
29
- return Array.from(set);
30
- };
31
- export const extractSelectionFontSizes = (editor) => {
32
- const selection = editor.view.state.selection;
33
- const set = new Set();
34
- editor.view.state.doc.nodesBetween(selection.from, selection.to, (node) => {
35
- if (node.attrs.fontSize) {
36
- set.add(node.attrs.fontSize);
37
- }
38
- });
39
- return Array.from(set);
40
- };
41
- export const extractNodeFontSizes = (content, set = new Set()) => {
42
- if (content.type !== 'text') {
43
- if (content.attrs?.fontSize) {
44
- set.add(content.attrs.fontSize);
45
- }
46
- content.content?.forEach((content) => extractNodeFontSizes(content, set));
47
- }
48
- return Array.from(set);
49
- };
50
- export const extractSelectionColors = (editor) => {
51
- const selection = editor.view.state.selection;
52
- const set = new Set();
53
- editor.view.state.doc.nodesBetween(selection.from, selection.to, (node) => {
54
- if (node.isText && node.text?.trim().length) {
55
- const color = node.marks?.find((mark) => mark.type.name === 'textStyle')?.attrs?.color;
56
- set.add(color || DEFAULT_COLOR);
57
- }
58
- });
59
- return Array.from(set);
60
- };
61
- export const extractNodeColors = (content, set = new Set()) => {
62
- if (content.type === 'text') {
63
- const color = content.marks?.find((mark) => mark.type === 'textStyle')?.attrs?.color;
64
- set.add(color || DEFAULT_COLOR);
65
- }
66
- else {
67
- if (content.attrs?.color) {
68
- set.add(content.attrs.color);
69
- }
70
- }
71
- content.content?.forEach((content) => extractNodeColors(content, set));
72
- return Array.from(set);
73
- };
74
- export const extractUppercase = (editor) => {
75
- const selection = editor.view.state.selection;
76
- let uppercase = null;
77
- editor.view.state.doc.nodesBetween(selection.from, selection.to, (node) => {
78
- if (node.type.name !== 'text') {
79
- if (uppercase !== false && node.attrs.textTransform === 'uppercase') {
80
- uppercase = true;
81
- }
82
- else {
83
- uppercase = false;
84
- }
85
- }
86
- });
87
- return !!uppercase;
88
- };
@@ -1,3 +0,0 @@
1
- import { UnstyledList } from './unstyled-list.js';
2
- export * from './unstyled-list.js';
3
- export default UnstyledList;
@@ -1,3 +0,0 @@
1
- import { UnstyledList } from './unstyled-list.js';
2
- export * from './unstyled-list.js';
3
- export default UnstyledList;