@antscorp/antsomi-ui 2.0.110 → 2.0.111

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 (344) hide show
  1. package/es/assets/css/main.scss +2 -0
  2. package/es/components/atoms/Eyedropper/Eyedropper.d.ts +2 -0
  3. package/es/components/atoms/Eyedropper/Eyedropper.js +53 -0
  4. package/es/components/atoms/Eyedropper/index.d.ts +0 -0
  5. package/es/components/atoms/Eyedropper/index.js +1 -0
  6. package/es/components/atoms/Eyedropper/styled.d.ts +9 -0
  7. package/es/components/atoms/Eyedropper/styled.js +45 -0
  8. package/es/components/atoms/Eyedropper/types.d.ts +5 -0
  9. package/es/components/atoms/Eyedropper/types.js +1 -0
  10. package/es/components/icons/ALignRightIcon.d.ts +3 -0
  11. package/es/components/icons/ALignRightIcon.js +7 -0
  12. package/es/components/icons/AlignCenterIcon.d.ts +3 -0
  13. package/es/components/icons/AlignCenterIcon.js +7 -0
  14. package/es/components/icons/AlignJustifyIcon.d.ts +3 -0
  15. package/es/components/icons/AlignJustifyIcon.js +7 -0
  16. package/es/components/icons/AlignLeftIcon.d.ts +3 -0
  17. package/es/components/icons/AlignLeftIcon.js +7 -0
  18. package/es/components/icons/ArrowDropDownIcon.d.ts +3 -0
  19. package/es/components/icons/ArrowDropDownIcon.js +7 -0
  20. package/es/components/icons/ChevronRightIcon.d.ts +3 -0
  21. package/es/components/icons/ChevronRightIcon.js +7 -0
  22. package/es/components/icons/ColorizeIcon.d.ts +3 -0
  23. package/es/components/icons/ColorizeIcon.js +7 -0
  24. package/es/components/icons/LazyIcon/LazyIcon.d.ts +9 -0
  25. package/es/components/icons/LazyIcon/LazyIcon.js +9 -0
  26. package/es/components/icons/LinkOffIcon.d.ts +3 -0
  27. package/es/components/icons/LinkOffIcon.js +7 -0
  28. package/es/components/icons/MinusIcon.d.ts +3 -0
  29. package/es/components/icons/MinusIcon.js +7 -0
  30. package/es/components/icons/index.d.ts +9 -0
  31. package/es/components/icons/index.js +9 -0
  32. package/es/components/index.scss +1 -0
  33. package/es/components/molecules/EmojiCollections/CommonCollection/index.js +2 -2
  34. package/es/components/molecules/EmojiCollections/types.d.ts +1 -0
  35. package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +2 -0
  36. package/es/components/molecules/EmojiPopover/EmojiPopover.js +10 -6
  37. package/es/components/molecules/EmojiPopover/styled.js +1 -1
  38. package/es/components/molecules/EyedropperButton/EyedropperButton.d.ts +11 -0
  39. package/es/components/molecules/EyedropperButton/EyedropperButton.js +34 -0
  40. package/es/components/molecules/EyedropperButton/index.d.ts +0 -0
  41. package/es/components/molecules/EyedropperButton/index.js +1 -0
  42. package/es/components/molecules/EyedropperButton/styled.d.ts +7 -0
  43. package/es/components/molecules/EyedropperButton/styled.js +23 -0
  44. package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
  45. package/es/components/molecules/FontSizeInput/FontSizeInput.js +134 -0
  46. package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +8 -0
  47. package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +14 -0
  48. package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +21 -0
  49. package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +19 -0
  50. package/es/components/molecules/FontSizeInput/constants.d.ts +2 -0
  51. package/es/components/molecules/FontSizeInput/constants.js +5 -0
  52. package/es/components/molecules/FontSizeInput/index.d.ts +2 -0
  53. package/es/components/molecules/FontSizeInput/index.js +1 -0
  54. package/es/components/molecules/FontSizeInput/styled.d.ts +7 -0
  55. package/es/components/molecules/FontSizeInput/styled.js +39 -0
  56. package/es/components/molecules/FontSizeInput/types.d.ts +23 -0
  57. package/es/components/molecules/FontSizeInput/types.js +1 -0
  58. package/es/components/molecules/FontSizeInput/utils.d.ts +7 -0
  59. package/es/components/molecules/FontSizeInput/utils.js +9 -0
  60. package/es/components/molecules/SearchPopover/SearchPopover.d.ts +2 -1
  61. package/es/components/molecules/SearchPopover/SearchPopover.js +3 -3
  62. package/es/components/molecules/SearchPopover/styled.d.ts +12 -1
  63. package/es/components/molecules/SearchPopover/styled.js +1 -2
  64. package/es/components/molecules/SearchPopover/types.d.ts +4 -3
  65. package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -0
  66. package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +6 -8
  67. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +10 -10
  68. package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +49 -289
  69. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.d.ts +9 -0
  70. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.js +5 -0
  71. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.d.ts +23 -0
  72. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.js +81 -0
  73. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.d.ts +24 -0
  74. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.js +32 -0
  75. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.d.ts +26 -0
  76. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.js +93 -0
  77. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.d.ts +24 -0
  78. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.js +94 -0
  79. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.d.ts +7 -0
  80. package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.js +132 -0
  81. package/es/components/molecules/VirtualizedMenu/styled.js +24 -3
  82. package/es/components/molecules/VirtualizedMenu/types.d.ts +2 -0
  83. package/es/components/molecules/VirtualizedMenu/utils.d.ts +2 -0
  84. package/es/components/molecules/VirtualizedMenu/utils.js +2 -0
  85. package/es/components/molecules/index.d.ts +1 -0
  86. package/es/components/molecules/index.js +1 -0
  87. package/es/components/molecules/index.scss +1 -0
  88. package/es/components/organism/TextEditor/TextEditor.d.ts +10 -0
  89. package/es/components/organism/TextEditor/TextEditor.js +388 -0
  90. package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +320 -0
  91. package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +1 -0
  92. package/es/components/organism/TextEditor/__mocks__/text-contennt.js +47 -0
  93. package/es/components/organism/TextEditor/constants.d.ts +196 -0
  94. package/es/components/organism/TextEditor/constants.js +398 -0
  95. package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
  96. package/es/components/organism/TextEditor/extensions/BackgroundColor.js +43 -0
  97. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +18 -0
  98. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +81 -0
  99. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
  100. package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +35 -0
  101. package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +2 -0
  102. package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +2 -0
  103. package/es/components/organism/TextEditor/extensions/ClearFormatting.d.ts +16 -0
  104. package/es/components/organism/TextEditor/extensions/ClearFormatting.js +30 -0
  105. package/es/components/organism/TextEditor/extensions/Color.d.ts +6 -0
  106. package/es/components/organism/TextEditor/extensions/Color.js +34 -0
  107. package/es/components/organism/TextEditor/extensions/Emoji.d.ts +57 -0
  108. package/es/components/organism/TextEditor/extensions/Emoji.js +184 -0
  109. package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +6 -0
  110. package/es/components/organism/TextEditor/extensions/FontFamily.js +36 -0
  111. package/es/components/organism/TextEditor/extensions/FontSize.d.ts +31 -0
  112. package/es/components/organism/TextEditor/extensions/FontSize.js +46 -0
  113. package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +23 -0
  114. package/es/components/organism/TextEditor/extensions/FontWeight.js +41 -0
  115. package/es/components/organism/TextEditor/extensions/Indent.d.ts +21 -0
  116. package/es/components/organism/TextEditor/extensions/Indent.js +63 -0
  117. package/es/components/organism/TextEditor/extensions/LetterSpacing.d.ts +32 -0
  118. package/es/components/organism/TextEditor/extensions/LetterSpacing.js +48 -0
  119. package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +20 -0
  120. package/es/components/organism/TextEditor/extensions/LineHeight.js +101 -0
  121. package/es/components/organism/TextEditor/extensions/Link.d.ts +22 -0
  122. package/es/components/organism/TextEditor/extensions/Link.js +178 -0
  123. package/es/components/organism/TextEditor/extensions/ListItem.d.ts +10 -0
  124. package/es/components/organism/TextEditor/extensions/ListItem.js +93 -0
  125. package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +13 -0
  126. package/es/components/organism/TextEditor/extensions/ListItemMarker.js +174 -0
  127. package/es/components/organism/TextEditor/extensions/OrderedList.d.ts +56 -0
  128. package/es/components/organism/TextEditor/extensions/OrderedList.js +187 -0
  129. package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +28 -0
  130. package/es/components/organism/TextEditor/extensions/SmartTag.js +103 -0
  131. package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +36 -0
  132. package/es/components/organism/TextEditor/extensions/StyleMemory.js +163 -0
  133. package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +30 -0
  134. package/es/components/organism/TextEditor/extensions/TextTransform.js +36 -0
  135. package/es/components/organism/TextEditor/extensions/UnorderedList.d.ts +55 -0
  136. package/es/components/organism/TextEditor/extensions/UnorderedList.js +176 -0
  137. package/es/components/organism/TextEditor/hooks/index.d.ts +6 -0
  138. package/es/components/organism/TextEditor/hooks/index.js +6 -0
  139. package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +4 -0
  140. package/es/components/organism/TextEditor/hooks/useColorSet.js +29 -0
  141. package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +18 -0
  142. package/es/components/organism/TextEditor/hooks/useDocumentState.js +42 -0
  143. package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +26 -0
  144. package/es/components/organism/TextEditor/hooks/useMarkTracking.js +69 -0
  145. package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +31 -0
  146. package/es/components/organism/TextEditor/hooks/usePersistence.js +169 -0
  147. package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +6 -0
  148. package/es/components/organism/TextEditor/hooks/useStyleMemory.js +42 -0
  149. package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +34 -0
  150. package/es/components/organism/TextEditor/hooks/useStylePresets.js +83 -0
  151. package/es/components/organism/TextEditor/index.d.ts +18 -0
  152. package/es/components/organism/TextEditor/index.js +8 -0
  153. package/es/components/organism/TextEditor/index.scss +65 -0
  154. package/es/components/organism/TextEditor/provider.d.ts +15 -0
  155. package/es/components/organism/TextEditor/provider.js +36 -0
  156. package/es/components/organism/TextEditor/store.d.ts +20 -0
  157. package/es/components/organism/TextEditor/store.js +40 -0
  158. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/froala-legacy-format.settings.json +95 -0
  159. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.d.ts +111 -0
  160. package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.js +82 -0
  161. package/es/components/organism/TextEditor/stories/shared.d.ts +64 -0
  162. package/es/components/organism/TextEditor/stories/shared.js +57 -0
  163. package/es/components/organism/TextEditor/styled.d.ts +9 -0
  164. package/es/components/organism/TextEditor/styled.js +61 -0
  165. package/es/components/organism/TextEditor/types.d.ts +311 -0
  166. package/es/components/organism/TextEditor/types.js +6 -0
  167. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +3 -0
  168. package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +114 -0
  169. package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +1 -0
  170. package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +1 -0
  171. package/es/components/organism/TextEditor/ui/Button/Button.d.ts +9 -0
  172. package/es/components/organism/TextEditor/ui/Button/Button.js +35 -0
  173. package/es/components/organism/TextEditor/ui/Button/index.d.ts +2 -0
  174. package/es/components/organism/TextEditor/ui/Button/index.js +1 -0
  175. package/es/components/organism/TextEditor/ui/Button/types.d.ts +10 -0
  176. package/es/components/organism/TextEditor/ui/Button/types.js +1 -0
  177. package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +39 -0
  178. package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +131 -0
  179. package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +1 -0
  180. package/es/components/organism/TextEditor/ui/ColorPicker/index.js +1 -0
  181. package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.d.ts +17 -0
  182. package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.js +51 -0
  183. package/es/components/organism/TextEditor/ui/DropdownButton/index.d.ts +1 -0
  184. package/es/components/organism/TextEditor/ui/DropdownButton/index.js +1 -0
  185. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +11 -0
  186. package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +66 -0
  187. package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +2 -0
  188. package/es/components/organism/TextEditor/ui/Emoji/index.js +2 -0
  189. package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +4 -0
  190. package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +71 -0
  191. package/es/components/organism/TextEditor/ui/FontPopover/FontItem.d.ts +2 -0
  192. package/es/components/organism/TextEditor/ui/FontPopover/FontItem.js +27 -0
  193. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +16 -0
  194. package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +102 -0
  195. package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +2 -0
  196. package/es/components/organism/TextEditor/ui/FontPopover/styled.js +36 -0
  197. package/es/components/organism/TextEditor/ui/FontPopover/types.d.ts +35 -0
  198. package/es/components/organism/TextEditor/ui/FontPopover/types.js +1 -0
  199. package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.d.ts +16 -0
  200. package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.js +61 -0
  201. package/es/components/organism/TextEditor/ui/LinkInsertForm/index.d.ts +2 -0
  202. package/es/components/organism/TextEditor/ui/LinkInsertForm/index.js +1 -0
  203. package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.d.ts +9 -0
  204. package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.js +126 -0
  205. package/es/components/organism/TextEditor/ui/LinkPopover/index.d.ts +2 -0
  206. package/es/components/organism/TextEditor/ui/LinkPopover/index.js +1 -0
  207. package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +6 -0
  208. package/es/components/organism/TextEditor/ui/Popover/Popover.js +9 -0
  209. package/es/components/organism/TextEditor/ui/Popover/index.d.ts +1 -0
  210. package/es/components/organism/TextEditor/ui/Popover/index.js +1 -0
  211. package/es/components/organism/TextEditor/ui/Select/Select.d.ts +4 -0
  212. package/es/components/organism/TextEditor/ui/Select/Select.js +7 -0
  213. package/es/components/organism/TextEditor/ui/Select/index.d.ts +1 -0
  214. package/es/components/organism/TextEditor/ui/Select/index.js +1 -0
  215. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.d.ts +2 -0
  216. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.js +44 -0
  217. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.d.ts +1 -0
  218. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.js +1 -0
  219. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.d.ts +2 -0
  220. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.js +58 -0
  221. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.d.ts +19 -0
  222. package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.js +1 -0
  223. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +30 -0
  224. package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +75 -0
  225. package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +1 -0
  226. package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +1 -0
  227. package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.d.ts +19 -0
  228. package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.js +85 -0
  229. package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.d.ts +10 -0
  230. package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.js +39 -0
  231. package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +6 -0
  232. package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +19 -0
  233. package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +6 -0
  234. package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +93 -0
  235. package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
  236. package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +20 -0
  237. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
  238. package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +32 -0
  239. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +18 -0
  240. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +41 -0
  241. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +8 -0
  242. package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +51 -0
  243. package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.d.ts +5 -0
  244. package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.js +21 -0
  245. package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +5 -0
  246. package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +17 -0
  247. package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +5 -0
  248. package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +18 -0
  249. package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.d.ts +5 -0
  250. package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.js +28 -0
  251. package/es/components/organism/TextEditor/ui/Toolbar/actions/LineSpacingAction.d.ts +10 -0
  252. package/es/components/organism/TextEditor/ui/Toolbar/actions/LineSpacingAction.js +45 -0
  253. package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +6 -0
  254. package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +17 -0
  255. package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +5 -0
  256. package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +67 -0
  257. package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +5 -0
  258. package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +17 -0
  259. package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +7 -0
  260. package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +18 -0
  261. package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +5 -0
  262. package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +18 -0
  263. package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +5 -0
  264. package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +26 -0
  265. package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +5 -0
  266. package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +26 -0
  267. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +5 -0
  268. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +3 -0
  269. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +5 -0
  270. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +29 -0
  271. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +14 -0
  272. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +22 -0
  273. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +5 -0
  274. package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +36 -0
  275. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +5 -0
  276. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +18 -0
  277. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +7 -0
  278. package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +18 -0
  279. package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +24 -0
  280. package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +24 -0
  281. package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +2 -0
  282. package/es/components/organism/TextEditor/ui/Toolbar/index.js +2 -0
  283. package/es/components/organism/TextEditor/utils/documentState.d.ts +73 -0
  284. package/es/components/organism/TextEditor/utils/documentState.js +149 -0
  285. package/es/components/organism/TextEditor/utils/font.d.ts +74 -0
  286. package/es/components/organism/TextEditor/utils/font.js +147 -0
  287. package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +87 -0
  288. package/es/components/organism/TextEditor/utils/htmlProcessing.js +460 -0
  289. package/es/components/organism/TextEditor/utils/indent.d.ts +11 -0
  290. package/es/components/organism/TextEditor/utils/indent.js +56 -0
  291. package/es/components/organism/TextEditor/utils/index.d.ts +8 -0
  292. package/es/components/organism/TextEditor/utils/index.js +16 -0
  293. package/es/components/organism/TextEditor/utils/link.d.ts +116 -0
  294. package/es/components/organism/TextEditor/utils/link.js +304 -0
  295. package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
  296. package/es/components/organism/TextEditor/utils/menu.js +321 -0
  297. package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
  298. package/es/components/organism/TextEditor/utils/selection.js +58 -0
  299. package/es/components/organism/TextEditor/utils/shared.d.ts +13 -0
  300. package/es/components/organism/TextEditor/utils/shared.js +52 -0
  301. package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
  302. package/es/components/organism/TextEditor/utils/smartTag.js +90 -0
  303. package/es/components/organism/TextEditor/utils/style.d.ts +78 -0
  304. package/es/components/organism/TextEditor/utils/style.js +193 -0
  305. package/es/components/organism/index.d.ts +1 -0
  306. package/es/components/organism/index.js +1 -0
  307. package/es/components/organism/index.scss +1 -0
  308. package/es/constants/index.d.ts +1 -0
  309. package/es/constants/index.js +1 -0
  310. package/es/constants/web.d.ts +8 -0
  311. package/es/constants/web.js +57 -0
  312. package/es/hooks/index.d.ts +4 -0
  313. package/es/hooks/index.js +4 -0
  314. package/es/hooks/useBroadcastedLocalStorage.d.ts +5 -0
  315. package/es/hooks/useBroadcastedLocalStorage.js +71 -0
  316. package/es/hooks/useElementSize.d.ts +7 -0
  317. package/es/hooks/useElementSize.js +56 -0
  318. package/es/hooks/useEyedropper/attach.d.ts +4 -0
  319. package/es/hooks/useEyedropper/attach.js +9 -0
  320. package/es/hooks/useEyedropper/eyedropper.d.ts +69 -0
  321. package/es/hooks/useEyedropper/eyedropper.js +205 -0
  322. package/es/hooks/useEyedropper/index.d.ts +2 -0
  323. package/es/hooks/useEyedropper/index.js +7 -0
  324. package/es/hooks/useEyedropper/support.d.ts +1 -0
  325. package/es/hooks/useEyedropper/support.js +3 -0
  326. package/es/hooks/useEyedropper/types.d.ts +9 -0
  327. package/es/hooks/useEyedropper/types.js +1 -0
  328. package/es/hooks/useEyedropper/useEyedropper.d.ts +8 -0
  329. package/es/hooks/useEyedropper/useEyedropper.js +50 -0
  330. package/es/hooks/useEyedropper/utils.d.ts +11 -0
  331. package/es/hooks/useEyedropper/utils.js +17 -0
  332. package/es/hooks/useIsMounted.d.ts +1 -0
  333. package/es/hooks/useIsMounted.js +11 -0
  334. package/es/index.d.ts +1 -1
  335. package/es/index.js +1 -1
  336. package/es/locales/i18n.d.ts +1 -1
  337. package/es/types/index.d.ts +9 -0
  338. package/es/utils/common.d.ts +15 -9
  339. package/es/utils/common.js +62 -24
  340. package/es/utils/index.d.ts +1 -0
  341. package/es/utils/index.js +1 -0
  342. package/es/utils/web.d.ts +80 -0
  343. package/es/utils/web.js +226 -0
  344. package/package.json +26 -17
@@ -0,0 +1,193 @@
1
+ import { DEFAULT_TEXT_STYLE, LINK_TEXT_COLOR } from '../constants';
2
+ import { uniqBy } from 'lodash';
3
+ import tinycolor from 'tinycolor2';
4
+ /**
5
+ * Extracts text style from element's computed style
6
+ * @param style CSSStyleDeclaration from element
7
+ * @returns Partial TextStyle object
8
+ */
9
+ export const textStyleFromElStyle = (style, defaultStyle) => ({
10
+ color: style.color || defaultStyle.color || 'inherit',
11
+ fontFamily: style.fontFamily || defaultStyle.fontFamily || 'inherit',
12
+ fontSize: style.fontSize || defaultStyle.fontSize || 'inherit',
13
+ lineHeight: style.lineHeight || defaultStyle.lineHeight || '1.15',
14
+ backgroundColor: style.backgroundColor,
15
+ });
16
+ /**
17
+ * Applies text style to HTML element
18
+ * @param el HTML element to apply styles to
19
+ * @param style TextStyle object
20
+ */
21
+ export const appendTextStyleToEl = (el, style) => {
22
+ if (style.color) {
23
+ el.style.color = style.color;
24
+ }
25
+ if (style.fontSize) {
26
+ el.style.fontSize = style.fontSize;
27
+ }
28
+ if (style.fontFamily) {
29
+ el.style.fontFamily = style.fontFamily;
30
+ }
31
+ if (style.backgroundColor) {
32
+ el.style.backgroundColor = style.backgroundColor;
33
+ }
34
+ if (style.lineHeight) {
35
+ el.style.lineHeight = style.lineHeight;
36
+ }
37
+ if (style.fontWeight) {
38
+ el.style.fontWeight = style.fontWeight;
39
+ }
40
+ };
41
+ /**
42
+ * Converts a style object to a CSS string representation
43
+ * @param styleObj The style object to convert
44
+ * @returns The CSS string representation
45
+ * @example
46
+ * styleObjectToString({ color: 'red', fontSize: '16px' })
47
+ * // returns "color: red; font-size: 16px"
48
+ */
49
+ export function styleObjectToString(styleObj) {
50
+ return Object.entries(styleObj)
51
+ .map(([key, value]) => {
52
+ // Nếu key đã là kebab-case hoặc bắt đầu bằng dấu '-', giữ nguyên
53
+ const isPrefixed = key.startsWith('-');
54
+ const kebabKey = isPrefixed ? key : key.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);
55
+ return `${kebabKey}: ${value}`;
56
+ })
57
+ .join('; ');
58
+ }
59
+ /**
60
+ * Normalizes a font-family string by adding quotes when needed
61
+ * @param fontFamily The font-family string to normalize
62
+ * @returns The normalized font-family string
63
+ * @description
64
+ * - Preserves existing quoted names
65
+ * - Doesn't quote generic families (e.g. sans-serif)
66
+ * - Quotes names containing spaces or special characters
67
+ * @example
68
+ * normalizeFontFamily('Arial, Helvetica, sans-serif')
69
+ * // returns 'Arial, Helvetica, sans-serif'
70
+ *
71
+ * normalizeFontFamily('Times New Roman, serif')
72
+ * // returns '"Times New Roman", serif'
73
+ */
74
+ export function normalizeFontFamily(fontFamily) {
75
+ if (!fontFamily || typeof fontFamily !== 'string')
76
+ return '';
77
+ const genericFamilies = new Set([
78
+ 'serif',
79
+ 'sans-serif',
80
+ 'monospace',
81
+ 'cursive',
82
+ 'fantasy',
83
+ 'system-ui',
84
+ 'ui-serif',
85
+ 'ui-sans-serif',
86
+ 'ui-monospace',
87
+ 'ui-rounded',
88
+ 'math',
89
+ 'emoji',
90
+ 'fangsong',
91
+ ]);
92
+ return uniqBy(fontFamily.split(','), name => name.trim())
93
+ .map(name => {
94
+ const trimmed = name.trim();
95
+ // Preserve already quoted names
96
+ const isQuoted = (trimmed.startsWith('"') && trimmed.endsWith('"')) ||
97
+ (trimmed.startsWith("'") && trimmed.endsWith("'"));
98
+ if (isQuoted)
99
+ return trimmed;
100
+ // Do not quote generic family names
101
+ if (genericFamilies.has(trimmed))
102
+ return trimmed;
103
+ // Quote if contains whitespace or special characters
104
+ const needsQuotes = /[^\w-]/.test(trimmed);
105
+ return needsQuotes ? `"${trimmed}"` : trimmed;
106
+ })
107
+ .join(', ');
108
+ }
109
+ /**
110
+ * Creates font-family string with fallback
111
+ * @param fontFamily Primary font family
112
+ * @param defaultFont Default fallback font
113
+ * @returns Normalized font-family string with fallback
114
+ */
115
+ export const fontWithFallback = (fontFamily, defaultFont = DEFAULT_TEXT_STYLE.fontFamily) => normalizeFontFamily(fontFamily ? `${fontFamily}, ${defaultFont}` : defaultFont);
116
+ /**
117
+ * Checks if a color matches the link color
118
+ * @param color Color to check
119
+ * @returns true if color matches link color
120
+ */
121
+ export const isLinkColor = (color) => tinycolor.equals(color, LINK_TEXT_COLOR);
122
+ /**
123
+ * Extracts CSS variables from a style object
124
+ * @param styleObj Style object that may contain CSS variables
125
+ * @returns Object with CSS variables and regular styles separated
126
+ */
127
+ export function extractCSSVariables(styleObj) {
128
+ const cssVariables = {};
129
+ const regularStyles = {};
130
+ Object.entries(styleObj).forEach(([key, value]) => {
131
+ if (key.startsWith('--')) {
132
+ cssVariables[key] = value;
133
+ }
134
+ else {
135
+ regularStyles[key] = value;
136
+ }
137
+ });
138
+ return { cssVariables, regularStyles };
139
+ }
140
+ /**
141
+ * Merges multiple text styles with priority
142
+ * @param styles Array of text styles to merge
143
+ * @returns Merged text style
144
+ */
145
+ export function mergeTextStyles(...styles) {
146
+ return styles.reduce((merged, style) => ({
147
+ ...merged,
148
+ ...Object.fromEntries(Object.entries(style).filter(([_, value]) => value !== undefined && value !== null)),
149
+ }), {});
150
+ }
151
+ /**
152
+ * Validates if a text style is complete
153
+ * @param style Text style to validate
154
+ * @returns true if all required properties are present
155
+ */
156
+ export function isCompleteTextStyle(style) {
157
+ const requiredProps = [
158
+ 'fontFamily',
159
+ 'fontSize',
160
+ 'color',
161
+ 'backgroundColor',
162
+ 'lineHeight',
163
+ 'fontWeight',
164
+ ];
165
+ return requiredProps.every(prop => style[prop] !== undefined);
166
+ }
167
+ /**
168
+ * Converts text style to CSS style object
169
+ * @param textStyle Text style object
170
+ * @returns CSS style object
171
+ */
172
+ export function textStyleToCSSStyle(textStyle) {
173
+ const cssStyle = {};
174
+ if (textStyle.fontFamily) {
175
+ cssStyle.fontFamily = textStyle.fontFamily;
176
+ }
177
+ if (textStyle.fontSize) {
178
+ cssStyle.fontSize = textStyle.fontSize;
179
+ }
180
+ if (textStyle.color) {
181
+ cssStyle.color = textStyle.color;
182
+ }
183
+ if (textStyle.backgroundColor) {
184
+ cssStyle.backgroundColor = textStyle.backgroundColor;
185
+ }
186
+ if (textStyle.lineHeight) {
187
+ cssStyle.lineHeight = textStyle.lineHeight;
188
+ }
189
+ if (textStyle.fontWeight) {
190
+ cssStyle.fontWeight = textStyle.fontWeight;
191
+ }
192
+ return cssStyle;
193
+ }
@@ -16,5 +16,6 @@ export * from './Login';
16
16
  export * from './BasicLogin';
17
17
  export * from './Filter';
18
18
  export { ActivityTimeline, type ActivityTimeLineProps } from './ActivityTimeline';
19
+ export { TextEditor, TextEditorProvider, type TextEditorWithProviderRef, type TextEditorAllProps, type TextEditorProps, type TextEditorRef, type TextEditorJSONContent, type TextEditorProviderProps, type TextEditorProviderRefHandler, type TextEditorComponentsRender, type FontConfig, CUSTOM_LINK_EXTENSION_NAME, } from './TextEditor';
19
20
  export { SQLGeneration, SQLGenerationIntegrations, SQLGenerationProvider, useSQLGenerationStore, type SQLGenerationProps, type SQLGenerationProviderProps, } from './SQLGeneration';
20
21
  export { WhatsappMobile, SAMPLE_PREVIEW } from './PreviewCollections';
@@ -16,5 +16,6 @@ export * from './Login';
16
16
  export * from './BasicLogin';
17
17
  export * from './Filter';
18
18
  export { ActivityTimeline } from './ActivityTimeline';
19
+ export { TextEditor, TextEditorProvider, CUSTOM_LINK_EXTENSION_NAME, } from './TextEditor';
19
20
  export { SQLGeneration, SQLGenerationIntegrations, SQLGenerationProvider, useSQLGenerationStore, } from './SQLGeneration';
20
21
  export { WhatsappMobile, SAMPLE_PREVIEW } from './PreviewCollections';
@@ -1 +1,2 @@
1
+ @use './TextEditor';
1
2
  @use './SQLGeneration';
@@ -12,4 +12,5 @@ export * from './theme';
12
12
  export * from './postMessage';
13
13
  export * from './condition';
14
14
  export * from './portal';
15
+ export * from './web';
15
16
  export * from './unsubscribe';
@@ -12,4 +12,5 @@ export * from './theme';
12
12
  export * from './postMessage';
13
13
  export * from './condition';
14
14
  export * from './portal';
15
+ export * from './web';
15
16
  export * from './unsubscribe';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generic font families that are CSS keywords, not specific fonts
3
+ */
4
+ export declare const GENERIC_FONT_FAMILIES: readonly ["serif", "sans-serif", "monospace", "cursive", "fantasy", "system-ui", "ui-serif", "ui-sans-serif", "ui-monospace", "ui-rounded"];
5
+ /**
6
+ * List of web safe fonts that are commonly available across different operating systems
7
+ */
8
+ export declare const WEB_SAFE_FONTS: readonly ["times new roman", "times", "georgia", "garamond", "book antiqua", "palatino linotype", "palatino", "arial", "helvetica", "arial black", "impact", "lucida sans unicode", "tahoma", "verdana", "ms sans serif", "geneva", "lucida console", "lucida sans", "trebuchet ms", "courier new", "courier", "monaco", "menlo", "consolas", "lucida console", "comic sans ms", "brush script mt", "papyrus", "copperplate", "fantasy", "system ui"];
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Generic font families that are CSS keywords, not specific fonts
3
+ */
4
+ export const GENERIC_FONT_FAMILIES = [
5
+ 'serif',
6
+ 'sans-serif',
7
+ 'monospace',
8
+ 'cursive',
9
+ 'fantasy',
10
+ 'system-ui',
11
+ 'ui-serif',
12
+ 'ui-sans-serif',
13
+ 'ui-monospace',
14
+ 'ui-rounded',
15
+ ];
16
+ /**
17
+ * List of web safe fonts that are commonly available across different operating systems
18
+ */
19
+ export const WEB_SAFE_FONTS = [
20
+ // Serif fonts
21
+ 'times new roman',
22
+ 'times',
23
+ 'georgia',
24
+ 'garamond',
25
+ 'book antiqua',
26
+ 'palatino linotype',
27
+ 'palatino',
28
+ // Sans-serif fonts
29
+ 'arial',
30
+ 'helvetica',
31
+ 'arial black',
32
+ 'impact',
33
+ 'lucida sans unicode',
34
+ 'tahoma',
35
+ 'verdana',
36
+ 'ms sans serif',
37
+ 'geneva',
38
+ 'lucida console',
39
+ 'lucida sans',
40
+ 'trebuchet ms', // Added: Microsoft font since Windows 2000, but use carefully
41
+ // Monospace fonts
42
+ 'courier new',
43
+ 'courier',
44
+ 'monaco',
45
+ 'menlo',
46
+ 'consolas',
47
+ 'lucida console',
48
+ // Cursive fonts
49
+ 'comic sans ms',
50
+ 'brush script mt',
51
+ // Fantasy fonts
52
+ 'papyrus',
53
+ 'copperplate',
54
+ 'fantasy',
55
+ // Unknown
56
+ 'system ui',
57
+ ];
@@ -26,5 +26,9 @@ export * from './useCustomRouter';
26
26
  export * from './useUpdateEffect';
27
27
  export * from './useOutsideClick';
28
28
  export * from './useDebouncedCallbackV2';
29
+ export * from './useElementSize';
30
+ export * from './useIsMounted';
31
+ export * from './useBroadcastedLocalStorage';
32
+ export * from './useEyedropper';
29
33
  export * from './useFocusManagement';
30
34
  export * from './useCountdown';
package/es/hooks/index.js CHANGED
@@ -45,5 +45,9 @@ export * from './useCustomRouter';
45
45
  export * from './useUpdateEffect';
46
46
  export * from './useOutsideClick';
47
47
  export * from './useDebouncedCallbackV2';
48
+ export * from './useElementSize';
49
+ export * from './useIsMounted';
50
+ export * from './useBroadcastedLocalStorage';
51
+ export * from './useEyedropper';
48
52
  export * from './useFocusManagement';
49
53
  export * from './useCountdown';
@@ -0,0 +1,5 @@
1
+ export declare function useBroadcastedLocalStorage<T>(key: string, initialValue: T): {
2
+ readonly value: T;
3
+ readonly setValue: (next: T | ((prev: T) => T)) => void;
4
+ readonly remove: () => void;
5
+ };
@@ -0,0 +1,71 @@
1
+ /* eslint-disable no-console */
2
+ import { useEffect, useState, useRef } from 'react';
3
+ import { useDeepCompareEffect } from './useDeepCompareEffect';
4
+ export function useBroadcastedLocalStorage(key, initialValue) {
5
+ const [value, setValue] = useState(() => {
6
+ if (typeof window === 'undefined')
7
+ return initialValue;
8
+ try {
9
+ const saved = window.localStorage.getItem(key);
10
+ return saved != null ? JSON.parse(saved) : initialValue;
11
+ }
12
+ catch {
13
+ return initialValue;
14
+ }
15
+ });
16
+ // We keep a ref to avoid re-creating the channel on every render
17
+ const channelRef = useRef(null);
18
+ // Initialize BroadcastChannel once
19
+ useEffect(() => {
20
+ if (typeof window === 'undefined' || !('BroadcastChannel' in window)) {
21
+ console.warn('BroadcastChannel not supported in this environment');
22
+ return;
23
+ }
24
+ const channel = new BroadcastChannel(`localstorage_${key}`);
25
+ channelRef.current = channel;
26
+ // Listen for incoming messages
27
+ const onMessage = (event) => {
28
+ setValue(event.data.value);
29
+ };
30
+ channel.addEventListener('message', onMessage);
31
+ return () => {
32
+ channel.removeEventListener('message', onMessage);
33
+ channel.close();
34
+ };
35
+ }, [key]);
36
+ // Whenever `value` changes, persist and broadcast
37
+ useDeepCompareEffect(() => {
38
+ if (typeof window === 'undefined')
39
+ return;
40
+ try {
41
+ window.localStorage.setItem(key, JSON.stringify(value));
42
+ }
43
+ catch (err) {
44
+ console.error('Failed to write to localStorage:', err);
45
+ }
46
+ if (channelRef.current) {
47
+ channelRef.current.postMessage({ value });
48
+ }
49
+ }, [key, value]);
50
+ // Expose setter that mirrors functional API of useState
51
+ const setValueAndBroadcast = (next) => {
52
+ setValue(prev => {
53
+ const computed = next instanceof Function ? next(prev) : next;
54
+ return computed;
55
+ });
56
+ };
57
+ // Optional: a remove function
58
+ const remove = () => {
59
+ try {
60
+ window.localStorage.removeItem(key);
61
+ setValue(initialValue);
62
+ if (channelRef.current) {
63
+ channelRef.current.postMessage({ value: initialValue });
64
+ }
65
+ }
66
+ catch (err) {
67
+ console.error('Failed to remove localStorage item:', err);
68
+ }
69
+ };
70
+ return { value, setValue: setValueAndBroadcast, remove };
71
+ }
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const useElementSize: <T extends HTMLElement>(options?: {
3
+ type: string;
4
+ }) => readonly [import("react").RefObject<T>, {
5
+ width: number;
6
+ height: number;
7
+ }];
@@ -0,0 +1,56 @@
1
+ import { useState, useEffect, useRef, useCallback } from 'react';
2
+ export const useElementSize = (options = { type: 'offset' }) => {
3
+ const { type = 'offset' } = options;
4
+ const [size, setSize] = useState({
5
+ width: 0,
6
+ height: 0,
7
+ });
8
+ const ref = useRef(null);
9
+ const updateSize = useCallback(() => {
10
+ if (ref.current) {
11
+ let width;
12
+ let height;
13
+ switch (type) {
14
+ case 'client':
15
+ width = ref.current.clientWidth; // excludes padding, border, scrollbar
16
+ height = ref.current.clientHeight;
17
+ break;
18
+ case 'scroll':
19
+ width = ref.current.scrollWidth; // includes all scrollable content
20
+ height = ref.current.scrollHeight;
21
+ break;
22
+ case 'offset':
23
+ default:
24
+ width = ref.current.offsetWidth; // includes padding and border
25
+ height = ref.current.offsetHeight;
26
+ break;
27
+ }
28
+ setSize({ width, height });
29
+ }
30
+ }, [type]);
31
+ useEffect(() => {
32
+ const element = ref.current;
33
+ if (!element)
34
+ return;
35
+ // Set initial size
36
+ updateSize();
37
+ // Use ResizeObserver if available
38
+ if (typeof ResizeObserver !== 'undefined') {
39
+ const resizeObserver = new ResizeObserver(() => {
40
+ // Always use the same measurement method as updateSize
41
+ updateSize();
42
+ });
43
+ resizeObserver.observe(element);
44
+ return () => {
45
+ resizeObserver.unobserve(element);
46
+ };
47
+ }
48
+ // Fallback to window resize event
49
+ const handleResize = () => updateSize();
50
+ window.addEventListener('resize', handleResize);
51
+ return () => {
52
+ window.removeEventListener('resize', handleResize);
53
+ };
54
+ }, [updateSize]);
55
+ return [ref, size];
56
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Attaches polyfill to the current window
3
+ */
4
+ export declare function attachPolyfill(): void;
@@ -0,0 +1,9 @@
1
+ import { EyeDropperPolyfill } from './eyedropper';
2
+ /**
3
+ * Attaches polyfill to the current window
4
+ */
5
+ export function attachPolyfill() {
6
+ if (!Reflect.defineProperty(window, 'EyeDropper', { value: EyeDropperPolyfill })) {
7
+ throw Error("Error attaching `EyeDropper` polyfill: couldn't attach `EyeDropper` to `window`");
8
+ }
9
+ }
@@ -0,0 +1,69 @@
1
+ import type { EyeDropper, ColorSelectionOptions, ColorSelectionResult } from './types';
2
+ /**
3
+ * EyeDropper API polyfill
4
+ * https://wicg.github.io/eyedropper-api/#dom-colorselectionoptions
5
+ */
6
+ export declare class EyeDropperPolyfill implements EyeDropper {
7
+ private colorSelectionResult?;
8
+ private previousDocumentCursor?;
9
+ private canvas?;
10
+ private canvasCtx?;
11
+ private resolve?;
12
+ private lastPoint?;
13
+ private magnification;
14
+ constructor();
15
+ /**
16
+ * Opens the polyfilled eyedropper
17
+ *
18
+ * §3.3 EyeDropper interface ► `open()`
19
+ */
20
+ open(options?: ColorSelectionOptions): Promise<ColorSelectionResult>;
21
+ /**
22
+ * Starting eyedropper mode
23
+ */
24
+ private start;
25
+ /**
26
+ * Stopping eyedropper mode
27
+ */
28
+ private stop;
29
+ /**
30
+ * Creates fake screenshot of page and assign it to the body
31
+ */
32
+ private createScreenshot;
33
+ /**
34
+ * Removes screenshot from page
35
+ */
36
+ private removeScreenshot;
37
+ /**
38
+ * Sets waiting cursor
39
+ */
40
+ private setWaitingCursor;
41
+ /**
42
+ * Removes waiting cursor
43
+ */
44
+ private revertWaitingCursor;
45
+ /**
46
+ * Binds events
47
+ */
48
+ private bindEvents;
49
+ /**
50
+ * Unbinds `mousemove` events
51
+ */
52
+ private unbindEvents;
53
+ /**
54
+ * `click` handler
55
+ */
56
+ private onClick;
57
+ /**
58
+ * `mousemove` handler
59
+ */
60
+ private onMouseMove;
61
+ /**
62
+ * Detects color from canvas data
63
+ */
64
+ private detectColor;
65
+ /**
66
+ * Canvas styles creator
67
+ */
68
+ private addCanvasStyle;
69
+ }