@nectary/components 4.12.1 → 5.0.0

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 (585) hide show
  1. package/accordion/global/index.d.ts +1 -0
  2. package/accordion/global/index.js +2 -0
  3. package/accordion/index.d.ts +1 -22
  4. package/accordion/index.js +41 -39
  5. package/accordion/types.d.ts +21 -1
  6. package/accordion/types.js +1 -1
  7. package/accordion-item/global/index.d.ts +1 -0
  8. package/accordion-item/global/index.js +2 -0
  9. package/accordion-item/index.d.ts +2 -22
  10. package/accordion-item/index.js +53 -49
  11. package/accordion-item/types.d.ts +21 -1
  12. package/accordion-item/types.js +1 -1
  13. package/accordion-item/utils.js +4 -1
  14. package/action-menu/global/index.d.ts +1 -0
  15. package/action-menu/global/index.js +2 -0
  16. package/action-menu/index.d.ts +1 -22
  17. package/action-menu/index.js +62 -77
  18. package/action-menu/types.d.ts +21 -1
  19. package/action-menu/types.js +1 -1
  20. package/action-menu-option/global/index.d.ts +1 -0
  21. package/action-menu-option/global/index.js +2 -0
  22. package/action-menu-option/index.d.ts +1 -22
  23. package/action-menu-option/index.js +39 -41
  24. package/action-menu-option/types.d.ts +21 -1
  25. package/action-menu-option/types.js +1 -1
  26. package/action-menu-option/utils.js +6 -3
  27. package/alert/global/index.d.ts +1 -0
  28. package/alert/global/index.js +2 -0
  29. package/alert/index.d.ts +2 -22
  30. package/alert/index.js +24 -21
  31. package/alert/types.d.ts +21 -1
  32. package/alert/types.js +1 -1
  33. package/alert/utils.js +4 -1
  34. package/avatar/colors.js +1 -1
  35. package/avatar/global/index.d.ts +1 -0
  36. package/avatar/global/index.js +2 -0
  37. package/avatar/index.d.ts +2 -22
  38. package/avatar/index.js +42 -41
  39. package/avatar/types.d.ts +21 -1
  40. package/avatar/types.js +1 -1
  41. package/avatar/utils.js +9 -4
  42. package/badge/global/index.d.ts +1 -0
  43. package/badge/global/index.js +2 -0
  44. package/badge/index.d.ts +3 -22
  45. package/badge/index.js +52 -51
  46. package/badge/types.d.ts +21 -1
  47. package/badge/types.js +1 -1
  48. package/badge/utils.js +4 -1
  49. package/bundle.d.ts +78 -0
  50. package/bundle.js +13033 -0
  51. package/bundle.ts +80 -0
  52. package/button/global/index.d.ts +1 -0
  53. package/button/global/index.js +2 -0
  54. package/button/index.d.ts +2 -22
  55. package/button/index.js +101 -111
  56. package/button/types.d.ts +21 -1
  57. package/button/types.js +1 -1
  58. package/button/utils.js +18 -2
  59. package/button-group/global/index.d.ts +1 -0
  60. package/button-group/global/index.js +2 -0
  61. package/button-group/index.d.ts +1 -22
  62. package/button-group/index.js +20 -18
  63. package/button-group/types.d.ts +22 -3
  64. package/button-group/types.js +1 -1
  65. package/button-group-item/global/index.d.ts +1 -0
  66. package/button-group-item/global/index.js +2 -0
  67. package/button-group-item/index.d.ts +2 -22
  68. package/button-group-item/index.js +31 -42
  69. package/button-group-item/types.d.ts +22 -3
  70. package/button-group-item/types.js +1 -1
  71. package/card-container/global/index.d.ts +1 -0
  72. package/card-container/global/index.js +2 -0
  73. package/card-container/index.d.ts +1 -21
  74. package/card-container/index.js +8 -5
  75. package/card-container/types.d.ts +21 -1
  76. package/card-container/types.js +1 -1
  77. package/card-v2/global/index.d.ts +1 -0
  78. package/card-v2/global/index.js +2 -0
  79. package/card-v2/index.d.ts +1 -22
  80. package/card-v2/index.js +59 -57
  81. package/card-v2/types.d.ts +21 -1
  82. package/card-v2/types.js +1 -1
  83. package/card-v2-title/global/index.d.ts +1 -0
  84. package/card-v2-title/global/index.js +2 -0
  85. package/card-v2-title/index.d.ts +2 -22
  86. package/card-v2-title/index.js +28 -26
  87. package/card-v2-title/types.d.ts +21 -1
  88. package/card-v2-title/types.js +1 -1
  89. package/checkbox/global/index.d.ts +1 -0
  90. package/checkbox/global/index.js +2 -0
  91. package/checkbox/index.d.ts +1 -22
  92. package/checkbox/index.js +88 -81
  93. package/checkbox/types.d.ts +21 -1
  94. package/checkbox/types.js +1 -1
  95. package/chip/colors.js +1 -1
  96. package/chip/global/index.d.ts +1 -0
  97. package/chip/global/index.js +2 -0
  98. package/chip/index.d.ts +1 -22
  99. package/chip/index.js +62 -75
  100. package/chip/types.d.ts +21 -1
  101. package/chip/types.js +1 -1
  102. package/chip/utils.js +7 -3
  103. package/code-tag/global/index.d.ts +1 -0
  104. package/code-tag/global/index.js +2 -0
  105. package/code-tag/index.d.ts +1 -22
  106. package/code-tag/index.js +17 -14
  107. package/code-tag/types.d.ts +21 -1
  108. package/code-tag/types.js +1 -1
  109. package/color-menu/global/index.d.ts +1 -0
  110. package/color-menu/global/index.js +2 -0
  111. package/color-menu/index.d.ts +2 -22
  112. package/color-menu/index.js +115 -115
  113. package/color-menu/types.d.ts +21 -1
  114. package/color-menu/types.js +1 -1
  115. package/color-menu/utils.js +6 -3
  116. package/color-menu-option/global/index.d.ts +1 -0
  117. package/color-menu-option/global/index.js +2 -0
  118. package/color-menu-option/index.d.ts +1 -22
  119. package/color-menu-option/index.js +30 -26
  120. package/color-menu-option/types.d.ts +21 -1
  121. package/color-menu-option/types.js +1 -1
  122. package/color-menu-option/utils.js +6 -3
  123. package/color-swatch/global/index.d.ts +1 -0
  124. package/color-swatch/global/index.js +2 -0
  125. package/color-swatch/index.d.ts +1 -22
  126. package/color-swatch/index.js +23 -20
  127. package/color-swatch/types.d.ts +21 -1
  128. package/color-swatch/types.js +1 -1
  129. package/color-swatch/utils.js +7 -3
  130. package/date-picker/global/index.d.ts +1 -0
  131. package/date-picker/global/index.js +2 -0
  132. package/date-picker/index.d.ts +2 -22
  133. package/date-picker/index.js +157 -150
  134. package/date-picker/types.d.ts +21 -1
  135. package/date-picker/types.js +1 -1
  136. package/date-picker/utils.js +59 -42
  137. package/dialog/global/index.d.ts +1 -0
  138. package/dialog/global/index.js +2 -0
  139. package/dialog/index.d.ts +1 -22
  140. package/dialog/index.js +71 -58
  141. package/dialog/types.d.ts +21 -1
  142. package/dialog/types.js +1 -1
  143. package/dialog/utils.js +11 -7
  144. package/emoji/global/index.d.ts +1 -0
  145. package/emoji/global/index.js +2 -0
  146. package/emoji/index.d.ts +1 -22
  147. package/emoji/index.js +19 -16
  148. package/emoji/types.d.ts +21 -1
  149. package/emoji/types.js +1 -1
  150. package/emoji/utils.js +22 -17
  151. package/emoji-picker/global/index.d.ts +1 -0
  152. package/emoji-picker/global/index.js +2 -0
  153. package/emoji-picker/index.d.ts +2 -22
  154. package/emoji-picker/index.js +138 -118
  155. package/emoji-picker/types.d.ts +21 -1
  156. package/emoji-picker/types.js +1 -1
  157. package/field/global/index.d.ts +1 -0
  158. package/field/global/index.js +2 -0
  159. package/field/index.d.ts +1 -22
  160. package/field/index.js +63 -60
  161. package/field/types.d.ts +21 -1
  162. package/field/types.js +1 -1
  163. package/file-drop/global/index.d.ts +1 -0
  164. package/file-drop/global/index.js +2 -0
  165. package/file-drop/index.d.ts +1 -22
  166. package/file-drop/index.js +103 -98
  167. package/file-drop/types.d.ts +21 -1
  168. package/file-drop/types.js +1 -1
  169. package/file-drop/utils.js +27 -22
  170. package/file-picker/global/index.d.ts +1 -0
  171. package/file-picker/global/index.js +2 -0
  172. package/file-picker/index.d.ts +1 -22
  173. package/file-picker/index.js +53 -48
  174. package/file-picker/types.d.ts +21 -1
  175. package/file-picker/types.js +1 -1
  176. package/file-picker/utils.js +6 -3
  177. package/file-status/global/index.d.ts +1 -0
  178. package/file-status/global/index.js +2 -0
  179. package/file-status/index.d.ts +2 -22
  180. package/file-status/index.js +33 -22
  181. package/file-status/types.d.ts +21 -1
  182. package/file-status/types.js +1 -1
  183. package/file-status/utils.js +4 -1
  184. package/flag/global/index.d.ts +1 -0
  185. package/flag/global/index.js +2 -0
  186. package/flag/index.d.ts +1 -22
  187. package/flag/index.js +19 -16
  188. package/flag/types.d.ts +21 -1
  189. package/flag/types.js +1 -1
  190. package/flag/utils.js +11 -8
  191. package/grid/global/index.d.ts +1 -0
  192. package/grid/global/index.js +2 -0
  193. package/grid/index.d.ts +1 -22
  194. package/grid/index.js +8 -5
  195. package/grid/types.d.ts +21 -1
  196. package/grid/types.js +1 -1
  197. package/grid-item/global/index.d.ts +1 -0
  198. package/grid-item/global/index.js +2 -0
  199. package/grid-item/index.d.ts +1 -22
  200. package/grid-item/index.js +17 -13
  201. package/grid-item/types.d.ts +21 -1
  202. package/grid-item/types.js +1 -1
  203. package/help-tooltip/global/index.d.ts +1 -0
  204. package/help-tooltip/global/index.js +2 -0
  205. package/help-tooltip/index.d.ts +1 -22
  206. package/help-tooltip/index.js +29 -26
  207. package/help-tooltip/types.d.ts +21 -1
  208. package/help-tooltip/types.js +1 -1
  209. package/icon/generated-icon-type.js +1 -1
  210. package/icon/global/index.d.ts +1 -0
  211. package/icon/global/index.js +2 -0
  212. package/icon/index.d.ts +1 -22
  213. package/icon/index.js +30 -28
  214. package/icon/types.d.ts +21 -1
  215. package/icon/types.js +1 -1
  216. package/inline-alert/global/index.d.ts +1 -0
  217. package/inline-alert/global/index.js +2 -0
  218. package/inline-alert/index.d.ts +2 -22
  219. package/inline-alert/index.js +58 -39
  220. package/inline-alert/types.d.ts +21 -1
  221. package/inline-alert/types.js +1 -1
  222. package/inline-alert/utils.js +4 -1
  223. package/input/global/index.d.ts +1 -0
  224. package/input/global/index.js +2 -0
  225. package/input/index.d.ts +2 -22
  226. package/input/index.js +295 -317
  227. package/input/types.d.ts +21 -1
  228. package/input/types.js +1 -1
  229. package/input/utils.js +56 -46
  230. package/link/global/index.d.ts +1 -0
  231. package/link/global/index.js +2 -0
  232. package/link/index.d.ts +1 -22
  233. package/link/index.js +88 -79
  234. package/link/types.d.ts +21 -1
  235. package/link/types.js +1 -1
  236. package/list/global/index.d.ts +1 -0
  237. package/list/global/index.js +2 -0
  238. package/list/index.d.ts +1 -21
  239. package/list/index.js +9 -6
  240. package/list/types.d.ts +21 -1
  241. package/list/types.js +1 -1
  242. package/list-item/global/index.d.ts +1 -0
  243. package/list-item/global/index.js +2 -0
  244. package/list-item/index.d.ts +1 -22
  245. package/list-item/index.js +9 -6
  246. package/list-item/types.d.ts +21 -1
  247. package/list-item/types.js +1 -1
  248. package/package.json +12 -6
  249. package/pagination/global/index.d.ts +1 -0
  250. package/pagination/global/index.js +2 -0
  251. package/pagination/index.d.ts +2 -22
  252. package/pagination/index.js +64 -46
  253. package/pagination/types.d.ts +21 -1
  254. package/pagination/types.js +1 -1
  255. package/persistent-overlay/global/index.d.ts +1 -0
  256. package/persistent-overlay/global/index.js +2 -0
  257. package/persistent-overlay/index.d.ts +1 -22
  258. package/persistent-overlay/index.js +42 -44
  259. package/persistent-overlay/types.d.ts +21 -1
  260. package/persistent-overlay/types.js +1 -1
  261. package/pop/global/index.d.ts +1 -0
  262. package/pop/global/index.js +2 -0
  263. package/pop/index.d.ts +3 -22
  264. package/pop/index.js +149 -150
  265. package/pop/types.d.ts +21 -1
  266. package/pop/types.js +1 -1
  267. package/pop/utils.js +24 -8
  268. package/popover/global/index.d.ts +1 -0
  269. package/popover/global/index.js +2 -0
  270. package/popover/index.d.ts +2 -22
  271. package/popover/index.js +75 -68
  272. package/popover/types.d.ts +21 -1
  273. package/popover/types.js +1 -1
  274. package/popover/utils.js +18 -7
  275. package/progress/global/index.d.ts +1 -0
  276. package/progress/global/index.js +2 -0
  277. package/progress/index.d.ts +1 -22
  278. package/progress/index.js +30 -33
  279. package/progress/types.d.ts +21 -1
  280. package/progress/types.js +1 -1
  281. package/progress-stepper/global/index.d.ts +1 -0
  282. package/progress-stepper/global/index.js +2 -0
  283. package/progress-stepper/index.d.ts +2 -22
  284. package/progress-stepper/index.js +64 -66
  285. package/progress-stepper/types.d.ts +21 -1
  286. package/progress-stepper/types.js +1 -1
  287. package/progress-stepper-item/global/index.d.ts +1 -0
  288. package/progress-stepper-item/global/index.js +2 -0
  289. package/progress-stepper-item/index.d.ts +1 -22
  290. package/progress-stepper-item/index.js +58 -50
  291. package/progress-stepper-item/types.d.ts +21 -1
  292. package/progress-stepper-item/types.js +1 -1
  293. package/progress-stepper-item/utils.js +22 -11
  294. package/radio/global/index.d.ts +1 -0
  295. package/radio/global/index.js +2 -0
  296. package/radio/index.d.ts +1 -22
  297. package/radio/index.js +79 -83
  298. package/radio/types.d.ts +21 -1
  299. package/radio/types.js +1 -1
  300. package/radio-option/global/index.d.ts +1 -0
  301. package/radio-option/global/index.js +2 -0
  302. package/radio-option/index.d.ts +1 -22
  303. package/radio-option/index.js +47 -41
  304. package/radio-option/types.d.ts +21 -1
  305. package/radio-option/types.js +1 -1
  306. package/rich-text/global/index.d.ts +1 -0
  307. package/rich-text/global/index.js +2 -0
  308. package/rich-text/index.d.ts +1 -22
  309. package/rich-text/index.js +45 -46
  310. package/rich-text/types.d.ts +21 -1
  311. package/rich-text/types.js +1 -1
  312. package/rich-text/utils.js +31 -33
  313. package/rich-textarea/global/index.d.ts +1 -0
  314. package/rich-textarea/global/index.js +2 -0
  315. package/rich-textarea/index.d.ts +1 -22
  316. package/rich-textarea/index.js +201 -194
  317. package/rich-textarea/types.d.ts +21 -1
  318. package/rich-textarea/types.js +1 -1
  319. package/rich-textarea/utils.js +313 -340
  320. package/segment-collapse/global/index.d.ts +1 -0
  321. package/segment-collapse/global/index.js +2 -0
  322. package/segment-collapse/index.d.ts +1 -22
  323. package/segment-collapse/index.js +31 -25
  324. package/segment-collapse/types.d.ts +21 -1
  325. package/segment-collapse/types.js +1 -1
  326. package/segmented-control/global/index.d.ts +1 -0
  327. package/segmented-control/global/index.js +2 -0
  328. package/segmented-control/index.d.ts +1 -22
  329. package/segmented-control/index.js +45 -45
  330. package/segmented-control/types.d.ts +21 -1
  331. package/segmented-control/types.js +1 -1
  332. package/segmented-control-option/global/index.d.ts +1 -0
  333. package/segmented-control-option/global/index.js +2 -0
  334. package/segmented-control-option/index.d.ts +1 -22
  335. package/segmented-control-option/index.js +44 -46
  336. package/segmented-control-option/types.d.ts +21 -1
  337. package/segmented-control-option/types.js +1 -1
  338. package/segmented-icon-control/global/index.d.ts +1 -0
  339. package/segmented-icon-control/global/index.js +2 -0
  340. package/segmented-icon-control/index.d.ts +1 -22
  341. package/segmented-icon-control/index.js +51 -50
  342. package/segmented-icon-control/types.d.ts +21 -1
  343. package/segmented-icon-control/types.js +1 -1
  344. package/segmented-icon-control-option/global/index.d.ts +1 -0
  345. package/segmented-icon-control-option/global/index.js +2 -0
  346. package/segmented-icon-control-option/index.d.ts +1 -22
  347. package/segmented-icon-control-option/index.js +36 -37
  348. package/segmented-icon-control-option/types.d.ts +21 -1
  349. package/segmented-icon-control-option/types.js +1 -1
  350. package/select-button/global/index.d.ts +1 -0
  351. package/select-button/global/index.js +2 -0
  352. package/select-button/index.d.ts +1 -26
  353. package/select-button/index.js +104 -112
  354. package/select-button/types.d.ts +25 -1
  355. package/select-button/types.js +1 -1
  356. package/select-menu/global/index.d.ts +1 -0
  357. package/select-menu/global/index.js +2 -0
  358. package/select-menu/index.d.ts +1 -22
  359. package/select-menu/index.js +201 -164
  360. package/select-menu/types.d.ts +21 -1
  361. package/select-menu/types.js +1 -1
  362. package/select-menu-option/global/index.d.ts +1 -0
  363. package/select-menu-option/global/index.js +2 -0
  364. package/select-menu-option/index.d.ts +1 -22
  365. package/select-menu-option/index.js +41 -33
  366. package/select-menu-option/types.d.ts +21 -1
  367. package/select-menu-option/types.js +1 -1
  368. package/select-menu-option/utils.js +4 -1
  369. package/skeleton/global/index.d.ts +1 -0
  370. package/skeleton/global/index.js +2 -0
  371. package/skeleton/index.d.ts +1 -22
  372. package/skeleton/index.js +35 -38
  373. package/skeleton/types.d.ts +21 -1
  374. package/skeleton/types.js +1 -1
  375. package/skeleton-item/global/index.d.ts +1 -0
  376. package/skeleton-item/global/index.js +2 -0
  377. package/skeleton-item/index.d.ts +1 -22
  378. package/skeleton-item/index.js +8 -5
  379. package/skeleton-item/types.d.ts +21 -1
  380. package/skeleton-item/types.js +1 -1
  381. package/spinner/global/index.d.ts +1 -0
  382. package/spinner/global/index.js +2 -0
  383. package/spinner/index.d.ts +1 -22
  384. package/spinner/index.js +31 -29
  385. package/spinner/types.d.ts +21 -1
  386. package/spinner/types.js +1 -1
  387. package/standalone.d.ts +0 -8
  388. package/standalone.js +79 -87
  389. package/standalone.ts +0 -8
  390. package/stop-events/index.js +12 -12
  391. package/table/global/index.d.ts +1 -0
  392. package/table/global/index.js +2 -0
  393. package/table/index.d.ts +1 -21
  394. package/table/index.js +9 -6
  395. package/table/types.d.ts +21 -1
  396. package/table/types.js +1 -1
  397. package/table-body/global/index.d.ts +1 -0
  398. package/table-body/global/index.js +2 -0
  399. package/table-body/index.d.ts +1 -21
  400. package/table-body/index.js +9 -6
  401. package/table-body/types.d.ts +21 -1
  402. package/table-body/types.js +1 -1
  403. package/table-cell/global/index.d.ts +1 -0
  404. package/table-cell/global/index.js +2 -0
  405. package/table-cell/index.d.ts +2 -22
  406. package/table-cell/index.js +13 -9
  407. package/table-cell/types.d.ts +21 -1
  408. package/table-cell/types.js +1 -1
  409. package/table-cell/utils.js +4 -1
  410. package/table-head/global/index.d.ts +1 -0
  411. package/table-head/global/index.js +2 -0
  412. package/table-head/index.d.ts +1 -21
  413. package/table-head/index.js +9 -6
  414. package/table-head/types.d.ts +21 -1
  415. package/table-head/types.js +1 -1
  416. package/table-head-cell/global/index.d.ts +1 -0
  417. package/table-head-cell/global/index.js +2 -0
  418. package/table-head-cell/index.d.ts +1 -22
  419. package/table-head-cell/index.js +29 -27
  420. package/table-head-cell/types.d.ts +21 -1
  421. package/table-head-cell/types.js +1 -1
  422. package/table-row/global/index.d.ts +1 -0
  423. package/table-row/global/index.js +2 -0
  424. package/table-row/index.d.ts +1 -22
  425. package/table-row/index.js +20 -17
  426. package/table-row/types.d.ts +21 -1
  427. package/table-row/types.js +1 -1
  428. package/tabs/global/index.d.ts +1 -0
  429. package/tabs/global/index.js +2 -0
  430. package/tabs/index.d.ts +2 -22
  431. package/tabs/index.js +32 -35
  432. package/tabs/types.d.ts +21 -1
  433. package/tabs/types.js +1 -1
  434. package/tabs-icon-option/global/index.d.ts +1 -0
  435. package/tabs-icon-option/global/index.js +2 -0
  436. package/tabs-icon-option/index.d.ts +1 -22
  437. package/tabs-icon-option/index.js +38 -40
  438. package/tabs-icon-option/types.d.ts +21 -1
  439. package/tabs-icon-option/types.js +1 -1
  440. package/tabs-option/global/index.d.ts +1 -0
  441. package/tabs-option/global/index.js +2 -0
  442. package/tabs-option/index.d.ts +1 -22
  443. package/tabs-option/index.js +41 -43
  444. package/tabs-option/types.d.ts +21 -1
  445. package/tabs-option/types.js +1 -1
  446. package/tag/colors.js +1 -1
  447. package/tag/global/index.d.ts +1 -0
  448. package/tag/global/index.js +2 -0
  449. package/tag/index.d.ts +1 -22
  450. package/tag/index.js +45 -44
  451. package/tag/types.d.ts +21 -1
  452. package/tag/types.js +1 -1
  453. package/tag/utils.js +7 -3
  454. package/text/global/index.d.ts +1 -0
  455. package/text/global/index.js +2 -0
  456. package/text/index.d.ts +2 -22
  457. package/text/index.js +33 -28
  458. package/text/types.d.ts +21 -1
  459. package/text/types.js +1 -1
  460. package/text/utils.js +4 -1
  461. package/textarea/global/index.d.ts +1 -0
  462. package/textarea/global/index.js +2 -0
  463. package/textarea/index.d.ts +1 -22
  464. package/textarea/index.js +147 -152
  465. package/textarea/types.d.ts +21 -1
  466. package/textarea/types.js +1 -1
  467. package/time-picker/global/index.d.ts +1 -0
  468. package/time-picker/global/index.js +2 -0
  469. package/time-picker/index.d.ts +2 -22
  470. package/time-picker/index.js +119 -123
  471. package/time-picker/types.d.ts +21 -1
  472. package/time-picker/types.js +1 -1
  473. package/time-picker/utils.js +31 -33
  474. package/title/global/index.d.ts +1 -0
  475. package/title/global/index.js +2 -0
  476. package/title/index.d.ts +2 -22
  477. package/title/index.js +32 -31
  478. package/title/types.d.ts +21 -1
  479. package/title/types.js +1 -1
  480. package/title/utils.js +18 -14
  481. package/toast/global/index.d.ts +1 -0
  482. package/toast/global/index.js +2 -0
  483. package/toast/index.d.ts +2 -22
  484. package/toast/index.js +37 -34
  485. package/toast/types.d.ts +21 -1
  486. package/toast/types.js +1 -1
  487. package/toast/utils.js +4 -1
  488. package/toast-manager/global/index.d.ts +1 -0
  489. package/toast-manager/global/index.js +2 -0
  490. package/toast-manager/index.d.ts +3 -22
  491. package/toast-manager/index.js +77 -63
  492. package/toast-manager/types.d.ts +21 -1
  493. package/toast-manager/types.js +1 -1
  494. package/toast-manager/utils.js +4 -1
  495. package/toggle/global/index.d.ts +1 -0
  496. package/toggle/global/index.js +2 -0
  497. package/toggle/index.d.ts +1 -22
  498. package/toggle/index.js +81 -75
  499. package/toggle/types.d.ts +21 -1
  500. package/toggle/types.js +1 -1
  501. package/tooltip/global/index.d.ts +1 -0
  502. package/tooltip/global/index.js +2 -0
  503. package/tooltip/index.d.ts +3 -22
  504. package/tooltip/index.js +105 -93
  505. package/tooltip/tooltip-state.js +56 -64
  506. package/tooltip/types.d.ts +21 -1
  507. package/tooltip/types.js +1 -1
  508. package/tooltip/utils.js +32 -13
  509. package/types.d.ts +12 -29
  510. package/utils/adapters.js +1 -1
  511. package/utils/component-names.d.ts +3 -0
  512. package/utils/component-names.js +85 -0
  513. package/utils/context.js +32 -42
  514. package/utils/countries.js +490 -2
  515. package/utils/csv.js +13 -6
  516. package/utils/debounce.js +10 -3
  517. package/utils/dom.js +60 -53
  518. package/utils/element.d.ts +107 -15
  519. package/utils/element.js +100 -19
  520. package/utils/event-target.js +11 -5
  521. package/utils/form.js +17 -12
  522. package/utils/get-react-event-handler.js +6 -3
  523. package/utils/global-components-constants.d.ts +3 -0
  524. package/utils/global-components-constants.js +8 -0
  525. package/utils/global-components-manager.d.ts +71 -0
  526. package/utils/global-components-manager.js +24 -0
  527. package/utils/index.js +65 -12
  528. package/utils/markdown.js +56 -43
  529. package/utils/rect.js +13 -18
  530. package/utils/shared/global-elements-manager.d.js +1 -0
  531. package/utils/shared/global-elements-manager.d.ts +62 -0
  532. package/utils/shared/global-elements-manager.js +163 -0
  533. package/utils/shared/global-elements-store.d.js +1 -0
  534. package/utils/shared/global-elements-store.d.ts +12 -0
  535. package/utils/shared/global-elements-store.js +31 -0
  536. package/utils/shared/index.d.js +11 -0
  537. package/utils/shared/index.d.ts +3 -0
  538. package/utils/shared/index.js +11 -0
  539. package/utils/shared/nectary-element-base.d.js +1 -0
  540. package/utils/shared/nectary-element-base.d.ts +9 -0
  541. package/utils/shared/nectary-element-base.js +25 -0
  542. package/utils/shared/package.json +9 -0
  543. package/utils/shared/tsconfig.json +20 -0
  544. package/utils/size.js +8 -3
  545. package/utils/slot.js +13 -9
  546. package/utils/throttle.js +5 -2
  547. package/utils/uid.js +5 -2
  548. package/card/index.d.ts +0 -40
  549. package/card/index.js +0 -134
  550. package/card/types.d.ts +0 -17
  551. package/card/types.js +0 -1
  552. package/horizontal-stepper/index.d.ts +0 -33
  553. package/horizontal-stepper/index.js +0 -62
  554. package/horizontal-stepper/types.d.ts +0 -42
  555. package/horizontal-stepper/types.js +0 -1
  556. package/horizontal-stepper-item/index.d.ts +0 -38
  557. package/horizontal-stepper-item/index.js +0 -62
  558. package/horizontal-stepper-item/types.d.ts +0 -38
  559. package/horizontal-stepper-item/types.js +0 -1
  560. package/horizontal-stepper-item/utils.d.ts +0 -2
  561. package/horizontal-stepper-item/utils.js +0 -1
  562. package/segment/index.d.ts +0 -40
  563. package/segment/index.js +0 -110
  564. package/segment/types.d.ts +0 -23
  565. package/segment/types.js +0 -1
  566. package/segment/utils.d.ts +0 -3
  567. package/segment/utils.js +0 -16
  568. package/tile-control/index.d.ts +0 -39
  569. package/tile-control/index.js +0 -111
  570. package/tile-control/types.d.ts +0 -29
  571. package/tile-control/types.js +0 -1
  572. package/tile-control-option/index.d.ts +0 -40
  573. package/tile-control-option/index.js +0 -99
  574. package/tile-control-option/types.d.ts +0 -52
  575. package/tile-control-option/types.js +0 -1
  576. package/vertical-stepper/index.d.ts +0 -33
  577. package/vertical-stepper/index.js +0 -58
  578. package/vertical-stepper/types.d.ts +0 -34
  579. package/vertical-stepper/types.js +0 -1
  580. package/vertical-stepper-item/index.d.ts +0 -38
  581. package/vertical-stepper-item/index.js +0 -62
  582. package/vertical-stepper-item/types.d.ts +0 -42
  583. package/vertical-stepper-item/types.js +0 -1
  584. package/vertical-stepper-item/utils.d.ts +0 -2
  585. package/vertical-stepper-item/utils.js +0 -1
@@ -1,32 +1,32 @@
1
- import { getEmojiBaseUrl, getEmojiUrl } from '../emoji/utils';
2
- import { isEmojiString, parseMarkdown } from '../utils';
3
- const TEXT_EMPTY_DATA = '';
4
- const TEXT_WHITESPACE = ' ';
5
- const isTextNode = $n => $n !== null && $n.nodeType === Node.TEXT_NODE;
6
- const isEmptyText = value => value === null || value.length === 0 || value === TEXT_EMPTY_DATA;
7
- const isEmptyTextNode = $n => isTextNode($n) && isEmptyText($n.nodeValue);
8
- const getTextValue = $n => isEmptyText($n.nodeValue) ? TEXT_EMPTY_DATA : $n.nodeValue;
9
- const isParagraph = $n => {
10
- return $n !== null && $n.nodeType === Node.ELEMENT_NODE && $n.classList.contains('p');
11
- };
12
- const isListItem = $n => {
1
+ import { getEmojiUrl, getEmojiBaseUrl } from "../emoji/utils.js";
2
+ import { isEmojiString, parseMarkdown } from "../utils/markdown.js";
3
+ const TEXT_EMPTY_DATA = "";
4
+ const TEXT_WHITESPACE = " ";
5
+ const isTextNode = ($n) => $n !== null && $n.nodeType === Node.TEXT_NODE;
6
+ const isEmptyText = (value) => value === null || value.length === 0 || value === TEXT_EMPTY_DATA;
7
+ const isEmptyTextNode = ($n) => isTextNode($n) && isEmptyText($n.nodeValue);
8
+ const getTextValue = ($n) => isEmptyText($n.nodeValue) ? TEXT_EMPTY_DATA : $n.nodeValue;
9
+ const isParagraph = ($n) => {
10
+ return $n !== null && $n.nodeType === Node.ELEMENT_NODE && $n.classList.contains("p");
11
+ };
12
+ const isListItem = ($n) => {
13
13
  return isUnorderedListItem($n) || isOrderedListItem($n);
14
14
  };
15
- const isUnorderedListItem = $n => {
16
- return $n !== null && $n.nodeType === Node.ELEMENT_NODE && $n.classList.contains('uli');
15
+ const isUnorderedListItem = ($n) => {
16
+ return $n !== null && $n.nodeType === Node.ELEMENT_NODE && $n.classList.contains("uli");
17
17
  };
18
- const isOrderedListItem = $n => {
19
- return $n !== null && $n.nodeType === Node.ELEMENT_NODE && $n.classList.contains('oli');
18
+ const isOrderedListItem = ($n) => {
19
+ return $n !== null && $n.nodeType === Node.ELEMENT_NODE && $n.classList.contains("oli");
20
20
  };
21
- const isTextBlock = $n => isParagraph($n) || isListItem($n);
22
- const isEmoji = $n => {
23
- return $n !== null && $n.nodeName === 'IMG';
21
+ const isTextBlock = ($n) => isParagraph($n) || isListItem($n);
22
+ const isEmoji = ($n) => {
23
+ return $n !== null && $n.nodeName === "IMG";
24
24
  };
25
- const isInline = $n => $n !== null && $n.nodeName === 'SPAN';
26
- const isRoot = $n => $n !== null && $n.nodeName === 'DIV';
27
- const assertNonNull = $n => {
25
+ const isInline = ($n) => $n !== null && $n.nodeName === "SPAN";
26
+ const isRoot = ($n) => $n !== null && $n.nodeName === "DIV";
27
+ const assertNonNull = ($n) => {
28
28
  if ($n === null) {
29
- throw new Error('Node is NULL');
29
+ throw new Error("Node is NULL");
30
30
  }
31
31
  };
32
32
  const assertEquals = (a, b) => {
@@ -34,64 +34,64 @@ const assertEquals = (a, b) => {
34
34
  throw new Error(`"${a}" not equals "${b}"`);
35
35
  }
36
36
  };
37
- const assertTextNode = $n => {
37
+ const assertTextNode = ($n) => {
38
38
  assertNonNull($n);
39
39
  if (!isTextNode($n)) {
40
40
  throw new Error(`Node is not a TextNode: ${$n?.nodeName}`);
41
41
  }
42
42
  };
43
- const assertTextBlock = $n => {
43
+ const assertTextBlock = ($n) => {
44
44
  assertNonNull($n);
45
45
  if (!isTextBlock($n)) {
46
46
  throw new Error(`Node is not a TextBlock: ${$n?.nodeName}`);
47
47
  }
48
48
  };
49
- const assertListItem = $n => {
49
+ const assertListItem = ($n) => {
50
50
  assertNonNull($n);
51
51
  if (!isListItem($n)) {
52
52
  throw new Error(`Node is not a ListItem: ${$n?.nodeName}`);
53
53
  }
54
54
  };
55
- const markListItemAsBlock = $li => {
56
- $li.classList.add('block');
55
+ const markListItemAsBlock = ($li) => {
56
+ $li.classList.add("block");
57
57
  };
58
- const isListItemMarkedArBlock = $li => {
59
- return $li.classList.contains('block');
58
+ const isListItemMarkedArBlock = ($li) => {
59
+ return $li.classList.contains("block");
60
60
  };
61
61
  const MAX_LISTITEM_LEVEL = 4;
62
- const removeListItemLevel = $li => {
63
- $li.classList.remove('l0', 'l1', 'l2', 'l3', 'l4');
62
+ const removeListItemLevel = ($li) => {
63
+ $li.classList.remove("l0", "l1", "l2", "l3", "l4");
64
64
  };
65
65
  const setListItemLevel = ($li, level) => {
66
66
  removeListItemLevel($li);
67
67
  const clampedLevel = Math.max(0, Math.min(level, MAX_LISTITEM_LEVEL));
68
68
  $li.classList.add(`l${clampedLevel}`);
69
69
  };
70
- const getListItemLevel = $li => {
71
- if ($li.classList.contains('l1')) {
70
+ const getListItemLevel = ($li) => {
71
+ if ($li.classList.contains("l1")) {
72
72
  return 1;
73
73
  }
74
- if ($li.classList.contains('l2')) {
74
+ if ($li.classList.contains("l2")) {
75
75
  return 2;
76
76
  }
77
- if ($li.classList.contains('l3')) {
77
+ if ($li.classList.contains("l3")) {
78
78
  return 3;
79
79
  }
80
- if ($li.classList.contains('l4')) {
80
+ if ($li.classList.contains("l4")) {
81
81
  return 4;
82
82
  }
83
83
  return 0;
84
84
  };
85
- const assertInline = $n => {
85
+ const assertInline = ($n) => {
86
86
  assertNonNull($n);
87
87
  if (!isInline($n)) {
88
88
  throw new Error(`Node is not an Inline: ${$n?.nodeName}`);
89
89
  }
90
90
  };
91
- const isTextContent = $n => {
91
+ const isTextContent = ($n) => {
92
92
  return $n !== null && $n.nodeType === Node.ELEMENT_NODE && (isInline($n) || isEmoji($n));
93
93
  };
94
- const assertTextContent = $n => {
94
+ const assertTextContent = ($n) => {
95
95
  assertNonNull($n);
96
96
  if (!isTextContent($n)) {
97
97
  throw new Error(`Node is not TextContent: ${$n?.nodeName}`);
@@ -100,15 +100,15 @@ const assertTextContent = $n => {
100
100
  const createTextNode = (data, doc) => {
101
101
  return doc.createTextNode(data);
102
102
  };
103
- const createEmptyTextNode = doc => {
103
+ const createEmptyTextNode = (doc) => {
104
104
  return createTextNode(TEXT_EMPTY_DATA, doc);
105
105
  };
106
- const createEmptyInline = doc => {
107
- const res = doc.createElement('SPAN');
106
+ const createEmptyInline = (doc) => {
107
+ const res = doc.createElement("SPAN");
108
108
  res.append(createEmptyTextNode(doc));
109
109
  return res;
110
110
  };
111
- const getParentInline = $n => {
111
+ const getParentInline = ($n) => {
112
112
  const $p = $n.parentNode;
113
113
  assertInline($p);
114
114
  return $p;
@@ -118,22 +118,26 @@ const isInsideList = (isOrdered, $n) => {
118
118
  return isOrdered ? isOrderedListItem($block) : isUnorderedListItem($block);
119
119
  };
120
120
  const isAllInsideList = (isOrdered, $a, $b) => {
121
- return allSiblingsIncludingSatisfy(getParentTextBlock($a), getParentTextBlock($b), isOrdered ? isOrderedListItem : isUnorderedListItem);
121
+ return allSiblingsIncludingSatisfy(
122
+ getParentTextBlock($a),
123
+ getParentTextBlock($b),
124
+ isOrdered ? isOrderedListItem : isUnorderedListItem
125
+ );
122
126
  };
123
127
  const FORMAT_TYPE_TO_NAME = {
124
- formatBold: 'b',
125
- formatCodeTag: 'c',
126
- formatItalic: 'i',
127
- formatStrikeThrough: 's'
128
+ formatBold: "b",
129
+ formatCodeTag: "c",
130
+ formatItalic: "i",
131
+ formatStrikeThrough: "s"
128
132
  };
129
133
  const isFormatName = ($n, inlineName) => {
130
134
  return $n.classList.contains(inlineName);
131
135
  };
132
- const isFormatBold = $n => isFormatName($n, 'b');
133
- const isFormatItalic = $n => isFormatName($n, 'i');
134
- const isFormatStrikethrough = $n => isFormatName($n, 's');
135
- const isFormatCodetag = $n => isFormatName($n, 'c');
136
- const isFormatLink = $n => isFormatName($n, 'l');
136
+ const isFormatBold = ($n) => isFormatName($n, "b");
137
+ const isFormatItalic = ($n) => isFormatName($n, "i");
138
+ const isFormatStrikethrough = ($n) => isFormatName($n, "s");
139
+ const isFormatCodetag = ($n) => isFormatName($n, "c");
140
+ const isFormatLink = ($n) => isFormatName($n, "l");
137
141
  const isAllInsideFormatName = ($a, $b, formatName) => {
138
142
  const aBlock = getParentTextBlock($a);
139
143
  const bBlock = getParentTextBlock($b);
@@ -158,31 +162,31 @@ const isAllInsideFormatName = ($a, $b, formatName) => {
158
162
  } while ($currentBlock !== null && $prevBlock !== bBlock);
159
163
  return hasTextNodes;
160
164
  };
161
- const isAllInsideBold = ($a, $b) => isAllInsideFormatName($a, $b, 'b');
162
- const isAllInsideItalic = ($a, $b) => isAllInsideFormatName($a, $b, 'i');
163
- const isAllInsideStrikethrough = ($a, $b) => isAllInsideFormatName($a, $b, 's');
164
- const isAllInsideCodetag = ($a, $b) => isAllInsideFormatName($a, $b, 'c');
165
- const isAllInsideLink = ($a, $b) => isAllInsideFormatName($a, $b, 'l');
166
- const LINK_HREF_ATTR_NAME = 'data-href';
165
+ const isAllInsideBold = ($a, $b) => isAllInsideFormatName($a, $b, "b");
166
+ const isAllInsideItalic = ($a, $b) => isAllInsideFormatName($a, $b, "i");
167
+ const isAllInsideStrikethrough = ($a, $b) => isAllInsideFormatName($a, $b, "s");
168
+ const isAllInsideCodetag = ($a, $b) => isAllInsideFormatName($a, $b, "c");
169
+ const isAllInsideLink = ($a, $b) => isAllInsideFormatName($a, $b, "l");
170
+ const LINK_HREF_ATTR_NAME = "data-href";
167
171
  const copyFormatName = ($source, $target) => {
168
172
  const $inline = isTextNode($source) ? getParentInline($source) : $source;
169
173
  $target.className = $inline.className;
170
174
  if (isFormatLink($inline)) {
171
- $target.setAttribute(LINK_HREF_ATTR_NAME, $inline.getAttribute(LINK_HREF_ATTR_NAME) ?? '');
175
+ $target.setAttribute(LINK_HREF_ATTR_NAME, $inline.getAttribute(LINK_HREF_ATTR_NAME) ?? "");
172
176
  }
173
177
  };
174
178
  const setInlineFormat = ($n, formatName, shouldEnable) => {
175
179
  if (shouldEnable) {
176
- if (formatName === 'c' || isFormatName($n, 'c')) {
177
- $n.className = '';
180
+ if (formatName === "c" || isFormatName($n, "c")) {
181
+ $n.className = "";
178
182
  }
179
- if (formatName === 'l' || isFormatName($n, 'l')) {
180
- $n.className = '';
183
+ if (formatName === "l" || isFormatName($n, "l")) {
184
+ $n.className = "";
181
185
  $n.removeAttribute(LINK_HREF_ATTR_NAME);
182
186
  }
183
187
  $n.classList.add(formatName);
184
188
  } else {
185
- if (formatName === 'l') {
189
+ if (formatName === "l") {
186
190
  $n.removeAttribute(LINK_HREF_ATTR_NAME);
187
191
  }
188
192
  $n.classList.remove(formatName);
@@ -217,8 +221,8 @@ const areSameInlineFormat = ($a, $b) => {
217
221
  if ($a.classList.length !== $b.classList.length) {
218
222
  return false;
219
223
  }
220
- if ($a.className === 'l') {
221
- return $b.className === 'l' && $a.getAttribute(LINK_HREF_ATTR_NAME) === $b.getAttribute(LINK_HREF_ATTR_NAME);
224
+ if ($a.className === "l") {
225
+ return $b.className === "l" && $a.getAttribute(LINK_HREF_ATTR_NAME) === $b.getAttribute(LINK_HREF_ATTR_NAME);
222
226
  }
223
227
  for (let i = 0; i < $a.classList.length; i++) {
224
228
  if (!$b.classList.contains($a.classList[i])) {
@@ -228,7 +232,7 @@ const areSameInlineFormat = ($a, $b) => {
228
232
  return true;
229
233
  };
230
234
  const createInlineWithText = (data, doc) => {
231
- const $res = doc.createElement('SPAN');
235
+ const $res = doc.createElement("SPAN");
232
236
  $res.append(createTextNode(data, doc));
233
237
  return $res;
234
238
  };
@@ -240,25 +244,25 @@ const createInlineWithTextOfType = ($text, $source) => {
240
244
  };
241
245
  const createLink = (text, href, doc) => {
242
246
  const $link = createInlineWithText(text, doc);
243
- setInlineFormat($link, 'l', true);
247
+ setInlineFormat($link, "l", true);
244
248
  $link.setAttribute(LINK_HREF_ATTR_NAME, href);
245
249
  return $link;
246
250
  };
247
- const EMOJI_CHAR_ATTR_NAME = 'data-char';
251
+ const EMOJI_CHAR_ATTR_NAME = "data-char";
248
252
  const createEmoji = (emojiChar, baseUrl, doc) => {
249
- const $emoji = doc.createElement('img');
253
+ const $emoji = doc.createElement("img");
250
254
  $emoji.setAttribute(EMOJI_CHAR_ATTR_NAME, emojiChar);
251
- $emoji.setAttribute('src', getEmojiUrl(baseUrl, emojiChar));
252
- $emoji.classList.add('e');
255
+ $emoji.setAttribute("src", getEmojiUrl(baseUrl, emojiChar));
256
+ $emoji.classList.add("e");
253
257
  return $emoji;
254
258
  };
255
- const PARAGRAPH_CLASSNAME = 'p';
256
- const createActuallyEmptyParagraph = doc => {
257
- const $p = doc.createElement('p');
259
+ const PARAGRAPH_CLASSNAME = "p";
260
+ const createActuallyEmptyParagraph = (doc) => {
261
+ const $p = doc.createElement("p");
258
262
  $p.classList.add(PARAGRAPH_CLASSNAME);
259
263
  return $p;
260
264
  };
261
- const createEmptyParagraph = doc => {
265
+ const createEmptyParagraph = (doc) => {
262
266
  const res = createActuallyEmptyParagraph(doc);
263
267
  res.append(createEmptyInline(doc));
264
268
  return res;
@@ -271,17 +275,19 @@ const createParagraphWithChildren = (children, doc) => {
271
275
  $p.append(...children);
272
276
  return $p;
273
277
  };
274
- const ULI_CLASSNAME = 'uli';
275
- const OLI_CLASSNAME = 'oli';
278
+ const ULI_CLASSNAME = "uli";
279
+ const OLI_CLASSNAME = "oli";
276
280
  const createActuallyEmptyListItem = (isOrdered, listLevel, doc) => {
277
- const $li = doc.createElement('p');
281
+ const $li = doc.createElement("p");
278
282
  $li.className = isOrdered ? OLI_CLASSNAME : ULI_CLASSNAME;
279
283
  setListItemLevel($li, listLevel);
280
284
  return $li;
281
285
  };
282
286
  const createEmptyListItem = (isOrdered, listLevel, doc) => {
283
287
  const $li = createActuallyEmptyListItem(isOrdered, listLevel, doc);
284
- $li.append(createEmptyInline(doc));
288
+ $li.append(
289
+ createEmptyInline(doc)
290
+ );
285
291
  return $li;
286
292
  };
287
293
  const setListItemOrderedType = ($li, isOrdered) => {
@@ -304,7 +310,7 @@ const convertToListItem = ($p, isOrdered) => {
304
310
  setListItemLevel($li, 0);
305
311
  return $li;
306
312
  };
307
- const convertToParagraph = $li => {
313
+ const convertToParagraph = ($li) => {
308
314
  removeListItemLevel($li);
309
315
  $li.classList.remove(ULI_CLASSNAME, OLI_CLASSNAME);
310
316
  $li.classList.add(PARAGRAPH_CLASSNAME);
@@ -319,7 +325,7 @@ const createListItemWithChildren = (children, isOrdered, listLevel, doc) => {
319
325
  $li.append(...children);
320
326
  return $li;
321
327
  };
322
- const getParentTextBlock = $node => {
328
+ const getParentTextBlock = ($node) => {
323
329
  const $inline = isTextNode($node) ? getParentInline($node) : $node;
324
330
  const $p = $inline.parentNode;
325
331
  assertTextBlock($p);
@@ -331,22 +337,22 @@ const childIndexOf = ($parent, $child) => {
331
337
  const getChildByIndex = ($parent, index) => {
332
338
  const children = $parent.childNodes;
333
339
  if (index < 0 || index >= children.length) {
334
- throw new Error('Invalid index');
340
+ throw new Error("Invalid index");
335
341
  }
336
342
  const $ch = index >= children.length ? children[children.length - 1] : children[index];
337
343
  return $ch;
338
344
  };
339
- const afterLastChildIndex = $parent => {
345
+ const afterLastChildIndex = ($parent) => {
340
346
  return $parent.childNodes.length;
341
347
  };
342
348
  const isAfterLastChildIndex = ($parent, index) => {
343
349
  return index >= $parent.childNodes.length;
344
350
  };
345
- const getLastChild = n => n.lastChild;
346
- const getFirstChild = n => n.firstChild;
347
- const getPrevSibling = n => n.previousSibling;
348
- const getNextSibling = n => n.nextSibling;
349
- const getSiblingTextBlock = getSibling => $node => {
351
+ const getLastChild = (n) => n.lastChild;
352
+ const getFirstChild = (n) => n.firstChild;
353
+ const getPrevSibling = (n) => n.previousSibling;
354
+ const getNextSibling = (n) => n.nextSibling;
355
+ const getSiblingTextBlock = (getSibling) => ($node) => {
350
356
  const $sib = getSibling($node);
351
357
  if ($sib !== null) {
352
358
  assertTextBlock($sib);
@@ -358,15 +364,6 @@ const getPrevSiblingTextBlock = getSiblingTextBlock(getPrevSibling);
358
364
  const getNextSiblingTextBlock = getSiblingTextBlock(getNextSibling);
359
365
  const getPrevSiblingTextContent = ($node, ensureValid) => {
360
366
  const $sib = $node.previousSibling;
361
- if ($sib === null && ensureValid === true) {
362
- const $currentBlock = getParentTextBlock($node);
363
- const $prevBlock = getPrevSiblingTextBlock($currentBlock);
364
- if ($prevBlock === null) {
365
- $currentBlock.prepend(createEmptyInline($node.ownerDocument));
366
- return getFirstTextContent($currentBlock);
367
- }
368
- return getLastTextContent($prevBlock);
369
- }
370
367
  if ($sib !== null) {
371
368
  assertTextContent($sib);
372
369
  }
@@ -374,25 +371,13 @@ const getPrevSiblingTextContent = ($node, ensureValid) => {
374
371
  };
375
372
  const getNextSiblingTextContent = ($node, ensureValid) => {
376
373
  const $sib = $node.nextSibling;
377
- if ($sib === null && ensureValid === true) {
378
- const $currentBlock = getParentTextBlock($node);
379
- const $nextBlock = getNextSiblingTextBlock($currentBlock);
380
- if ($nextBlock === null) {
381
- $currentBlock.append(createEmptyInline($node.ownerDocument));
382
- return getLastTextContent($currentBlock);
383
- }
384
- return getFirstTextContent($nextBlock);
385
- }
386
374
  if ($sib !== null) {
387
375
  assertTextContent($sib);
388
376
  }
389
377
  return $sib;
390
378
  };
391
- const createCollapsedRange = cursor => {
392
- const {
393
- node,
394
- offset
395
- } = cursorToNodeWithOffset(cursor);
379
+ const createCollapsedRange = (cursor) => {
380
+ const { node, offset } = cursorToNodeWithOffset(cursor);
396
381
  return {
397
382
  startContainer: node,
398
383
  startOffset: offset,
@@ -401,14 +386,8 @@ const createCollapsedRange = cursor => {
401
386
  };
402
387
  };
403
388
  const createSpanningRange = (aCursor, bCursor) => {
404
- const {
405
- node: startContainer,
406
- offset: startOffset
407
- } = cursorToNodeWithOffset(aCursor);
408
- const {
409
- node: endContainer,
410
- offset: endOffset
411
- } = cursorToNodeWithOffset(bCursor);
389
+ const { node: startContainer, offset: startOffset } = cursorToNodeWithOffset(aCursor);
390
+ const { node: endContainer, offset: endOffset } = cursorToNodeWithOffset(bCursor);
412
391
  return {
413
392
  startContainer,
414
393
  startOffset,
@@ -416,13 +395,13 @@ const createSpanningRange = (aCursor, bCursor) => {
416
395
  endOffset
417
396
  };
418
397
  };
419
- const removePrevSiblings = $node => {
398
+ const removePrevSiblings = ($node) => {
420
399
  let $n;
421
400
  while (($n = $node.previousSibling) !== null) {
422
401
  $n.remove();
423
402
  }
424
403
  };
425
- const removeNextSiblings = $node => {
404
+ const removeNextSiblings = ($node) => {
426
405
  let $n;
427
406
  while (($n = $node.nextSibling) !== null) {
428
407
  $n.remove();
@@ -459,9 +438,11 @@ const removeNodesBetween = (aCursor, bCursor) => {
459
438
  }
460
439
  removeSiblingsBetween($cpChildA, $cpChildB);
461
440
  };
462
- const ensureCorrectTextBlockIfEmpty = $node => {
441
+ const ensureCorrectTextBlockIfEmpty = ($node) => {
463
442
  if (!$node.hasChildNodes()) {
464
- $node.append(createEmptyInline($node.ownerDocument));
443
+ $node.append(
444
+ createEmptyInline($node.ownerDocument)
445
+ );
465
446
  return;
466
447
  }
467
448
  const children = $node.childNodes;
@@ -475,15 +456,15 @@ const ensureCorrectTextBlockIfEmpty = $node => {
475
456
  }
476
457
  }
477
458
  };
478
- const getChildText = $node => {
459
+ const getChildText = ($node) => {
479
460
  if ($node.childNodes.length !== 1) {
480
- throw new Error('Should have exact 1 child');
461
+ throw new Error("Should have exact 1 child");
481
462
  }
482
463
  const $child = $node.firstChild;
483
464
  assertTextNode($child);
484
465
  return $child;
485
466
  };
486
- const getChildTextContent = getFirstOrLastChild => $node => {
467
+ const getChildTextContent = (getFirstOrLastChild) => ($node) => {
487
468
  ensureCorrectTextBlockIfEmpty($node);
488
469
  const $child = getFirstOrLastChild($node);
489
470
  assertTextContent($child);
@@ -491,7 +472,7 @@ const getChildTextContent = getFirstOrLastChild => $node => {
491
472
  };
492
473
  const getLastTextContent = getChildTextContent(getLastChild);
493
474
  const getFirstTextContent = getChildTextContent(getFirstChild);
494
- const getFirstOrLastTextBlock = getFirstOrLastChild => $root => {
475
+ const getFirstOrLastTextBlock = (getFirstOrLastChild) => ($root) => {
495
476
  let $lc = getFirstOrLastChild($root);
496
477
  if ($lc === null) {
497
478
  $lc = createEmptyParagraph($root.ownerDocument);
@@ -512,7 +493,7 @@ const mergeSiblingTextNodes = ($a, aCursor, bCursor) => {
512
493
  const bContent = getTextValue($b);
513
494
  const aContentLength = isEmptyText(aContent) ? 0 : aContent.length;
514
495
  const bContentLength = isEmptyText(bContent) ? 0 : bContent.length;
515
- let resultText = (isEmptyText(aContent) ? '' : aContent) + (isEmptyText(bContent) ? '' : bContent);
496
+ let resultText = (isEmptyText(aContent) ? "" : aContent) + (isEmptyText(bContent) ? "" : bContent);
516
497
  const isEmptyResultText = resultText.length === 0;
517
498
  if (aCursor.$text === $a) {
518
499
  aCursor.offset = isEmptyResultText ? 1 : aCursor.offset;
@@ -608,7 +589,7 @@ const mergeNextTextBlock = ($a, aCursor, bCursor) => {
608
589
  };
609
590
  const sliceChildren = ($parent, index) => {
610
591
  if (index < 0) {
611
- throw new Error('Not found');
592
+ throw new Error("Not found");
612
593
  }
613
594
  const children = Array.from($parent.childNodes);
614
595
  if (index === 0) {
@@ -622,7 +603,10 @@ const splitTextBlock = ($a, childIndex) => {
622
603
  ensureCorrectTextBlockIfEmpty($a);
623
604
  ensureCorrectTextBlockIfEmpty($b);
624
605
  $a.after($b);
625
- return [$a, $b];
606
+ return [
607
+ $a,
608
+ $b
609
+ ];
626
610
  };
627
611
  const splitTextNode = ($aText, offset) => {
628
612
  const content = getTextValue($aText);
@@ -662,44 +646,42 @@ const splitTextNodeAndInsertEmptyInline = ($n, offset) => {
662
646
  }
663
647
  return $inline;
664
648
  };
665
- export const formatInline = (formatType, range) => {
649
+ const formatInline = (formatType, range) => {
666
650
  const aCursor = createIncomingCursorFromNodeWithOffset(range.startContainer, range.startOffset);
667
651
  const bCursor = createIncomingCursorFromNodeWithOffset(range.endContainer, range.endOffset);
668
652
  const formatName = FORMAT_TYPE_TO_NAME[formatType];
669
653
  if (aCursor.$inline === bCursor.$inline && isTextNode(aCursor.$text)) {
670
- const {
671
- $text,
672
- $inline,
673
- offset: startOffset
674
- } = aCursor;
675
- const {
676
- offset: endOffset
677
- } = bCursor;
654
+ const { $text, $inline, offset: startOffset } = aCursor;
655
+ const { offset: endOffset } = bCursor;
678
656
  if (isEmptyText($text.nodeValue)) {
679
657
  assertInline($inline);
680
658
  toggleInlineFormat($inline, formatName);
681
659
  return {
682
660
  prevent: true,
683
- range: createCollapsedRange(createEndCursorFromTextContent($inline))
661
+ range: createCollapsedRange(
662
+ createEndCursorFromTextContent($inline)
663
+ )
684
664
  };
685
665
  }
686
666
  if (startOffset === endOffset) {
687
- const $newinline = splitTextNodeAndInsertEmptyInline($text, startOffset);
688
- toggleInlineFormat($newinline, formatName);
667
+ const $newinline2 = splitTextNodeAndInsertEmptyInline($text, startOffset);
668
+ toggleInlineFormat($newinline2, formatName);
689
669
  return {
690
670
  prevent: true,
691
- range: createCollapsedRange(createEndCursorFromTextContent($newinline))
671
+ range: createCollapsedRange(
672
+ createEndCursorFromTextContent($newinline2)
673
+ )
692
674
  };
693
675
  }
694
676
  const $newinline = sliceTextNode($text, startOffset, endOffset);
695
677
  toggleInlineFormat($newinline, formatName);
696
- const aTrackingCursor = createBeginCursorFromTextContent($newinline);
697
- const bTrackingCursor = createEndCursorFromTextContent($newinline);
698
- mergeNextTextContentSibling($newinline, aTrackingCursor, bTrackingCursor);
699
- mergePrevTextContentSibling($newinline, aTrackingCursor, bTrackingCursor);
678
+ const aTrackingCursor2 = createBeginCursorFromTextContent($newinline);
679
+ const bTrackingCursor2 = createEndCursorFromTextContent($newinline);
680
+ mergeNextTextContentSibling($newinline, aTrackingCursor2, bTrackingCursor2);
681
+ mergePrevTextContentSibling($newinline, aTrackingCursor2, bTrackingCursor2);
700
682
  return {
701
683
  prevent: true,
702
- range: createSpanningRange(aTrackingCursor, bTrackingCursor)
684
+ range: createSpanningRange(aTrackingCursor2, bTrackingCursor2)
703
685
  };
704
686
  }
705
687
  const areAllInline = isAllInsideFormatName(aCursor.$inline, bCursor.$inline, formatName);
@@ -742,7 +724,7 @@ const allSiblingsIncludingSatisfy = (aNode, bNode, func) => {
742
724
  }
743
725
  return true;
744
726
  };
745
- export const formatIndent = range => {
727
+ const formatIndent = (range) => {
746
728
  if (range.startContainer === range.endContainer && range.startOffset === range.endOffset && range.startOffset !== 0) {
747
729
  return {
748
730
  prevent: false
@@ -771,7 +753,7 @@ export const formatIndent = range => {
771
753
  range
772
754
  };
773
755
  };
774
- const ensureListItemLevelsAreCorrect = $li => {
756
+ const ensureListItemLevelsAreCorrect = ($li) => {
775
757
  if ($li === null) {
776
758
  return;
777
759
  }
@@ -788,7 +770,7 @@ const ensureListItemLevelsAreCorrect = $li => {
788
770
  $block = getNextSiblingTextBlock($block);
789
771
  }
790
772
  };
791
- export const formatOutdent = range => {
773
+ const formatOutdent = (range) => {
792
774
  if (range.startContainer === range.endContainer && range.startOffset === range.endOffset && range.startOffset !== 0) {
793
775
  return {
794
776
  prevent: false
@@ -816,7 +798,7 @@ export const formatOutdent = range => {
816
798
  range
817
799
  };
818
800
  };
819
- export const formatList = (isOrdered, range) => {
801
+ const formatList = (isOrdered, range) => {
820
802
  const aCursor = createIncomingCursorFromNodeWithOffset(range.startContainer, range.startOffset);
821
803
  const bCursor = createIncomingCursorFromNodeWithOffset(range.endContainer, range.endOffset);
822
804
  const aBlock = getParentTextBlock(aCursor.$inline);
@@ -825,11 +807,11 @@ export const formatList = (isOrdered, range) => {
825
807
  if (isInsideSameListType) {
826
808
  assertListItem(aBlock);
827
809
  assertListItem(bBlock);
828
- const $iterateUpToNode = getNextSiblingTextBlock(bBlock);
829
- let $block = aBlock;
830
- while ($block !== null && $block !== $iterateUpToNode) {
831
- convertToParagraph($block);
832
- $block = getNextSiblingTextBlock($block);
810
+ const $iterateUpToNode2 = getNextSiblingTextBlock(bBlock);
811
+ let $block2 = aBlock;
812
+ while ($block2 !== null && $block2 !== $iterateUpToNode2) {
813
+ convertToParagraph($block2);
814
+ $block2 = getNextSiblingTextBlock($block2);
833
815
  }
834
816
  return {
835
817
  prevent: true,
@@ -859,7 +841,7 @@ const createCursorFromTextNode = (node, offset) => {
859
841
  offset: Math.min(node.length, offset)
860
842
  };
861
843
  };
862
- const createBeginCursorFromTextContent = node => {
844
+ const createBeginCursorFromTextContent = (node) => {
863
845
  if (isInline(node)) {
864
846
  const $text = getChildText(node);
865
847
  const content = getTextValue($text);
@@ -875,7 +857,7 @@ const createBeginCursorFromTextContent = node => {
875
857
  offset: 0
876
858
  };
877
859
  };
878
- const createEndCursorFromTextContent = node => {
860
+ const createEndCursorFromTextContent = (node) => {
879
861
  if (isInline(node)) {
880
862
  const $text = getChildText(node);
881
863
  return {
@@ -904,7 +886,9 @@ const createIncomingCursorFromNodeWithOffset = (node, offset) => {
904
886
  }
905
887
  if (isTextBlock(node)) {
906
888
  if (isAfterLastChildIndex(node, offset)) {
907
- return createEndCursorFromTextContent(getLastTextContent(node));
889
+ return createEndCursorFromTextContent(
890
+ getLastTextContent(node)
891
+ );
908
892
  }
909
893
  return createIncomingCursorFromNodeWithOffset(getChildByIndex(node, offset), 0);
910
894
  }
@@ -922,15 +906,9 @@ const createIncomingCursorFromNodeWithOffset = (node, offset) => {
922
906
  }
923
907
  return createIncomingCursorFromNodeWithOffset(getChildByIndex(node, offset), 0);
924
908
  }
925
- throw new Error('Should not happen');
909
+ throw new Error("Should not happen");
926
910
  };
927
- const cursorToNodeWithOffset = _ref => {
928
- let {
929
- $text,
930
- $inline,
931
- offset,
932
- isAfterInline
933
- } = _ref;
911
+ const cursorToNodeWithOffset = ({ $text, $inline, offset, isAfterInline }) => {
934
912
  if (isTextNode($text)) {
935
913
  return {
936
914
  node: $text,
@@ -944,21 +922,15 @@ const cursorToNodeWithOffset = _ref => {
944
922
  offset: childIndex
945
923
  };
946
924
  };
947
- const removeContentInRange = range => {
925
+ const removeContentInRange = (range) => {
948
926
  const aCursor = createIncomingCursorFromNodeWithOffset(range.startContainer, range.startOffset);
949
927
  const bCursor = createIncomingCursorFromNodeWithOffset(range.endContainer, range.endOffset);
950
928
  if (aCursor.$inline === bCursor.$inline && aCursor.offset === bCursor.offset && aCursor.isAfterInline === bCursor.isAfterInline) {
951
929
  return aCursor;
952
930
  }
953
931
  if (aCursor.$text === bCursor.$text && isTextNode(aCursor.$text)) {
954
- const {
955
- $text,
956
- $inline,
957
- offset: startOffset
958
- } = aCursor;
959
- const {
960
- offset: endOffset
961
- } = bCursor;
932
+ const { $text, $inline, offset: startOffset } = aCursor;
933
+ const { offset: endOffset } = bCursor;
962
934
  const content = getTextValue($text);
963
935
  const nextContent = content.substring(0, startOffset) + content.substring(endOffset);
964
936
  $text.nodeValue = nextContent;
@@ -1010,13 +982,8 @@ const removeContentInRange = range => {
1010
982
  }
1011
983
  return trackingCursor;
1012
984
  };
1013
- export const deleteContentBackward = ($root, range) => {
1014
- const {
1015
- startContainer,
1016
- endContainer,
1017
- startOffset,
1018
- endOffset
1019
- } = range;
985
+ const deleteContentBackward = ($root, range) => {
986
+ const { startContainer, endContainer, startOffset, endOffset } = range;
1020
987
  if (startContainer === endContainer && startOffset + 1 === endOffset && isTextNode(startContainer)) {
1021
988
  if (startContainer.length > 1) {
1022
989
  return DEFAULT_ACTION_RESULT;
@@ -1066,17 +1033,14 @@ export const deleteContentBackward = ($root, range) => {
1066
1033
  }
1067
1034
  return {
1068
1035
  prevent: true,
1069
- range: createCollapsedRange(removeContentInRange(range))
1036
+ range: createCollapsedRange(
1037
+ removeContentInRange(range)
1038
+ )
1070
1039
  };
1071
1040
  };
1072
- export const insertLink = ($root, text, href, range) => {
1041
+ const insertLink = ($root, text, href, range) => {
1073
1042
  const cursor = removeContentInRange(range);
1074
- const {
1075
- $text,
1076
- $inline,
1077
- offset,
1078
- isAfterInline: isAfterLastChild
1079
- } = cursor;
1043
+ const { $text, $inline, offset, isAfterInline: isAfterLastChild } = cursor;
1080
1044
  const $link = createLink(text, href, $root.ownerDocument);
1081
1045
  if (isTextNode($text)) {
1082
1046
  if (isEmptyText($text.nodeValue)) {
@@ -1097,24 +1061,23 @@ export const insertLink = ($root, text, href, range) => {
1097
1061
  }
1098
1062
  return {
1099
1063
  prevent: true,
1100
- range: createCollapsedRange(createEndCursorFromTextContent($link))
1064
+ range: createCollapsedRange(
1065
+ createEndCursorFromTextContent($link)
1066
+ )
1101
1067
  };
1102
1068
  };
1103
- export const insertLineBreak = range => {
1069
+ const insertLineBreak = (range) => {
1104
1070
  const cursor = removeContentInRange(range);
1105
- const {
1106
- $text,
1107
- $inline,
1108
- offset,
1109
- isAfterInline: isAfterLastChild
1110
- } = cursor;
1071
+ const { $text, $inline, offset, isAfterInline: isAfterLastChild } = cursor;
1111
1072
  const $block = getParentTextBlock($inline);
1112
1073
  if (isListItem($block)) {
1113
1074
  if (isEmptyTextBlock($block)) {
1114
1075
  convertToParagraph($block);
1115
1076
  return {
1116
1077
  prevent: true,
1117
- range: createCollapsedRange(createEndCursorFromTextContent(getLastTextContent($block)))
1078
+ range: createCollapsedRange(
1079
+ createEndCursorFromTextContent(getLastTextContent($block))
1080
+ )
1118
1081
  };
1119
1082
  }
1120
1083
  }
@@ -1128,17 +1091,14 @@ export const insertLineBreak = range => {
1128
1091
  const [_, $bBlock] = splitTextBlock($block, splitIndex);
1129
1092
  return {
1130
1093
  prevent: true,
1131
- range: createCollapsedRange(createBeginCursorFromTextContent(getFirstTextContent($bBlock)))
1094
+ range: createCollapsedRange(
1095
+ createBeginCursorFromTextContent(getFirstTextContent($bBlock))
1096
+ )
1132
1097
  };
1133
1098
  };
1134
1099
  const insertEmoji = ($root, emojiChar, range) => {
1135
1100
  const cursor = removeContentInRange(range);
1136
- const {
1137
- $text,
1138
- $inline,
1139
- offset,
1140
- isAfterInline
1141
- } = cursor;
1101
+ const { $text, $inline, offset, isAfterInline } = cursor;
1142
1102
  const baseUrl = getEmojiBaseUrl($root);
1143
1103
  const $emoji = createEmoji(emojiChar, baseUrl, $root.ownerDocument);
1144
1104
  if (isTextNode($text)) {
@@ -1160,16 +1120,22 @@ const insertEmoji = ($root, emojiChar, range) => {
1160
1120
  }
1161
1121
  return {
1162
1122
  prevent: true,
1163
- range: createCollapsedRange(createEndCursorFromTextContent($emoji))
1123
+ range: createCollapsedRange(
1124
+ createEndCursorFromTextContent($emoji)
1125
+ )
1164
1126
  };
1165
1127
  };
1166
- export const insertText = ($root, data, range) => {
1128
+ const insertText = ($root, data, range) => {
1167
1129
  if (data !== null && isEmojiString(data)) {
1168
1130
  return insertEmoji($root, data, range);
1169
1131
  }
1170
- if (range.startContainer === range.endContainer && range.startOffset === range.endOffset && isTextNode(range.startContainer) && !isEmptyText(range.startContainer.nodeValue)) {
1171
- const $inline = getParentInline(range.startContainer);
1172
- const isHotTextWhitespace = range.startOffset === range.startContainer.length && data === TEXT_WHITESPACE && (isFormatCodetag($inline) || isFormatLink($inline));
1132
+ if (
1133
+ // Is collapsed range
1134
+ range.startContainer === range.endContainer && range.startOffset === range.endOffset && // Is non-empty text node
1135
+ isTextNode(range.startContainer) && !isEmptyText(range.startContainer.nodeValue)
1136
+ ) {
1137
+ const $inline2 = getParentInline(range.startContainer);
1138
+ const isHotTextWhitespace = range.startOffset === range.startContainer.length && data === TEXT_WHITESPACE && (isFormatCodetag($inline2) || isFormatLink($inline2));
1173
1139
  if (!isHotTextWhitespace) {
1174
1140
  return DEFAULT_ACTION_RESULT;
1175
1141
  }
@@ -1181,12 +1147,7 @@ export const insertText = ($root, data, range) => {
1181
1147
  range: createCollapsedRange(cursor)
1182
1148
  };
1183
1149
  }
1184
- const {
1185
- $text,
1186
- $inline,
1187
- offset,
1188
- isAfterInline
1189
- } = cursor;
1150
+ const { $text, $inline, offset, isAfterInline } = cursor;
1190
1151
  if ($text === null && isEmoji($inline)) {
1191
1152
  const $newInline = createInlineWithText(data, $root.ownerDocument);
1192
1153
  if (isAfterInline === true) {
@@ -1196,7 +1157,9 @@ export const insertText = ($root, data, range) => {
1196
1157
  }
1197
1158
  return {
1198
1159
  prevent: true,
1199
- range: createCollapsedRange(createEndCursorFromTextContent($newInline))
1160
+ range: createCollapsedRange(
1161
+ createEndCursorFromTextContent($newInline)
1162
+ )
1200
1163
  };
1201
1164
  }
1202
1165
  if (isTextNode($text)) {
@@ -1205,7 +1168,9 @@ export const insertText = ($root, data, range) => {
1205
1168
  $text.nodeValue = data;
1206
1169
  return {
1207
1170
  prevent: true,
1208
- range: createCollapsedRange(createCursorFromTextNode($text, data.length))
1171
+ range: createCollapsedRange(
1172
+ createCursorFromTextNode($text, data.length)
1173
+ )
1209
1174
  };
1210
1175
  }
1211
1176
  if (offset === $text.length && data === TEXT_WHITESPACE) {
@@ -1214,7 +1179,9 @@ export const insertText = ($root, data, range) => {
1214
1179
  $inline.after($newinline);
1215
1180
  return {
1216
1181
  prevent: true,
1217
- range: createCollapsedRange(createEndCursorFromTextContent($newinline))
1182
+ range: createCollapsedRange(
1183
+ createEndCursorFromTextContent($newinline)
1184
+ )
1218
1185
  };
1219
1186
  }
1220
1187
  }
@@ -1222,7 +1189,9 @@ export const insertText = ($root, data, range) => {
1222
1189
  $text.nodeValue = content.substring(0, offset) + data + content.substring(offset);
1223
1190
  return {
1224
1191
  prevent: true,
1225
- range: createCollapsedRange(createCursorFromTextNode($text, offset + data.length))
1192
+ range: createCollapsedRange(
1193
+ createCursorFromTextNode($text, offset + data.length)
1194
+ )
1226
1195
  };
1227
1196
  }
1228
1197
  return {
@@ -1230,14 +1199,9 @@ export const insertText = ($root, data, range) => {
1230
1199
  range: createCollapsedRange(cursor)
1231
1200
  };
1232
1201
  };
1233
- export const insertFromPaste = (data, range, visitor) => {
1202
+ const insertFromPaste = (data, range, visitor) => {
1234
1203
  const cursor = removeContentInRange(range);
1235
- const {
1236
- $text,
1237
- $inline,
1238
- offset,
1239
- isAfterInline
1240
- } = cursor;
1204
+ const { $text, $inline, offset, isAfterInline } = cursor;
1241
1205
  const $mdFragment = parseMarkdown(data, visitor);
1242
1206
  if ($mdFragment.childNodes.length === 0) {
1243
1207
  return {
@@ -1247,7 +1211,7 @@ export const insertFromPaste = (data, range, visitor) => {
1247
1211
  }
1248
1212
  const shouldSpreadNodesIntoBlock = $mdFragment.childNodes.length === 1;
1249
1213
  if (shouldSpreadNodesIntoBlock) {
1250
- const $block = getParentTextBlock($inline);
1214
+ const $block2 = getParentTextBlock($inline);
1251
1215
  const $fragment = document.createDocumentFragment();
1252
1216
  $fragment.append(...Array.from($mdFragment.childNodes[0].childNodes));
1253
1217
  const $pasteLastChild = $fragment.lastChild;
@@ -1256,7 +1220,7 @@ export const insertFromPaste = (data, range, visitor) => {
1256
1220
  }
1257
1221
  if (isTextNode($text)) {
1258
1222
  if (isEmptyText($text.nodeValue)) {
1259
- $block.replaceChild($fragment, $inline);
1223
+ $block2.replaceChild($fragment, $inline);
1260
1224
  } else {
1261
1225
  const [$before, $after] = splitTextNode($text, offset);
1262
1226
  if ($before === null) {
@@ -1273,7 +1237,9 @@ export const insertFromPaste = (data, range, visitor) => {
1273
1237
  }
1274
1238
  return {
1275
1239
  prevent: true,
1276
- range: createCollapsedRange(createEndCursorFromTextContent($pasteLastChild ?? getLastTextContent($block)))
1240
+ range: createCollapsedRange(
1241
+ createEndCursorFromTextContent($pasteLastChild ?? getLastTextContent($block2))
1242
+ )
1277
1243
  };
1278
1244
  }
1279
1245
  const $block = getParentTextBlock($inline);
@@ -1304,39 +1270,46 @@ export const insertFromPaste = (data, range, visitor) => {
1304
1270
  }
1305
1271
  return {
1306
1272
  prevent: true,
1307
- range: createCollapsedRange(createEndCursorFromTextContent(getLastTextContent($lastBlock)))
1273
+ range: createCollapsedRange(
1274
+ createEndCursorFromTextContent(
1275
+ getLastTextContent($lastBlock)
1276
+ )
1277
+ )
1308
1278
  };
1309
1279
  };
1310
1280
  const DEFAULT_ACTION_RESULT = {
1311
1281
  prevent: false
1312
1282
  };
1313
- export const handleEmojiMousedown = $n => {
1283
+ const handleEmojiMousedown = ($n) => {
1314
1284
  if (isEmoji($n)) {
1315
1285
  return {
1316
1286
  prevent: true,
1317
- range: createCollapsedRange(createEndCursorFromTextContent($n))
1287
+ range: createCollapsedRange(
1288
+ createEndCursorFromTextContent($n)
1289
+ )
1318
1290
  };
1319
1291
  }
1320
1292
  return DEFAULT_ACTION_RESULT;
1321
1293
  };
1322
- export const getBeginRange = $root => {
1294
+ const getBeginRange = ($root) => {
1323
1295
  const $block = getFirstTextBlock($root);
1324
1296
  const $inline = getFirstTextContent($block);
1325
- return createCollapsedRange(createBeginCursorFromTextContent($inline));
1297
+ return createCollapsedRange(
1298
+ createBeginCursorFromTextContent($inline)
1299
+ );
1326
1300
  };
1327
- export const getEndRange = $root => {
1301
+ const getEndRange = ($root) => {
1328
1302
  const $block = getLastTextBlock($root);
1329
1303
  const $inline = getLastTextContent($block);
1330
- return createCollapsedRange(createEndCursorFromTextContent($inline));
1304
+ return createCollapsedRange(
1305
+ createEndCursorFromTextContent($inline)
1306
+ );
1331
1307
  };
1332
- export const getSelectionInfo = range => {
1308
+ const getSelectionInfo = (range) => {
1333
1309
  const aCursor = createIncomingCursorFromNodeWithOffset(range.startContainer, range.startOffset);
1334
1310
  const bCursor = createIncomingCursorFromNodeWithOffset(range.endContainer, range.endOffset);
1335
1311
  if (aCursor.$inline === bCursor.$inline) {
1336
- const {
1337
- $text,
1338
- $inline
1339
- } = aCursor;
1312
+ const { $text, $inline } = aCursor;
1340
1313
  if ($text !== null || isInline($inline)) {
1341
1314
  assertInline($inline);
1342
1315
  return {
@@ -1369,19 +1342,19 @@ export const getSelectionInfo = range => {
1369
1342
  ulist: isAllInsideList(false, aCursor.$inline, bCursor.$inline)
1370
1343
  };
1371
1344
  };
1372
- export const isSelectionEqual = (a, b) => {
1345
+ const isSelectionEqual = (a, b) => {
1373
1346
  return a === b || a !== null && b !== null && a.bold === b.bold && a.codetag === b.codetag && a.italic === b.italic && a.link === b.link && a.strikethrough === b.strikethrough && a.olist === b.olist && a.ulist === b.ulist;
1374
1347
  };
1375
- const isEmptyTextBlock = $block => {
1348
+ const isEmptyTextBlock = ($block) => {
1376
1349
  const blockChildren = $block.childNodes;
1377
1350
  if (blockChildren.length > 1) {
1378
1351
  return false;
1379
1352
  }
1380
1353
  const $inline = blockChildren[0];
1381
- const isEmptyText = isInline($inline) && !isFormatCodetag($inline) && isEmptyTextNode(getChildText($inline));
1382
- return isEmptyText;
1354
+ const isEmptyText2 = isInline($inline) && !isFormatCodetag($inline) && isEmptyTextNode(getChildText($inline));
1355
+ return isEmptyText2;
1383
1356
  };
1384
- export const isEditorEmpty = $root => {
1357
+ const isEditorEmpty = ($root) => {
1385
1358
  const rootChildren = $root.childNodes;
1386
1359
  if (rootChildren.length > 1) {
1387
1360
  return false;
@@ -1390,19 +1363,16 @@ export const isEditorEmpty = $root => {
1390
1363
  assertTextBlock($block);
1391
1364
  return isEmptyTextBlock($block);
1392
1365
  };
1393
- const serializeDescriptorReducer = range => (state, $n) => {
1366
+ const serializeDescriptorReducer = (range) => (state, $n) => {
1394
1367
  if (isEmoji($n)) {
1395
- const text = $n.getAttribute(EMOJI_CHAR_ATTR_NAME) ?? '';
1396
- if (text.length > 0) {
1397
- state.push({
1398
- isEmoji: true,
1399
- text
1400
- });
1368
+ const text2 = $n.getAttribute(EMOJI_CHAR_ATTR_NAME) ?? "";
1369
+ if (text2.length > 0) {
1370
+ state.push({ isEmoji: true, text: text2 });
1401
1371
  }
1402
1372
  return state;
1403
1373
  }
1404
1374
  let text = getTextValue(getChildText($n));
1405
- let trailingSpaces = '';
1375
+ let trailingSpaces = "";
1406
1376
  if (range !== null) {
1407
1377
  const [aCursor, bCursor] = range;
1408
1378
  const isACursorPointingHere = aCursor.$inline === $n;
@@ -1419,34 +1389,21 @@ const serializeDescriptorReducer = range => (state, $n) => {
1419
1389
  return state;
1420
1390
  }
1421
1391
  if (isFormatCodetag($n)) {
1422
- state.push({
1423
- isCodetag: true,
1424
- text
1425
- });
1392
+ state.push({ isCodetag: true, text });
1426
1393
  return state;
1427
1394
  }
1428
1395
  if (isFormatLink($n)) {
1429
- const href = $n.getAttribute(LINK_HREF_ATTR_NAME) ?? '#';
1430
- state.push({
1431
- isLink: true,
1432
- text,
1433
- href
1434
- });
1396
+ const href = $n.getAttribute(LINK_HREF_ATTR_NAME) ?? "#";
1397
+ state.push({ isLink: true, text, href });
1435
1398
  return state;
1436
1399
  }
1437
1400
  const leadingNonSpaceIndex = text.search(/\S/);
1438
1401
  if (leadingNonSpaceIndex < 0) {
1439
- state.push({
1440
- isWhitespace: true,
1441
- text
1442
- });
1402
+ state.push({ isWhitespace: true, text });
1443
1403
  return state;
1444
1404
  }
1445
1405
  if (leadingNonSpaceIndex > 0) {
1446
- state.push({
1447
- isWhitespace: true,
1448
- text: text.substring(0, leadingNonSpaceIndex)
1449
- });
1406
+ state.push({ isWhitespace: true, text: text.substring(0, leadingNonSpaceIndex) });
1450
1407
  text = text.substring(leadingNonSpaceIndex);
1451
1408
  }
1452
1409
  const trailingSpaceIndex = text.search(/\s+$/);
@@ -1461,30 +1418,25 @@ const serializeDescriptorReducer = range => (state, $n) => {
1461
1418
  text
1462
1419
  });
1463
1420
  if (trailingSpaces.length > 0) {
1464
- state.push({
1465
- isWhitespace: true,
1466
- text: trailingSpaces
1467
- });
1421
+ state.push({ isWhitespace: true, text: trailingSpaces });
1468
1422
  }
1469
1423
  return state;
1470
1424
  };
1471
- const MD_STRIKE_TOKEN = '~~';
1472
- const MD_EM3_STAR_TOKEN = '***';
1473
- const MD_EM2_STAR_TOKEN = '**';
1474
- const MD_EM1_STAR_TOKEN = '*';
1475
- const MD_EM3_UNDERSCORE_TOKEN = '___';
1476
- const MD_EM2_UNDERSCORE_TOKEN = '__';
1477
- const MD_EM1_UNDERSCORE_TOKEN = '_';
1478
- const MD_LINEBREAK_TOKEN = ' \n';
1479
- const MD_CODETAG_TOKEN = '`';
1480
- const MD_ULISTITEM_TOKEN = '*';
1481
- const MD_OLISTITEM_TOKEN = '1.';
1482
- const MD_LISTITEM_JOIN = '\n';
1483
- const MD_PARAGRAPH_JOIN = '\n\n';
1425
+ const MD_STRIKE_TOKEN = "~~";
1426
+ const MD_EM3_STAR_TOKEN = "***";
1427
+ const MD_EM2_STAR_TOKEN = "**";
1428
+ const MD_EM1_STAR_TOKEN = "*";
1429
+ const MD_EM3_UNDERSCORE_TOKEN = "___";
1430
+ const MD_EM2_UNDERSCORE_TOKEN = "__";
1431
+ const MD_EM1_UNDERSCORE_TOKEN = "_";
1432
+ const MD_LINEBREAK_TOKEN = " \n";
1433
+ const MD_CODETAG_TOKEN = "`";
1434
+ const MD_ULISTITEM_TOKEN = "*";
1435
+ const MD_OLISTITEM_TOKEN = "1.";
1436
+ const MD_LISTITEM_JOIN = "\n";
1437
+ const MD_PARAGRAPH_JOIN = "\n\n";
1484
1438
  const serializeTextReducer = (state, desc, i, descArray) => {
1485
- const {
1486
- chunks
1487
- } = state;
1439
+ const { chunks } = state;
1488
1440
  if (desc.isLink === true) {
1489
1441
  chunks.push(`[${desc.text}](${desc.href})`);
1490
1442
  return state;
@@ -1504,11 +1456,7 @@ const serializeTextReducer = (state, desc, i, descArray) => {
1504
1456
  const prev = i === 0 ? null : descArray[i - 1];
1505
1457
  const next = i >= descArray.length - 1 ? null : descArray[i + 1];
1506
1458
  const shouldUseUnderscores = (i - state.lastUnderscoreIndex) % 2 === 0 && (prev === null || prev.isBold === true || prev.isItalic === true || prev.isWhitespace === true || prev.isCodetag === true) && (next === null || next.isBold === true || next.isItalic === true || next.isWhitespace === true || next.isCodetag === true);
1507
- const {
1508
- isBold,
1509
- isItalic,
1510
- isStrikethrough
1511
- } = desc;
1459
+ const { isBold, isItalic, isStrikethrough } = desc;
1512
1460
  if (shouldUseUnderscores) {
1513
1461
  state.lastUnderscoreIndex = i;
1514
1462
  }
@@ -1547,16 +1495,26 @@ const serializeTextBlock = ($n, range) => {
1547
1495
  } else {
1548
1496
  children = Array.from($n.childNodes);
1549
1497
  }
1550
- const result = children.reduce(serializeDescriptorReducer(range), []).reduce(serializeTextReducer, {
1551
- lastUnderscoreIndex: 0,
1552
- chunks: []
1553
- });
1554
- return result.chunks.join('');
1498
+ const result = children.reduce(
1499
+ serializeDescriptorReducer(range),
1500
+ []
1501
+ ).reduce(
1502
+ serializeTextReducer,
1503
+ {
1504
+ lastUnderscoreIndex: 0,
1505
+ chunks: []
1506
+ }
1507
+ );
1508
+ return result.chunks.join("");
1555
1509
  };
1556
1510
  const serializeListItemIndent = (level, isOrderedStack) => {
1557
- let res = '';
1511
+ let res = "";
1558
1512
  for (let i = 0; i < level; i++) {
1559
- res = res.concat(isOrderedStack[i] ? ' ' : ' ', ' ');
1513
+ res = res.concat(
1514
+ isOrderedStack[i] ? " " : " ",
1515
+ // MD_ULISTITEM_TOKEN.length
1516
+ " "
1517
+ );
1560
1518
  }
1561
1519
  return res;
1562
1520
  };
@@ -1585,15 +1543,19 @@ const serializeRoot = ($root, range) => {
1585
1543
  const paragraphChunks = [];
1586
1544
  const flushListChunks = () => {
1587
1545
  if (listChunks.length > 0) {
1588
- chunks.push(listChunks.join(MD_LISTITEM_JOIN));
1546
+ chunks.push(
1547
+ listChunks.join(MD_LISTITEM_JOIN)
1548
+ );
1589
1549
  listChunks.length = 0;
1590
1550
  }
1591
1551
  };
1592
1552
  const flushParagraphChunks = () => {
1593
1553
  if (paragraphChunks.length > 0) {
1594
- chunks.push(paragraphChunks.reduce((a, b) => {
1595
- return b.length > 0 ? a.concat(MD_LINEBREAK_TOKEN, b) : a.concat('<br>');
1596
- }));
1554
+ chunks.push(
1555
+ paragraphChunks.reduce((a, b) => {
1556
+ return b.length > 0 ? a.concat(MD_LINEBREAK_TOKEN, b) : a.concat("<br>");
1557
+ })
1558
+ );
1597
1559
  paragraphChunks.length = 0;
1598
1560
  }
1599
1561
  };
@@ -1605,18 +1567,22 @@ const serializeRoot = ($root, range) => {
1605
1567
  if (isMainList) {
1606
1568
  flushListChunks();
1607
1569
  }
1608
- listChunks.push(serializeListItem($child, listIsOrderedStack, range));
1570
+ listChunks.push(
1571
+ serializeListItem($child, listIsOrderedStack, range)
1572
+ );
1609
1573
  } else {
1610
1574
  assertTextBlock($child);
1611
1575
  flushListChunks();
1612
- paragraphChunks.push(serializeTextBlock($child, range));
1576
+ paragraphChunks.push(
1577
+ serializeTextBlock($child, range)
1578
+ );
1613
1579
  }
1614
1580
  }
1615
1581
  flushListChunks();
1616
1582
  flushParagraphChunks();
1617
1583
  return chunks.join(MD_PARAGRAPH_JOIN);
1618
1584
  };
1619
- export const serializeMarkdown = ($root, range) => {
1585
+ const serializeMarkdown = ($root, range) => {
1620
1586
  if (range !== null) {
1621
1587
  const aCursor = createIncomingCursorFromNodeWithOffset(range.startContainer, range.startOffset);
1622
1588
  const bCursor = createIncomingCursorFromNodeWithOffset(range.endContainer, range.endOffset);
@@ -1624,7 +1590,7 @@ export const serializeMarkdown = ($root, range) => {
1624
1590
  }
1625
1591
  return serializeRoot($root, null);
1626
1592
  };
1627
- export const createParseVisitor = doc => {
1593
+ const createParseVisitor = (doc) => {
1628
1594
  let emojiBaseUrl = null;
1629
1595
  return {
1630
1596
  updateEmojiBaseUrl(url) {
@@ -1651,19 +1617,14 @@ export const createParseVisitor = doc => {
1651
1617
  },
1652
1618
  codetag(text) {
1653
1619
  const $inline = createInlineWithText(text, doc);
1654
- setInlineFormat($inline, 'c', true);
1620
+ setInlineFormat($inline, "c", true);
1655
1621
  $currentBlock.appendChild($inline);
1656
1622
  },
1657
- inline(text, _ref2) {
1658
- let {
1659
- isBold,
1660
- isItalic,
1661
- isStrikethrough
1662
- } = _ref2;
1623
+ inline(text, { isBold, isItalic, isStrikethrough }) {
1663
1624
  const $inline = createInlineWithText(text, doc);
1664
- setInlineFormat($inline, 'b', isBold === true);
1665
- setInlineFormat($inline, 'i', isItalic === true);
1666
- setInlineFormat($inline, 's', isStrikethrough === true);
1625
+ setInlineFormat($inline, "b", isBold === true);
1626
+ setInlineFormat($inline, "i", isItalic === true);
1627
+ setInlineFormat($inline, "s", isStrikethrough === true);
1667
1628
  $currentBlock.appendChild($inline);
1668
1629
  },
1669
1630
  linebreak() {
@@ -1690,9 +1651,7 @@ export const createParseVisitor = doc => {
1690
1651
  },
1691
1652
  listItem() {
1692
1653
  const listLevel = listsStack.length - 1;
1693
- const {
1694
- isOrdered
1695
- } = listsStack.at(-1);
1654
+ const { isOrdered } = listsStack.at(-1);
1696
1655
  const $li = createActuallyEmptyListItem(isOrdered, listLevel, doc);
1697
1656
  if (listsStack.length === 1 && isFirstListItem) {
1698
1657
  markListItemAsBlock($li);
@@ -1720,13 +1679,7 @@ export const createParseVisitor = doc => {
1720
1679
  }
1721
1680
  };
1722
1681
  };
1723
- export const setBrowserCaret = _ref3 => {
1724
- let {
1725
- startContainer,
1726
- startOffset,
1727
- endContainer,
1728
- endOffset
1729
- } = _ref3;
1682
+ const setBrowserCaret = ({ startContainer, startOffset, endContainer, endOffset }) => {
1730
1683
  const selection = document.getSelection();
1731
1684
  if (selection === null) {
1732
1685
  return;
@@ -1736,4 +1689,24 @@ export const setBrowserCaret = _ref3 => {
1736
1689
  range.setStart(startContainer, startOffset);
1737
1690
  range.setEnd(endContainer, endOffset);
1738
1691
  selection.addRange(range);
1739
- };
1692
+ };
1693
+ export {
1694
+ createParseVisitor,
1695
+ deleteContentBackward,
1696
+ formatIndent,
1697
+ formatInline,
1698
+ formatList,
1699
+ formatOutdent,
1700
+ getBeginRange,
1701
+ getEndRange,
1702
+ getSelectionInfo,
1703
+ handleEmojiMousedown,
1704
+ insertFromPaste,
1705
+ insertLineBreak,
1706
+ insertLink,
1707
+ insertText,
1708
+ isEditorEmpty,
1709
+ isSelectionEqual,
1710
+ serializeMarkdown,
1711
+ setBrowserCaret
1712
+ };