@react-fabric/lexical 1.0.0-beta.61 → 1.0.0-beta.62

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 (359) hide show
  1. package/css/_lexical.css +61 -0
  2. package/dist/cjs/node_modules/date-fns/_lib/addLeadingZeros.js +9 -0
  3. package/dist/cjs/node_modules/date-fns/_lib/defaultOptions.js +9 -0
  4. package/dist/cjs/node_modules/date-fns/_lib/format/formatters.js +779 -0
  5. package/dist/cjs/node_modules/date-fns/_lib/format/lightFormatters.js +96 -0
  6. package/dist/cjs/node_modules/date-fns/_lib/format/longFormatters.js +68 -0
  7. package/dist/cjs/node_modules/date-fns/_lib/getRoundingMethod.js +12 -0
  8. package/dist/cjs/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +33 -0
  9. package/dist/cjs/node_modules/date-fns/_lib/normalizeDates.js +13 -0
  10. package/dist/cjs/node_modules/date-fns/_lib/normalizeInterval.js +10 -0
  11. package/dist/cjs/node_modules/date-fns/_lib/protectedTokens.js +29 -0
  12. package/dist/cjs/node_modules/date-fns/add.js +73 -0
  13. package/dist/cjs/node_modules/date-fns/addDays.js +46 -0
  14. package/dist/cjs/node_modules/date-fns/addHours.js +39 -0
  15. package/dist/cjs/node_modules/date-fns/addMilliseconds.js +39 -0
  16. package/dist/cjs/node_modules/date-fns/addMinutes.js +41 -0
  17. package/dist/cjs/node_modules/date-fns/addMonths.js +80 -0
  18. package/dist/cjs/node_modules/date-fns/addQuarters.js +38 -0
  19. package/dist/cjs/node_modules/date-fns/addWeeks.js +38 -0
  20. package/dist/cjs/node_modules/date-fns/addYears.js +38 -0
  21. package/dist/cjs/node_modules/date-fns/compareAsc.js +50 -0
  22. package/dist/cjs/node_modules/date-fns/constants.js +66 -0
  23. package/dist/cjs/node_modules/date-fns/constructFrom.js +54 -0
  24. package/dist/cjs/node_modules/date-fns/differenceInCalendarDays.js +67 -0
  25. package/dist/cjs/node_modules/date-fns/differenceInCalendarMonths.js +47 -0
  26. package/dist/cjs/node_modules/date-fns/differenceInCalendarYears.js +43 -0
  27. package/dist/cjs/node_modules/date-fns/differenceInDays.js +112 -0
  28. package/dist/cjs/node_modules/date-fns/differenceInHours.js +46 -0
  29. package/dist/cjs/node_modules/date-fns/differenceInMilliseconds.js +34 -0
  30. package/dist/cjs/node_modules/date-fns/differenceInMinutes.js +50 -0
  31. package/dist/cjs/node_modules/date-fns/differenceInMonths.js +65 -0
  32. package/dist/cjs/node_modules/date-fns/differenceInSeconds.js +41 -0
  33. package/dist/cjs/node_modules/date-fns/differenceInYears.js +67 -0
  34. package/dist/cjs/node_modules/date-fns/endOfDay.js +40 -0
  35. package/dist/cjs/node_modules/date-fns/endOfDecade.js +45 -0
  36. package/dist/cjs/node_modules/date-fns/endOfHour.js +40 -0
  37. package/dist/cjs/node_modules/date-fns/endOfMinute.js +40 -0
  38. package/dist/cjs/node_modules/date-fns/endOfMonth.js +42 -0
  39. package/dist/cjs/node_modules/date-fns/endOfQuarter.js +43 -0
  40. package/dist/cjs/node_modules/date-fns/endOfWeek.js +58 -0
  41. package/dist/cjs/node_modules/date-fns/endOfYear.js +42 -0
  42. package/dist/cjs/node_modules/date-fns/format.js +431 -0
  43. package/dist/cjs/node_modules/date-fns/getDayOfYear.js +39 -0
  44. package/dist/cjs/node_modules/date-fns/getISOWeek.js +45 -0
  45. package/dist/cjs/node_modules/date-fns/getISOWeekYear.js +57 -0
  46. package/dist/cjs/node_modules/date-fns/getWeek.js +59 -0
  47. package/dist/cjs/node_modules/date-fns/getWeekYear.js +80 -0
  48. package/dist/cjs/node_modules/date-fns/intervalToDuration.js +70 -0
  49. package/dist/cjs/node_modules/date-fns/isAfter.js +30 -0
  50. package/dist/cjs/node_modules/date-fns/isBefore.js +30 -0
  51. package/dist/cjs/node_modules/date-fns/isDate.js +46 -0
  52. package/dist/cjs/node_modules/date-fns/isLastDayOfMonth.js +33 -0
  53. package/dist/cjs/node_modules/date-fns/isSameMonth.js +48 -0
  54. package/dist/cjs/node_modules/date-fns/isSameWeek.js +56 -0
  55. package/dist/cjs/node_modules/date-fns/isSameYear.js +40 -0
  56. package/dist/cjs/node_modules/date-fns/isValid.js +44 -0
  57. package/dist/cjs/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +12 -0
  58. package/dist/cjs/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +66 -0
  59. package/dist/cjs/node_modules/date-fns/locale/_lib/buildMatchFn.js +61 -0
  60. package/dist/cjs/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +24 -0
  61. package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatDistance.js +139 -0
  62. package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatLong.js +43 -0
  63. package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatRelative.js +15 -0
  64. package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/localize.js +166 -0
  65. package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/match.js +146 -0
  66. package/dist/cjs/node_modules/date-fns/locale/ar-SA.js +32 -0
  67. package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatDistance.js +200 -0
  68. package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatLong.js +44 -0
  69. package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatRelative.js +15 -0
  70. package/dist/cjs/node_modules/date-fns/locale/de/_lib/localize.js +195 -0
  71. package/dist/cjs/node_modules/date-fns/locale/de/_lib/match.js +138 -0
  72. package/dist/cjs/node_modules/date-fns/locale/de.js +36 -0
  73. package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +105 -0
  74. package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatLong.js +43 -0
  75. package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +15 -0
  76. package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/localize.js +191 -0
  77. package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/match.js +136 -0
  78. package/dist/cjs/node_modules/date-fns/locale/en-US.js +33 -0
  79. package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatDistance.js +105 -0
  80. package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatLong.js +43 -0
  81. package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatRelative.js +29 -0
  82. package/dist/cjs/node_modules/date-fns/locale/es/_lib/localize.js +168 -0
  83. package/dist/cjs/node_modules/date-fns/locale/es/_lib/match.js +142 -0
  84. package/dist/cjs/node_modules/date-fns/locale/es.js +36 -0
  85. package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatDistance.js +104 -0
  86. package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatLong.js +43 -0
  87. package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatRelative.js +15 -0
  88. package/dist/cjs/node_modules/date-fns/locale/fr/_lib/localize.js +169 -0
  89. package/dist/cjs/node_modules/date-fns/locale/fr/_lib/match.js +137 -0
  90. package/dist/cjs/node_modules/date-fns/locale/fr.js +33 -0
  91. package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatDistance.js +109 -0
  92. package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatLong.js +43 -0
  93. package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatRelative.js +15 -0
  94. package/dist/cjs/node_modules/date-fns/locale/hi/_lib/localize.js +233 -0
  95. package/dist/cjs/node_modules/date-fns/locale/hi/_lib/match.js +141 -0
  96. package/dist/cjs/node_modules/date-fns/locale/hi.js +32 -0
  97. package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatDistance.js +105 -0
  98. package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatLong.js +43 -0
  99. package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatRelative.js +70 -0
  100. package/dist/cjs/node_modules/date-fns/locale/it/_lib/localize.js +168 -0
  101. package/dist/cjs/node_modules/date-fns/locale/it/_lib/match.js +137 -0
  102. package/dist/cjs/node_modules/date-fns/locale/it.js +34 -0
  103. package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatDistance.js +119 -0
  104. package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatLong.js +43 -0
  105. package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatRelative.js +16 -0
  106. package/dist/cjs/node_modules/date-fns/locale/ja/_lib/localize.js +181 -0
  107. package/dist/cjs/node_modules/date-fns/locale/ja/_lib/match.js +122 -0
  108. package/dist/cjs/node_modules/date-fns/locale/ja.js +36 -0
  109. package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatDistance.js +105 -0
  110. package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatLong.js +43 -0
  111. package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatRelative.js +15 -0
  112. package/dist/cjs/node_modules/date-fns/locale/ko/_lib/localize.js +171 -0
  113. package/dist/cjs/node_modules/date-fns/locale/ko/_lib/match.js +119 -0
  114. package/dist/cjs/node_modules/date-fns/locale/ko.js +34 -0
  115. package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatDistance.js +105 -0
  116. package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatLong.js +43 -0
  117. package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatRelative.js +26 -0
  118. package/dist/cjs/node_modules/date-fns/locale/pt/_lib/localize.js +168 -0
  119. package/dist/cjs/node_modules/date-fns/locale/pt/_lib/match.js +141 -0
  120. package/dist/cjs/node_modules/date-fns/locale/pt.js +33 -0
  121. package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatDistance.js +250 -0
  122. package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatLong.js +40 -0
  123. package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatRelative.js +92 -0
  124. package/dist/cjs/node_modules/date-fns/locale/ru/_lib/localize.js +214 -0
  125. package/dist/cjs/node_modules/date-fns/locale/ru/_lib/match.js +142 -0
  126. package/dist/cjs/node_modules/date-fns/locale/ru.js +33 -0
  127. package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js +105 -0
  128. package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js +43 -0
  129. package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js +35 -0
  130. package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/localize.js +187 -0
  131. package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/match.js +134 -0
  132. package/dist/cjs/node_modules/date-fns/locale/zh-CN.js +36 -0
  133. package/dist/cjs/node_modules/date-fns/startOfDay.js +40 -0
  134. package/dist/cjs/node_modules/date-fns/startOfDecade.js +45 -0
  135. package/dist/cjs/node_modules/date-fns/startOfHour.js +40 -0
  136. package/dist/cjs/node_modules/date-fns/startOfISOWeek.js +40 -0
  137. package/dist/cjs/node_modules/date-fns/startOfISOWeekYear.js +47 -0
  138. package/dist/cjs/node_modules/date-fns/startOfMinute.js +40 -0
  139. package/dist/cjs/node_modules/date-fns/startOfMonth.js +42 -0
  140. package/dist/cjs/node_modules/date-fns/startOfQuarter.js +43 -0
  141. package/dist/cjs/node_modules/date-fns/startOfWeek.js +58 -0
  142. package/dist/cjs/node_modules/date-fns/startOfWeekYear.js +69 -0
  143. package/dist/cjs/node_modules/date-fns/startOfYear.js +41 -0
  144. package/dist/cjs/node_modules/date-fns/toDate.js +51 -0
  145. package/dist/cjs/packages/date/dist/esm/display/DateDuration.js +178 -0
  146. package/dist/cjs/packages/date/dist/esm/hijri/DateConverter.js +154 -0
  147. package/dist/cjs/packages/date/dist/esm/hijri/FormatDate.js +116 -0
  148. package/dist/cjs/packages/date/dist/esm/hijri/HijriDate.js +531 -0
  149. package/dist/cjs/packages/date/dist/esm/hijri/StringDateParser.js +74 -0
  150. package/dist/cjs/packages/date/dist/esm/hijri/index.js +21 -0
  151. package/dist/cjs/packages/date/dist/esm/hijri/initializer.js +113 -0
  152. package/dist/cjs/packages/date/dist/esm/hijri/locales.js +19 -0
  153. package/dist/cjs/packages/date/dist/esm/hijri/safe.js +17 -0
  154. package/dist/cjs/packages/date/dist/esm/i18n/ar/date.json.js +213 -0
  155. package/dist/cjs/packages/date/dist/esm/i18n/en/date.json.js +83 -0
  156. package/{src/plugins/StickyPlugin.ts → dist/cjs/packages/date/dist/esm/i18n/index.js} +10 -15
  157. package/dist/cjs/packages/date/dist/esm/types/index.js +46 -0
  158. package/dist/cjs/packages/date/dist/esm/utils/dateUtil.js +472 -0
  159. package/dist/cjs/{editor → packages/lexical/src/editor}/LexicalEditor.js +32 -9
  160. package/dist/cjs/{i18n/ar.json.js → packages/lexical/src/i18n/ar/lexical.json.js} +10 -4
  161. package/dist/cjs/{i18n/en.json.js → packages/lexical/src/i18n/en/lexical.json.js} +7 -1
  162. package/dist/cjs/{i18n → packages/lexical/src/i18n}/index.js +4 -4
  163. package/dist/cjs/packages/lexical/src/plugins/CommentPlugin.js +477 -0
  164. package/dist/cjs/{plugins → packages/lexical/src/plugins}/DraggableBlockPlugin.js +8 -11
  165. package/dist/esm/node_modules/date-fns/_lib/addLeadingZeros.js +9 -0
  166. package/dist/esm/node_modules/date-fns/_lib/defaultOptions.js +9 -0
  167. package/dist/esm/node_modules/date-fns/_lib/format/formatters.js +779 -0
  168. package/dist/esm/node_modules/date-fns/_lib/format/lightFormatters.js +96 -0
  169. package/dist/esm/node_modules/date-fns/_lib/format/longFormatters.js +68 -0
  170. package/dist/esm/node_modules/date-fns/_lib/getRoundingMethod.js +12 -0
  171. package/dist/esm/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +33 -0
  172. package/dist/esm/node_modules/date-fns/_lib/normalizeDates.js +13 -0
  173. package/dist/esm/node_modules/date-fns/_lib/normalizeInterval.js +10 -0
  174. package/dist/esm/node_modules/date-fns/_lib/protectedTokens.js +27 -0
  175. package/dist/esm/node_modules/date-fns/add.js +70 -0
  176. package/dist/esm/node_modules/date-fns/addDays.js +43 -0
  177. package/dist/esm/node_modules/date-fns/addHours.js +36 -0
  178. package/dist/esm/node_modules/date-fns/addMilliseconds.js +36 -0
  179. package/dist/esm/node_modules/date-fns/addMinutes.js +38 -0
  180. package/dist/esm/node_modules/date-fns/addMonths.js +77 -0
  181. package/dist/esm/node_modules/date-fns/addQuarters.js +35 -0
  182. package/dist/esm/node_modules/date-fns/addWeeks.js +35 -0
  183. package/dist/esm/node_modules/date-fns/addYears.js +35 -0
  184. package/dist/esm/node_modules/date-fns/compareAsc.js +47 -0
  185. package/dist/esm/node_modules/date-fns/constants.js +62 -0
  186. package/dist/esm/node_modules/date-fns/constructFrom.js +51 -0
  187. package/dist/esm/node_modules/date-fns/differenceInCalendarDays.js +64 -0
  188. package/dist/esm/node_modules/date-fns/differenceInCalendarMonths.js +44 -0
  189. package/dist/esm/node_modules/date-fns/differenceInCalendarYears.js +40 -0
  190. package/dist/esm/node_modules/date-fns/differenceInDays.js +109 -0
  191. package/dist/esm/node_modules/date-fns/differenceInHours.js +43 -0
  192. package/dist/esm/node_modules/date-fns/differenceInMilliseconds.js +31 -0
  193. package/dist/esm/node_modules/date-fns/differenceInMinutes.js +47 -0
  194. package/dist/esm/node_modules/date-fns/differenceInMonths.js +62 -0
  195. package/dist/esm/node_modules/date-fns/differenceInSeconds.js +38 -0
  196. package/dist/esm/node_modules/date-fns/differenceInYears.js +64 -0
  197. package/dist/esm/node_modules/date-fns/endOfDay.js +37 -0
  198. package/dist/esm/node_modules/date-fns/endOfDecade.js +42 -0
  199. package/dist/esm/node_modules/date-fns/endOfHour.js +37 -0
  200. package/dist/esm/node_modules/date-fns/endOfMinute.js +37 -0
  201. package/dist/esm/node_modules/date-fns/endOfMonth.js +39 -0
  202. package/dist/esm/node_modules/date-fns/endOfQuarter.js +40 -0
  203. package/dist/esm/node_modules/date-fns/endOfWeek.js +55 -0
  204. package/dist/esm/node_modules/date-fns/endOfYear.js +39 -0
  205. package/dist/esm/node_modules/date-fns/format.js +425 -0
  206. package/dist/esm/node_modules/date-fns/getDayOfYear.js +36 -0
  207. package/dist/esm/node_modules/date-fns/getISOWeek.js +42 -0
  208. package/dist/esm/node_modules/date-fns/getISOWeekYear.js +54 -0
  209. package/dist/esm/node_modules/date-fns/getWeek.js +56 -0
  210. package/dist/esm/node_modules/date-fns/getWeekYear.js +77 -0
  211. package/dist/esm/node_modules/date-fns/intervalToDuration.js +67 -0
  212. package/dist/esm/node_modules/date-fns/isAfter.js +27 -0
  213. package/dist/esm/node_modules/date-fns/isBefore.js +27 -0
  214. package/dist/esm/node_modules/date-fns/isDate.js +43 -0
  215. package/dist/esm/node_modules/date-fns/isLastDayOfMonth.js +30 -0
  216. package/dist/esm/node_modules/date-fns/isSameMonth.js +45 -0
  217. package/dist/esm/node_modules/date-fns/isSameWeek.js +53 -0
  218. package/dist/esm/node_modules/date-fns/isSameYear.js +37 -0
  219. package/dist/esm/node_modules/date-fns/isValid.js +41 -0
  220. package/dist/esm/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +12 -0
  221. package/dist/esm/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +66 -0
  222. package/dist/esm/node_modules/date-fns/locale/_lib/buildMatchFn.js +61 -0
  223. package/dist/esm/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +24 -0
  224. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatDistance.js +139 -0
  225. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatLong.js +43 -0
  226. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatRelative.js +15 -0
  227. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/localize.js +166 -0
  228. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/match.js +146 -0
  229. package/dist/esm/node_modules/date-fns/locale/ar-SA.js +29 -0
  230. package/dist/esm/node_modules/date-fns/locale/de/_lib/formatDistance.js +200 -0
  231. package/dist/esm/node_modules/date-fns/locale/de/_lib/formatLong.js +44 -0
  232. package/dist/esm/node_modules/date-fns/locale/de/_lib/formatRelative.js +15 -0
  233. package/dist/esm/node_modules/date-fns/locale/de/_lib/localize.js +195 -0
  234. package/dist/esm/node_modules/date-fns/locale/de/_lib/match.js +138 -0
  235. package/dist/esm/node_modules/date-fns/locale/de.js +33 -0
  236. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +105 -0
  237. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatLong.js +43 -0
  238. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +15 -0
  239. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/localize.js +191 -0
  240. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/match.js +136 -0
  241. package/dist/esm/node_modules/date-fns/locale/en-US.js +30 -0
  242. package/dist/esm/node_modules/date-fns/locale/es/_lib/formatDistance.js +105 -0
  243. package/dist/esm/node_modules/date-fns/locale/es/_lib/formatLong.js +43 -0
  244. package/dist/esm/node_modules/date-fns/locale/es/_lib/formatRelative.js +29 -0
  245. package/dist/esm/node_modules/date-fns/locale/es/_lib/localize.js +168 -0
  246. package/dist/esm/node_modules/date-fns/locale/es/_lib/match.js +142 -0
  247. package/dist/esm/node_modules/date-fns/locale/es.js +33 -0
  248. package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatDistance.js +104 -0
  249. package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatLong.js +43 -0
  250. package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatRelative.js +15 -0
  251. package/dist/esm/node_modules/date-fns/locale/fr/_lib/localize.js +169 -0
  252. package/dist/esm/node_modules/date-fns/locale/fr/_lib/match.js +137 -0
  253. package/dist/esm/node_modules/date-fns/locale/fr.js +30 -0
  254. package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatDistance.js +109 -0
  255. package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatLong.js +43 -0
  256. package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatRelative.js +15 -0
  257. package/dist/esm/node_modules/date-fns/locale/hi/_lib/localize.js +231 -0
  258. package/dist/esm/node_modules/date-fns/locale/hi/_lib/match.js +141 -0
  259. package/dist/esm/node_modules/date-fns/locale/hi.js +29 -0
  260. package/dist/esm/node_modules/date-fns/locale/it/_lib/formatDistance.js +105 -0
  261. package/dist/esm/node_modules/date-fns/locale/it/_lib/formatLong.js +43 -0
  262. package/dist/esm/node_modules/date-fns/locale/it/_lib/formatRelative.js +70 -0
  263. package/dist/esm/node_modules/date-fns/locale/it/_lib/localize.js +168 -0
  264. package/dist/esm/node_modules/date-fns/locale/it/_lib/match.js +137 -0
  265. package/dist/esm/node_modules/date-fns/locale/it.js +31 -0
  266. package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatDistance.js +119 -0
  267. package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatLong.js +43 -0
  268. package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatRelative.js +16 -0
  269. package/dist/esm/node_modules/date-fns/locale/ja/_lib/localize.js +181 -0
  270. package/dist/esm/node_modules/date-fns/locale/ja/_lib/match.js +122 -0
  271. package/dist/esm/node_modules/date-fns/locale/ja.js +33 -0
  272. package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatDistance.js +105 -0
  273. package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatLong.js +43 -0
  274. package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatRelative.js +15 -0
  275. package/dist/esm/node_modules/date-fns/locale/ko/_lib/localize.js +171 -0
  276. package/dist/esm/node_modules/date-fns/locale/ko/_lib/match.js +119 -0
  277. package/dist/esm/node_modules/date-fns/locale/ko.js +31 -0
  278. package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatDistance.js +105 -0
  279. package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatLong.js +43 -0
  280. package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatRelative.js +26 -0
  281. package/dist/esm/node_modules/date-fns/locale/pt/_lib/localize.js +168 -0
  282. package/dist/esm/node_modules/date-fns/locale/pt/_lib/match.js +141 -0
  283. package/dist/esm/node_modules/date-fns/locale/pt.js +30 -0
  284. package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatDistance.js +250 -0
  285. package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatLong.js +40 -0
  286. package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatRelative.js +92 -0
  287. package/dist/esm/node_modules/date-fns/locale/ru/_lib/localize.js +214 -0
  288. package/dist/esm/node_modules/date-fns/locale/ru/_lib/match.js +142 -0
  289. package/dist/esm/node_modules/date-fns/locale/ru.js +30 -0
  290. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js +105 -0
  291. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js +43 -0
  292. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js +35 -0
  293. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/localize.js +187 -0
  294. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/match.js +134 -0
  295. package/dist/esm/node_modules/date-fns/locale/zh-CN.js +33 -0
  296. package/dist/esm/node_modules/date-fns/startOfDay.js +37 -0
  297. package/dist/esm/node_modules/date-fns/startOfDecade.js +42 -0
  298. package/dist/esm/node_modules/date-fns/startOfHour.js +37 -0
  299. package/dist/esm/node_modules/date-fns/startOfISOWeek.js +37 -0
  300. package/dist/esm/node_modules/date-fns/startOfISOWeekYear.js +44 -0
  301. package/dist/esm/node_modules/date-fns/startOfMinute.js +37 -0
  302. package/dist/esm/node_modules/date-fns/startOfMonth.js +39 -0
  303. package/dist/esm/node_modules/date-fns/startOfQuarter.js +40 -0
  304. package/dist/esm/node_modules/date-fns/startOfWeek.js +55 -0
  305. package/dist/esm/node_modules/date-fns/startOfWeekYear.js +66 -0
  306. package/dist/esm/node_modules/date-fns/startOfYear.js +38 -0
  307. package/dist/esm/node_modules/date-fns/toDate.js +48 -0
  308. package/dist/esm/packages/date/dist/esm/display/DateDuration.js +178 -0
  309. package/dist/esm/packages/date/dist/esm/hijri/DateConverter.js +152 -0
  310. package/dist/esm/packages/date/dist/esm/hijri/FormatDate.js +113 -0
  311. package/dist/esm/packages/date/dist/esm/hijri/HijriDate.js +528 -0
  312. package/dist/esm/packages/date/dist/esm/hijri/StringDateParser.js +74 -0
  313. package/dist/esm/packages/date/dist/esm/hijri/index.js +21 -0
  314. package/dist/esm/packages/date/dist/esm/hijri/initializer.js +113 -0
  315. package/dist/esm/packages/date/dist/esm/hijri/locales.js +18 -0
  316. package/dist/esm/packages/date/dist/esm/hijri/safe.js +14 -0
  317. package/dist/esm/packages/date/dist/esm/i18n/ar/date.json.js +209 -0
  318. package/dist/esm/packages/date/dist/esm/i18n/en/date.json.js +79 -0
  319. package/dist/esm/packages/date/dist/esm/i18n/index.js +33 -0
  320. package/dist/esm/packages/date/dist/esm/types/index.js +45 -0
  321. package/dist/esm/packages/date/dist/esm/utils/dateUtil.js +474 -0
  322. package/dist/esm/{editor → packages/lexical/src/editor}/LexicalEditor.js +33 -10
  323. package/dist/esm/{i18n/ar.json.js → packages/lexical/src/i18n/ar/lexical.json.js} +9 -5
  324. package/dist/esm/{i18n/en.json.js → packages/lexical/src/i18n/en/lexical.json.js} +6 -2
  325. package/dist/esm/{i18n → packages/lexical/src/i18n}/index.js +2 -2
  326. package/dist/esm/packages/lexical/src/plugins/CommentPlugin.js +477 -0
  327. package/dist/esm/{plugins → packages/lexical/src/plugins}/DraggableBlockPlugin.js +9 -12
  328. package/dist/types/editor/LexicalEditor.d.ts +12 -3
  329. package/dist/types/hooks/useFormatWatcher.d.ts +1 -1
  330. package/dist/types/plugins/CommentPlugin.d.ts +5 -0
  331. package/dist/types/plugins/DraggableBlockPlugin.d.ts +2 -1
  332. package/package.json +5 -5
  333. package/src/editor/LexicalEditor.tsx +65 -18
  334. package/src/i18n/{ar.json → ar/lexical.json} +6 -4
  335. package/src/i18n/{en.json → en/lexical.json} +3 -1
  336. package/src/i18n/index.ts +2 -2
  337. package/src/plugins/CommentPlugin.tsx +554 -0
  338. package/src/plugins/DraggableBlockPlugin.tsx +5 -10
  339. package/dist/cjs/components/StickyComponent.js +0 -220
  340. package/dist/cjs/nodes/StickyNode.js +0 -218
  341. package/dist/cjs/plugins/StickyPlugin.js +0 -20
  342. package/dist/esm/components/StickyComponent.js +0 -220
  343. package/dist/esm/nodes/StickyNode.js +0 -216
  344. package/dist/esm/plugins/StickyPlugin.js +0 -20
  345. package/dist/types/components/StickyComponent.d.ts +0 -9
  346. package/dist/types/nodes/StickyNode.d.ts +0 -34
  347. package/dist/types/plugins/StickyPlugin.d.ts +0 -1
  348. package/src/components/StickyComponent.tsx +0 -270
  349. package/src/nodes/StickyNode.tsx +0 -249
  350. /package/dist/cjs/{editor → packages/lexical/src/editor}/theme.js +0 -0
  351. /package/dist/cjs/{hooks → packages/lexical/src/hooks}/useFormatWatcher.js +0 -0
  352. /package/dist/cjs/{index.js → packages/lexical/src/index.js} +0 -0
  353. /package/dist/cjs/{plugins → packages/lexical/src/plugins}/ToolbarPlugin.js +0 -0
  354. /package/dist/cjs/{utils → packages/lexical/src/utils}/index.js +0 -0
  355. /package/dist/esm/{editor → packages/lexical/src/editor}/theme.js +0 -0
  356. /package/dist/esm/{hooks → packages/lexical/src/hooks}/useFormatWatcher.js +0 -0
  357. /package/dist/esm/{index.js → packages/lexical/src/index.js} +0 -0
  358. /package/dist/esm/{plugins → packages/lexical/src/plugins}/ToolbarPlugin.js +0 -0
  359. /package/dist/esm/{utils → packages/lexical/src/utils}/index.js +0 -0
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var defaultOptions = require('./_lib/defaultOptions.js');
6
+ var constructFrom = require('./constructFrom.js');
7
+ var startOfWeek = require('./startOfWeek.js');
8
+ var toDate = require('./toDate.js');
9
+
10
+ /**
11
+ * The {@link getWeekYear} function options.
12
+ */
13
+
14
+ /**
15
+ * @name getWeekYear
16
+ * @category Week-Numbering Year Helpers
17
+ * @summary Get the local week-numbering year of the given date.
18
+ *
19
+ * @description
20
+ * Get the local week-numbering year of the given date.
21
+ * The exact calculation depends on the values of
22
+ * `options.weekStartsOn` (which is the index of the first day of the week)
23
+ * and `options.firstWeekContainsDate` (which is the day of January, which is always in
24
+ * the first week of the week-numbering year)
25
+ *
26
+ * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
27
+ *
28
+ * @param date - The given date
29
+ * @param options - An object with options.
30
+ *
31
+ * @returns The local week-numbering year
32
+ *
33
+ * @example
34
+ * // Which week numbering year is 26 December 2004 with the default settings?
35
+ * const result = getWeekYear(new Date(2004, 11, 26))
36
+ * //=> 2005
37
+ *
38
+ * @example
39
+ * // Which week numbering year is 26 December 2004 if week starts on Saturday?
40
+ * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
41
+ * //=> 2004
42
+ *
43
+ * @example
44
+ * // Which week numbering year is 26 December 2004 if the first week contains 4 January?
45
+ * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
46
+ * //=> 2004
47
+ */
48
+ function getWeekYear(date, options) {
49
+ const _date = toDate.toDate(date, options?.in);
50
+ const year = _date.getFullYear();
51
+
52
+ const defaultOptions$1 = defaultOptions.getDefaultOptions();
53
+ const firstWeekContainsDate =
54
+ options?.firstWeekContainsDate ??
55
+ options?.locale?.options?.firstWeekContainsDate ??
56
+ defaultOptions$1.firstWeekContainsDate ??
57
+ defaultOptions$1.locale?.options?.firstWeekContainsDate ??
58
+ 1;
59
+
60
+ const firstWeekOfNextYear = constructFrom.constructFrom(options?.in || date, 0);
61
+ firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
62
+ firstWeekOfNextYear.setHours(0, 0, 0, 0);
63
+ const startOfNextYear = startOfWeek.startOfWeek(firstWeekOfNextYear, options);
64
+
65
+ const firstWeekOfThisYear = constructFrom.constructFrom(options?.in || date, 0);
66
+ firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
67
+ firstWeekOfThisYear.setHours(0, 0, 0, 0);
68
+ const startOfThisYear = startOfWeek.startOfWeek(firstWeekOfThisYear, options);
69
+
70
+ if (+_date >= +startOfNextYear) {
71
+ return year + 1;
72
+ } else if (+_date >= +startOfThisYear) {
73
+ return year;
74
+ } else {
75
+ return year - 1;
76
+ }
77
+ }
78
+
79
+ exports.default = getWeekYear;
80
+ exports.getWeekYear = getWeekYear;
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var normalizeInterval = require('./_lib/normalizeInterval.js');
6
+ var add = require('./add.js');
7
+ var differenceInDays = require('./differenceInDays.js');
8
+ var differenceInHours = require('./differenceInHours.js');
9
+ var differenceInMinutes = require('./differenceInMinutes.js');
10
+ var differenceInMonths = require('./differenceInMonths.js');
11
+ var differenceInSeconds = require('./differenceInSeconds.js');
12
+ var differenceInYears = require('./differenceInYears.js');
13
+
14
+ /**
15
+ * The {@link intervalToDuration} function options.
16
+ */
17
+
18
+ /**
19
+ * @name intervalToDuration
20
+ * @category Common Helpers
21
+ * @summary Convert interval to duration
22
+ *
23
+ * @description
24
+ * Convert an interval object to a duration object.
25
+ *
26
+ * @param interval - The interval to convert to duration
27
+ * @param options - The context options
28
+ *
29
+ * @returns The duration object
30
+ *
31
+ * @example
32
+ * // Get the duration between January 15, 1929 and April 4, 1968.
33
+ * intervalToDuration({
34
+ * start: new Date(1929, 0, 15, 12, 0, 0),
35
+ * end: new Date(1968, 3, 4, 19, 5, 0)
36
+ * });
37
+ * //=> { years: 39, months: 2, days: 20, hours: 7, minutes: 5, seconds: 0 }
38
+ */
39
+ function intervalToDuration(interval, options) {
40
+ const { start, end } = normalizeInterval.normalizeInterval(options?.in, interval);
41
+ const duration = {};
42
+
43
+ const years = differenceInYears.differenceInYears(end, start);
44
+ if (years) duration.years = years;
45
+
46
+ const remainingMonths = add.add(start, { years: duration.years });
47
+ const months = differenceInMonths.differenceInMonths(end, remainingMonths);
48
+ if (months) duration.months = months;
49
+
50
+ const remainingDays = add.add(remainingMonths, { months: duration.months });
51
+ const days = differenceInDays.differenceInDays(end, remainingDays);
52
+ if (days) duration.days = days;
53
+
54
+ const remainingHours = add.add(remainingDays, { days: duration.days });
55
+ const hours = differenceInHours.differenceInHours(end, remainingHours);
56
+ if (hours) duration.hours = hours;
57
+
58
+ const remainingMinutes = add.add(remainingHours, { hours: duration.hours });
59
+ const minutes = differenceInMinutes.differenceInMinutes(end, remainingMinutes);
60
+ if (minutes) duration.minutes = minutes;
61
+
62
+ const remainingSeconds = add.add(remainingMinutes, { minutes: duration.minutes });
63
+ const seconds = differenceInSeconds.differenceInSeconds(end, remainingSeconds);
64
+ if (seconds) duration.seconds = seconds;
65
+
66
+ return duration;
67
+ }
68
+
69
+ exports.default = intervalToDuration;
70
+ exports.intervalToDuration = intervalToDuration;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var toDate = require('./toDate.js');
6
+
7
+ /**
8
+ * @name isAfter
9
+ * @category Common Helpers
10
+ * @summary Is the first date after the second one?
11
+ *
12
+ * @description
13
+ * Is the first date after the second one?
14
+ *
15
+ * @param date - The date that should be after the other one to return true
16
+ * @param dateToCompare - The date to compare with
17
+ *
18
+ * @returns The first date is after the second date
19
+ *
20
+ * @example
21
+ * // Is 10 July 1989 after 11 February 1987?
22
+ * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
23
+ * //=> true
24
+ */
25
+ function isAfter(date, dateToCompare) {
26
+ return +toDate.toDate(date) > +toDate.toDate(dateToCompare);
27
+ }
28
+
29
+ exports.default = isAfter;
30
+ exports.isAfter = isAfter;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var toDate = require('./toDate.js');
6
+
7
+ /**
8
+ * @name isBefore
9
+ * @category Common Helpers
10
+ * @summary Is the first date before the second one?
11
+ *
12
+ * @description
13
+ * Is the first date before the second one?
14
+ *
15
+ * @param date - The date that should be before the other one to return true
16
+ * @param dateToCompare - The date to compare with
17
+ *
18
+ * @returns The first date is before the second date
19
+ *
20
+ * @example
21
+ * // Is 10 July 1989 before 11 February 1987?
22
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
23
+ * //=> false
24
+ */
25
+ function isBefore(date, dateToCompare) {
26
+ return +toDate.toDate(date) < +toDate.toDate(dateToCompare);
27
+ }
28
+
29
+ exports.default = isBefore;
30
+ exports.isBefore = isBefore;
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * @name isDate
7
+ * @category Common Helpers
8
+ * @summary Is the given value a date?
9
+ *
10
+ * @description
11
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
12
+ *
13
+ * @param value - The value to check
14
+ *
15
+ * @returns True if the given value is a date
16
+ *
17
+ * @example
18
+ * // For a valid date:
19
+ * const result = isDate(new Date())
20
+ * //=> true
21
+ *
22
+ * @example
23
+ * // For an invalid date:
24
+ * const result = isDate(new Date(NaN))
25
+ * //=> true
26
+ *
27
+ * @example
28
+ * // For some value:
29
+ * const result = isDate('2014-02-31')
30
+ * //=> false
31
+ *
32
+ * @example
33
+ * // For an object:
34
+ * const result = isDate({})
35
+ * //=> false
36
+ */
37
+ function isDate(value) {
38
+ return (
39
+ value instanceof Date ||
40
+ (typeof value === "object" &&
41
+ Object.prototype.toString.call(value) === "[object Date]")
42
+ );
43
+ }
44
+
45
+ exports.default = isDate;
46
+ exports.isDate = isDate;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var endOfDay = require('./endOfDay.js');
6
+ var endOfMonth = require('./endOfMonth.js');
7
+ var toDate = require('./toDate.js');
8
+
9
+ /**
10
+ * @name isLastDayOfMonth
11
+ * @category Month Helpers
12
+ * @summary Is the given date the last day of a month?
13
+ *
14
+ * @description
15
+ * Is the given date the last day of a month?
16
+ *
17
+ * @param date - The date to check
18
+ * @param options - An object with options
19
+ *
20
+ * @returns The date is the last day of a month
21
+ *
22
+ * @example
23
+ * // Is 28 February 2014 the last day of a month?
24
+ * const result = isLastDayOfMonth(new Date(2014, 1, 28))
25
+ * //=> true
26
+ */
27
+ function isLastDayOfMonth(date, options) {
28
+ const _date = toDate.toDate(date, options?.in);
29
+ return +endOfDay.endOfDay(_date, options) === +endOfMonth.endOfMonth(_date, options);
30
+ }
31
+
32
+ exports.default = isLastDayOfMonth;
33
+ exports.isLastDayOfMonth = isLastDayOfMonth;
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var normalizeDates = require('./_lib/normalizeDates.js');
6
+
7
+ /**
8
+ * The {@link isSameMonth} function options.
9
+ */
10
+
11
+ /**
12
+ * @name isSameMonth
13
+ * @category Month Helpers
14
+ * @summary Are the given dates in the same month (and year)?
15
+ *
16
+ * @description
17
+ * Are the given dates in the same month (and year)?
18
+ *
19
+ * @param laterDate - The first date to check
20
+ * @param earlierDate - The second date to check
21
+ * @param options - An object with options
22
+ *
23
+ * @returns The dates are in the same month (and year)
24
+ *
25
+ * @example
26
+ * // Are 2 September 2014 and 25 September 2014 in the same month?
27
+ * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
28
+ * //=> true
29
+ *
30
+ * @example
31
+ * // Are 2 September 2014 and 25 September 2015 in the same month?
32
+ * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
33
+ * //=> false
34
+ */
35
+ function isSameMonth(laterDate, earlierDate, options) {
36
+ const [laterDate_, earlierDate_] = normalizeDates.normalizeDates(
37
+ options?.in,
38
+ laterDate,
39
+ earlierDate,
40
+ );
41
+ return (
42
+ laterDate_.getFullYear() === earlierDate_.getFullYear() &&
43
+ laterDate_.getMonth() === earlierDate_.getMonth()
44
+ );
45
+ }
46
+
47
+ exports.default = isSameMonth;
48
+ exports.isSameMonth = isSameMonth;
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var normalizeDates = require('./_lib/normalizeDates.js');
6
+ var startOfWeek = require('./startOfWeek.js');
7
+
8
+ /**
9
+ * The {@link isSameWeek} function options.
10
+ */
11
+
12
+ /**
13
+ * @name isSameWeek
14
+ * @category Week Helpers
15
+ * @summary Are the given dates in the same week (and month and year)?
16
+ *
17
+ * @description
18
+ * Are the given dates in the same week (and month and year)?
19
+ *
20
+ * @param laterDate - The first date to check
21
+ * @param earlierDate - The second date to check
22
+ * @param options - An object with options
23
+ *
24
+ * @returns The dates are in the same week (and month and year)
25
+ *
26
+ * @example
27
+ * // Are 31 August 2014 and 4 September 2014 in the same week?
28
+ * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4))
29
+ * //=> true
30
+ *
31
+ * @example
32
+ * // If week starts with Monday,
33
+ * // are 31 August 2014 and 4 September 2014 in the same week?
34
+ * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), {
35
+ * weekStartsOn: 1
36
+ * })
37
+ * //=> false
38
+ *
39
+ * @example
40
+ * // Are 1 January 2014 and 1 January 2015 in the same week?
41
+ * const result = isSameWeek(new Date(2014, 0, 1), new Date(2015, 0, 1))
42
+ * //=> false
43
+ */
44
+ function isSameWeek(laterDate, earlierDate, options) {
45
+ const [laterDate_, earlierDate_] = normalizeDates.normalizeDates(
46
+ options?.in,
47
+ laterDate,
48
+ earlierDate,
49
+ );
50
+ return (
51
+ +startOfWeek.startOfWeek(laterDate_, options) === +startOfWeek.startOfWeek(earlierDate_, options)
52
+ );
53
+ }
54
+
55
+ exports.default = isSameWeek;
56
+ exports.isSameWeek = isSameWeek;
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var normalizeDates = require('./_lib/normalizeDates.js');
6
+
7
+ /**
8
+ * The {@link isSameYear} function options.
9
+ */
10
+
11
+ /**
12
+ * @name isSameYear
13
+ * @category Year Helpers
14
+ * @summary Are the given dates in the same year?
15
+ *
16
+ * @description
17
+ * Are the given dates in the same year?
18
+ *
19
+ * @param laterDate - The first date to check
20
+ * @param earlierDate - The second date to check
21
+ * @param options - An object with options
22
+ *
23
+ * @returns The dates are in the same year
24
+ *
25
+ * @example
26
+ * // Are 2 September 2014 and 25 September 2014 in the same year?
27
+ * const result = isSameYear(new Date(2014, 8, 2), new Date(2014, 8, 25))
28
+ * //=> true
29
+ */
30
+ function isSameYear(laterDate, earlierDate, options) {
31
+ const [laterDate_, earlierDate_] = normalizeDates.normalizeDates(
32
+ options?.in,
33
+ laterDate,
34
+ earlierDate,
35
+ );
36
+ return laterDate_.getFullYear() === earlierDate_.getFullYear();
37
+ }
38
+
39
+ exports.default = isSameYear;
40
+ exports.isSameYear = isSameYear;
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var isDate = require('./isDate.js');
6
+ var toDate = require('./toDate.js');
7
+
8
+ /**
9
+ * @name isValid
10
+ * @category Common Helpers
11
+ * @summary Is the given date valid?
12
+ *
13
+ * @description
14
+ * Returns false if argument is Invalid Date and true otherwise.
15
+ * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
16
+ * Invalid Date is a Date, whose time value is NaN.
17
+ *
18
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
19
+ *
20
+ * @param date - The date to check
21
+ *
22
+ * @returns The date is valid
23
+ *
24
+ * @example
25
+ * // For the valid date:
26
+ * const result = isValid(new Date(2014, 1, 31))
27
+ * //=> true
28
+ *
29
+ * @example
30
+ * // For the value, convertible into a date:
31
+ * const result = isValid(1393804800000)
32
+ * //=> true
33
+ *
34
+ * @example
35
+ * // For the invalid date:
36
+ * const result = isValid(new Date(''))
37
+ * //=> false
38
+ */
39
+ function isValid(date) {
40
+ return !((!isDate.isDate(date) && typeof date !== "number") || isNaN(+toDate.toDate(date)));
41
+ }
42
+
43
+ exports.default = isValid;
44
+ exports.isValid = isValid;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ function buildFormatLongFn(args) {
4
+ return (options = {}) => {
5
+ // TODO: Remove String()
6
+ const width = options.width ? String(options.width) : args.defaultWidth;
7
+ const format = args.formats[width] || args.formats[args.defaultWidth];
8
+ return format;
9
+ };
10
+ }
11
+
12
+ exports.buildFormatLongFn = buildFormatLongFn;
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * The localize function argument callback which allows to convert raw value to
5
+ * the actual type.
6
+ *
7
+ * @param value - The value to convert
8
+ *
9
+ * @returns The converted value
10
+ */
11
+
12
+ /**
13
+ * The map of localized values for each width.
14
+ */
15
+
16
+ /**
17
+ * The index type of the locale unit value. It types conversion of units of
18
+ * values that don't start at 0 (i.e. quarters).
19
+ */
20
+
21
+ /**
22
+ * Converts the unit value to the tuple of values.
23
+ */
24
+
25
+ /**
26
+ * The tuple of localized era values. The first element represents BC,
27
+ * the second element represents AD.
28
+ */
29
+
30
+ /**
31
+ * The tuple of localized quarter values. The first element represents Q1.
32
+ */
33
+
34
+ /**
35
+ * The tuple of localized day values. The first element represents Sunday.
36
+ */
37
+
38
+ /**
39
+ * The tuple of localized month values. The first element represents January.
40
+ */
41
+
42
+ function buildLocalizeFn(args) {
43
+ return (value, options) => {
44
+ const context = options?.context ? String(options.context) : "standalone";
45
+
46
+ let valuesArray;
47
+ if (context === "formatting" && args.formattingValues) {
48
+ const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
49
+ const width = options?.width ? String(options.width) : defaultWidth;
50
+
51
+ valuesArray =
52
+ args.formattingValues[width] || args.formattingValues[defaultWidth];
53
+ } else {
54
+ const defaultWidth = args.defaultWidth;
55
+ const width = options?.width ? String(options.width) : args.defaultWidth;
56
+
57
+ valuesArray = args.values[width] || args.values[defaultWidth];
58
+ }
59
+ const index = args.argumentCallback ? args.argumentCallback(value) : value;
60
+
61
+ // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
62
+ return valuesArray[index];
63
+ };
64
+ }
65
+
66
+ exports.buildLocalizeFn = buildLocalizeFn;
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ function buildMatchFn(args) {
4
+ return (string, options = {}) => {
5
+ const width = options.width;
6
+
7
+ const matchPattern =
8
+ (width && args.matchPatterns[width]) ||
9
+ args.matchPatterns[args.defaultMatchWidth];
10
+ const matchResult = string.match(matchPattern);
11
+
12
+ if (!matchResult) {
13
+ return null;
14
+ }
15
+ const matchedString = matchResult[0];
16
+
17
+ const parsePatterns =
18
+ (width && args.parsePatterns[width]) ||
19
+ args.parsePatterns[args.defaultParseWidth];
20
+
21
+ const key = Array.isArray(parsePatterns)
22
+ ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
23
+ : // [TODO] -- I challenge you to fix the type
24
+ findKey(parsePatterns, (pattern) => pattern.test(matchedString));
25
+
26
+ let value;
27
+
28
+ value = args.valueCallback ? args.valueCallback(key) : key;
29
+ value = options.valueCallback
30
+ ? // [TODO] -- I challenge you to fix the type
31
+ options.valueCallback(value)
32
+ : value;
33
+
34
+ const rest = string.slice(matchedString.length);
35
+
36
+ return { value, rest };
37
+ };
38
+ }
39
+
40
+ function findKey(object, predicate) {
41
+ for (const key in object) {
42
+ if (
43
+ Object.prototype.hasOwnProperty.call(object, key) &&
44
+ predicate(object[key])
45
+ ) {
46
+ return key;
47
+ }
48
+ }
49
+ return undefined;
50
+ }
51
+
52
+ function findIndex(array, predicate) {
53
+ for (let key = 0; key < array.length; key++) {
54
+ if (predicate(array[key])) {
55
+ return key;
56
+ }
57
+ }
58
+ return undefined;
59
+ }
60
+
61
+ exports.buildMatchFn = buildMatchFn;
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ function buildMatchPatternFn(args) {
4
+ return (string, options = {}) => {
5
+ const matchResult = string.match(args.matchPattern);
6
+ if (!matchResult) return null;
7
+ const matchedString = matchResult[0];
8
+
9
+ const parseResult = string.match(args.parsePattern);
10
+ if (!parseResult) return null;
11
+ let value = args.valueCallback
12
+ ? args.valueCallback(parseResult[0])
13
+ : parseResult[0];
14
+
15
+ // [TODO] I challenge you to fix the type
16
+ value = options.valueCallback ? options.valueCallback(value) : value;
17
+
18
+ const rest = string.slice(matchedString.length);
19
+
20
+ return { value, rest };
21
+ };
22
+ }
23
+
24
+ exports.buildMatchPatternFn = buildMatchPatternFn;