@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
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
4
|
-
import _createClass from '@babel/runtime/helpers/createClass';
|
|
5
|
-
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
|
|
6
|
-
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
|
|
7
|
-
import _inherits from '@babel/runtime/helpers/inherits';
|
|
8
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
9
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
10
|
-
import { DecoratorNode, $applyNodeReplacement } from 'lexical';
|
|
11
|
-
import { Suspense, lazy } from 'react';
|
|
12
|
-
import { createPortal } from 'react-dom';
|
|
13
|
-
import { jsx } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
-
var StickyComponent = /*#__PURE__*/lazy( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
18
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
|
-
while (1) switch (_context.prev = _context.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
_context.next = 2;
|
|
22
|
-
return import('../components/StickyComponent.js').then(function (_ref2) {
|
|
23
|
-
var StickyComponent = _ref2.StickyComponent;
|
|
24
|
-
return {
|
|
25
|
-
"default": StickyComponent
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
case 2:
|
|
29
|
-
return _context.abrupt("return", _context.sent);
|
|
30
|
-
case 3:
|
|
31
|
-
case "end":
|
|
32
|
-
return _context.stop();
|
|
33
|
-
}
|
|
34
|
-
}, _callee);
|
|
35
|
-
})));
|
|
36
|
-
var convertStickyElement = function convertStickyElement(domNode) {
|
|
37
|
-
var sticky = domNode.getAttribute("data-lexical-sticky") === "true";
|
|
38
|
-
if (sticky) {
|
|
39
|
-
var _domNode$getAttribute, _domNode$getAttribute2, _domNode$getAttribute3, _domNode$getAttribute4;
|
|
40
|
-
var node = $createStickyNode({
|
|
41
|
-
xOffset: +((_domNode$getAttribute = domNode.getAttribute("data-x")) !== null && _domNode$getAttribute !== void 0 ? _domNode$getAttribute : "8"),
|
|
42
|
-
yOffset: +((_domNode$getAttribute2 = domNode.getAttribute("data-y")) !== null && _domNode$getAttribute2 !== void 0 ? _domNode$getAttribute2 : "8"),
|
|
43
|
-
user: (_domNode$getAttribute3 = domNode.getAttribute("data-user")) !== null && _domNode$getAttribute3 !== void 0 ? _domNode$getAttribute3 : "",
|
|
44
|
-
color: domNode.getAttribute("data-color"),
|
|
45
|
-
state: (_domNode$getAttribute4 = domNode.getAttribute("data-state")) !== null && _domNode$getAttribute4 !== void 0 ? _domNode$getAttribute4 : ""
|
|
46
|
-
});
|
|
47
|
-
return {
|
|
48
|
-
node: node
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
return null;
|
|
52
|
-
};
|
|
53
|
-
var colors = {
|
|
54
|
-
yellow: "green",
|
|
55
|
-
green: "blue",
|
|
56
|
-
blue: "pink",
|
|
57
|
-
pink: "yellow"
|
|
58
|
-
};
|
|
59
|
-
var StickyNode = /*#__PURE__*/function (_DecoratorNode) {
|
|
60
|
-
function StickyNode(x, y) {
|
|
61
|
-
var _this;
|
|
62
|
-
var user = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
63
|
-
var color = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "yellow";
|
|
64
|
-
var state = arguments.length > 4 ? arguments[4] : undefined;
|
|
65
|
-
var key = arguments.length > 5 ? arguments[5] : undefined;
|
|
66
|
-
_classCallCheck(this, StickyNode);
|
|
67
|
-
_this = _callSuper(this, StickyNode, [key]);
|
|
68
|
-
_this.__x = x;
|
|
69
|
-
_this.__y = y;
|
|
70
|
-
_this.__user = user;
|
|
71
|
-
_this.__state = state;
|
|
72
|
-
_this.__color = color;
|
|
73
|
-
return _this;
|
|
74
|
-
}
|
|
75
|
-
_inherits(StickyNode, _DecoratorNode);
|
|
76
|
-
return _createClass(StickyNode, [{
|
|
77
|
-
key: "exportJSON",
|
|
78
|
-
value: function exportJSON() {
|
|
79
|
-
return {
|
|
80
|
-
state: this.__state,
|
|
81
|
-
color: this.__color,
|
|
82
|
-
user: this.__user,
|
|
83
|
-
type: "sticky",
|
|
84
|
-
version: 1,
|
|
85
|
-
xOffset: this.__x,
|
|
86
|
-
yOffset: this.__y
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
key: "createDOM",
|
|
91
|
-
value: function createDOM(config) {
|
|
92
|
-
var div = document.createElement("div");
|
|
93
|
-
div.style.display = "contents";
|
|
94
|
-
return div;
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "updateDOM",
|
|
98
|
-
value: function updateDOM() {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
key: "exportDOM",
|
|
103
|
-
value: function exportDOM() {
|
|
104
|
-
var writable = this.getWritable();
|
|
105
|
-
var element = document.createElement("div");
|
|
106
|
-
element.setAttribute("data-lexical-sticky", "true");
|
|
107
|
-
element.setAttribute("data-x", "".concat(writable.__x));
|
|
108
|
-
element.setAttribute("data-y", "".concat(writable.__y));
|
|
109
|
-
element.setAttribute("data-user", "".concat(writable.__user));
|
|
110
|
-
element.setAttribute("data-color", "".concat(writable.__color));
|
|
111
|
-
element.setAttribute("data-state", "".concat(writable.__state));
|
|
112
|
-
return {
|
|
113
|
-
element: element
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "setPosition",
|
|
118
|
-
value: function setPosition(x, y) {
|
|
119
|
-
var writable = this.getWritable();
|
|
120
|
-
writable.__x = x;
|
|
121
|
-
writable.__y = y;
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
key: "toggleColor",
|
|
125
|
-
value: function toggleColor() {
|
|
126
|
-
var _writable$__color;
|
|
127
|
-
var writable = this.getWritable();
|
|
128
|
-
writable.__color = colors[(_writable$__color = writable.__color) !== null && _writable$__color !== void 0 ? _writable$__color : "yellow"];
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "updateState",
|
|
132
|
-
value: function updateState(text) {
|
|
133
|
-
var writable = this.getWritable();
|
|
134
|
-
writable.__state = text;
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "decorate",
|
|
138
|
-
value: function decorate(editor, config) {
|
|
139
|
-
var _document$querySelect;
|
|
140
|
-
return /*#__PURE__*/createPortal( /*#__PURE__*/jsx(Suspense, {
|
|
141
|
-
fallback: null,
|
|
142
|
-
children: /*#__PURE__*/jsx(StickyComponent, {
|
|
143
|
-
x: this.__x,
|
|
144
|
-
y: this.__y,
|
|
145
|
-
user: this.__user,
|
|
146
|
-
state: this.__state,
|
|
147
|
-
nodeKey: this.getKey(),
|
|
148
|
-
color: this.__color
|
|
149
|
-
})
|
|
150
|
-
}), (_document$querySelect = document.querySelector(".lexical-container")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.body);
|
|
151
|
-
}
|
|
152
|
-
}, {
|
|
153
|
-
key: "isIsolated",
|
|
154
|
-
value: function isIsolated() {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
}], [{
|
|
158
|
-
key: "getType",
|
|
159
|
-
value: function getType() {
|
|
160
|
-
return "sticky";
|
|
161
|
-
}
|
|
162
|
-
}, {
|
|
163
|
-
key: "clone",
|
|
164
|
-
value: function clone(node) {
|
|
165
|
-
return new StickyNode(node.__x, node.__y, node.__user, node.__color, node.__state, node.__key);
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
key: "importJSON",
|
|
169
|
-
value: function importJSON(serializedNode) {
|
|
170
|
-
var stickyNode = new StickyNode(serializedNode.xOffset, serializedNode.yOffset, serializedNode.user, serializedNode.color, serializedNode.state);
|
|
171
|
-
return stickyNode;
|
|
172
|
-
}
|
|
173
|
-
}, {
|
|
174
|
-
key: "importDOM",
|
|
175
|
-
value: function importDOM() {
|
|
176
|
-
return {
|
|
177
|
-
div: function div(domNode) {
|
|
178
|
-
if (!domNode.hasAttribute("data-lexical-sticky")) {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
conversion: convertStickyElement,
|
|
183
|
-
priority: 2
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
span: function span(domNode) {
|
|
187
|
-
if (!domNode.hasAttribute("data-lexical-sticky")) {
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
return {
|
|
191
|
-
conversion: convertStickyElement,
|
|
192
|
-
priority: 1
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
}]);
|
|
198
|
-
}(DecoratorNode);
|
|
199
|
-
function $isStickyNode(node) {
|
|
200
|
-
return node instanceof StickyNode;
|
|
201
|
-
}
|
|
202
|
-
function $createStickyNode(_ref3) {
|
|
203
|
-
var _ref3$xOffset = _ref3.xOffset,
|
|
204
|
-
xOffset = _ref3$xOffset === void 0 ? 650 : _ref3$xOffset,
|
|
205
|
-
_ref3$yOffset = _ref3.yOffset,
|
|
206
|
-
yOffset = _ref3$yOffset === void 0 ? 32 : _ref3$yOffset,
|
|
207
|
-
_ref3$user = _ref3.user,
|
|
208
|
-
user = _ref3$user === void 0 ? "" : _ref3$user,
|
|
209
|
-
_ref3$color = _ref3.color,
|
|
210
|
-
color = _ref3$color === void 0 ? "yellow" : _ref3$color,
|
|
211
|
-
state = _ref3.state;
|
|
212
|
-
var node = new StickyNode(xOffset, yOffset, user, color, state);
|
|
213
|
-
return $applyNodeReplacement(node);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export { $createStickyNode, $isStickyNode, StickyNode };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
5
|
-
import { useEffect } from 'react';
|
|
6
|
-
import { StickyNode } from '../nodes/StickyNode.js';
|
|
7
|
-
|
|
8
|
-
var StickyPlugin = function StickyPlugin() {
|
|
9
|
-
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
10
|
-
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
11
|
-
editor = _useLexicalComposerCo2[0];
|
|
12
|
-
useEffect(function () {
|
|
13
|
-
if (!editor.hasNodes([StickyNode])) {
|
|
14
|
-
throw new Error("StickyPlugin: StickyNode not registered on editor");
|
|
15
|
-
}
|
|
16
|
-
}, [editor]);
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { StickyPlugin };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type NodeKey } from "lexical";
|
|
2
|
-
export declare const StickyComponent: ({ x, y, nodeKey, color, state, user, }: {
|
|
3
|
-
user: string;
|
|
4
|
-
state?: AnyObject;
|
|
5
|
-
color: "pink" | "yellow";
|
|
6
|
-
nodeKey: NodeKey;
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type EditorConfig, type LexicalEditor, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from "lexical";
|
|
2
|
-
type StickyNoteColor = "pink" | "yellow" | "green" | "blue";
|
|
3
|
-
interface StickyNodeType {
|
|
4
|
-
xOffset: number;
|
|
5
|
-
yOffset: number;
|
|
6
|
-
user?: string;
|
|
7
|
-
color?: StickyNoteColor;
|
|
8
|
-
state?: AnyObject;
|
|
9
|
-
}
|
|
10
|
-
export type SerializedStickyNode = Spread<StickyNodeType, SerializedLexicalNode>;
|
|
11
|
-
export declare class StickyNode extends DecoratorNode<JSX.Element> {
|
|
12
|
-
__x: number;
|
|
13
|
-
__y: number;
|
|
14
|
-
__user: string;
|
|
15
|
-
__state?: AnyObject;
|
|
16
|
-
__color: StickyNoteColor;
|
|
17
|
-
static getType(): string;
|
|
18
|
-
static clone(node: StickyNode): StickyNode;
|
|
19
|
-
static importJSON(serializedNode: SerializedStickyNode): StickyNode;
|
|
20
|
-
static importDOM(): DOMConversionMap | null;
|
|
21
|
-
constructor(x: number, y: number, user?: string, color?: StickyNoteColor, state?: KeyValue, key?: NodeKey);
|
|
22
|
-
exportJSON(): SerializedStickyNode;
|
|
23
|
-
createDOM(config: EditorConfig): HTMLElement;
|
|
24
|
-
updateDOM(): false;
|
|
25
|
-
exportDOM(): DOMExportOutput;
|
|
26
|
-
setPosition(x: number, y: number): void;
|
|
27
|
-
toggleColor(): void;
|
|
28
|
-
updateState(text: KeyValue): void;
|
|
29
|
-
decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element;
|
|
30
|
-
isIsolated(): true;
|
|
31
|
-
}
|
|
32
|
-
export declare function $isStickyNode(node: LexicalNode | null | undefined): node is StickyNode;
|
|
33
|
-
export declare function $createStickyNode({ xOffset, yOffset, user, color, state, }: StickyNodeType): StickyNode;
|
|
34
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const StickyPlugin: () => JSX.Element | null;
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* React Fabric
|
|
3
|
-
* @version: 1.0.0
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* The MIT License (MIT)
|
|
7
|
-
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
-
*
|
|
9
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
-
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
-
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
-
* subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
-
* portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
// REF: https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/nodes/StickyComponent.tsx
|
|
25
|
-
|
|
26
|
-
import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
27
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
28
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
29
|
-
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
30
|
-
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer";
|
|
31
|
-
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
32
|
-
import { Icon } from "@react-fabric/core";
|
|
33
|
-
import { $getNodeByKey, createEditor, type NodeKey } from "lexical";
|
|
34
|
-
import { useEffect, useMemo, useRef } from "react";
|
|
35
|
-
import { $isStickyNode } from "../nodes/StickyNode";
|
|
36
|
-
|
|
37
|
-
interface Positioning {
|
|
38
|
-
isDragging: boolean;
|
|
39
|
-
offsetX: number;
|
|
40
|
-
offsetY: number;
|
|
41
|
-
rootElementRect: null | { left: number; top: number };
|
|
42
|
-
x: number;
|
|
43
|
-
y: number;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function positionSticky(
|
|
47
|
-
stickyElem: HTMLElement,
|
|
48
|
-
positioning: Positioning,
|
|
49
|
-
): void {
|
|
50
|
-
const style = stickyElem.style;
|
|
51
|
-
style.top = `${positioning.y}px`;
|
|
52
|
-
style.left = `${positioning.x}px`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const StickyComponent = ({
|
|
56
|
-
x = 0,
|
|
57
|
-
y = 0,
|
|
58
|
-
nodeKey,
|
|
59
|
-
color,
|
|
60
|
-
state,
|
|
61
|
-
user,
|
|
62
|
-
}: {
|
|
63
|
-
user: string;
|
|
64
|
-
state?: AnyObject;
|
|
65
|
-
color: "pink" | "yellow";
|
|
66
|
-
nodeKey: NodeKey;
|
|
67
|
-
x: number;
|
|
68
|
-
y: number;
|
|
69
|
-
}) => {
|
|
70
|
-
const [editor] = useLexicalComposerContext();
|
|
71
|
-
const stickyContainerRef = useRef<null | HTMLDivElement>(null);
|
|
72
|
-
const positioningRef = useRef<Positioning>({
|
|
73
|
-
isDragging: false,
|
|
74
|
-
offsetX: 0,
|
|
75
|
-
offsetY: 0,
|
|
76
|
-
rootElementRect: { left: 8, top: 8 },
|
|
77
|
-
x: 8,
|
|
78
|
-
y: 8,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
const position = positioningRef.current;
|
|
83
|
-
position.x = x;
|
|
84
|
-
position.y = y;
|
|
85
|
-
|
|
86
|
-
const stickyContainer = stickyContainerRef.current;
|
|
87
|
-
if (stickyContainer !== null) {
|
|
88
|
-
positioningRef.current.rootElementRect = {
|
|
89
|
-
left: x,
|
|
90
|
-
top: y,
|
|
91
|
-
};
|
|
92
|
-
positionSticky(stickyContainer, position);
|
|
93
|
-
}
|
|
94
|
-
}, [x, y]);
|
|
95
|
-
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
const stickyContainer = stickyContainerRef.current;
|
|
98
|
-
if (stickyContainer !== null) {
|
|
99
|
-
// Delay adding transition so we don't trigger the
|
|
100
|
-
// transition on load of the sticky.
|
|
101
|
-
setTimeout(() => {
|
|
102
|
-
stickyContainer.style.setProperty(
|
|
103
|
-
"transition",
|
|
104
|
-
"top 300ms ease 0s, left 300ms ease 0s",
|
|
105
|
-
);
|
|
106
|
-
}, 500);
|
|
107
|
-
}
|
|
108
|
-
}, []);
|
|
109
|
-
|
|
110
|
-
const handlePointerMove = (event: PointerEvent) => {
|
|
111
|
-
const stickyContainer = stickyContainerRef.current;
|
|
112
|
-
const positioning = positioningRef.current;
|
|
113
|
-
const rootElementRect = positioning.rootElementRect;
|
|
114
|
-
if (
|
|
115
|
-
stickyContainer !== null &&
|
|
116
|
-
positioning.isDragging &&
|
|
117
|
-
rootElementRect !== null
|
|
118
|
-
) {
|
|
119
|
-
positioning.x =
|
|
120
|
-
rootElementRect.left + (event.pageX - positioning.offsetX);
|
|
121
|
-
positioning.y = rootElementRect.top + (event.pageY - positioning.offsetY);
|
|
122
|
-
if (positioning.x < 0) positioning.x = 0;
|
|
123
|
-
if (positioning.x > 642)
|
|
124
|
-
positioning.x = 642 - stickyContainer.offsetWidth;
|
|
125
|
-
if (positioning.y < 0) positioning.y = 0;
|
|
126
|
-
positionSticky(stickyContainer, positioning);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const handlePointerUp = (event: PointerEvent) => {
|
|
131
|
-
const stickyContainer = stickyContainerRef.current;
|
|
132
|
-
const positioning = positioningRef.current;
|
|
133
|
-
if (stickyContainer !== null) {
|
|
134
|
-
positioning.isDragging = false;
|
|
135
|
-
stickyContainer.classList.remove("dragging");
|
|
136
|
-
editor.update(() => {
|
|
137
|
-
const node = $getNodeByKey(nodeKey);
|
|
138
|
-
if ($isStickyNode(node)) {
|
|
139
|
-
node.setPosition(positioning.x, positioning.y);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
document.removeEventListener("pointermove", handlePointerMove);
|
|
144
|
-
document.removeEventListener("pointerup", handlePointerUp);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const handleDelete = () => {
|
|
148
|
-
editor.update(() => {
|
|
149
|
-
const node = $getNodeByKey(nodeKey);
|
|
150
|
-
if ($isStickyNode(node)) {
|
|
151
|
-
node.remove();
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const handleColorChange = () => {
|
|
157
|
-
editor.update(() => {
|
|
158
|
-
const node = $getNodeByKey(nodeKey);
|
|
159
|
-
if ($isStickyNode(node)) {
|
|
160
|
-
node.toggleColor();
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const innerEditor = useMemo(() => {
|
|
166
|
-
const editor = createEditor({ editable: true });
|
|
167
|
-
if (state) {
|
|
168
|
-
const editorState = editor.parseEditorState(state);
|
|
169
|
-
editor.setEditorState(editorState);
|
|
170
|
-
}
|
|
171
|
-
return editor;
|
|
172
|
-
}, []);
|
|
173
|
-
|
|
174
|
-
useEffect(() => {
|
|
175
|
-
if (innerEditor._editable) {
|
|
176
|
-
const dispose = innerEditor.registerUpdateListener(({ editorState }) => {
|
|
177
|
-
editor.update(() => {
|
|
178
|
-
const node = $getNodeByKey(nodeKey);
|
|
179
|
-
if ($isStickyNode(node)) {
|
|
180
|
-
node.updateState(innerEditor.getEditorState().toJSON());
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
return () => {
|
|
186
|
-
dispose();
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
}, [innerEditor._editable]);
|
|
190
|
-
|
|
191
|
-
return (
|
|
192
|
-
<div ref={stickyContainerRef} className="sticky__container">
|
|
193
|
-
<div
|
|
194
|
-
className="sticky__handle"
|
|
195
|
-
onPointerDown={(event) => {
|
|
196
|
-
const stickyContainer = stickyContainerRef.current;
|
|
197
|
-
if (
|
|
198
|
-
stickyContainer == null ||
|
|
199
|
-
event.button === 2 ||
|
|
200
|
-
event.target !== stickyContainer.firstChild
|
|
201
|
-
) {
|
|
202
|
-
// Right click or click on editor should not work
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
const stickContainer = stickyContainer;
|
|
206
|
-
const positioning = positioningRef.current;
|
|
207
|
-
if (stickContainer !== null) {
|
|
208
|
-
positioning.offsetX = event.clientX;
|
|
209
|
-
positioning.offsetY = event.clientY;
|
|
210
|
-
positioning.rootElementRect = {
|
|
211
|
-
left: positioning.x,
|
|
212
|
-
top: positioning.y,
|
|
213
|
-
};
|
|
214
|
-
positioning.isDragging = true;
|
|
215
|
-
stickContainer.classList.add("dragging");
|
|
216
|
-
document.addEventListener("pointermove", handlePointerMove);
|
|
217
|
-
document.addEventListener("pointerup", handlePointerUp);
|
|
218
|
-
event.preventDefault();
|
|
219
|
-
}
|
|
220
|
-
}}
|
|
221
|
-
/>
|
|
222
|
-
<div className={`sticky-note ${color}`}>
|
|
223
|
-
<div className="sticky__tools">
|
|
224
|
-
<button
|
|
225
|
-
onClick={handleColorChange}
|
|
226
|
-
className="sticky--color"
|
|
227
|
-
aria-label="Change sticky note color"
|
|
228
|
-
title="Color"
|
|
229
|
-
>
|
|
230
|
-
<Icon icon="icon-[mdi--format-color-fill]" />
|
|
231
|
-
</button>
|
|
232
|
-
<button
|
|
233
|
-
onClick={handleDelete}
|
|
234
|
-
className="sticky--delete"
|
|
235
|
-
aria-label="Delete sticky note"
|
|
236
|
-
title="Delete"
|
|
237
|
-
>
|
|
238
|
-
<Icon icon="icon-[mdi--close]" />
|
|
239
|
-
</button>
|
|
240
|
-
</div>
|
|
241
|
-
<div className="text-sm font-semibold">{user}</div>
|
|
242
|
-
<LexicalNestedComposer
|
|
243
|
-
initialEditor={innerEditor}
|
|
244
|
-
initialTheme={{
|
|
245
|
-
paragraph: "sticky__paragraph",
|
|
246
|
-
text: {
|
|
247
|
-
bold: "editor-textBold",
|
|
248
|
-
code: "editor-textCode",
|
|
249
|
-
italic: "editor-textItalic",
|
|
250
|
-
strikethrough: "editor-textStrikethrough",
|
|
251
|
-
subscript: "editor-textSubscript",
|
|
252
|
-
superscript: "editor-textSuperscript",
|
|
253
|
-
underline: "editor-textUnderline",
|
|
254
|
-
underlineStrikethrough: "editor-textUnderlineStrikethrough",
|
|
255
|
-
},
|
|
256
|
-
}}
|
|
257
|
-
>
|
|
258
|
-
<RichTextPlugin
|
|
259
|
-
contentEditable={<ContentEditable className="sticky__editor" />}
|
|
260
|
-
placeholder={
|
|
261
|
-
<div className="sticky-placeholder">Sticky note...</div>
|
|
262
|
-
}
|
|
263
|
-
ErrorBoundary={LexicalErrorBoundary as any}
|
|
264
|
-
/>
|
|
265
|
-
<AutoFocusPlugin />
|
|
266
|
-
</LexicalNestedComposer>
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
);
|
|
270
|
-
};
|