@react-fabric/lexical 1.0.0-beta.60 → 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 (450) 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/packages/lexical/src/editor/LexicalEditor.js +36 -13
  160. package/dist/cjs/packages/lexical/src/hooks/useFormatWatcher.js +101 -95
  161. package/dist/cjs/packages/lexical/src/i18n/ar/lexical.json.js +30 -0
  162. package/dist/cjs/packages/lexical/src/i18n/en/lexical.json.js +30 -0
  163. package/dist/cjs/packages/lexical/src/i18n/index.js +33 -0
  164. package/dist/cjs/packages/lexical/src/index.js +1 -0
  165. package/dist/cjs/packages/lexical/src/plugins/CommentPlugin.js +477 -0
  166. package/dist/cjs/packages/lexical/src/plugins/DraggableBlockPlugin.js +13 -16
  167. package/dist/cjs/packages/lexical/src/plugins/ToolbarPlugin.js +35 -22
  168. package/dist/esm/node_modules/date-fns/_lib/addLeadingZeros.js +9 -0
  169. package/dist/esm/node_modules/date-fns/_lib/defaultOptions.js +9 -0
  170. package/dist/esm/node_modules/date-fns/_lib/format/formatters.js +779 -0
  171. package/dist/esm/node_modules/date-fns/_lib/format/lightFormatters.js +96 -0
  172. package/dist/esm/node_modules/date-fns/_lib/format/longFormatters.js +68 -0
  173. package/dist/esm/node_modules/date-fns/_lib/getRoundingMethod.js +12 -0
  174. package/dist/esm/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +33 -0
  175. package/dist/esm/node_modules/date-fns/_lib/normalizeDates.js +13 -0
  176. package/dist/esm/node_modules/date-fns/_lib/normalizeInterval.js +10 -0
  177. package/dist/esm/node_modules/date-fns/_lib/protectedTokens.js +27 -0
  178. package/dist/esm/node_modules/date-fns/add.js +70 -0
  179. package/dist/esm/node_modules/date-fns/addDays.js +43 -0
  180. package/dist/esm/node_modules/date-fns/addHours.js +36 -0
  181. package/dist/esm/node_modules/date-fns/addMilliseconds.js +36 -0
  182. package/dist/esm/node_modules/date-fns/addMinutes.js +38 -0
  183. package/dist/esm/node_modules/date-fns/addMonths.js +77 -0
  184. package/dist/esm/node_modules/date-fns/addQuarters.js +35 -0
  185. package/dist/esm/node_modules/date-fns/addWeeks.js +35 -0
  186. package/dist/esm/node_modules/date-fns/addYears.js +35 -0
  187. package/dist/esm/node_modules/date-fns/compareAsc.js +47 -0
  188. package/dist/esm/node_modules/date-fns/constants.js +62 -0
  189. package/dist/esm/node_modules/date-fns/constructFrom.js +51 -0
  190. package/dist/esm/node_modules/date-fns/differenceInCalendarDays.js +64 -0
  191. package/dist/esm/node_modules/date-fns/differenceInCalendarMonths.js +44 -0
  192. package/dist/esm/node_modules/date-fns/differenceInCalendarYears.js +40 -0
  193. package/dist/esm/node_modules/date-fns/differenceInDays.js +109 -0
  194. package/dist/esm/node_modules/date-fns/differenceInHours.js +43 -0
  195. package/dist/esm/node_modules/date-fns/differenceInMilliseconds.js +31 -0
  196. package/dist/esm/node_modules/date-fns/differenceInMinutes.js +47 -0
  197. package/dist/esm/node_modules/date-fns/differenceInMonths.js +62 -0
  198. package/dist/esm/node_modules/date-fns/differenceInSeconds.js +38 -0
  199. package/dist/esm/node_modules/date-fns/differenceInYears.js +64 -0
  200. package/dist/esm/node_modules/date-fns/endOfDay.js +37 -0
  201. package/dist/esm/node_modules/date-fns/endOfDecade.js +42 -0
  202. package/dist/esm/node_modules/date-fns/endOfHour.js +37 -0
  203. package/dist/esm/node_modules/date-fns/endOfMinute.js +37 -0
  204. package/dist/esm/node_modules/date-fns/endOfMonth.js +39 -0
  205. package/dist/esm/node_modules/date-fns/endOfQuarter.js +40 -0
  206. package/dist/esm/node_modules/date-fns/endOfWeek.js +55 -0
  207. package/dist/esm/node_modules/date-fns/endOfYear.js +39 -0
  208. package/dist/esm/node_modules/date-fns/format.js +425 -0
  209. package/dist/esm/node_modules/date-fns/getDayOfYear.js +36 -0
  210. package/dist/esm/node_modules/date-fns/getISOWeek.js +42 -0
  211. package/dist/esm/node_modules/date-fns/getISOWeekYear.js +54 -0
  212. package/dist/esm/node_modules/date-fns/getWeek.js +56 -0
  213. package/dist/esm/node_modules/date-fns/getWeekYear.js +77 -0
  214. package/dist/esm/node_modules/date-fns/intervalToDuration.js +67 -0
  215. package/dist/esm/node_modules/date-fns/isAfter.js +27 -0
  216. package/dist/esm/node_modules/date-fns/isBefore.js +27 -0
  217. package/dist/esm/node_modules/date-fns/isDate.js +43 -0
  218. package/dist/esm/node_modules/date-fns/isLastDayOfMonth.js +30 -0
  219. package/dist/esm/node_modules/date-fns/isSameMonth.js +45 -0
  220. package/dist/esm/node_modules/date-fns/isSameWeek.js +53 -0
  221. package/dist/esm/node_modules/date-fns/isSameYear.js +37 -0
  222. package/dist/esm/node_modules/date-fns/isValid.js +41 -0
  223. package/dist/esm/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +12 -0
  224. package/dist/esm/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +66 -0
  225. package/dist/esm/node_modules/date-fns/locale/_lib/buildMatchFn.js +61 -0
  226. package/dist/esm/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +24 -0
  227. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatDistance.js +139 -0
  228. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatLong.js +43 -0
  229. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatRelative.js +15 -0
  230. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/localize.js +166 -0
  231. package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/match.js +146 -0
  232. package/dist/esm/node_modules/date-fns/locale/ar-SA.js +29 -0
  233. package/dist/esm/node_modules/date-fns/locale/de/_lib/formatDistance.js +200 -0
  234. package/dist/esm/node_modules/date-fns/locale/de/_lib/formatLong.js +44 -0
  235. package/dist/esm/node_modules/date-fns/locale/de/_lib/formatRelative.js +15 -0
  236. package/dist/esm/node_modules/date-fns/locale/de/_lib/localize.js +195 -0
  237. package/dist/esm/node_modules/date-fns/locale/de/_lib/match.js +138 -0
  238. package/dist/esm/node_modules/date-fns/locale/de.js +33 -0
  239. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +105 -0
  240. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatLong.js +43 -0
  241. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +15 -0
  242. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/localize.js +191 -0
  243. package/dist/esm/node_modules/date-fns/locale/en-US/_lib/match.js +136 -0
  244. package/dist/esm/node_modules/date-fns/locale/en-US.js +30 -0
  245. package/dist/esm/node_modules/date-fns/locale/es/_lib/formatDistance.js +105 -0
  246. package/dist/esm/node_modules/date-fns/locale/es/_lib/formatLong.js +43 -0
  247. package/dist/esm/node_modules/date-fns/locale/es/_lib/formatRelative.js +29 -0
  248. package/dist/esm/node_modules/date-fns/locale/es/_lib/localize.js +168 -0
  249. package/dist/esm/node_modules/date-fns/locale/es/_lib/match.js +142 -0
  250. package/dist/esm/node_modules/date-fns/locale/es.js +33 -0
  251. package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatDistance.js +104 -0
  252. package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatLong.js +43 -0
  253. package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatRelative.js +15 -0
  254. package/dist/esm/node_modules/date-fns/locale/fr/_lib/localize.js +169 -0
  255. package/dist/esm/node_modules/date-fns/locale/fr/_lib/match.js +137 -0
  256. package/dist/esm/node_modules/date-fns/locale/fr.js +30 -0
  257. package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatDistance.js +109 -0
  258. package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatLong.js +43 -0
  259. package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatRelative.js +15 -0
  260. package/dist/esm/node_modules/date-fns/locale/hi/_lib/localize.js +231 -0
  261. package/dist/esm/node_modules/date-fns/locale/hi/_lib/match.js +141 -0
  262. package/dist/esm/node_modules/date-fns/locale/hi.js +29 -0
  263. package/dist/esm/node_modules/date-fns/locale/it/_lib/formatDistance.js +105 -0
  264. package/dist/esm/node_modules/date-fns/locale/it/_lib/formatLong.js +43 -0
  265. package/dist/esm/node_modules/date-fns/locale/it/_lib/formatRelative.js +70 -0
  266. package/dist/esm/node_modules/date-fns/locale/it/_lib/localize.js +168 -0
  267. package/dist/esm/node_modules/date-fns/locale/it/_lib/match.js +137 -0
  268. package/dist/esm/node_modules/date-fns/locale/it.js +31 -0
  269. package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatDistance.js +119 -0
  270. package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatLong.js +43 -0
  271. package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatRelative.js +16 -0
  272. package/dist/esm/node_modules/date-fns/locale/ja/_lib/localize.js +181 -0
  273. package/dist/esm/node_modules/date-fns/locale/ja/_lib/match.js +122 -0
  274. package/dist/esm/node_modules/date-fns/locale/ja.js +33 -0
  275. package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatDistance.js +105 -0
  276. package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatLong.js +43 -0
  277. package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatRelative.js +15 -0
  278. package/dist/esm/node_modules/date-fns/locale/ko/_lib/localize.js +171 -0
  279. package/dist/esm/node_modules/date-fns/locale/ko/_lib/match.js +119 -0
  280. package/dist/esm/node_modules/date-fns/locale/ko.js +31 -0
  281. package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatDistance.js +105 -0
  282. package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatLong.js +43 -0
  283. package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatRelative.js +26 -0
  284. package/dist/esm/node_modules/date-fns/locale/pt/_lib/localize.js +168 -0
  285. package/dist/esm/node_modules/date-fns/locale/pt/_lib/match.js +141 -0
  286. package/dist/esm/node_modules/date-fns/locale/pt.js +30 -0
  287. package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatDistance.js +250 -0
  288. package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatLong.js +40 -0
  289. package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatRelative.js +92 -0
  290. package/dist/esm/node_modules/date-fns/locale/ru/_lib/localize.js +214 -0
  291. package/dist/esm/node_modules/date-fns/locale/ru/_lib/match.js +142 -0
  292. package/dist/esm/node_modules/date-fns/locale/ru.js +30 -0
  293. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js +105 -0
  294. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js +43 -0
  295. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js +35 -0
  296. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/localize.js +187 -0
  297. package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/match.js +134 -0
  298. package/dist/esm/node_modules/date-fns/locale/zh-CN.js +33 -0
  299. package/dist/esm/node_modules/date-fns/startOfDay.js +37 -0
  300. package/dist/esm/node_modules/date-fns/startOfDecade.js +42 -0
  301. package/dist/esm/node_modules/date-fns/startOfHour.js +37 -0
  302. package/dist/esm/node_modules/date-fns/startOfISOWeek.js +37 -0
  303. package/dist/esm/node_modules/date-fns/startOfISOWeekYear.js +44 -0
  304. package/dist/esm/node_modules/date-fns/startOfMinute.js +37 -0
  305. package/dist/esm/node_modules/date-fns/startOfMonth.js +39 -0
  306. package/dist/esm/node_modules/date-fns/startOfQuarter.js +40 -0
  307. package/dist/esm/node_modules/date-fns/startOfWeek.js +55 -0
  308. package/dist/esm/node_modules/date-fns/startOfWeekYear.js +66 -0
  309. package/dist/esm/node_modules/date-fns/startOfYear.js +38 -0
  310. package/dist/esm/node_modules/date-fns/toDate.js +48 -0
  311. package/dist/esm/packages/date/dist/esm/display/DateDuration.js +178 -0
  312. package/dist/esm/packages/date/dist/esm/hijri/DateConverter.js +152 -0
  313. package/dist/esm/packages/date/dist/esm/hijri/FormatDate.js +113 -0
  314. package/dist/esm/packages/date/dist/esm/hijri/HijriDate.js +528 -0
  315. package/dist/esm/packages/date/dist/esm/hijri/StringDateParser.js +74 -0
  316. package/dist/esm/packages/date/dist/esm/hijri/index.js +21 -0
  317. package/dist/esm/packages/date/dist/esm/hijri/initializer.js +113 -0
  318. package/dist/esm/packages/date/dist/esm/hijri/locales.js +18 -0
  319. package/dist/esm/packages/date/dist/esm/hijri/safe.js +14 -0
  320. package/dist/esm/packages/date/dist/esm/i18n/ar/date.json.js +209 -0
  321. package/dist/esm/packages/date/dist/esm/i18n/en/date.json.js +79 -0
  322. package/dist/esm/packages/date/dist/esm/i18n/index.js +33 -0
  323. package/dist/esm/packages/date/dist/esm/types/index.js +45 -0
  324. package/dist/esm/packages/date/dist/esm/utils/dateUtil.js +474 -0
  325. package/dist/esm/packages/lexical/src/editor/LexicalEditor.js +37 -14
  326. package/dist/esm/packages/lexical/src/hooks/useFormatWatcher.js +43 -37
  327. package/dist/esm/packages/lexical/src/i18n/ar/lexical.json.js +25 -0
  328. package/dist/esm/packages/lexical/src/i18n/en/lexical.json.js +25 -0
  329. package/dist/esm/packages/lexical/src/i18n/index.js +33 -0
  330. package/dist/esm/packages/lexical/src/index.js +1 -0
  331. package/dist/esm/packages/lexical/src/plugins/CommentPlugin.js +477 -0
  332. package/dist/esm/packages/lexical/src/plugins/DraggableBlockPlugin.js +11 -14
  333. package/dist/esm/packages/lexical/src/plugins/ToolbarPlugin.js +36 -23
  334. package/dist/types/editor/LexicalEditor.d.ts +12 -3
  335. package/dist/types/hooks/useFormatWatcher.d.ts +2 -1
  336. package/dist/types/i18n/index.d.ts +1 -0
  337. package/dist/types/index.d.ts +1 -0
  338. package/dist/types/plugins/CommentPlugin.d.ts +5 -0
  339. package/dist/types/plugins/DraggableBlockPlugin.d.ts +2 -1
  340. package/package.json +5 -5
  341. package/src/editor/LexicalEditor.tsx +65 -18
  342. package/src/hooks/useFormatWatcher.ts +3 -0
  343. package/src/i18n/ar/lexical.json +18 -0
  344. package/src/i18n/en/lexical.json +18 -0
  345. package/src/i18n/index.ts +28 -0
  346. package/src/index.ts +2 -0
  347. package/src/plugins/CommentPlugin.tsx +554 -0
  348. package/src/plugins/DraggableBlockPlugin.tsx +5 -10
  349. package/src/plugins/ToolbarPlugin.tsx +34 -23
  350. package/dist/cjs/_virtual/prism.js +0 -5
  351. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -474
  352. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -21
  353. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -27
  354. package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +0 -1537
  355. package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +0 -25
  356. package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +0 -57
  357. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +0 -252
  358. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +0 -19
  359. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +0 -18
  360. package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +0 -572
  361. package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +0 -17
  362. package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +0 -25
  363. package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +0 -1614
  364. package/dist/cjs/node_modules/@lexical/list/LexicalList.js +0 -29
  365. package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +0 -36
  366. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -838
  367. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +0 -29
  368. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -26
  369. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -1057
  370. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +0 -39
  371. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -45
  372. package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +0 -4207
  373. package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +0 -23
  374. package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +0 -68
  375. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -1166
  376. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +0 -47
  377. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -81
  378. package/dist/cjs/node_modules/@mdi/js/mdi.js +0 -8
  379. package/dist/cjs/node_modules/prismjs/components/prism-c.js +0 -82
  380. package/dist/cjs/node_modules/prismjs/components/prism-clike.js +0 -33
  381. package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +0 -101
  382. package/dist/cjs/node_modules/prismjs/components/prism-css.js +0 -66
  383. package/dist/cjs/node_modules/prismjs/components/prism-java.js +0 -126
  384. package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +0 -174
  385. package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +0 -417
  386. package/dist/cjs/node_modules/prismjs/components/prism-markup.js +0 -188
  387. package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +0 -14
  388. package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +0 -60
  389. package/dist/cjs/node_modules/prismjs/components/prism-python.js +0 -67
  390. package/dist/cjs/node_modules/prismjs/components/prism-rust.js +0 -130
  391. package/dist/cjs/node_modules/prismjs/components/prism-sql.js +0 -34
  392. package/dist/cjs/node_modules/prismjs/components/prism-swift.js +0 -150
  393. package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +0 -62
  394. package/dist/cjs/node_modules/prismjs/prism.js +0 -1951
  395. package/dist/cjs/packages/lexical/src/components/StickyComponent.js +0 -221
  396. package/dist/cjs/packages/lexical/src/nodes/StickyNode.js +0 -218
  397. package/dist/cjs/packages/lexical/src/plugins/StickyPlugin.js +0 -20
  398. package/dist/esm/_virtual/prism.js +0 -5
  399. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -465
  400. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -19
  401. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -18
  402. package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +0 -1512
  403. package/dist/esm/node_modules/@lexical/code/LexicalCode.js +0 -21
  404. package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +0 -32
  405. package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +0 -251
  406. package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +0 -18
  407. package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +0 -17
  408. package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +0 -563
  409. package/dist/esm/node_modules/@lexical/link/LexicalLink.js +0 -17
  410. package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +0 -16
  411. package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +0 -1595
  412. package/dist/esm/node_modules/@lexical/list/LexicalList.js +0 -23
  413. package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +0 -17
  414. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -830
  415. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +0 -23
  416. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -18
  417. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -1028
  418. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +0 -28
  419. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -16
  420. package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +0 -4156
  421. package/dist/esm/node_modules/@lexical/table/LexicalTable.js +0 -20
  422. package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +0 -17
  423. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -1102
  424. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +0 -32
  425. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -17
  426. package/dist/esm/node_modules/@mdi/js/mdi.js +0 -7
  427. package/dist/esm/node_modules/prismjs/components/prism-c.js +0 -82
  428. package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -33
  429. package/dist/esm/node_modules/prismjs/components/prism-cpp.js +0 -101
  430. package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -66
  431. package/dist/esm/node_modules/prismjs/components/prism-java.js +0 -126
  432. package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -174
  433. package/dist/esm/node_modules/prismjs/components/prism-markdown.js +0 -417
  434. package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -188
  435. package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +0 -14
  436. package/dist/esm/node_modules/prismjs/components/prism-powershell.js +0 -60
  437. package/dist/esm/node_modules/prismjs/components/prism-python.js +0 -67
  438. package/dist/esm/node_modules/prismjs/components/prism-rust.js +0 -130
  439. package/dist/esm/node_modules/prismjs/components/prism-sql.js +0 -34
  440. package/dist/esm/node_modules/prismjs/components/prism-swift.js +0 -150
  441. package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -62
  442. package/dist/esm/node_modules/prismjs/prism.js +0 -1951
  443. package/dist/esm/packages/lexical/src/components/StickyComponent.js +0 -221
  444. package/dist/esm/packages/lexical/src/nodes/StickyNode.js +0 -216
  445. package/dist/esm/packages/lexical/src/plugins/StickyPlugin.js +0 -20
  446. package/dist/types/components/StickyComponent.d.ts +0 -9
  447. package/dist/types/nodes/StickyNode.d.ts +0 -34
  448. package/dist/types/plugins/StickyPlugin.d.ts +0 -1
  449. package/src/components/StickyComponent.tsx +0 -271
  450. package/src/nodes/StickyNode.tsx +0 -249
@@ -0,0 +1,425 @@
1
+ 'use client';
2
+
3
+ import { getDefaultOptions } from './_lib/defaultOptions.js';
4
+ import { formatters } from './_lib/format/formatters.js';
5
+ import { longFormatters } from './_lib/format/longFormatters.js';
6
+ import { isProtectedWeekYearToken, isProtectedDayOfYearToken, warnOrThrowProtectedError } from './_lib/protectedTokens.js';
7
+ import { isValid } from './isValid.js';
8
+ import { toDate } from './toDate.js';
9
+ import { enUS } from './locale/en-US.js';
10
+
11
+ // This RegExp consists of three parts separated by `|`:
12
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
13
+ // (one of the certain letters followed by `o`)
14
+ // - (\w)\1* matches any sequences of the same letter
15
+ // - '' matches two quote characters in a row
16
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
17
+ // except a single quote symbol, which ends the sequence.
18
+ // Two quote characters do not end the sequence.
19
+ // If there is no matching single quote
20
+ // then the sequence will continue until the end of the string.
21
+ // - . matches any single character unmatched by previous parts of the RegExps
22
+ const formattingTokensRegExp =
23
+ /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
24
+
25
+ // This RegExp catches symbols escaped by quotes, and also
26
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
27
+ const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
28
+
29
+ const escapedStringRegExp = /^'([^]*?)'?$/;
30
+ const doubleQuoteRegExp = /''/g;
31
+ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
32
+
33
+ /**
34
+ * The {@link format} function options.
35
+ */
36
+
37
+ /**
38
+ * @name format
39
+ * @alias formatDate
40
+ * @category Common Helpers
41
+ * @summary Format the date.
42
+ *
43
+ * @description
44
+ * Return the formatted date string in the given format. The result may vary by locale.
45
+ *
46
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
47
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
48
+ *
49
+ * The characters wrapped between two single quotes characters (') are escaped.
50
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
51
+ * (see the last example)
52
+ *
53
+ * Format of the string is based on Unicode Technical Standard #35:
54
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
55
+ * with a few additions (see note 7 below the table).
56
+ *
57
+ * Accepted patterns:
58
+ * | Unit | Pattern | Result examples | Notes |
59
+ * |---------------------------------|---------|-----------------------------------|-------|
60
+ * | Era | G..GGG | AD, BC | |
61
+ * | | GGGG | Anno Domini, Before Christ | 2 |
62
+ * | | GGGGG | A, B | |
63
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
64
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
65
+ * | | yy | 44, 01, 00, 17 | 5 |
66
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
67
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
68
+ * | | yyyyy | ... | 3,5 |
69
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
70
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
71
+ * | | YY | 44, 01, 00, 17 | 5,8 |
72
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
73
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
74
+ * | | YYYYY | ... | 3,5 |
75
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
76
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
77
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
78
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
79
+ * | | RRRRR | ... | 3,5,7 |
80
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
81
+ * | | uu | -43, 01, 1900, 2017 | 5 |
82
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
83
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
84
+ * | | uuuuu | ... | 3,5 |
85
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
86
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
87
+ * | | QQ | 01, 02, 03, 04 | |
88
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
89
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
90
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
91
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
92
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
93
+ * | | qq | 01, 02, 03, 04 | |
94
+ * | | qqq | Q1, Q2, Q3, Q4 | |
95
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
96
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
97
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
98
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
99
+ * | | MM | 01, 02, ..., 12 | |
100
+ * | | MMM | Jan, Feb, ..., Dec | |
101
+ * | | MMMM | January, February, ..., December | 2 |
102
+ * | | MMMMM | J, F, ..., D | |
103
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
104
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
105
+ * | | LL | 01, 02, ..., 12 | |
106
+ * | | LLL | Jan, Feb, ..., Dec | |
107
+ * | | LLLL | January, February, ..., December | 2 |
108
+ * | | LLLLL | J, F, ..., D | |
109
+ * | Local week of year | w | 1, 2, ..., 53 | |
110
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
111
+ * | | ww | 01, 02, ..., 53 | |
112
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
113
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
114
+ * | | II | 01, 02, ..., 53 | 7 |
115
+ * | Day of month | d | 1, 2, ..., 31 | |
116
+ * | | do | 1st, 2nd, ..., 31st | 7 |
117
+ * | | dd | 01, 02, ..., 31 | |
118
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
119
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
120
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
121
+ * | | DDD | 001, 002, ..., 365, 366 | |
122
+ * | | DDDD | ... | 3 |
123
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
124
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
125
+ * | | EEEEE | M, T, W, T, F, S, S | |
126
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
127
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
128
+ * | | io | 1st, 2nd, ..., 7th | 7 |
129
+ * | | ii | 01, 02, ..., 07 | 7 |
130
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
131
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
132
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
133
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
134
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
135
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
136
+ * | | ee | 02, 03, ..., 01 | |
137
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
138
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
139
+ * | | eeeee | M, T, W, T, F, S, S | |
140
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
141
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
142
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
143
+ * | | cc | 02, 03, ..., 01 | |
144
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
145
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
146
+ * | | ccccc | M, T, W, T, F, S, S | |
147
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
148
+ * | AM, PM | a..aa | AM, PM | |
149
+ * | | aaa | am, pm | |
150
+ * | | aaaa | a.m., p.m. | 2 |
151
+ * | | aaaaa | a, p | |
152
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
153
+ * | | bbb | am, pm, noon, midnight | |
154
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
155
+ * | | bbbbb | a, p, n, mi | |
156
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
157
+ * | | BBBB | at night, in the morning, ... | 2 |
158
+ * | | BBBBB | at night, in the morning, ... | |
159
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
160
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
161
+ * | | hh | 01, 02, ..., 11, 12 | |
162
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
163
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
164
+ * | | HH | 00, 01, 02, ..., 23 | |
165
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
166
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
167
+ * | | KK | 01, 02, ..., 11, 00 | |
168
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
169
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
170
+ * | | kk | 24, 01, 02, ..., 23 | |
171
+ * | Minute | m | 0, 1, ..., 59 | |
172
+ * | | mo | 0th, 1st, ..., 59th | 7 |
173
+ * | | mm | 00, 01, ..., 59 | |
174
+ * | Second | s | 0, 1, ..., 59 | |
175
+ * | | so | 0th, 1st, ..., 59th | 7 |
176
+ * | | ss | 00, 01, ..., 59 | |
177
+ * | Fraction of second | S | 0, 1, ..., 9 | |
178
+ * | | SS | 00, 01, ..., 99 | |
179
+ * | | SSS | 000, 001, ..., 999 | |
180
+ * | | SSSS | ... | 3 |
181
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
182
+ * | | XX | -0800, +0530, Z | |
183
+ * | | XXX | -08:00, +05:30, Z | |
184
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
185
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
186
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
187
+ * | | xx | -0800, +0530, +0000 | |
188
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
189
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
190
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
191
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
192
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
193
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
194
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
195
+ * | Seconds timestamp | t | 512969520 | 7 |
196
+ * | | tt | ... | 3,7 |
197
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
198
+ * | | TT | ... | 3,7 |
199
+ * | Long localized date | P | 04/29/1453 | 7 |
200
+ * | | PP | Apr 29, 1453 | 7 |
201
+ * | | PPP | April 29th, 1453 | 7 |
202
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
203
+ * | Long localized time | p | 12:00 AM | 7 |
204
+ * | | pp | 12:00:00 AM | 7 |
205
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
206
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
207
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
208
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
209
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
210
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
211
+ * Notes:
212
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
213
+ * are the same as "stand-alone" units, but are different in some languages.
214
+ * "Formatting" units are declined according to the rules of the language
215
+ * in the context of a date. "Stand-alone" units are always nominative singular:
216
+ *
217
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
218
+ *
219
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
220
+ *
221
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
222
+ * the single quote characters (see below).
223
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
224
+ * the output will be the same as default pattern for this unit, usually
225
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
226
+ * are marked with "2" in the last column of the table.
227
+ *
228
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
229
+ *
230
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
231
+ *
232
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
233
+ *
234
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
235
+ *
236
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
237
+ *
238
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
239
+ * The output will be padded with zeros to match the length of the pattern.
240
+ *
241
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
242
+ *
243
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
244
+ * These tokens represent the shortest form of the quarter.
245
+ *
246
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
247
+ *
248
+ * | Year | `y` | `u` |
249
+ * |------|-----|-----|
250
+ * | AC 1 | 1 | 1 |
251
+ * | BC 1 | 1 | 0 |
252
+ * | BC 2 | 2 | -1 |
253
+ *
254
+ * Also `yy` always returns the last two digits of a year,
255
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
256
+ *
257
+ * | Year | `yy` | `uu` |
258
+ * |------|------|------|
259
+ * | 1 | 01 | 01 |
260
+ * | 14 | 14 | 14 |
261
+ * | 376 | 76 | 376 |
262
+ * | 1453 | 53 | 1453 |
263
+ *
264
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
265
+ * except local week-numbering years are dependent on `options.weekStartsOn`
266
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
267
+ * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
268
+ *
269
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
270
+ * so right now these tokens fall back to GMT timezones.
271
+ *
272
+ * 7. These patterns are not in the Unicode Technical Standard #35:
273
+ * - `i`: ISO day of week
274
+ * - `I`: ISO week of year
275
+ * - `R`: ISO week-numbering year
276
+ * - `t`: seconds timestamp
277
+ * - `T`: milliseconds timestamp
278
+ * - `o`: ordinal number modifier
279
+ * - `P`: long localized date
280
+ * - `p`: long localized time
281
+ *
282
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
283
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
284
+ *
285
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
286
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
287
+ *
288
+ * @param date - The original date
289
+ * @param format - The string of tokens
290
+ * @param options - An object with options
291
+ *
292
+ * @returns The formatted date string
293
+ *
294
+ * @throws `date` must not be Invalid Date
295
+ * @throws `options.locale` must contain `localize` property
296
+ * @throws `options.locale` must contain `formatLong` property
297
+ * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
298
+ * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
299
+ * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
300
+ * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
301
+ * @throws format string contains an unescaped latin alphabet character
302
+ *
303
+ * @example
304
+ * // Represent 11 February 2014 in middle-endian format:
305
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
306
+ * //=> '02/11/2014'
307
+ *
308
+ * @example
309
+ * // Represent 2 July 2014 in Esperanto:
310
+ * import { eoLocale } from 'date-fns/locale/eo'
311
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
312
+ * locale: eoLocale
313
+ * })
314
+ * //=> '2-a de julio 2014'
315
+ *
316
+ * @example
317
+ * // Escape string by single quote characters:
318
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
319
+ * //=> "3 o'clock"
320
+ */
321
+ function format(date, formatStr, options) {
322
+ const defaultOptions = getDefaultOptions();
323
+ const locale = options?.locale ?? defaultOptions.locale ?? enUS;
324
+
325
+ const firstWeekContainsDate =
326
+ options?.firstWeekContainsDate ??
327
+ options?.locale?.options?.firstWeekContainsDate ??
328
+ defaultOptions.firstWeekContainsDate ??
329
+ defaultOptions.locale?.options?.firstWeekContainsDate ??
330
+ 1;
331
+
332
+ const weekStartsOn =
333
+ options?.weekStartsOn ??
334
+ options?.locale?.options?.weekStartsOn ??
335
+ defaultOptions.weekStartsOn ??
336
+ defaultOptions.locale?.options?.weekStartsOn ??
337
+ 0;
338
+
339
+ const originalDate = toDate(date, options?.in);
340
+
341
+ if (!isValid(originalDate)) {
342
+ throw new RangeError("Invalid time value");
343
+ }
344
+
345
+ let parts = formatStr
346
+ .match(longFormattingTokensRegExp)
347
+ .map((substring) => {
348
+ const firstCharacter = substring[0];
349
+ if (firstCharacter === "p" || firstCharacter === "P") {
350
+ const longFormatter = longFormatters[firstCharacter];
351
+ return longFormatter(substring, locale.formatLong);
352
+ }
353
+ return substring;
354
+ })
355
+ .join("")
356
+ .match(formattingTokensRegExp)
357
+ .map((substring) => {
358
+ // Replace two single quote characters with one single quote character
359
+ if (substring === "''") {
360
+ return { isToken: false, value: "'" };
361
+ }
362
+
363
+ const firstCharacter = substring[0];
364
+ if (firstCharacter === "'") {
365
+ return { isToken: false, value: cleanEscapedString(substring) };
366
+ }
367
+
368
+ if (formatters[firstCharacter]) {
369
+ return { isToken: true, value: substring };
370
+ }
371
+
372
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
373
+ throw new RangeError(
374
+ "Format string contains an unescaped latin alphabet character `" +
375
+ firstCharacter +
376
+ "`",
377
+ );
378
+ }
379
+
380
+ return { isToken: false, value: substring };
381
+ });
382
+
383
+ // invoke localize preprocessor (only for french locales at the moment)
384
+ if (locale.localize.preprocessor) {
385
+ parts = locale.localize.preprocessor(originalDate, parts);
386
+ }
387
+
388
+ const formatterOptions = {
389
+ firstWeekContainsDate,
390
+ weekStartsOn,
391
+ locale,
392
+ };
393
+
394
+ return parts
395
+ .map((part) => {
396
+ if (!part.isToken) return part.value;
397
+
398
+ const token = part.value;
399
+
400
+ if (
401
+ (!options?.useAdditionalWeekYearTokens &&
402
+ isProtectedWeekYearToken(token)) ||
403
+ (!options?.useAdditionalDayOfYearTokens &&
404
+ isProtectedDayOfYearToken(token))
405
+ ) {
406
+ warnOrThrowProtectedError(token, formatStr, String(date));
407
+ }
408
+
409
+ const formatter = formatters[token[0]];
410
+ return formatter(originalDate, token, locale.localize, formatterOptions);
411
+ })
412
+ .join("");
413
+ }
414
+
415
+ function cleanEscapedString(input) {
416
+ const matched = input.match(escapedStringRegExp);
417
+
418
+ if (!matched) {
419
+ return input;
420
+ }
421
+
422
+ return matched[1].replace(doubleQuoteRegExp, "'");
423
+ }
424
+
425
+ export { format as default, format, format as formatDate, formatters, longFormatters };
@@ -0,0 +1,36 @@
1
+ 'use client';
2
+
3
+ import { differenceInCalendarDays } from './differenceInCalendarDays.js';
4
+ import { startOfYear } from './startOfYear.js';
5
+ import { toDate } from './toDate.js';
6
+
7
+ /**
8
+ * The {@link getDayOfYear} function options.
9
+ */
10
+
11
+ /**
12
+ * @name getDayOfYear
13
+ * @category Day Helpers
14
+ * @summary Get the day of the year of the given date.
15
+ *
16
+ * @description
17
+ * Get the day of the year of the given date.
18
+ *
19
+ * @param date - The given date
20
+ * @param options - The options
21
+ *
22
+ * @returns The day of year
23
+ *
24
+ * @example
25
+ * // Which day of the year is 2 July 2014?
26
+ * const result = getDayOfYear(new Date(2014, 6, 2))
27
+ * //=> 183
28
+ */
29
+ function getDayOfYear(date, options) {
30
+ const _date = toDate(date, options?.in);
31
+ const diff = differenceInCalendarDays(_date, startOfYear(_date));
32
+ const dayOfYear = diff + 1;
33
+ return dayOfYear;
34
+ }
35
+
36
+ export { getDayOfYear as default, getDayOfYear };
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+
3
+ import { millisecondsInWeek } from './constants.js';
4
+ import { startOfISOWeek } from './startOfISOWeek.js';
5
+ import { startOfISOWeekYear } from './startOfISOWeekYear.js';
6
+ import { toDate } from './toDate.js';
7
+
8
+ /**
9
+ * The {@link getISOWeek} function options.
10
+ */
11
+
12
+ /**
13
+ * @name getISOWeek
14
+ * @category ISO Week Helpers
15
+ * @summary Get the ISO week of the given date.
16
+ *
17
+ * @description
18
+ * Get the ISO week of the given date.
19
+ *
20
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
21
+ *
22
+ * @param date - The given date
23
+ * @param options - The options
24
+ *
25
+ * @returns The ISO week
26
+ *
27
+ * @example
28
+ * // Which week of the ISO-week numbering year is 2 January 2005?
29
+ * const result = getISOWeek(new Date(2005, 0, 2))
30
+ * //=> 53
31
+ */
32
+ function getISOWeek(date, options) {
33
+ const _date = toDate(date, options?.in);
34
+ const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
35
+
36
+ // Round the number of weeks to the nearest integer because the number of
37
+ // milliseconds in a week is not constant (e.g. it's different in the week of
38
+ // the daylight saving time clock shift).
39
+ return Math.round(diff / millisecondsInWeek) + 1;
40
+ }
41
+
42
+ export { getISOWeek as default, getISOWeek };
@@ -0,0 +1,54 @@
1
+ 'use client';
2
+
3
+ import { constructFrom } from './constructFrom.js';
4
+ import { startOfISOWeek } from './startOfISOWeek.js';
5
+ import { toDate } from './toDate.js';
6
+
7
+ /**
8
+ * The {@link getISOWeekYear} function options.
9
+ */
10
+
11
+ /**
12
+ * @name getISOWeekYear
13
+ * @category ISO Week-Numbering Year Helpers
14
+ * @summary Get the ISO week-numbering year of the given date.
15
+ *
16
+ * @description
17
+ * Get the ISO week-numbering year of the given date,
18
+ * which always starts 3 days before the year's first Thursday.
19
+ *
20
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
21
+ *
22
+ * @param date - The given date
23
+ *
24
+ * @returns The ISO week-numbering year
25
+ *
26
+ * @example
27
+ * // Which ISO-week numbering year is 2 January 2005?
28
+ * const result = getISOWeekYear(new Date(2005, 0, 2))
29
+ * //=> 2004
30
+ */
31
+ function getISOWeekYear(date, options) {
32
+ const _date = toDate(date, options?.in);
33
+ const year = _date.getFullYear();
34
+
35
+ const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
36
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
37
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
38
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
39
+
40
+ const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
41
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
42
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
43
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
44
+
45
+ if (_date.getTime() >= startOfNextYear.getTime()) {
46
+ return year + 1;
47
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
48
+ return year;
49
+ } else {
50
+ return year - 1;
51
+ }
52
+ }
53
+
54
+ export { getISOWeekYear as default, getISOWeekYear };
@@ -0,0 +1,56 @@
1
+ 'use client';
2
+
3
+ import { millisecondsInWeek } from './constants.js';
4
+ import { startOfWeek } from './startOfWeek.js';
5
+ import { startOfWeekYear } from './startOfWeekYear.js';
6
+ import { toDate } from './toDate.js';
7
+
8
+ /**
9
+ * The {@link getWeek} function options.
10
+ */
11
+
12
+ /**
13
+ * @name getWeek
14
+ * @category Week Helpers
15
+ * @summary Get the local week index of the given date.
16
+ *
17
+ * @description
18
+ * Get the local week index 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 week
30
+ *
31
+ * @example
32
+ * // Which week of the local week numbering year is 2 January 2005 with default options?
33
+ * const result = getWeek(new Date(2005, 0, 2))
34
+ * //=> 2
35
+ *
36
+ * @example
37
+ * // Which week of the local week numbering year is 2 January 2005,
38
+ * // if Monday is the first day of the week,
39
+ * // and the first week of the year always contains 4 January?
40
+ * const result = getWeek(new Date(2005, 0, 2), {
41
+ * weekStartsOn: 1,
42
+ * firstWeekContainsDate: 4
43
+ * })
44
+ * //=> 53
45
+ */
46
+ function getWeek(date, options) {
47
+ const _date = toDate(date, options?.in);
48
+ const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
49
+
50
+ // Round the number of weeks to the nearest integer because the number of
51
+ // milliseconds in a week is not constant (e.g. it's different in the week of
52
+ // the daylight saving time clock shift).
53
+ return Math.round(diff / millisecondsInWeek) + 1;
54
+ }
55
+
56
+ export { getWeek as default, getWeek };