@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.
- package/css/_lexical.css +61 -0
- package/dist/cjs/node_modules/date-fns/_lib/addLeadingZeros.js +9 -0
- package/dist/cjs/node_modules/date-fns/_lib/defaultOptions.js +9 -0
- package/dist/cjs/node_modules/date-fns/_lib/format/formatters.js +779 -0
- package/dist/cjs/node_modules/date-fns/_lib/format/lightFormatters.js +96 -0
- package/dist/cjs/node_modules/date-fns/_lib/format/longFormatters.js +68 -0
- package/dist/cjs/node_modules/date-fns/_lib/getRoundingMethod.js +12 -0
- package/dist/cjs/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +33 -0
- package/dist/cjs/node_modules/date-fns/_lib/normalizeDates.js +13 -0
- package/dist/cjs/node_modules/date-fns/_lib/normalizeInterval.js +10 -0
- package/dist/cjs/node_modules/date-fns/_lib/protectedTokens.js +29 -0
- package/dist/cjs/node_modules/date-fns/add.js +73 -0
- package/dist/cjs/node_modules/date-fns/addDays.js +46 -0
- package/dist/cjs/node_modules/date-fns/addHours.js +39 -0
- package/dist/cjs/node_modules/date-fns/addMilliseconds.js +39 -0
- package/dist/cjs/node_modules/date-fns/addMinutes.js +41 -0
- package/dist/cjs/node_modules/date-fns/addMonths.js +80 -0
- package/dist/cjs/node_modules/date-fns/addQuarters.js +38 -0
- package/dist/cjs/node_modules/date-fns/addWeeks.js +38 -0
- package/dist/cjs/node_modules/date-fns/addYears.js +38 -0
- package/dist/cjs/node_modules/date-fns/compareAsc.js +50 -0
- package/dist/cjs/node_modules/date-fns/constants.js +66 -0
- package/dist/cjs/node_modules/date-fns/constructFrom.js +54 -0
- package/dist/cjs/node_modules/date-fns/differenceInCalendarDays.js +67 -0
- package/dist/cjs/node_modules/date-fns/differenceInCalendarMonths.js +47 -0
- package/dist/cjs/node_modules/date-fns/differenceInCalendarYears.js +43 -0
- package/dist/cjs/node_modules/date-fns/differenceInDays.js +112 -0
- package/dist/cjs/node_modules/date-fns/differenceInHours.js +46 -0
- package/dist/cjs/node_modules/date-fns/differenceInMilliseconds.js +34 -0
- package/dist/cjs/node_modules/date-fns/differenceInMinutes.js +50 -0
- package/dist/cjs/node_modules/date-fns/differenceInMonths.js +65 -0
- package/dist/cjs/node_modules/date-fns/differenceInSeconds.js +41 -0
- package/dist/cjs/node_modules/date-fns/differenceInYears.js +67 -0
- package/dist/cjs/node_modules/date-fns/endOfDay.js +40 -0
- package/dist/cjs/node_modules/date-fns/endOfDecade.js +45 -0
- package/dist/cjs/node_modules/date-fns/endOfHour.js +40 -0
- package/dist/cjs/node_modules/date-fns/endOfMinute.js +40 -0
- package/dist/cjs/node_modules/date-fns/endOfMonth.js +42 -0
- package/dist/cjs/node_modules/date-fns/endOfQuarter.js +43 -0
- package/dist/cjs/node_modules/date-fns/endOfWeek.js +58 -0
- package/dist/cjs/node_modules/date-fns/endOfYear.js +42 -0
- package/dist/cjs/node_modules/date-fns/format.js +431 -0
- package/dist/cjs/node_modules/date-fns/getDayOfYear.js +39 -0
- package/dist/cjs/node_modules/date-fns/getISOWeek.js +45 -0
- package/dist/cjs/node_modules/date-fns/getISOWeekYear.js +57 -0
- package/dist/cjs/node_modules/date-fns/getWeek.js +59 -0
- package/dist/cjs/node_modules/date-fns/getWeekYear.js +80 -0
- package/dist/cjs/node_modules/date-fns/intervalToDuration.js +70 -0
- package/dist/cjs/node_modules/date-fns/isAfter.js +30 -0
- package/dist/cjs/node_modules/date-fns/isBefore.js +30 -0
- package/dist/cjs/node_modules/date-fns/isDate.js +46 -0
- package/dist/cjs/node_modules/date-fns/isLastDayOfMonth.js +33 -0
- package/dist/cjs/node_modules/date-fns/isSameMonth.js +48 -0
- package/dist/cjs/node_modules/date-fns/isSameWeek.js +56 -0
- package/dist/cjs/node_modules/date-fns/isSameYear.js +40 -0
- package/dist/cjs/node_modules/date-fns/isValid.js +44 -0
- package/dist/cjs/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +12 -0
- package/dist/cjs/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +66 -0
- package/dist/cjs/node_modules/date-fns/locale/_lib/buildMatchFn.js +61 -0
- package/dist/cjs/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +24 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatDistance.js +139 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/localize.js +166 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/match.js +146 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA.js +32 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatDistance.js +200 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatLong.js +44 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/localize.js +195 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/match.js +138 -0
- package/dist/cjs/node_modules/date-fns/locale/de.js +36 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/localize.js +191 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/match.js +136 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US.js +33 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatRelative.js +29 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/localize.js +168 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/match.js +142 -0
- package/dist/cjs/node_modules/date-fns/locale/es.js +36 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatDistance.js +104 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/localize.js +169 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/match.js +137 -0
- package/dist/cjs/node_modules/date-fns/locale/fr.js +33 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatDistance.js +109 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/localize.js +233 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/match.js +141 -0
- package/dist/cjs/node_modules/date-fns/locale/hi.js +32 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatRelative.js +70 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/localize.js +168 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/match.js +137 -0
- package/dist/cjs/node_modules/date-fns/locale/it.js +34 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatDistance.js +119 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatRelative.js +16 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/localize.js +181 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/match.js +122 -0
- package/dist/cjs/node_modules/date-fns/locale/ja.js +36 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/localize.js +171 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/match.js +119 -0
- package/dist/cjs/node_modules/date-fns/locale/ko.js +34 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatRelative.js +26 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/localize.js +168 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/match.js +141 -0
- package/dist/cjs/node_modules/date-fns/locale/pt.js +33 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatDistance.js +250 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatLong.js +40 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatRelative.js +92 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/localize.js +214 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/match.js +142 -0
- package/dist/cjs/node_modules/date-fns/locale/ru.js +33 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js +35 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/localize.js +187 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/match.js +134 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN.js +36 -0
- package/dist/cjs/node_modules/date-fns/startOfDay.js +40 -0
- package/dist/cjs/node_modules/date-fns/startOfDecade.js +45 -0
- package/dist/cjs/node_modules/date-fns/startOfHour.js +40 -0
- package/dist/cjs/node_modules/date-fns/startOfISOWeek.js +40 -0
- package/dist/cjs/node_modules/date-fns/startOfISOWeekYear.js +47 -0
- package/dist/cjs/node_modules/date-fns/startOfMinute.js +40 -0
- package/dist/cjs/node_modules/date-fns/startOfMonth.js +42 -0
- package/dist/cjs/node_modules/date-fns/startOfQuarter.js +43 -0
- package/dist/cjs/node_modules/date-fns/startOfWeek.js +58 -0
- package/dist/cjs/node_modules/date-fns/startOfWeekYear.js +69 -0
- package/dist/cjs/node_modules/date-fns/startOfYear.js +41 -0
- package/dist/cjs/node_modules/date-fns/toDate.js +51 -0
- package/dist/cjs/packages/date/dist/esm/display/DateDuration.js +178 -0
- package/dist/cjs/packages/date/dist/esm/hijri/DateConverter.js +154 -0
- package/dist/cjs/packages/date/dist/esm/hijri/FormatDate.js +116 -0
- package/dist/cjs/packages/date/dist/esm/hijri/HijriDate.js +531 -0
- package/dist/cjs/packages/date/dist/esm/hijri/StringDateParser.js +74 -0
- package/dist/cjs/packages/date/dist/esm/hijri/index.js +21 -0
- package/dist/cjs/packages/date/dist/esm/hijri/initializer.js +113 -0
- package/dist/cjs/packages/date/dist/esm/hijri/locales.js +19 -0
- package/dist/cjs/packages/date/dist/esm/hijri/safe.js +17 -0
- package/dist/cjs/packages/date/dist/esm/i18n/ar/date.json.js +213 -0
- package/dist/cjs/packages/date/dist/esm/i18n/en/date.json.js +83 -0
- package/{src/plugins/StickyPlugin.ts → dist/cjs/packages/date/dist/esm/i18n/index.js} +10 -15
- package/dist/cjs/packages/date/dist/esm/types/index.js +46 -0
- package/dist/cjs/packages/date/dist/esm/utils/dateUtil.js +472 -0
- package/dist/cjs/{editor → packages/lexical/src/editor}/LexicalEditor.js +32 -9
- package/dist/cjs/{i18n/ar.json.js → packages/lexical/src/i18n/ar/lexical.json.js} +10 -4
- package/dist/cjs/{i18n/en.json.js → packages/lexical/src/i18n/en/lexical.json.js} +7 -1
- package/dist/cjs/{i18n → packages/lexical/src/i18n}/index.js +4 -4
- package/dist/cjs/packages/lexical/src/plugins/CommentPlugin.js +477 -0
- package/dist/cjs/{plugins → packages/lexical/src/plugins}/DraggableBlockPlugin.js +8 -11
- package/dist/esm/node_modules/date-fns/_lib/addLeadingZeros.js +9 -0
- package/dist/esm/node_modules/date-fns/_lib/defaultOptions.js +9 -0
- package/dist/esm/node_modules/date-fns/_lib/format/formatters.js +779 -0
- package/dist/esm/node_modules/date-fns/_lib/format/lightFormatters.js +96 -0
- package/dist/esm/node_modules/date-fns/_lib/format/longFormatters.js +68 -0
- package/dist/esm/node_modules/date-fns/_lib/getRoundingMethod.js +12 -0
- package/dist/esm/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +33 -0
- package/dist/esm/node_modules/date-fns/_lib/normalizeDates.js +13 -0
- package/dist/esm/node_modules/date-fns/_lib/normalizeInterval.js +10 -0
- package/dist/esm/node_modules/date-fns/_lib/protectedTokens.js +27 -0
- package/dist/esm/node_modules/date-fns/add.js +70 -0
- package/dist/esm/node_modules/date-fns/addDays.js +43 -0
- package/dist/esm/node_modules/date-fns/addHours.js +36 -0
- package/dist/esm/node_modules/date-fns/addMilliseconds.js +36 -0
- package/dist/esm/node_modules/date-fns/addMinutes.js +38 -0
- package/dist/esm/node_modules/date-fns/addMonths.js +77 -0
- package/dist/esm/node_modules/date-fns/addQuarters.js +35 -0
- package/dist/esm/node_modules/date-fns/addWeeks.js +35 -0
- package/dist/esm/node_modules/date-fns/addYears.js +35 -0
- package/dist/esm/node_modules/date-fns/compareAsc.js +47 -0
- package/dist/esm/node_modules/date-fns/constants.js +62 -0
- package/dist/esm/node_modules/date-fns/constructFrom.js +51 -0
- package/dist/esm/node_modules/date-fns/differenceInCalendarDays.js +64 -0
- package/dist/esm/node_modules/date-fns/differenceInCalendarMonths.js +44 -0
- package/dist/esm/node_modules/date-fns/differenceInCalendarYears.js +40 -0
- package/dist/esm/node_modules/date-fns/differenceInDays.js +109 -0
- package/dist/esm/node_modules/date-fns/differenceInHours.js +43 -0
- package/dist/esm/node_modules/date-fns/differenceInMilliseconds.js +31 -0
- package/dist/esm/node_modules/date-fns/differenceInMinutes.js +47 -0
- package/dist/esm/node_modules/date-fns/differenceInMonths.js +62 -0
- package/dist/esm/node_modules/date-fns/differenceInSeconds.js +38 -0
- package/dist/esm/node_modules/date-fns/differenceInYears.js +64 -0
- package/dist/esm/node_modules/date-fns/endOfDay.js +37 -0
- package/dist/esm/node_modules/date-fns/endOfDecade.js +42 -0
- package/dist/esm/node_modules/date-fns/endOfHour.js +37 -0
- package/dist/esm/node_modules/date-fns/endOfMinute.js +37 -0
- package/dist/esm/node_modules/date-fns/endOfMonth.js +39 -0
- package/dist/esm/node_modules/date-fns/endOfQuarter.js +40 -0
- package/dist/esm/node_modules/date-fns/endOfWeek.js +55 -0
- package/dist/esm/node_modules/date-fns/endOfYear.js +39 -0
- package/dist/esm/node_modules/date-fns/format.js +425 -0
- package/dist/esm/node_modules/date-fns/getDayOfYear.js +36 -0
- package/dist/esm/node_modules/date-fns/getISOWeek.js +42 -0
- package/dist/esm/node_modules/date-fns/getISOWeekYear.js +54 -0
- package/dist/esm/node_modules/date-fns/getWeek.js +56 -0
- package/dist/esm/node_modules/date-fns/getWeekYear.js +77 -0
- package/dist/esm/node_modules/date-fns/intervalToDuration.js +67 -0
- package/dist/esm/node_modules/date-fns/isAfter.js +27 -0
- package/dist/esm/node_modules/date-fns/isBefore.js +27 -0
- package/dist/esm/node_modules/date-fns/isDate.js +43 -0
- package/dist/esm/node_modules/date-fns/isLastDayOfMonth.js +30 -0
- package/dist/esm/node_modules/date-fns/isSameMonth.js +45 -0
- package/dist/esm/node_modules/date-fns/isSameWeek.js +53 -0
- package/dist/esm/node_modules/date-fns/isSameYear.js +37 -0
- package/dist/esm/node_modules/date-fns/isValid.js +41 -0
- package/dist/esm/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +12 -0
- package/dist/esm/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +66 -0
- package/dist/esm/node_modules/date-fns/locale/_lib/buildMatchFn.js +61 -0
- package/dist/esm/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +24 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatDistance.js +139 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/localize.js +166 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/match.js +146 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA.js +29 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/formatDistance.js +200 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/formatLong.js +44 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/localize.js +195 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/match.js +138 -0
- package/dist/esm/node_modules/date-fns/locale/de.js +33 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/localize.js +191 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/match.js +136 -0
- package/dist/esm/node_modules/date-fns/locale/en-US.js +30 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/formatRelative.js +29 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/localize.js +168 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/match.js +142 -0
- package/dist/esm/node_modules/date-fns/locale/es.js +33 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatDistance.js +104 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/localize.js +169 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/match.js +137 -0
- package/dist/esm/node_modules/date-fns/locale/fr.js +30 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatDistance.js +109 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/localize.js +231 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/match.js +141 -0
- package/dist/esm/node_modules/date-fns/locale/hi.js +29 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/formatRelative.js +70 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/localize.js +168 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/match.js +137 -0
- package/dist/esm/node_modules/date-fns/locale/it.js +31 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatDistance.js +119 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatRelative.js +16 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/localize.js +181 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/match.js +122 -0
- package/dist/esm/node_modules/date-fns/locale/ja.js +33 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/localize.js +171 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/match.js +119 -0
- package/dist/esm/node_modules/date-fns/locale/ko.js +31 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatRelative.js +26 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/localize.js +168 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/match.js +141 -0
- package/dist/esm/node_modules/date-fns/locale/pt.js +30 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatDistance.js +250 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatLong.js +40 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatRelative.js +92 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/localize.js +214 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/match.js +142 -0
- package/dist/esm/node_modules/date-fns/locale/ru.js +30 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js +35 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/localize.js +187 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/match.js +134 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN.js +33 -0
- package/dist/esm/node_modules/date-fns/startOfDay.js +37 -0
- package/dist/esm/node_modules/date-fns/startOfDecade.js +42 -0
- package/dist/esm/node_modules/date-fns/startOfHour.js +37 -0
- package/dist/esm/node_modules/date-fns/startOfISOWeek.js +37 -0
- package/dist/esm/node_modules/date-fns/startOfISOWeekYear.js +44 -0
- package/dist/esm/node_modules/date-fns/startOfMinute.js +37 -0
- package/dist/esm/node_modules/date-fns/startOfMonth.js +39 -0
- package/dist/esm/node_modules/date-fns/startOfQuarter.js +40 -0
- package/dist/esm/node_modules/date-fns/startOfWeek.js +55 -0
- package/dist/esm/node_modules/date-fns/startOfWeekYear.js +66 -0
- package/dist/esm/node_modules/date-fns/startOfYear.js +38 -0
- package/dist/esm/node_modules/date-fns/toDate.js +48 -0
- package/dist/esm/packages/date/dist/esm/display/DateDuration.js +178 -0
- package/dist/esm/packages/date/dist/esm/hijri/DateConverter.js +152 -0
- package/dist/esm/packages/date/dist/esm/hijri/FormatDate.js +113 -0
- package/dist/esm/packages/date/dist/esm/hijri/HijriDate.js +528 -0
- package/dist/esm/packages/date/dist/esm/hijri/StringDateParser.js +74 -0
- package/dist/esm/packages/date/dist/esm/hijri/index.js +21 -0
- package/dist/esm/packages/date/dist/esm/hijri/initializer.js +113 -0
- package/dist/esm/packages/date/dist/esm/hijri/locales.js +18 -0
- package/dist/esm/packages/date/dist/esm/hijri/safe.js +14 -0
- package/dist/esm/packages/date/dist/esm/i18n/ar/date.json.js +209 -0
- package/dist/esm/packages/date/dist/esm/i18n/en/date.json.js +79 -0
- package/dist/esm/packages/date/dist/esm/i18n/index.js +33 -0
- package/dist/esm/packages/date/dist/esm/types/index.js +45 -0
- package/dist/esm/packages/date/dist/esm/utils/dateUtil.js +474 -0
- package/dist/esm/{editor → packages/lexical/src/editor}/LexicalEditor.js +33 -10
- package/dist/esm/{i18n/ar.json.js → packages/lexical/src/i18n/ar/lexical.json.js} +9 -5
- package/dist/esm/{i18n/en.json.js → packages/lexical/src/i18n/en/lexical.json.js} +6 -2
- package/dist/esm/{i18n → packages/lexical/src/i18n}/index.js +2 -2
- package/dist/esm/packages/lexical/src/plugins/CommentPlugin.js +477 -0
- package/dist/esm/{plugins → packages/lexical/src/plugins}/DraggableBlockPlugin.js +9 -12
- package/dist/types/editor/LexicalEditor.d.ts +12 -3
- package/dist/types/hooks/useFormatWatcher.d.ts +1 -1
- package/dist/types/plugins/CommentPlugin.d.ts +5 -0
- package/dist/types/plugins/DraggableBlockPlugin.d.ts +2 -1
- package/package.json +5 -5
- package/src/editor/LexicalEditor.tsx +65 -18
- package/src/i18n/{ar.json → ar/lexical.json} +6 -4
- package/src/i18n/{en.json → en/lexical.json} +3 -1
- package/src/i18n/index.ts +2 -2
- package/src/plugins/CommentPlugin.tsx +554 -0
- package/src/plugins/DraggableBlockPlugin.tsx +5 -10
- package/dist/cjs/components/StickyComponent.js +0 -220
- package/dist/cjs/nodes/StickyNode.js +0 -218
- package/dist/cjs/plugins/StickyPlugin.js +0 -20
- package/dist/esm/components/StickyComponent.js +0 -220
- package/dist/esm/nodes/StickyNode.js +0 -216
- package/dist/esm/plugins/StickyPlugin.js +0 -20
- package/dist/types/components/StickyComponent.d.ts +0 -9
- package/dist/types/nodes/StickyNode.d.ts +0 -34
- package/dist/types/plugins/StickyPlugin.d.ts +0 -1
- package/src/components/StickyComponent.tsx +0 -270
- package/src/nodes/StickyNode.tsx +0 -249
- /package/dist/cjs/{editor → packages/lexical/src/editor}/theme.js +0 -0
- /package/dist/cjs/{hooks → packages/lexical/src/hooks}/useFormatWatcher.js +0 -0
- /package/dist/cjs/{index.js → packages/lexical/src/index.js} +0 -0
- /package/dist/cjs/{plugins → packages/lexical/src/plugins}/ToolbarPlugin.js +0 -0
- /package/dist/cjs/{utils → packages/lexical/src/utils}/index.js +0 -0
- /package/dist/esm/{editor → packages/lexical/src/editor}/theme.js +0 -0
- /package/dist/esm/{hooks → packages/lexical/src/hooks}/useFormatWatcher.js +0 -0
- /package/dist/esm/{index.js → packages/lexical/src/index.js} +0 -0
- /package/dist/esm/{plugins → packages/lexical/src/plugins}/ToolbarPlugin.js +0 -0
- /package/dist/esm/{utils → packages/lexical/src/utils}/index.js +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var addLeadingZeros = require('../addLeadingZeros.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* | | Unit | | Unit |
|
|
7
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
8
|
+
* | a | AM, PM | A* | |
|
|
9
|
+
* | d | Day of month | D | |
|
|
10
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
11
|
+
* | m | Minute | M | Month |
|
|
12
|
+
* | s | Second | S | Fraction of second |
|
|
13
|
+
* | y | Year (abs) | Y | |
|
|
14
|
+
*
|
|
15
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const lightFormatters = {
|
|
19
|
+
// Year
|
|
20
|
+
y(date, token) {
|
|
21
|
+
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
|
22
|
+
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
23
|
+
// |----------|-------|----|-------|-------|-------|
|
|
24
|
+
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
25
|
+
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
26
|
+
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
27
|
+
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
28
|
+
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
29
|
+
|
|
30
|
+
const signedYear = date.getFullYear();
|
|
31
|
+
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
32
|
+
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
33
|
+
return addLeadingZeros.addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// Month
|
|
37
|
+
M(date, token) {
|
|
38
|
+
const month = date.getMonth();
|
|
39
|
+
return token === "M" ? String(month + 1) : addLeadingZeros.addLeadingZeros(month + 1, 2);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// Day of the month
|
|
43
|
+
d(date, token) {
|
|
44
|
+
return addLeadingZeros.addLeadingZeros(date.getDate(), token.length);
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
// AM or PM
|
|
48
|
+
a(date, token) {
|
|
49
|
+
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
50
|
+
|
|
51
|
+
switch (token) {
|
|
52
|
+
case "a":
|
|
53
|
+
case "aa":
|
|
54
|
+
return dayPeriodEnumValue.toUpperCase();
|
|
55
|
+
case "aaa":
|
|
56
|
+
return dayPeriodEnumValue;
|
|
57
|
+
case "aaaaa":
|
|
58
|
+
return dayPeriodEnumValue[0];
|
|
59
|
+
case "aaaa":
|
|
60
|
+
default:
|
|
61
|
+
return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
// Hour [1-12]
|
|
66
|
+
h(date, token) {
|
|
67
|
+
return addLeadingZeros.addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// Hour [0-23]
|
|
71
|
+
H(date, token) {
|
|
72
|
+
return addLeadingZeros.addLeadingZeros(date.getHours(), token.length);
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
// Minute
|
|
76
|
+
m(date, token) {
|
|
77
|
+
return addLeadingZeros.addLeadingZeros(date.getMinutes(), token.length);
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
// Second
|
|
81
|
+
s(date, token) {
|
|
82
|
+
return addLeadingZeros.addLeadingZeros(date.getSeconds(), token.length);
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
// Fraction of second
|
|
86
|
+
S(date, token) {
|
|
87
|
+
const numberOfDigits = token.length;
|
|
88
|
+
const milliseconds = date.getMilliseconds();
|
|
89
|
+
const fractionalSeconds = Math.trunc(
|
|
90
|
+
milliseconds * Math.pow(10, numberOfDigits - 3),
|
|
91
|
+
);
|
|
92
|
+
return addLeadingZeros.addLeadingZeros(fractionalSeconds, token.length);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
exports.lightFormatters = lightFormatters;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const dateLongFormatter = (pattern, formatLong) => {
|
|
4
|
+
switch (pattern) {
|
|
5
|
+
case "P":
|
|
6
|
+
return formatLong.date({ width: "short" });
|
|
7
|
+
case "PP":
|
|
8
|
+
return formatLong.date({ width: "medium" });
|
|
9
|
+
case "PPP":
|
|
10
|
+
return formatLong.date({ width: "long" });
|
|
11
|
+
case "PPPP":
|
|
12
|
+
default:
|
|
13
|
+
return formatLong.date({ width: "full" });
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const timeLongFormatter = (pattern, formatLong) => {
|
|
18
|
+
switch (pattern) {
|
|
19
|
+
case "p":
|
|
20
|
+
return formatLong.time({ width: "short" });
|
|
21
|
+
case "pp":
|
|
22
|
+
return formatLong.time({ width: "medium" });
|
|
23
|
+
case "ppp":
|
|
24
|
+
return formatLong.time({ width: "long" });
|
|
25
|
+
case "pppp":
|
|
26
|
+
default:
|
|
27
|
+
return formatLong.time({ width: "full" });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const dateTimeLongFormatter = (pattern, formatLong) => {
|
|
32
|
+
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
33
|
+
const datePattern = matchResult[1];
|
|
34
|
+
const timePattern = matchResult[2];
|
|
35
|
+
|
|
36
|
+
if (!timePattern) {
|
|
37
|
+
return dateLongFormatter(pattern, formatLong);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let dateTimeFormat;
|
|
41
|
+
|
|
42
|
+
switch (datePattern) {
|
|
43
|
+
case "P":
|
|
44
|
+
dateTimeFormat = formatLong.dateTime({ width: "short" });
|
|
45
|
+
break;
|
|
46
|
+
case "PP":
|
|
47
|
+
dateTimeFormat = formatLong.dateTime({ width: "medium" });
|
|
48
|
+
break;
|
|
49
|
+
case "PPP":
|
|
50
|
+
dateTimeFormat = formatLong.dateTime({ width: "long" });
|
|
51
|
+
break;
|
|
52
|
+
case "PPPP":
|
|
53
|
+
default:
|
|
54
|
+
dateTimeFormat = formatLong.dateTime({ width: "full" });
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return dateTimeFormat
|
|
59
|
+
.replace("{{date}}", dateLongFormatter(datePattern, formatLong))
|
|
60
|
+
.replace("{{time}}", timeLongFormatter(timePattern, formatLong));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const longFormatters = {
|
|
64
|
+
p: timeLongFormatter,
|
|
65
|
+
P: dateTimeLongFormatter,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.longFormatters = longFormatters;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function getRoundingMethod(method) {
|
|
4
|
+
return (number) => {
|
|
5
|
+
const round = method ? Math[method] : Math.trunc;
|
|
6
|
+
const result = round(number);
|
|
7
|
+
// Prevent negative zero
|
|
8
|
+
return result === 0 ? 0 : result;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.getRoundingMethod = getRoundingMethod;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var toDate = require('../toDate.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
7
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
8
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
9
|
+
* and GMT+01:00:00 after that date)
|
|
10
|
+
*
|
|
11
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
12
|
+
* which would lead to incorrect calculations.
|
|
13
|
+
*
|
|
14
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
15
|
+
*/
|
|
16
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
|
17
|
+
const _date = toDate.toDate(date);
|
|
18
|
+
const utcDate = new Date(
|
|
19
|
+
Date.UTC(
|
|
20
|
+
_date.getFullYear(),
|
|
21
|
+
_date.getMonth(),
|
|
22
|
+
_date.getDate(),
|
|
23
|
+
_date.getHours(),
|
|
24
|
+
_date.getMinutes(),
|
|
25
|
+
_date.getSeconds(),
|
|
26
|
+
_date.getMilliseconds(),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
utcDate.setUTCFullYear(_date.getFullYear());
|
|
30
|
+
return +date - +utcDate;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
exports.getTimezoneOffsetInMilliseconds = getTimezoneOffsetInMilliseconds;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constructFrom = require('../constructFrom.js');
|
|
4
|
+
|
|
5
|
+
function normalizeDates(context, ...dates) {
|
|
6
|
+
const normalize = constructFrom.constructFrom.bind(
|
|
7
|
+
null,
|
|
8
|
+
context || dates.find((date) => typeof date === "object"),
|
|
9
|
+
);
|
|
10
|
+
return dates.map(normalize);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.normalizeDates = normalizeDates;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var normalizeDates = require('./normalizeDates.js');
|
|
4
|
+
|
|
5
|
+
function normalizeInterval(context, interval) {
|
|
6
|
+
const [start, end] = normalizeDates.normalizeDates(context, interval.start, interval.end);
|
|
7
|
+
return { start, end };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.normalizeInterval = normalizeInterval;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const dayOfYearTokenRE = /^D+$/;
|
|
4
|
+
const weekYearTokenRE = /^Y+$/;
|
|
5
|
+
|
|
6
|
+
const throwTokens = ["D", "DD", "YY", "YYYY"];
|
|
7
|
+
|
|
8
|
+
function isProtectedDayOfYearToken(token) {
|
|
9
|
+
return dayOfYearTokenRE.test(token);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function isProtectedWeekYearToken(token) {
|
|
13
|
+
return weekYearTokenRE.test(token);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function warnOrThrowProtectedError(token, format, input) {
|
|
17
|
+
const _message = message(token, format, input);
|
|
18
|
+
console.warn(_message);
|
|
19
|
+
if (throwTokens.includes(token)) throw new RangeError(_message);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function message(token, format, input) {
|
|
23
|
+
const subject = token[0] === "Y" ? "years" : "days of the month";
|
|
24
|
+
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.isProtectedDayOfYearToken = isProtectedDayOfYearToken;
|
|
28
|
+
exports.isProtectedWeekYearToken = isProtectedWeekYearToken;
|
|
29
|
+
exports.warnOrThrowProtectedError = warnOrThrowProtectedError;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var addDays = require('./addDays.js');
|
|
6
|
+
var addMonths = require('./addMonths.js');
|
|
7
|
+
var constructFrom = require('./constructFrom.js');
|
|
8
|
+
var toDate = require('./toDate.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The {@link add} function options.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @name add
|
|
16
|
+
* @category Common Helpers
|
|
17
|
+
* @summary Add the specified years, months, weeks, days, hours, minutes, and seconds to the given date.
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* Add the specified years, months, weeks, days, hours, minutes, and seconds to the given date.
|
|
21
|
+
*
|
|
22
|
+
* @typeParam DateType - The `Date` type the function operates on. Gets inferred from passed arguments. Allows using extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
23
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
24
|
+
*
|
|
25
|
+
* @param date - The date to be changed
|
|
26
|
+
* @param duration - The object with years, months, weeks, days, hours, minutes, and seconds to be added.
|
|
27
|
+
* @param options - An object with options
|
|
28
|
+
*
|
|
29
|
+
* @returns The new date with the seconds added
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Add the following duration to 1 September 2014, 10:19:50
|
|
33
|
+
* const result = add(new Date(2014, 8, 1, 10, 19, 50), {
|
|
34
|
+
* years: 2,
|
|
35
|
+
* months: 9,
|
|
36
|
+
* weeks: 1,
|
|
37
|
+
* days: 7,
|
|
38
|
+
* hours: 5,
|
|
39
|
+
* minutes: 9,
|
|
40
|
+
* seconds: 30,
|
|
41
|
+
* })
|
|
42
|
+
* //=> Thu Jun 15 2017 15:29:20
|
|
43
|
+
*/
|
|
44
|
+
function add(date, duration, options) {
|
|
45
|
+
const {
|
|
46
|
+
years = 0,
|
|
47
|
+
months = 0,
|
|
48
|
+
weeks = 0,
|
|
49
|
+
days = 0,
|
|
50
|
+
hours = 0,
|
|
51
|
+
minutes = 0,
|
|
52
|
+
seconds = 0,
|
|
53
|
+
} = duration;
|
|
54
|
+
|
|
55
|
+
// Add years and months
|
|
56
|
+
const _date = toDate.toDate(date, options?.in);
|
|
57
|
+
const dateWithMonths =
|
|
58
|
+
months || years ? addMonths.addMonths(_date, months + years * 12) : _date;
|
|
59
|
+
|
|
60
|
+
// Add weeks and days
|
|
61
|
+
const dateWithDays =
|
|
62
|
+
days || weeks ? addDays.addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
|
|
63
|
+
|
|
64
|
+
// Add days, hours, minutes, and seconds
|
|
65
|
+
const minutesToAdd = minutes + hours * 60;
|
|
66
|
+
const secondsToAdd = seconds + minutesToAdd * 60;
|
|
67
|
+
const msToAdd = secondsToAdd * 1000;
|
|
68
|
+
|
|
69
|
+
return constructFrom.constructFrom(options?.in || date, +dateWithDays + msToAdd);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
exports.add = add;
|
|
73
|
+
exports.default = add;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var constructFrom = require('./constructFrom.js');
|
|
6
|
+
var toDate = require('./toDate.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The {@link addDays} function options.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @name addDays
|
|
14
|
+
* @category Day Helpers
|
|
15
|
+
* @summary Add the specified number of days to the given date.
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* Add the specified number of days to the given date.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
21
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
22
|
+
*
|
|
23
|
+
* @param date - The date to be changed
|
|
24
|
+
* @param amount - The amount of days to be added.
|
|
25
|
+
* @param options - An object with options
|
|
26
|
+
*
|
|
27
|
+
* @returns The new date with the days added
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Add 10 days to 1 September 2014:
|
|
31
|
+
* const result = addDays(new Date(2014, 8, 1), 10)
|
|
32
|
+
* //=> Thu Sep 11 2014 00:00:00
|
|
33
|
+
*/
|
|
34
|
+
function addDays(date, amount, options) {
|
|
35
|
+
const _date = toDate.toDate(date, options?.in);
|
|
36
|
+
if (isNaN(amount)) return constructFrom.constructFrom(options?.in || date, NaN);
|
|
37
|
+
|
|
38
|
+
// If 0 days, no-op to avoid changing times in the hour before end of DST
|
|
39
|
+
if (!amount) return _date;
|
|
40
|
+
|
|
41
|
+
_date.setDate(_date.getDate() + amount);
|
|
42
|
+
return _date;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.addDays = addDays;
|
|
46
|
+
exports.default = addDays;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var addMilliseconds = require('./addMilliseconds.js');
|
|
6
|
+
var constants = require('./constants.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The {@link addHours} function options.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @name addHours
|
|
14
|
+
* @category Hour Helpers
|
|
15
|
+
* @summary Add the specified number of hours to the given date.
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* Add the specified number of hours to the given date.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
21
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
22
|
+
*
|
|
23
|
+
* @param date - The date to be changed
|
|
24
|
+
* @param amount - The amount of hours to be added
|
|
25
|
+
* @param options - An object with options
|
|
26
|
+
*
|
|
27
|
+
* @returns The new date with the hours added
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Add 2 hours to 10 July 2014 23:00:00:
|
|
31
|
+
* const result = addHours(new Date(2014, 6, 10, 23, 0), 2)
|
|
32
|
+
* //=> Fri Jul 11 2014 01:00:00
|
|
33
|
+
*/
|
|
34
|
+
function addHours(date, amount, options) {
|
|
35
|
+
return addMilliseconds.addMilliseconds(date, amount * constants.millisecondsInHour, options);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.addHours = addHours;
|
|
39
|
+
exports.default = addHours;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var constructFrom = require('./constructFrom.js');
|
|
6
|
+
var toDate = require('./toDate.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The {@link addMilliseconds} function options.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @name addMilliseconds
|
|
14
|
+
* @category Millisecond Helpers
|
|
15
|
+
* @summary Add the specified number of milliseconds to the given date.
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* Add the specified number of milliseconds to the given date.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
21
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
22
|
+
*
|
|
23
|
+
* @param date - The date to be changed
|
|
24
|
+
* @param amount - The amount of milliseconds to be added.
|
|
25
|
+
* @param options - The options object
|
|
26
|
+
*
|
|
27
|
+
* @returns The new date with the milliseconds added
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
|
31
|
+
* const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
32
|
+
* //=> Thu Jul 10 2014 12:45:30.750
|
|
33
|
+
*/
|
|
34
|
+
function addMilliseconds(date, amount, options) {
|
|
35
|
+
return constructFrom.constructFrom(options?.in || date, +toDate.toDate(date) + amount);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.addMilliseconds = addMilliseconds;
|
|
39
|
+
exports.default = addMilliseconds;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var constants = require('./constants.js');
|
|
6
|
+
var toDate = require('./toDate.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The {@link addMinutes} function options.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @name addMinutes
|
|
14
|
+
* @category Minute Helpers
|
|
15
|
+
* @summary Add the specified number of minutes to the given date.
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* Add the specified number of minutes to the given date.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
21
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
22
|
+
*
|
|
23
|
+
* @param date - The date to be changed
|
|
24
|
+
* @param amount - The amount of minutes to be added.
|
|
25
|
+
* @param options - An object with options
|
|
26
|
+
*
|
|
27
|
+
* @returns The new date with the minutes added
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Add 30 minutes to 10 July 2014 12:00:00:
|
|
31
|
+
* const result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)
|
|
32
|
+
* //=> Thu Jul 10 2014 12:30:00
|
|
33
|
+
*/
|
|
34
|
+
function addMinutes(date, amount, options) {
|
|
35
|
+
const _date = toDate.toDate(date, options?.in);
|
|
36
|
+
_date.setTime(_date.getTime() + amount * constants.millisecondsInMinute);
|
|
37
|
+
return _date;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.addMinutes = addMinutes;
|
|
41
|
+
exports.default = addMinutes;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var constructFrom = require('./constructFrom.js');
|
|
6
|
+
var toDate = require('./toDate.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The {@link addMonths} function options.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @name addMonths
|
|
14
|
+
* @category Month Helpers
|
|
15
|
+
* @summary Add the specified number of months to the given date.
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* Add the specified number of months to the given date.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
21
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
22
|
+
*
|
|
23
|
+
* @param date - The date to be changed
|
|
24
|
+
* @param amount - The amount of months to be added.
|
|
25
|
+
* @param options - The options object
|
|
26
|
+
*
|
|
27
|
+
* @returns The new date with the months added
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Add 5 months to 1 September 2014:
|
|
31
|
+
* const result = addMonths(new Date(2014, 8, 1), 5)
|
|
32
|
+
* //=> Sun Feb 01 2015 00:00:00
|
|
33
|
+
*
|
|
34
|
+
* // Add one month to 30 January 2023:
|
|
35
|
+
* const result = addMonths(new Date(2023, 0, 30), 1)
|
|
36
|
+
* //=> Tue Feb 28 2023 00:00:00
|
|
37
|
+
*/
|
|
38
|
+
function addMonths(date, amount, options) {
|
|
39
|
+
const _date = toDate.toDate(date, options?.in);
|
|
40
|
+
if (isNaN(amount)) return constructFrom.constructFrom(options?.in || date, NaN);
|
|
41
|
+
if (!amount) {
|
|
42
|
+
// If 0 months, no-op to avoid changing times in the hour before end of DST
|
|
43
|
+
return _date;
|
|
44
|
+
}
|
|
45
|
+
const dayOfMonth = _date.getDate();
|
|
46
|
+
|
|
47
|
+
// The JS Date object supports date math by accepting out-of-bounds values for
|
|
48
|
+
// month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
|
|
49
|
+
// new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
|
|
50
|
+
// want except that dates will wrap around the end of a month, meaning that
|
|
51
|
+
// new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
|
|
52
|
+
// we'll default to the end of the desired month by adding 1 to the desired
|
|
53
|
+
// month and using a date of 0 to back up one day to the end of the desired
|
|
54
|
+
// month.
|
|
55
|
+
const endOfDesiredMonth = constructFrom.constructFrom(options?.in || date, _date.getTime());
|
|
56
|
+
endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
|
|
57
|
+
const daysInMonth = endOfDesiredMonth.getDate();
|
|
58
|
+
if (dayOfMonth >= daysInMonth) {
|
|
59
|
+
// If we're already at the end of the month, then this is the correct date
|
|
60
|
+
// and we're done.
|
|
61
|
+
return endOfDesiredMonth;
|
|
62
|
+
} else {
|
|
63
|
+
// Otherwise, we now know that setting the original day-of-month value won't
|
|
64
|
+
// cause an overflow, so set the desired day-of-month. Note that we can't
|
|
65
|
+
// just set the date of `endOfDesiredMonth` because that object may have had
|
|
66
|
+
// its time changed in the unusual case where where a DST transition was on
|
|
67
|
+
// the last day of the month and its local time was in the hour skipped or
|
|
68
|
+
// repeated next to a DST transition. So we use `date` instead which is
|
|
69
|
+
// guaranteed to still have the original time.
|
|
70
|
+
_date.setFullYear(
|
|
71
|
+
endOfDesiredMonth.getFullYear(),
|
|
72
|
+
endOfDesiredMonth.getMonth(),
|
|
73
|
+
dayOfMonth,
|
|
74
|
+
);
|
|
75
|
+
return _date;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
exports.addMonths = addMonths;
|
|
80
|
+
exports.default = addMonths;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var addMonths = require('./addMonths.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The {@link addQuarters} function options.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @name addQuarters
|
|
13
|
+
* @category Quarter Helpers
|
|
14
|
+
* @summary Add the specified number of year quarters to the given date.
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* Add the specified number of year quarters to the given date.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
20
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
21
|
+
*
|
|
22
|
+
* @param date - The date to be changed
|
|
23
|
+
* @param amount - The amount of quarters to be added.
|
|
24
|
+
* @param options - An object with options
|
|
25
|
+
*
|
|
26
|
+
* @returns The new date with the quarters added
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Add 1 quarter to 1 September 2014:
|
|
30
|
+
* const result = addQuarters(new Date(2014, 8, 1), 1)
|
|
31
|
+
* //=; Mon Dec 01 2014 00:00:00
|
|
32
|
+
*/
|
|
33
|
+
function addQuarters(date, amount, options) {
|
|
34
|
+
return addMonths.addMonths(date, amount * 3, options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.addQuarters = addQuarters;
|
|
38
|
+
exports.default = addQuarters;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var addDays = require('./addDays.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The {@link addWeeks} function options.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @name addWeeks
|
|
13
|
+
* @category Week Helpers
|
|
14
|
+
* @summary Add the specified number of weeks to the given date.
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* Add the specified number of weeks to the given date.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
20
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
21
|
+
*
|
|
22
|
+
* @param date - The date to be changed
|
|
23
|
+
* @param amount - The amount of weeks to be added.
|
|
24
|
+
* @param options - An object with options
|
|
25
|
+
*
|
|
26
|
+
* @returns The new date with the weeks added
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Add 4 weeks to 1 September 2014:
|
|
30
|
+
* const result = addWeeks(new Date(2014, 8, 1), 4)
|
|
31
|
+
* //=> Mon Sep 29 2014 00:00:00
|
|
32
|
+
*/
|
|
33
|
+
function addWeeks(date, amount, options) {
|
|
34
|
+
return addDays.addDays(date, amount * 7, options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.addWeeks = addWeeks;
|
|
38
|
+
exports.default = addWeeks;
|