@salla.sa/twilight-theme-engine 1.0.181 → 1.0.183

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 (292) hide show
  1. package/dist/{AddToCartForm-BTMREFCB.js → AddToCartForm-NY32TPDW.js} +3 -3
  2. package/dist/{AddToCartForm-BTMREFCB.js.map → AddToCartForm-NY32TPDW.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-FCT6LUO7.js → BlogAuthorPage-PF22XOO6.js} +20 -19
  4. package/dist/BlogAuthorPage-PF22XOO6.js.map +1 -0
  5. package/dist/{BlogCategoryPage-MIZADPR6.js → BlogCategoryPage-4XIUFCTB.js} +20 -19
  6. package/dist/BlogCategoryPage-4XIUFCTB.js.map +1 -0
  7. package/dist/{BlogPage-A4NK5HKV.js → BlogPage-B3H2N4CV.js} +18 -17
  8. package/dist/BlogPage-B3H2N4CV.js.map +1 -0
  9. package/dist/{BlogSinglePage-5MHRXZA4.js → BlogSinglePage-DTERGNLP.js} +18 -17
  10. package/dist/BlogSinglePage-DTERGNLP.js.map +1 -0
  11. package/dist/{BlogTagPage-N4Z5XVQV.js → BlogTagPage-IF4YZE4L.js} +20 -19
  12. package/dist/BlogTagPage-IF4YZE4L.js.map +1 -0
  13. package/dist/{BrandsPage-3MLX7ANQ.js → BrandsPage-ZSUNDSUM.js} +19 -18
  14. package/dist/BrandsPage-ZSUNDSUM.js.map +1 -0
  15. package/dist/{Breadcrumb-CCTHHEQH.js → Breadcrumb-P6E4SWIW.js} +18 -17
  16. package/dist/Breadcrumb-P6E4SWIW.js.map +1 -0
  17. package/dist/CanvasOverlay-IBVG2YOL.js +655 -0
  18. package/dist/CanvasOverlay-IBVG2YOL.js.map +1 -0
  19. package/dist/{CartItem-YCJF3HXH.js → CartItem-GAD5DZPM.js} +18 -17
  20. package/dist/CartItem-GAD5DZPM.js.map +1 -0
  21. package/dist/{CartSummary-ZJOGWEWI.js → CartSummary-C7MEH6P3.js} +18 -17
  22. package/dist/CartSummary-C7MEH6P3.js.map +1 -0
  23. package/dist/{Copyright-ICYJGCPF.js → Copyright-OEELARY6.js} +3 -3
  24. package/dist/{Copyright-ICYJGCPF.js.map → Copyright-OEELARY6.js.map} +1 -1
  25. package/dist/{CustomerLayout-VRBDGYGF.js → CustomerLayout-6IF6ARRJ.js} +18 -17
  26. package/dist/CustomerLayout-6IF6ARRJ.js.map +1 -0
  27. package/dist/{Footer-FHLO2CHL.js → Footer-7AQSVHHP.js} +3 -3
  28. package/dist/{Footer-FHLO2CHL.js.map → Footer-7AQSVHHP.js.map} +1 -1
  29. package/dist/GoogleTag-ILCEW2QI.js +15 -0
  30. package/dist/{GoogleTag-EEPZ4AH6.js.map → GoogleTag-ILCEW2QI.js.map} +1 -1
  31. package/dist/{Header-RER3EUW6.js → Header-2XD55BJV.js} +8 -8
  32. package/dist/{Header-RER3EUW6.js.map → Header-2XD55BJV.js.map} +1 -1
  33. package/dist/{LatestProducts-4HNU7EXD.js → LatestProducts-3U5K63XI.js} +20 -19
  34. package/dist/LatestProducts-3U5K63XI.js.map +1 -0
  35. package/dist/{LiveEditorBar-3DUDCCSM.js → LiveEditorBar-3ZCT3ZVC.js} +4 -14
  36. package/dist/LiveEditorBar-3ZCT3ZVC.js.map +1 -0
  37. package/dist/{LoyaltyPage-DN4JA4C5.js → LoyaltyPage-3E3IU4NK.js} +18 -17
  38. package/dist/LoyaltyPage-3E3IU4NK.js.map +1 -0
  39. package/dist/{LoyaltyPointsPage-PKYAXASN.js → LoyaltyPointsPage-LCLUP4NT.js} +6 -6
  40. package/dist/{LoyaltyPointsPage-PKYAXASN.js.map → LoyaltyPointsPage-LCLUP4NT.js.map} +1 -1
  41. package/dist/{MainMenu-DHPNKYU5.js → MainMenu-IVN37G3K.js} +5 -5
  42. package/dist/{MainMenu-DHPNKYU5.js.map → MainMenu-IVN37G3K.js.map} +1 -1
  43. package/dist/{MasterLayout-RWAUJ75I.js → MasterLayout-72YUDDQB.js} +18 -17
  44. package/dist/{MasterLayout-RWAUJ75I.js.map → MasterLayout-72YUDDQB.js.map} +1 -1
  45. package/dist/{MobileMenu-7DV5SX7C.js → MobileMenu-TORJJZR3.js} +19 -18
  46. package/dist/MobileMenu-TORJJZR3.js.map +1 -0
  47. package/dist/{NotificationsPage-CGCZOXE5.js → NotificationsPage-TKVZOIGI.js} +18 -17
  48. package/dist/NotificationsPage-TKVZOIGI.js.map +1 -0
  49. package/dist/{OrderSinglePage-OETGEAGR.js → OrderSinglePage-UE3MXRNG.js} +19 -18
  50. package/dist/OrderSinglePage-UE3MXRNG.js.map +1 -0
  51. package/dist/{OrdersPage-GJREHQAP.js → OrdersPage-HMFSFKE7.js} +18 -17
  52. package/dist/OrdersPage-HMFSFKE7.js.map +1 -0
  53. package/dist/{PageSingle-CSRJFQPI.js → PageSingle-YKOQ5NES.js} +3 -3
  54. package/dist/{PageSingle-CSRJFQPI.js.map → PageSingle-YKOQ5NES.js.map} +1 -1
  55. package/dist/{ProductDetails-VV72WQTK.js → ProductDetails-F7RNL33V.js} +4 -4
  56. package/dist/{ProductDetails-VV72WQTK.js.map → ProductDetails-F7RNL33V.js.map} +1 -1
  57. package/dist/{ProfilePage-SKX6MBDZ.js → ProfilePage-LK4VIVXG.js} +18 -17
  58. package/dist/ProfilePage-LK4VIVXG.js.map +1 -0
  59. package/dist/{ReviewsPage-ADN447YV.js → ReviewsPage-MTA53CS7.js} +3 -3
  60. package/dist/{ReviewsPage-ADN447YV.js.map → ReviewsPage-MTA53CS7.js.map} +1 -1
  61. package/dist/{SeoCartWidget-BMNXLYIV.js → SeoCartWidget-SWIQTAEE.js} +18 -17
  62. package/dist/SeoCartWidget-SWIQTAEE.js.map +1 -0
  63. package/dist/{SettingsPage-NKH24AG6.js → SettingsPage-WAXZP4NR.js} +18 -17
  64. package/dist/SettingsPage-WAXZP4NR.js.map +1 -0
  65. package/dist/{StoreClosedNotification-HJC4PYA5.js → StoreClosedNotification-DZAEQ7S5.js} +19 -18
  66. package/dist/{StoreClosedNotification-HJC4PYA5.js.map → StoreClosedNotification-DZAEQ7S5.js.map} +1 -1
  67. package/dist/{TestimonialsPage-T56BGX7K.js → TestimonialsPage-3HXCX3M2.js} +3 -3
  68. package/dist/{TestimonialsPage-T56BGX7K.js.map → TestimonialsPage-3HXCX3M2.js.map} +1 -1
  69. package/dist/{ThankYouPage-ATDW34LU.js → ThankYouPage-47W6PNYQ.js} +18 -17
  70. package/dist/ThankYouPage-47W6PNYQ.js.map +1 -0
  71. package/dist/{WalletPage-BTGNWJEB.js → WalletPage-VCH7SGAU.js} +19 -18
  72. package/dist/WalletPage-VCH7SGAU.js.map +1 -0
  73. package/dist/{WebMcpTools-Y537MP25.js → WebMcpTools-CTDK4U4B.js} +5 -5
  74. package/dist/{WebMcpTools-Y537MP25.js.map → WebMcpTools-CTDK4U4B.js.map} +1 -1
  75. package/dist/{WishlistPage-5HAYJGZY.js → WishlistPage-GP2K2XJR.js} +20 -19
  76. package/dist/WishlistPage-GP2K2XJR.js.map +1 -0
  77. package/dist/api/advertisement.js +2 -2
  78. package/dist/api/apps.js +2 -2
  79. package/dist/api/blog.js +3 -3
  80. package/dist/api/brands.js +3 -3
  81. package/dist/api/cart.js +3 -3
  82. package/dist/api/category.js +3 -3
  83. package/dist/api/client.js +1 -1
  84. package/dist/api/custom-url.js +2 -2
  85. package/dist/api/home.js +2 -2
  86. package/dist/api/loyalty.js +3 -3
  87. package/dist/api/menu.js +2 -2
  88. package/dist/api/notification.js +2 -2
  89. package/dist/api/order.js +3 -3
  90. package/dist/api/page.js +3 -3
  91. package/dist/api/product.js +3 -3
  92. package/dist/api/profile.js +1 -1
  93. package/dist/api/store.js +2 -2
  94. package/dist/api/translations.js +2 -2
  95. package/dist/api/user.js +2 -2
  96. package/dist/api/wallet.js +2 -2
  97. package/dist/api/wishlist.js +4 -4
  98. package/dist/{chunk-RDY5EAO3.js → chunk-2GPRKLLH.js} +3 -3
  99. package/dist/{chunk-RDY5EAO3.js.map → chunk-2GPRKLLH.js.map} +1 -1
  100. package/dist/{chunk-WXQ5BNI3.js → chunk-2GWSDPU7.js} +4 -4
  101. package/dist/{chunk-WXQ5BNI3.js.map → chunk-2GWSDPU7.js.map} +1 -1
  102. package/dist/{chunk-4MKZ7JPZ.js → chunk-3EZYZ2NV.js} +4 -4
  103. package/dist/{chunk-4MKZ7JPZ.js.map → chunk-3EZYZ2NV.js.map} +1 -1
  104. package/dist/{chunk-5NREKFL6.js → chunk-4TFMJ6A5.js} +4 -4
  105. package/dist/{chunk-5NREKFL6.js.map → chunk-4TFMJ6A5.js.map} +1 -1
  106. package/dist/{chunk-U4A66HPY.js → chunk-5G7D55KO.js} +3 -3
  107. package/dist/{chunk-U4A66HPY.js.map → chunk-5G7D55KO.js.map} +1 -1
  108. package/dist/{chunk-2B3VPD42.js → chunk-6A5EPTTH.js} +4 -4
  109. package/dist/{chunk-2B3VPD42.js.map → chunk-6A5EPTTH.js.map} +1 -1
  110. package/dist/{chunk-F2DYT55P.js → chunk-6EIMYWI6.js} +4 -4
  111. package/dist/{chunk-F2DYT55P.js.map → chunk-6EIMYWI6.js.map} +1 -1
  112. package/dist/{chunk-CZTJ2YC2.js → chunk-72664JTK.js} +6 -6
  113. package/dist/{chunk-CZTJ2YC2.js.map → chunk-72664JTK.js.map} +1 -1
  114. package/dist/{chunk-NVQKZ2FF.js → chunk-7AXKYYNY.js} +4 -4
  115. package/dist/{chunk-NVQKZ2FF.js.map → chunk-7AXKYYNY.js.map} +1 -1
  116. package/dist/{chunk-GRF2ZTUB.js → chunk-7XSCVF3W.js} +5 -5
  117. package/dist/{chunk-GRF2ZTUB.js.map → chunk-7XSCVF3W.js.map} +1 -1
  118. package/dist/{chunk-N7CPWUSY.js → chunk-ALXVXCKU.js} +3 -3
  119. package/dist/{chunk-N7CPWUSY.js.map → chunk-ALXVXCKU.js.map} +1 -1
  120. package/dist/{chunk-WCYGDU5H.js → chunk-AUP5QIQY.js} +3 -3
  121. package/dist/{chunk-WCYGDU5H.js.map → chunk-AUP5QIQY.js.map} +1 -1
  122. package/dist/{chunk-7RH6YE4A.js → chunk-AXXU5JZB.js} +3 -3
  123. package/dist/{chunk-7RH6YE4A.js.map → chunk-AXXU5JZB.js.map} +1 -1
  124. package/dist/{chunk-BDFEI5DD.js → chunk-D4K2LOKQ.js} +14 -14
  125. package/dist/{chunk-BDFEI5DD.js.map → chunk-D4K2LOKQ.js.map} +1 -1
  126. package/dist/chunk-DFAXWCUA.js +16 -0
  127. package/dist/chunk-DFAXWCUA.js.map +1 -0
  128. package/dist/{chunk-UNYPBBZJ.js → chunk-DL5PKYFT.js} +5 -5
  129. package/dist/{chunk-UNYPBBZJ.js.map → chunk-DL5PKYFT.js.map} +1 -1
  130. package/dist/{chunk-FRVKNJHM.js → chunk-DMMNDKCR.js} +3 -3
  131. package/dist/{chunk-FRVKNJHM.js.map → chunk-DMMNDKCR.js.map} +1 -1
  132. package/dist/{chunk-AQDJ5UDM.js → chunk-DZN2RIYW.js} +3 -3
  133. package/dist/{chunk-AQDJ5UDM.js.map → chunk-DZN2RIYW.js.map} +1 -1
  134. package/dist/{chunk-YL6X3ZMG.js → chunk-ELGZOQEY.js} +13 -4
  135. package/dist/chunk-ELGZOQEY.js.map +1 -0
  136. package/dist/{chunk-LAESVQK6.js → chunk-EWGXV5GI.js} +28 -19
  137. package/dist/chunk-EWGXV5GI.js.map +1 -0
  138. package/dist/{chunk-RD7ZPLRZ.js → chunk-G5YHYWJ7.js} +3 -3
  139. package/dist/{chunk-RD7ZPLRZ.js.map → chunk-G5YHYWJ7.js.map} +1 -1
  140. package/dist/{chunk-G5T6TU4H.js → chunk-G7INI2GH.js} +7 -7
  141. package/dist/{chunk-G5T6TU4H.js.map → chunk-G7INI2GH.js.map} +1 -1
  142. package/dist/{chunk-TJ7R6LJB.js → chunk-GUFFZID4.js} +4 -4
  143. package/dist/{chunk-TJ7R6LJB.js.map → chunk-GUFFZID4.js.map} +1 -1
  144. package/dist/{chunk-GIKIIAGI.js → chunk-IPUPJ4MD.js} +3 -3
  145. package/dist/{chunk-GIKIIAGI.js.map → chunk-IPUPJ4MD.js.map} +1 -1
  146. package/dist/{chunk-MKHRHWCT.js → chunk-ISMI6GBX.js} +3 -3
  147. package/dist/{chunk-MKHRHWCT.js.map → chunk-ISMI6GBX.js.map} +1 -1
  148. package/dist/{chunk-GO4EVN5H.js → chunk-J5KHVHGN.js} +3 -3
  149. package/dist/{chunk-GO4EVN5H.js.map → chunk-J5KHVHGN.js.map} +1 -1
  150. package/dist/{chunk-AOP3NGP5.js → chunk-JKZ3B7IW.js} +4 -4
  151. package/dist/{chunk-AOP3NGP5.js.map → chunk-JKZ3B7IW.js.map} +1 -1
  152. package/dist/{chunk-WGUF75EV.js → chunk-JNCLYBYU.js} +3 -3
  153. package/dist/{chunk-WGUF75EV.js.map → chunk-JNCLYBYU.js.map} +1 -1
  154. package/dist/{chunk-SA3UNTGI.js → chunk-KJWPNYNL.js} +4 -4
  155. package/dist/{chunk-SA3UNTGI.js.map → chunk-KJWPNYNL.js.map} +1 -1
  156. package/dist/{chunk-VIZE6HIA.js → chunk-LUGXERBC.js} +4 -4
  157. package/dist/{chunk-VIZE6HIA.js.map → chunk-LUGXERBC.js.map} +1 -1
  158. package/dist/{chunk-VKKA35I2.js → chunk-LZCKSQAK.js} +3 -3
  159. package/dist/{chunk-VKKA35I2.js.map → chunk-LZCKSQAK.js.map} +1 -1
  160. package/dist/{chunk-53GFVA6K.js → chunk-M4PT4CN6.js} +3 -3
  161. package/dist/{chunk-53GFVA6K.js.map → chunk-M4PT4CN6.js.map} +1 -1
  162. package/dist/{chunk-EJJUUXL3.js → chunk-MLUOHGVP.js} +5 -5
  163. package/dist/{chunk-EJJUUXL3.js.map → chunk-MLUOHGVP.js.map} +1 -1
  164. package/dist/{chunk-VTIXMCC2.js → chunk-NBCPX7US.js} +3 -3
  165. package/dist/{chunk-VTIXMCC2.js.map → chunk-NBCPX7US.js.map} +1 -1
  166. package/dist/{chunk-UXLV3RDY.js → chunk-NRQZA5P2.js} +3 -3
  167. package/dist/{chunk-UXLV3RDY.js.map → chunk-NRQZA5P2.js.map} +1 -1
  168. package/dist/{chunk-RWNWVAR3.js → chunk-OV3TQVMB.js} +3 -3
  169. package/dist/{chunk-RWNWVAR3.js.map → chunk-OV3TQVMB.js.map} +1 -1
  170. package/dist/{chunk-FBAEVGER.js → chunk-P3ER5Z6O.js} +8 -8
  171. package/dist/{chunk-FBAEVGER.js.map → chunk-P3ER5Z6O.js.map} +1 -1
  172. package/dist/{chunk-VMANXK5R.js → chunk-PE22AZ54.js} +3 -3
  173. package/dist/{chunk-VMANXK5R.js.map → chunk-PE22AZ54.js.map} +1 -1
  174. package/dist/{chunk-RLDBGJGY.js → chunk-Q2K6SAFY.js} +7 -7
  175. package/dist/{chunk-RLDBGJGY.js.map → chunk-Q2K6SAFY.js.map} +1 -1
  176. package/dist/{chunk-S4PQLNYO.js → chunk-RKKLRDKO.js} +4 -4
  177. package/dist/{chunk-S4PQLNYO.js.map → chunk-RKKLRDKO.js.map} +1 -1
  178. package/dist/{chunk-4NRJSPJD.js → chunk-S5IEEOGD.js} +3 -3
  179. package/dist/{chunk-4NRJSPJD.js.map → chunk-S5IEEOGD.js.map} +1 -1
  180. package/dist/{chunk-BKTOWTO4.js → chunk-TF4XU7QK.js} +4 -4
  181. package/dist/{chunk-BKTOWTO4.js.map → chunk-TF4XU7QK.js.map} +1 -1
  182. package/dist/{chunk-LCC7IV6O.js → chunk-U4B5QVLL.js} +4 -4
  183. package/dist/{chunk-LCC7IV6O.js.map → chunk-U4B5QVLL.js.map} +1 -1
  184. package/dist/chunk-VJF4DOIT.js +140 -0
  185. package/dist/chunk-VJF4DOIT.js.map +1 -0
  186. package/dist/{chunk-QYWNYSCI.js → chunk-VQPRCNEZ.js} +5 -5
  187. package/dist/{chunk-QYWNYSCI.js.map → chunk-VQPRCNEZ.js.map} +1 -1
  188. package/dist/{chunk-QF7HVZM5.js → chunk-VU4WEZY2.js} +3 -3
  189. package/dist/{chunk-QF7HVZM5.js.map → chunk-VU4WEZY2.js.map} +1 -1
  190. package/dist/{chunk-TMTJTEGN.js → chunk-WKCWVVQF.js} +3 -3
  191. package/dist/{chunk-TMTJTEGN.js.map → chunk-WKCWVVQF.js.map} +1 -1
  192. package/dist/{chunk-GRYATL7L.js → chunk-YAR327PT.js} +4 -4
  193. package/dist/{chunk-GRYATL7L.js.map → chunk-YAR327PT.js.map} +1 -1
  194. package/dist/{chunk-SCQQ67YE.js → chunk-YCD34CQS.js} +4 -4
  195. package/dist/{chunk-SCQQ67YE.js.map → chunk-YCD34CQS.js.map} +1 -1
  196. package/dist/{chunk-VND65UMT.js → chunk-YK6PF6AX.js} +3 -3
  197. package/dist/{chunk-VND65UMT.js.map → chunk-YK6PF6AX.js.map} +1 -1
  198. package/dist/components/cart/index.js +1 -1
  199. package/dist/components/common/index.js +1 -1
  200. package/dist/components/drawer/index.js +16 -15
  201. package/dist/components/home/index.js +21 -20
  202. package/dist/components/layout/index.js +4 -4
  203. package/dist/components/live-editor/CanvasOverlay.d.ts +14 -0
  204. package/dist/components/live-editor/CanvasOverlay.d.ts.map +1 -0
  205. package/dist/components/live-editor/LiveEditorBar.d.ts.map +1 -1
  206. package/dist/components/live-editor/box.d.ts +12 -0
  207. package/dist/components/live-editor/box.d.ts.map +1 -0
  208. package/dist/components/live-editor/canvas.d.ts +65 -0
  209. package/dist/components/live-editor/canvas.d.ts.map +1 -0
  210. package/dist/components/live-editor/frame.d.ts +2 -0
  211. package/dist/components/live-editor/frame.d.ts.map +1 -1
  212. package/dist/components/live-editor/index.d.ts +3 -2
  213. package/dist/components/live-editor/index.d.ts.map +1 -1
  214. package/dist/components/product/index.js +18 -17
  215. package/dist/components/store/index.js +17 -16
  216. package/dist/components/tracking/index.js +6 -6
  217. package/dist/{custom-urls-Z3EPMC5B.js → custom-urls-SKEEUL2X.js} +7 -7
  218. package/dist/{custom-urls-Z3EPMC5B.js.map → custom-urls-SKEEUL2X.js.map} +1 -1
  219. package/dist/dev/editor/index.js +2 -2
  220. package/dist/dev/index.js +1 -1
  221. package/dist/{document-class-SYUN4GYO.js → document-class-GWI4Q6ZU.js} +17 -17
  222. package/dist/{document-class-SYUN4GYO.js.map → document-class-GWI4Q6ZU.js.map} +1 -1
  223. package/dist/hooks/index.js +16 -15
  224. package/dist/hooks/useGtm.js +16 -15
  225. package/dist/hooks/useMoney.js +16 -15
  226. package/dist/hooks/useStore.js +16 -15
  227. package/dist/hooks/useUser.js +3 -3
  228. package/dist/index.js +16 -15
  229. package/dist/index.js.map +1 -1
  230. package/dist/{navigation-F7D6JQKB.js → navigation-EIXIQKK7.js} +4 -4
  231. package/dist/{navigation-F7D6JQKB.js.map → navigation-EIXIQKK7.js.map} +1 -1
  232. package/dist/{navigation-5NG7XJSO.js → navigation-GEHGAEBI.js} +5 -5
  233. package/dist/{navigation-5NG7XJSO.js.map → navigation-GEHGAEBI.js.map} +1 -1
  234. package/dist/{not-found-DFW7Y4AX.js → not-found-E2NPNFSK.js} +19 -18
  235. package/dist/not-found-E2NPNFSK.js.map +1 -0
  236. package/dist/providers/index.js +16 -15
  237. package/dist/routes/account/orders.js +4 -4
  238. package/dist/routes/account.js +13 -13
  239. package/dist/routes/blog.js +8 -8
  240. package/dist/routes/brands.js +4 -4
  241. package/dist/routes/cart.js +24 -23
  242. package/dist/routes/cart.js.map +1 -1
  243. package/dist/routes/home.js +22 -21
  244. package/dist/routes/index.js +8 -8
  245. package/dist/routes/loyalty.js +5 -5
  246. package/dist/routes/page.js +4 -4
  247. package/dist/routes/product-listing.js +26 -25
  248. package/dist/routes/product-listing.js.map +1 -1
  249. package/dist/routes/product.js +25 -24
  250. package/dist/routes/product.js.map +1 -1
  251. package/dist/routes/seo-redirects.js +8 -8
  252. package/dist/routes/testimonials.js +2 -2
  253. package/dist/routes/thank-you.js +4 -4
  254. package/dist/skeleton.js +22 -21
  255. package/dist/{store-lookup-TGXQXPJL.js → store-lookup-6XBLKJNS.js} +8 -8
  256. package/dist/{store-lookup-TGXQXPJL.js.map → store-lookup-6XBLKJNS.js.map} +1 -1
  257. package/dist/tanstack.js +17 -17
  258. package/dist/utils/index.js +3 -3
  259. package/package.json +1 -1
  260. package/tailwind/components/live-editor/CanvasOverlay.tsx.txt +812 -0
  261. package/tailwind/components/live-editor/LiveEditorBar.tsx.txt +1 -24
  262. package/tailwind/components/live-editor/box.ts.txt +22 -0
  263. package/tailwind/components/live-editor/canvas.ts.txt +218 -0
  264. package/tailwind/components/live-editor/frame.ts.txt +18 -2
  265. package/tailwind/components/live-editor/index.tsx.txt +18 -2
  266. package/dist/BlogAuthorPage-FCT6LUO7.js.map +0 -1
  267. package/dist/BlogCategoryPage-MIZADPR6.js.map +0 -1
  268. package/dist/BlogPage-A4NK5HKV.js.map +0 -1
  269. package/dist/BlogSinglePage-5MHRXZA4.js.map +0 -1
  270. package/dist/BlogTagPage-N4Z5XVQV.js.map +0 -1
  271. package/dist/BrandsPage-3MLX7ANQ.js.map +0 -1
  272. package/dist/Breadcrumb-CCTHHEQH.js.map +0 -1
  273. package/dist/CartItem-YCJF3HXH.js.map +0 -1
  274. package/dist/CartSummary-ZJOGWEWI.js.map +0 -1
  275. package/dist/CustomerLayout-VRBDGYGF.js.map +0 -1
  276. package/dist/GoogleTag-EEPZ4AH6.js +0 -15
  277. package/dist/LatestProducts-4HNU7EXD.js.map +0 -1
  278. package/dist/LiveEditorBar-3DUDCCSM.js.map +0 -1
  279. package/dist/LoyaltyPage-DN4JA4C5.js.map +0 -1
  280. package/dist/MobileMenu-7DV5SX7C.js.map +0 -1
  281. package/dist/NotificationsPage-CGCZOXE5.js.map +0 -1
  282. package/dist/OrderSinglePage-OETGEAGR.js.map +0 -1
  283. package/dist/OrdersPage-GJREHQAP.js.map +0 -1
  284. package/dist/ProfilePage-SKX6MBDZ.js.map +0 -1
  285. package/dist/SeoCartWidget-BMNXLYIV.js.map +0 -1
  286. package/dist/SettingsPage-NKH24AG6.js.map +0 -1
  287. package/dist/ThankYouPage-ATDW34LU.js.map +0 -1
  288. package/dist/WalletPage-BTGNWJEB.js.map +0 -1
  289. package/dist/WishlistPage-5HAYJGZY.js.map +0 -1
  290. package/dist/chunk-LAESVQK6.js.map +0 -1
  291. package/dist/chunk-YL6X3ZMG.js.map +0 -1
  292. package/dist/not-found-DFW7Y4AX.js.map +0 -1
@@ -0,0 +1,655 @@
1
+ import { boxOf } from './chunk-DFAXWCUA.js';
2
+ import { moveLiveBlock } from './chunk-IXHM24Z4.js';
3
+ import { takeCanvasCommands, postToCanvas, matchBlocks } from './chunk-VJF4DOIT.js';
4
+ import { targetOf, BLOCK_ATTRIBUTE, areaOf, TARGET_SELECTOR } from './chunk-ELGZOQEY.js';
5
+ import './chunk-OXMUPNMH.js';
6
+ import { useTranslation } from './chunk-TYNZ5B2B.js';
7
+ import './chunk-T72DAX7R.js';
8
+ import './chunk-DGUM43GV.js';
9
+ import { useState, useRef, useEffect, useLayoutEffect } from 'react';
10
+ import { createPortal, flushSync } from 'react-dom';
11
+ import { jsxs, jsx } from 'react/jsx-runtime';
12
+
13
+ var PARTS = {
14
+ logo: '[data-live-editor="logo"], .navbar-brand, .site-header__brand, .store-footer__logo',
15
+ menu: '[data-live-editor="menu"], custom-main-menu, .main-menu, .site-header__mainmenu, .store-footer__menu'
16
+ };
17
+ var PART_TARGETS = `${PARTS.logo}, ${PARTS.menu}`;
18
+ var DRAG_EDGE = 60;
19
+ var DEFAULT_LABELS = {
20
+ ar: {
21
+ add_here: "\u0623\u0636\u0641 \u0639\u0646\u0635\u0631 \u0647\u0646\u0627",
22
+ header: "\u0631\u0623\u0633 \u0627\u0644\u0635\u0641\u062D\u0629",
23
+ footer: "\u062A\u0630\u064A\u064A\u0644 \u0627\u0644\u0635\u0641\u062D\u0629",
24
+ logo: "\u0627\u0644\u0634\u0639\u0627\u0631",
25
+ header_menu: "\u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",
26
+ footer_menu: "\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0641\u0648\u062A\u0631"
27
+ },
28
+ en: {
29
+ add_here: "Add an element here",
30
+ header: "Header",
31
+ footer: "Footer",
32
+ logo: "Logo",
33
+ header_menu: "Main menu",
34
+ footer_menu: "Footer menu"
35
+ }
36
+ };
37
+ var CANVAS_CSS = `
38
+ .s-canvas-layer{position:fixed;inset:0;z-index:2147483000;pointer-events:none}
39
+ .s-canvas-box{--s-canvas-border:2px;position:absolute;display:none;box-sizing:border-box;border:var(--s-canvas-border) solid #5196f3}
40
+ .s-canvas-tag{position:absolute;top:calc(var(--s-canvas-border) * -1);inset-inline-start:calc(var(--s-canvas-border) * -1);display:flex;align-items:center;gap:10px;max-width:calc(100% + var(--s-canvas-border) * 2);height:26px;box-sizing:border-box;padding-block:0;padding-inline:14px 16px;background:#5196f3;color:#fff;font-family:inherit;font-size:12px;font-weight:500;line-height:26px;white-space:nowrap;border-start-end-radius:8px;border-end-end-radius:8px;pointer-events:auto}
41
+ .s-canvas-title{overflow:hidden;text-overflow:ellipsis}
42
+ .s-canvas-handle{display:flex;flex-shrink:0;cursor:grab;touch-action:none}
43
+ .s-canvas-handle svg{width:16px;height:16px}
44
+ .s-canvas-add{position:absolute;top:0;left:50%;width:40px;height:40px;margin:-20px 0 0 -20px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:#5196f3;color:#fff;cursor:pointer;pointer-events:auto}
45
+ .s-canvas-add svg{width:22px;height:22px}
46
+ .s-canvas-tip{position:absolute;bottom:calc(100% + 10px);left:50%;transform:translateX(-50%);display:none;padding:8px 12px;border-radius:10px;background:#fff;color:#444;font-family:inherit;font-size:13px;line-height:18px;white-space:nowrap;box-shadow:0 4px 12px rgba(18,18,23,.12)}
47
+ .s-canvas-tip::after{content:'';position:absolute;top:100%;left:50%;margin-left:-6px;border:6px solid transparent;border-top-color:#fff}
48
+ .s-canvas-add:hover .s-canvas-tip{display:block}
49
+ .s-canvas-box.is-top .s-canvas-add{margin-top:4px}
50
+ .s-canvas-box.is-top .s-canvas-tip{bottom:auto;top:calc(100% + 10px)}
51
+ .s-canvas-box.is-top .s-canvas-tip::after{top:auto;bottom:100%;border-top-color:transparent;border-bottom-color:#fff}
52
+ .s-canvas-box.is-fixed .s-canvas-handle,.s-canvas-box.is-fixed .s-canvas-add,.s-canvas-box--select:not(.is-hovered) .s-canvas-add{display:none}
53
+ .s-canvas-box.is-part .s-canvas-tag,.s-canvas-box--parent .s-canvas-add{display:none}
54
+ .s-canvas-box--parent{--s-canvas-border:1.5px;border-style:dashed}
55
+ .s-canvas-drop{position:absolute;display:none;height:4px;margin-top:-2px;border-radius:2px;background:#5196f3}
56
+ `;
57
+ var DRAGGING_CSS = "html,html *{cursor:grabbing!important;user-select:none}";
58
+ var DRAG_ICON = /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: [
59
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "5", r: "1.5" }),
60
+ /* @__PURE__ */ jsx("circle", { cx: "15", cy: "5", r: "1.5" }),
61
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "12", r: "1.5" }),
62
+ /* @__PURE__ */ jsx("circle", { cx: "15", cy: "12", r: "1.5" }),
63
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "19", r: "1.5" }),
64
+ /* @__PURE__ */ jsx("circle", { cx: "15", cy: "19", r: "1.5" })
65
+ ] });
66
+ var ADD_ICON = /* @__PURE__ */ jsx(
67
+ "svg",
68
+ {
69
+ width: "14",
70
+ height: "14",
71
+ viewBox: "0 0 24 24",
72
+ fill: "none",
73
+ stroke: "currentColor",
74
+ strokeWidth: "2.5",
75
+ strokeLinecap: "round",
76
+ "aria-hidden": "true",
77
+ children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14" })
78
+ }
79
+ );
80
+ function useLabels() {
81
+ const { t, i18n } = useTranslation();
82
+ const defaults = i18n?.language?.startsWith("ar") ? DEFAULT_LABELS.ar : DEFAULT_LABELS.en;
83
+ return Object.fromEntries(
84
+ Object.keys(defaults).map((key) => [
85
+ key,
86
+ t(`blocks.live_editor.canvas.${key}`, { defaultValue: defaults[key] })
87
+ ])
88
+ );
89
+ }
90
+ function roleOf(el) {
91
+ const block = targetOf(el);
92
+ return block ? areaOf(block) ?? "component" : null;
93
+ }
94
+ function partOf(el) {
95
+ if (el.hasAttribute(BLOCK_ATTRIBUTE) || areaOf(el)) return null;
96
+ if (el.matches(PARTS.logo)) return "logo";
97
+ return el.matches(PARTS.menu) ? "menu" : null;
98
+ }
99
+ function outermost(part) {
100
+ const kind = partOf(part);
101
+ if (!kind) return part;
102
+ let found = part;
103
+ for (let up = part.parentElement?.closest(PARTS[kind]); up; up = up.parentElement?.closest(PARTS[kind])) {
104
+ found = up;
105
+ }
106
+ return found;
107
+ }
108
+ function pick(node) {
109
+ if (!(node instanceof Element)) return null;
110
+ const part = node.closest(PART_TARGETS);
111
+ const block = part ? targetOf(part) : null;
112
+ if (part && block && areaOf(block)) return outermost(part);
113
+ return targetOf(node);
114
+ }
115
+ var visible = (el) => {
116
+ const box = boxOf(el);
117
+ return box.width > 0 && box.height > 0;
118
+ };
119
+ function siblings(el) {
120
+ const parent = el.parentElement;
121
+ if (!parent) return [];
122
+ return Array.from(parent.children).filter(
123
+ (child) => child instanceof HTMLElement && child.hasAttribute(BLOCK_ATTRIBUTE)
124
+ );
125
+ }
126
+ var pageBlocks = () => Array.from(document.querySelectorAll(`[${BLOCK_ATTRIBUTE}]`)).filter(
127
+ (el) => !el.closest('[role="dialog"]')
128
+ );
129
+ function nameBlocks(blocks) {
130
+ const els = pageBlocks();
131
+ const names = { map: /* @__PURE__ */ new WeakMap(), listed: blocks !== null, seen: new WeakSet(els) };
132
+ if (!blocks?.length) return names;
133
+ matchBlocks(
134
+ els.map((el) => el.getAttribute(BLOCK_ATTRIBUTE) ?? ""),
135
+ blocks
136
+ ).forEach((block, at) => {
137
+ if (block) names.map.set(els[at], block);
138
+ });
139
+ return names;
140
+ }
141
+ function idOf(el, names) {
142
+ const block = targetOf(el);
143
+ if (!block) return null;
144
+ const area = areaOf(block);
145
+ if (area) return area;
146
+ const named = names.map.get(block);
147
+ if (named) return named.eid;
148
+ return names.listed ? null : block.getAttribute(BLOCK_ATTRIBUTE);
149
+ }
150
+ function titleOf(el, names, labels) {
151
+ const role = roleOf(el);
152
+ const part = partOf(el);
153
+ if (part === "logo") return labels.logo;
154
+ if (part === "menu") return role === "header" ? labels.header_menu : labels.footer_menu;
155
+ if (role === "header" || role === "footer") return labels[role];
156
+ const block = targetOf(el);
157
+ return block && names.map.get(block)?.title || "";
158
+ }
159
+ function findBlock(eid, names) {
160
+ if (eid === "header" || eid === "footer") {
161
+ return Array.from(document.querySelectorAll(TARGET_SELECTOR)).find(
162
+ (el) => !el.hasAttribute(BLOCK_ATTRIBUTE) && areaOf(el) === eid
163
+ ) ?? null;
164
+ }
165
+ return pageBlocks().find((el) => {
166
+ const named = names.map.get(el);
167
+ if (named) return named.eid === eid;
168
+ return !names.listed && el.getAttribute(BLOCK_ATTRIBUTE) === eid;
169
+ }) ?? null;
170
+ }
171
+ function find(eid, part, names) {
172
+ const block = findBlock(eid, names);
173
+ if (!block || !part || roleOf(block) === "component") return block;
174
+ return Array.from(block.querySelectorAll(PARTS[part])).find(visible) ?? block;
175
+ }
176
+ function neighbours(el, names) {
177
+ if (roleOf(el) !== "component") return { prev: null, next: null };
178
+ const list = siblings(el);
179
+ const at = list.indexOf(el);
180
+ return {
181
+ prev: list[at - 1] ? idOf(list[at - 1], names) : null,
182
+ next: list[at + 1] ? idOf(list[at + 1], names) : null
183
+ };
184
+ }
185
+ function rectOf(el) {
186
+ const box = boxOf(el);
187
+ return { x: box.left, y: box.top, width: box.width, height: box.height };
188
+ }
189
+ var SLIDE_MS = 200;
190
+ var slides = /* @__PURE__ */ new WeakMap();
191
+ function slideBlocks(blocks, change) {
192
+ const still = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
193
+ if (typeof Element.prototype.animate !== "function" || still) return change() ? [] : null;
194
+ const tops = blocks.map((el) => el.getBoundingClientRect().top + window.scrollY);
195
+ if (!change()) return null;
196
+ const started = [];
197
+ blocks.forEach((el, at) => {
198
+ if (!el.isConnected) return;
199
+ slides.get(el)?.cancel();
200
+ const shift = tops[at] - (el.getBoundingClientRect().top + window.scrollY);
201
+ if (Math.abs(shift) < 1) return;
202
+ const slide = el.animate([{ transform: `translateY(${shift}px)` }, { transform: "none" }], {
203
+ duration: SLIDE_MS,
204
+ easing: "cubic-bezier(.2, 0, 0, 1)"
205
+ });
206
+ slides.set(el, slide);
207
+ started.push(slide);
208
+ });
209
+ return started;
210
+ }
211
+ function moveBlock(from, to) {
212
+ let moved = false;
213
+ flushSync(() => {
214
+ moved = moveLiveBlock(from, to);
215
+ });
216
+ return moved;
217
+ }
218
+ function useLayoutTick() {
219
+ const [, setTick] = useState(0);
220
+ useEffect(() => {
221
+ let frame = 0;
222
+ const schedule = () => {
223
+ if (frame) return;
224
+ frame = requestAnimationFrame(() => {
225
+ frame = 0;
226
+ setTick((n) => n + 1);
227
+ });
228
+ };
229
+ window.addEventListener("scroll", schedule, { capture: true, passive: true });
230
+ window.addEventListener("resize", schedule);
231
+ const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(schedule) : null;
232
+ observer?.observe(document.body);
233
+ return () => {
234
+ cancelAnimationFrame(frame);
235
+ window.removeEventListener("scroll", schedule, { capture: true });
236
+ window.removeEventListener("resize", schedule);
237
+ observer?.disconnect();
238
+ };
239
+ }, []);
240
+ return () => setTick((n) => n + 1);
241
+ }
242
+ function CanvasBox({ kind, target, at, title, hovered, labels, onTag, onAdd, onHandle }) {
243
+ const shown = target?.isConnected ? target : null;
244
+ const box = shown ? boxOf(shown) : null;
245
+ const role = shown ? roleOf(shown) : null;
246
+ const className = [
247
+ "s-canvas-box",
248
+ `s-canvas-box--${kind}`,
249
+ role && role !== "component" ? "is-fixed" : "",
250
+ shown && partOf(shown) ? "is-part" : "",
251
+ box && box.top < 12 ? "is-top" : "",
252
+ hovered ? "is-hovered" : ""
253
+ ].filter(Boolean).join(" ");
254
+ const style = box ? {
255
+ display: "block",
256
+ top: box.top - at.top,
257
+ left: box.left - at.left,
258
+ width: box.width,
259
+ height: box.height
260
+ } : void 0;
261
+ return /* @__PURE__ */ jsxs("div", { className, style, "data-testid": `canvas-box-${kind}`, children: [
262
+ /* @__PURE__ */ jsxs(
263
+ "div",
264
+ {
265
+ className: "s-canvas-tag",
266
+ "aria-hidden": "true",
267
+ "data-testid": `canvas-tag-${kind}`,
268
+ onClick: () => shown && onTag(shown),
269
+ children: [
270
+ /* @__PURE__ */ jsx(
271
+ "span",
272
+ {
273
+ className: "s-canvas-handle",
274
+ "data-testid": `canvas-handle-${kind}`,
275
+ onPointerDown: (event) => shown && onHandle(event, shown),
276
+ children: DRAG_ICON
277
+ }
278
+ ),
279
+ /* @__PURE__ */ jsx("span", { className: "s-canvas-title", "data-testid": `canvas-title-${kind}`, children: title })
280
+ ]
281
+ }
282
+ ),
283
+ /* @__PURE__ */ jsxs(
284
+ "div",
285
+ {
286
+ className: "s-canvas-add",
287
+ "aria-hidden": "true",
288
+ "data-testid": `canvas-add-${kind}`,
289
+ onClick: () => shown && onAdd(shown),
290
+ children: [
291
+ ADD_ICON,
292
+ /* @__PURE__ */ jsx("span", { className: "s-canvas-tip", "data-testid": `canvas-tip-${kind}`, children: labels.add_here })
293
+ ]
294
+ }
295
+ )
296
+ ] });
297
+ }
298
+ function CanvasOverlay({
299
+ origin,
300
+ blocks
301
+ }) {
302
+ const labels = useLabels();
303
+ const [root, setRoot] = useState(null);
304
+ const [layer, setLayer] = useState(null);
305
+ const [hovered, setHovered] = useState(null);
306
+ const [selected, setSelected] = useState(null);
307
+ const [drop, setDrop] = useState(null);
308
+ const [dragging, setDragging] = useState(false);
309
+ const [names, setNames] = useState(() => ({
310
+ map: /* @__PURE__ */ new WeakMap(),
311
+ listed: false,
312
+ seen: /* @__PURE__ */ new WeakSet()
313
+ }));
314
+ const hoveredRef = useRef(null);
315
+ const selectedRef = useRef(null);
316
+ const namesRef = useRef(names);
317
+ const drag = useRef(null);
318
+ const lastRect = useRef("");
319
+ const wanted = useRef(null);
320
+ const listed = useRef(blocks);
321
+ const refresh = useLayoutTick();
322
+ const post = (message) => postToCanvas(origin, message);
323
+ const hover = (el) => {
324
+ if (hoveredRef.current === el) return;
325
+ hoveredRef.current = el;
326
+ setHovered(el);
327
+ };
328
+ const select = (target, reveal = false) => {
329
+ wanted.current = null;
330
+ if (!idOf(target, namesRef.current)) {
331
+ if (selectedRef.current === target) deselect(true);
332
+ return;
333
+ }
334
+ selectedRef.current = target;
335
+ setSelected(target);
336
+ if (reveal) target.scrollIntoView({ block: "nearest" });
337
+ const rect = rectOf(target);
338
+ lastRect.current = JSON.stringify(rect);
339
+ const named = namesRef.current;
340
+ post({
341
+ type: "select",
342
+ eid: idOf(target, named),
343
+ role: roleOf(target),
344
+ tag: target.tagName.toLowerCase(),
345
+ text: titleOf(target, named, labels),
346
+ part: partOf(target),
347
+ idx: null,
348
+ rect,
349
+ ...neighbours(target, named)
350
+ });
351
+ };
352
+ const deselect = (notify) => {
353
+ wanted.current = null;
354
+ if (!selectedRef.current) return;
355
+ selectedRef.current = null;
356
+ setSelected(null);
357
+ lastRect.current = "";
358
+ if (notify) post({ type: "deselect" });
359
+ };
360
+ const reordered = (target) => {
361
+ post({
362
+ type: "reorder",
363
+ eid: idOf(target, namesRef.current),
364
+ after: neighbours(target, namesRef.current).prev
365
+ });
366
+ select(target);
367
+ refresh();
368
+ };
369
+ const follow = (slides2) => {
370
+ if (!slides2?.length) return;
371
+ const until = performance.now() + SLIDE_MS + 50;
372
+ const tick = () => {
373
+ refresh();
374
+ if (performance.now() < until) requestAnimationFrame(tick);
375
+ };
376
+ requestAnimationFrame(tick);
377
+ };
378
+ const move = (eid, direction) => {
379
+ const target = find(eid, void 0, namesRef.current);
380
+ if (!target || roleOf(target) !== "component") return;
381
+ const list = siblings(target);
382
+ const at2 = list.indexOf(target);
383
+ const to = direction === "up" ? at2 - 1 : at2 + 1;
384
+ if (to < 0 || to >= list.length) return;
385
+ const slides2 = slideBlocks(list, () => {
386
+ if (!moveBlock(at2, to)) return false;
387
+ target.scrollIntoView({ block: "nearest" });
388
+ return true;
389
+ });
390
+ if (!slides2) return;
391
+ reordered(target);
392
+ follow(slides2);
393
+ };
394
+ const order = (eids) => {
395
+ const targets = eids.map((eid) => findBlock(eid, namesRef.current)).filter((el) => !!el && roleOf(el) === "component");
396
+ const list = targets.length ? siblings(targets[0]) : [];
397
+ const inList = new Set(list);
398
+ const placed = targets.filter((el) => inList.has(el));
399
+ if (!placed.length) return;
400
+ const isPlaced = new Set(placed);
401
+ const laidOut = [...placed, ...list.filter((el) => !isPlaced.has(el))];
402
+ const current = [...list];
403
+ const slides2 = slideBlocks(list, () => {
404
+ flushSync(() => {
405
+ laidOut.forEach((el, to) => {
406
+ const from = current.indexOf(el);
407
+ if (from === to || !moveLiveBlock(from, to)) return;
408
+ current.splice(to, 0, ...current.splice(from, 1));
409
+ });
410
+ });
411
+ return true;
412
+ });
413
+ refresh();
414
+ follow(slides2);
415
+ };
416
+ const placeDrop = (y) => {
417
+ const state = drag.current;
418
+ if (!state || !layer) return;
419
+ const { list, target } = state;
420
+ let place = list.findIndex((item) => {
421
+ const box3 = boxOf(item);
422
+ return y < box3.top + box3.height / 2;
423
+ });
424
+ if (place === -1) place = list.length;
425
+ const from = list.indexOf(target);
426
+ state.place = place === from || place === from + 1 ? null : place;
427
+ if (state.place === null) {
428
+ setDrop(null);
429
+ return;
430
+ }
431
+ const anchor = list[place] ?? list[list.length - 1];
432
+ const box2 = boxOf(anchor);
433
+ const at2 = layer.getBoundingClientRect();
434
+ setDrop({
435
+ top: (list[place] ? box2.top : box2.top + box2.height) - at2.top,
436
+ left: box2.left - at2.left,
437
+ width: box2.width
438
+ });
439
+ };
440
+ const dragStep = () => {
441
+ const state = drag.current;
442
+ if (!state) return;
443
+ state.frame = 0;
444
+ const { y } = state;
445
+ const bottom = window.innerHeight - DRAG_EDGE;
446
+ const over = y < DRAG_EDGE ? y - DRAG_EDGE : y > bottom ? y - bottom : 0;
447
+ if (over) window.scrollBy(0, Math.max(-DRAG_EDGE, Math.min(DRAG_EDGE, over)) / 3);
448
+ placeDrop(y);
449
+ if (over) state.frame = requestAnimationFrame(() => latest.current.dragStep());
450
+ };
451
+ const startDrag = (event, target) => {
452
+ const unnamed = !idOf(target, namesRef.current);
453
+ if (roleOf(target) !== "component" || event.button !== 0 || unnamed) return;
454
+ event.preventDefault();
455
+ event.currentTarget.setPointerCapture?.(event.pointerId);
456
+ siblings(target).forEach((el) => slides.get(el)?.finish());
457
+ drag.current = { target, list: siblings(target), place: null, y: event.clientY, frame: 0 };
458
+ setDragging(true);
459
+ if (selectedRef.current !== target) select(target);
460
+ };
461
+ const endDrag = (event) => {
462
+ const state = drag.current;
463
+ if (!state) return;
464
+ if (event.type !== "pointercancel") placeDrop(state.y);
465
+ drag.current = null;
466
+ cancelAnimationFrame(state.frame);
467
+ setDrop(null);
468
+ setDragging(false);
469
+ const { target, list, place } = state;
470
+ if (place === null || event.type === "pointercancel") return;
471
+ const from = list.indexOf(target);
472
+ const slides2 = slideBlocks(list, () => moveBlock(from, place > from ? place - 1 : place));
473
+ if (!slides2) return;
474
+ reordered(target);
475
+ follow(slides2);
476
+ };
477
+ const onPointerMove = (event) => {
478
+ const state = drag.current;
479
+ if (state) {
480
+ state.y = event.clientY;
481
+ if (!state.frame) state.frame = requestAnimationFrame(() => latest.current.dragStep());
482
+ return;
483
+ }
484
+ if (layer?.contains(event.target)) return;
485
+ const target = pick(event.target);
486
+ hover(target && idOf(target, namesRef.current) ? target : null);
487
+ };
488
+ const onLeave = (event) => {
489
+ if (event.relatedTarget || drag.current) return;
490
+ hover(null);
491
+ };
492
+ const onClick = (event) => {
493
+ if (layer?.contains(event.target)) return;
494
+ event.preventDefault();
495
+ event.stopPropagation();
496
+ const target = pick(event.target);
497
+ if (target) select(target);
498
+ else deselect(true);
499
+ };
500
+ const swallow = (event) => {
501
+ if (layer?.contains(event.target)) return;
502
+ event.preventDefault();
503
+ event.stopPropagation();
504
+ };
505
+ const onKey = (event) => {
506
+ if (event.key === "Escape") deselect(true);
507
+ };
508
+ const onCommand = (command) => {
509
+ switch (command.type) {
510
+ case "select": {
511
+ const target = find(command.eid, command.part, namesRef.current);
512
+ if (target) select(target, true);
513
+ else {
514
+ deselect(false);
515
+ post({ type: "deselect" });
516
+ wanted.current = { eid: command.eid, part: command.part };
517
+ }
518
+ break;
519
+ }
520
+ case "deselect":
521
+ wanted.current = null;
522
+ deselect(false);
523
+ break;
524
+ case "move":
525
+ move(command.eid, command.direction);
526
+ break;
527
+ case "order":
528
+ order(command.eids);
529
+ break;
530
+ }
531
+ };
532
+ const rename = (retell) => {
533
+ const before = namesRef.current;
534
+ const next = nameBlocks(listed.current);
535
+ namesRef.current = next;
536
+ setNames(next);
537
+ if (hoveredRef.current && !idOf(hoveredRef.current, next)) hover(null);
538
+ const asked = wanted.current;
539
+ const target = asked ? find(asked.eid, asked.part, next) : selectedRef.current;
540
+ if (!target?.isConnected) return;
541
+ if (asked || retell || idOf(target, before) !== idOf(target, next)) select(target, !!asked);
542
+ };
543
+ const handlers = {
544
+ onPointerMove,
545
+ endDrag,
546
+ onLeave,
547
+ onClick,
548
+ swallow,
549
+ onKey,
550
+ onCommand,
551
+ dragStep,
552
+ rename
553
+ };
554
+ const latest = useRef(handlers);
555
+ useEffect(() => {
556
+ latest.current = handlers;
557
+ });
558
+ useEffect(() => setRoot(document.body), []);
559
+ useLayoutEffect(() => {
560
+ listed.current = blocks;
561
+ latest.current.rename(true);
562
+ }, [blocks]);
563
+ useEffect(() => {
564
+ if (typeof MutationObserver === "undefined") return;
565
+ const observer = new MutationObserver(() => {
566
+ if (pageBlocks().some((el) => !namesRef.current.seen.has(el))) latest.current.rename(false);
567
+ });
568
+ observer.observe(document.body, { childList: true, subtree: true });
569
+ return () => observer.disconnect();
570
+ }, []);
571
+ useEffect(() => {
572
+ const pointerMove = (event) => latest.current.onPointerMove(event);
573
+ const pointerUp = (event) => latest.current.endDrag(event);
574
+ const mouseOut = (event) => latest.current.onLeave(event);
575
+ const click = (event) => latest.current.onClick(event);
576
+ const doubleClick = (event) => latest.current.swallow(event);
577
+ const keyDown = (event) => latest.current.onKey(event);
578
+ window.addEventListener("pointermove", pointerMove, { passive: true });
579
+ window.addEventListener("pointerup", pointerUp);
580
+ window.addEventListener("pointercancel", pointerUp);
581
+ document.addEventListener("mouseout", mouseOut);
582
+ window.addEventListener("click", click, true);
583
+ window.addEventListener("dblclick", doubleClick, true);
584
+ window.addEventListener("keydown", keyDown);
585
+ const stop = takeCanvasCommands((command) => latest.current.onCommand(command));
586
+ return () => {
587
+ window.removeEventListener("pointermove", pointerMove);
588
+ window.removeEventListener("pointerup", pointerUp);
589
+ window.removeEventListener("pointercancel", pointerUp);
590
+ document.removeEventListener("mouseout", mouseOut);
591
+ window.removeEventListener("click", click, true);
592
+ window.removeEventListener("dblclick", doubleClick, true);
593
+ window.removeEventListener("keydown", keyDown);
594
+ stop();
595
+ if (drag.current) cancelAnimationFrame(drag.current.frame);
596
+ drag.current = null;
597
+ };
598
+ }, []);
599
+ useEffect(() => {
600
+ const target = selectedRef.current;
601
+ if (!target) return;
602
+ if (!target.isConnected) {
603
+ deselect(true);
604
+ return;
605
+ }
606
+ const rect = rectOf(target);
607
+ const key = JSON.stringify(rect);
608
+ if (key === lastRect.current) return;
609
+ lastRect.current = key;
610
+ post({ type: "rect", eid: idOf(target, namesRef.current), part: partOf(target), rect });
611
+ });
612
+ if (!root) return null;
613
+ const at = layer ? layer.getBoundingClientRect() : { top: 0, left: 0 };
614
+ const box = (kind, target, isHovered = false) => /* @__PURE__ */ jsx(
615
+ CanvasBox,
616
+ {
617
+ kind,
618
+ target,
619
+ at,
620
+ title: target?.isConnected ? titleOf(target, names, labels) : "",
621
+ hovered: isHovered,
622
+ labels,
623
+ onTag: (el) => {
624
+ if (el !== selectedRef.current) select(el);
625
+ },
626
+ onAdd: (el) => {
627
+ const eid = idOf(el, namesRef.current);
628
+ if (eid) post({ type: "add", eid, place: "before" });
629
+ },
630
+ onHandle: startDrag
631
+ }
632
+ );
633
+ return createPortal(
634
+ /* @__PURE__ */ jsxs("div", { ref: setLayer, className: "s-canvas-layer", "data-testid": "canvas-overlay-layer", children: [
635
+ /* @__PURE__ */ jsx("style", { children: CANVAS_CSS }),
636
+ dragging && /* @__PURE__ */ jsx("style", { children: DRAGGING_CSS }),
637
+ box("parent", selected && partOf(selected) ? targetOf(selected) : null),
638
+ box("hover", hovered !== selected ? hovered : null),
639
+ box("select", selected, !!selected && hovered === selected),
640
+ /* @__PURE__ */ jsx(
641
+ "div",
642
+ {
643
+ className: "s-canvas-drop",
644
+ "data-testid": "canvas-drop-line",
645
+ style: drop ? { display: "block", ...drop } : void 0
646
+ }
647
+ )
648
+ ] }),
649
+ root
650
+ );
651
+ }
652
+
653
+ export { CanvasOverlay };
654
+ //# sourceMappingURL=CanvasOverlay-IBVG2YOL.js.map
655
+ //# sourceMappingURL=CanvasOverlay-IBVG2YOL.js.map