@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,77 @@
1
+ 'use client';
2
+
3
+ import { getDefaultOptions } from './_lib/defaultOptions.js';
4
+ import { constructFrom } from './constructFrom.js';
5
+ import { startOfWeek } from './startOfWeek.js';
6
+ import { toDate } from './toDate.js';
7
+
8
+ /**
9
+ * The {@link getWeekYear} function options.
10
+ */
11
+
12
+ /**
13
+ * @name getWeekYear
14
+ * @category Week-Numbering Year Helpers
15
+ * @summary Get the local week-numbering year of the given date.
16
+ *
17
+ * @description
18
+ * Get the local week-numbering year of the given date.
19
+ * The exact calculation depends on the values of
20
+ * `options.weekStartsOn` (which is the index of the first day of the week)
21
+ * and `options.firstWeekContainsDate` (which is the day of January, which is always in
22
+ * the first week of the week-numbering year)
23
+ *
24
+ * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
25
+ *
26
+ * @param date - The given date
27
+ * @param options - An object with options.
28
+ *
29
+ * @returns The local week-numbering year
30
+ *
31
+ * @example
32
+ * // Which week numbering year is 26 December 2004 with the default settings?
33
+ * const result = getWeekYear(new Date(2004, 11, 26))
34
+ * //=> 2005
35
+ *
36
+ * @example
37
+ * // Which week numbering year is 26 December 2004 if week starts on Saturday?
38
+ * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
39
+ * //=> 2004
40
+ *
41
+ * @example
42
+ * // Which week numbering year is 26 December 2004 if the first week contains 4 January?
43
+ * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
44
+ * //=> 2004
45
+ */
46
+ function getWeekYear(date, options) {
47
+ const _date = toDate(date, options?.in);
48
+ const year = _date.getFullYear();
49
+
50
+ const defaultOptions = getDefaultOptions();
51
+ const firstWeekContainsDate =
52
+ options?.firstWeekContainsDate ??
53
+ options?.locale?.options?.firstWeekContainsDate ??
54
+ defaultOptions.firstWeekContainsDate ??
55
+ defaultOptions.locale?.options?.firstWeekContainsDate ??
56
+ 1;
57
+
58
+ const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
59
+ firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
60
+ firstWeekOfNextYear.setHours(0, 0, 0, 0);
61
+ const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
62
+
63
+ const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
64
+ firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
65
+ firstWeekOfThisYear.setHours(0, 0, 0, 0);
66
+ const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
67
+
68
+ if (+_date >= +startOfNextYear) {
69
+ return year + 1;
70
+ } else if (+_date >= +startOfThisYear) {
71
+ return year;
72
+ } else {
73
+ return year - 1;
74
+ }
75
+ }
76
+
77
+ export { getWeekYear as default, getWeekYear };
@@ -0,0 +1,67 @@
1
+ 'use client';
2
+
3
+ import { normalizeInterval } from './_lib/normalizeInterval.js';
4
+ import { add } from './add.js';
5
+ import { differenceInDays } from './differenceInDays.js';
6
+ import { differenceInHours } from './differenceInHours.js';
7
+ import { differenceInMinutes } from './differenceInMinutes.js';
8
+ import { differenceInMonths } from './differenceInMonths.js';
9
+ import { differenceInSeconds } from './differenceInSeconds.js';
10
+ import { differenceInYears } from './differenceInYears.js';
11
+
12
+ /**
13
+ * The {@link intervalToDuration} function options.
14
+ */
15
+
16
+ /**
17
+ * @name intervalToDuration
18
+ * @category Common Helpers
19
+ * @summary Convert interval to duration
20
+ *
21
+ * @description
22
+ * Convert an interval object to a duration object.
23
+ *
24
+ * @param interval - The interval to convert to duration
25
+ * @param options - The context options
26
+ *
27
+ * @returns The duration object
28
+ *
29
+ * @example
30
+ * // Get the duration between January 15, 1929 and April 4, 1968.
31
+ * intervalToDuration({
32
+ * start: new Date(1929, 0, 15, 12, 0, 0),
33
+ * end: new Date(1968, 3, 4, 19, 5, 0)
34
+ * });
35
+ * //=> { years: 39, months: 2, days: 20, hours: 7, minutes: 5, seconds: 0 }
36
+ */
37
+ function intervalToDuration(interval, options) {
38
+ const { start, end } = normalizeInterval(options?.in, interval);
39
+ const duration = {};
40
+
41
+ const years = differenceInYears(end, start);
42
+ if (years) duration.years = years;
43
+
44
+ const remainingMonths = add(start, { years: duration.years });
45
+ const months = differenceInMonths(end, remainingMonths);
46
+ if (months) duration.months = months;
47
+
48
+ const remainingDays = add(remainingMonths, { months: duration.months });
49
+ const days = differenceInDays(end, remainingDays);
50
+ if (days) duration.days = days;
51
+
52
+ const remainingHours = add(remainingDays, { days: duration.days });
53
+ const hours = differenceInHours(end, remainingHours);
54
+ if (hours) duration.hours = hours;
55
+
56
+ const remainingMinutes = add(remainingHours, { hours: duration.hours });
57
+ const minutes = differenceInMinutes(end, remainingMinutes);
58
+ if (minutes) duration.minutes = minutes;
59
+
60
+ const remainingSeconds = add(remainingMinutes, { minutes: duration.minutes });
61
+ const seconds = differenceInSeconds(end, remainingSeconds);
62
+ if (seconds) duration.seconds = seconds;
63
+
64
+ return duration;
65
+ }
66
+
67
+ export { intervalToDuration as default, intervalToDuration };
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+
3
+ import { toDate } from './toDate.js';
4
+
5
+ /**
6
+ * @name isAfter
7
+ * @category Common Helpers
8
+ * @summary Is the first date after the second one?
9
+ *
10
+ * @description
11
+ * Is the first date after the second one?
12
+ *
13
+ * @param date - The date that should be after the other one to return true
14
+ * @param dateToCompare - The date to compare with
15
+ *
16
+ * @returns The first date is after the second date
17
+ *
18
+ * @example
19
+ * // Is 10 July 1989 after 11 February 1987?
20
+ * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
21
+ * //=> true
22
+ */
23
+ function isAfter(date, dateToCompare) {
24
+ return +toDate(date) > +toDate(dateToCompare);
25
+ }
26
+
27
+ export { isAfter as default, isAfter };
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+
3
+ import { toDate } from './toDate.js';
4
+
5
+ /**
6
+ * @name isBefore
7
+ * @category Common Helpers
8
+ * @summary Is the first date before the second one?
9
+ *
10
+ * @description
11
+ * Is the first date before the second one?
12
+ *
13
+ * @param date - The date that should be before the other one to return true
14
+ * @param dateToCompare - The date to compare with
15
+ *
16
+ * @returns The first date is before the second date
17
+ *
18
+ * @example
19
+ * // Is 10 July 1989 before 11 February 1987?
20
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
21
+ * //=> false
22
+ */
23
+ function isBefore(date, dateToCompare) {
24
+ return +toDate(date) < +toDate(dateToCompare);
25
+ }
26
+
27
+ export { isBefore as default, isBefore };
@@ -0,0 +1,43 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * @name isDate
5
+ * @category Common Helpers
6
+ * @summary Is the given value a date?
7
+ *
8
+ * @description
9
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
10
+ *
11
+ * @param value - The value to check
12
+ *
13
+ * @returns True if the given value is a date
14
+ *
15
+ * @example
16
+ * // For a valid date:
17
+ * const result = isDate(new Date())
18
+ * //=> true
19
+ *
20
+ * @example
21
+ * // For an invalid date:
22
+ * const result = isDate(new Date(NaN))
23
+ * //=> true
24
+ *
25
+ * @example
26
+ * // For some value:
27
+ * const result = isDate('2014-02-31')
28
+ * //=> false
29
+ *
30
+ * @example
31
+ * // For an object:
32
+ * const result = isDate({})
33
+ * //=> false
34
+ */
35
+ function isDate(value) {
36
+ return (
37
+ value instanceof Date ||
38
+ (typeof value === "object" &&
39
+ Object.prototype.toString.call(value) === "[object Date]")
40
+ );
41
+ }
42
+
43
+ export { isDate as default, isDate };
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+
3
+ import { endOfDay } from './endOfDay.js';
4
+ import { endOfMonth } from './endOfMonth.js';
5
+ import { toDate } from './toDate.js';
6
+
7
+ /**
8
+ * @name isLastDayOfMonth
9
+ * @category Month Helpers
10
+ * @summary Is the given date the last day of a month?
11
+ *
12
+ * @description
13
+ * Is the given date the last day of a month?
14
+ *
15
+ * @param date - The date to check
16
+ * @param options - An object with options
17
+ *
18
+ * @returns The date is the last day of a month
19
+ *
20
+ * @example
21
+ * // Is 28 February 2014 the last day of a month?
22
+ * const result = isLastDayOfMonth(new Date(2014, 1, 28))
23
+ * //=> true
24
+ */
25
+ function isLastDayOfMonth(date, options) {
26
+ const _date = toDate(date, options?.in);
27
+ return +endOfDay(_date, options) === +endOfMonth(_date, options);
28
+ }
29
+
30
+ export { isLastDayOfMonth as default, isLastDayOfMonth };
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+
3
+ import { normalizeDates } from './_lib/normalizeDates.js';
4
+
5
+ /**
6
+ * The {@link isSameMonth} function options.
7
+ */
8
+
9
+ /**
10
+ * @name isSameMonth
11
+ * @category Month Helpers
12
+ * @summary Are the given dates in the same month (and year)?
13
+ *
14
+ * @description
15
+ * Are the given dates in the same month (and year)?
16
+ *
17
+ * @param laterDate - The first date to check
18
+ * @param earlierDate - The second date to check
19
+ * @param options - An object with options
20
+ *
21
+ * @returns The dates are in the same month (and year)
22
+ *
23
+ * @example
24
+ * // Are 2 September 2014 and 25 September 2014 in the same month?
25
+ * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
26
+ * //=> true
27
+ *
28
+ * @example
29
+ * // Are 2 September 2014 and 25 September 2015 in the same month?
30
+ * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
31
+ * //=> false
32
+ */
33
+ function isSameMonth(laterDate, earlierDate, options) {
34
+ const [laterDate_, earlierDate_] = normalizeDates(
35
+ options?.in,
36
+ laterDate,
37
+ earlierDate,
38
+ );
39
+ return (
40
+ laterDate_.getFullYear() === earlierDate_.getFullYear() &&
41
+ laterDate_.getMonth() === earlierDate_.getMonth()
42
+ );
43
+ }
44
+
45
+ export { isSameMonth as default, isSameMonth };
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+
3
+ import { normalizeDates } from './_lib/normalizeDates.js';
4
+ import { startOfWeek } from './startOfWeek.js';
5
+
6
+ /**
7
+ * The {@link isSameWeek} function options.
8
+ */
9
+
10
+ /**
11
+ * @name isSameWeek
12
+ * @category Week Helpers
13
+ * @summary Are the given dates in the same week (and month and year)?
14
+ *
15
+ * @description
16
+ * Are the given dates in the same week (and month and year)?
17
+ *
18
+ * @param laterDate - The first date to check
19
+ * @param earlierDate - The second date to check
20
+ * @param options - An object with options
21
+ *
22
+ * @returns The dates are in the same week (and month and year)
23
+ *
24
+ * @example
25
+ * // Are 31 August 2014 and 4 September 2014 in the same week?
26
+ * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4))
27
+ * //=> true
28
+ *
29
+ * @example
30
+ * // If week starts with Monday,
31
+ * // are 31 August 2014 and 4 September 2014 in the same week?
32
+ * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), {
33
+ * weekStartsOn: 1
34
+ * })
35
+ * //=> false
36
+ *
37
+ * @example
38
+ * // Are 1 January 2014 and 1 January 2015 in the same week?
39
+ * const result = isSameWeek(new Date(2014, 0, 1), new Date(2015, 0, 1))
40
+ * //=> false
41
+ */
42
+ function isSameWeek(laterDate, earlierDate, options) {
43
+ const [laterDate_, earlierDate_] = normalizeDates(
44
+ options?.in,
45
+ laterDate,
46
+ earlierDate,
47
+ );
48
+ return (
49
+ +startOfWeek(laterDate_, options) === +startOfWeek(earlierDate_, options)
50
+ );
51
+ }
52
+
53
+ export { isSameWeek as default, isSameWeek };
@@ -0,0 +1,37 @@
1
+ 'use client';
2
+
3
+ import { normalizeDates } from './_lib/normalizeDates.js';
4
+
5
+ /**
6
+ * The {@link isSameYear} function options.
7
+ */
8
+
9
+ /**
10
+ * @name isSameYear
11
+ * @category Year Helpers
12
+ * @summary Are the given dates in the same year?
13
+ *
14
+ * @description
15
+ * Are the given dates in the same year?
16
+ *
17
+ * @param laterDate - The first date to check
18
+ * @param earlierDate - The second date to check
19
+ * @param options - An object with options
20
+ *
21
+ * @returns The dates are in the same year
22
+ *
23
+ * @example
24
+ * // Are 2 September 2014 and 25 September 2014 in the same year?
25
+ * const result = isSameYear(new Date(2014, 8, 2), new Date(2014, 8, 25))
26
+ * //=> true
27
+ */
28
+ function isSameYear(laterDate, earlierDate, options) {
29
+ const [laterDate_, earlierDate_] = normalizeDates(
30
+ options?.in,
31
+ laterDate,
32
+ earlierDate,
33
+ );
34
+ return laterDate_.getFullYear() === earlierDate_.getFullYear();
35
+ }
36
+
37
+ export { isSameYear as default, isSameYear };
@@ -0,0 +1,41 @@
1
+ 'use client';
2
+
3
+ import { isDate } from './isDate.js';
4
+ import { toDate } from './toDate.js';
5
+
6
+ /**
7
+ * @name isValid
8
+ * @category Common Helpers
9
+ * @summary Is the given date valid?
10
+ *
11
+ * @description
12
+ * Returns false if argument is Invalid Date and true otherwise.
13
+ * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
14
+ * Invalid Date is a Date, whose time value is NaN.
15
+ *
16
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
17
+ *
18
+ * @param date - The date to check
19
+ *
20
+ * @returns The date is valid
21
+ *
22
+ * @example
23
+ * // For the valid date:
24
+ * const result = isValid(new Date(2014, 1, 31))
25
+ * //=> true
26
+ *
27
+ * @example
28
+ * // For the value, convertible into a date:
29
+ * const result = isValid(1393804800000)
30
+ * //=> true
31
+ *
32
+ * @example
33
+ * // For the invalid date:
34
+ * const result = isValid(new Date(''))
35
+ * //=> false
36
+ */
37
+ function isValid(date) {
38
+ return !((!isDate(date) && typeof date !== "number") || isNaN(+toDate(date)));
39
+ }
40
+
41
+ export { isValid as default, isValid };
@@ -0,0 +1,12 @@
1
+ 'use client';
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
+ export { buildFormatLongFn };
@@ -0,0 +1,66 @@
1
+ 'use client';
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
+ export { buildLocalizeFn };
@@ -0,0 +1,61 @@
1
+ 'use client';
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
+ export { buildMatchFn };
@@ -0,0 +1,24 @@
1
+ 'use client';
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
+ export { buildMatchPatternFn };