@memobit/libs 3.0.0 → 3.1.0
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/dist/components/Accordion/Accordion.css +1 -0
- package/dist/components/Accordion/Accordion2.js +79 -0
- package/dist/components/AlertDialog/AlertDialog.css +1 -0
- package/dist/components/AlertDialog/AlertDialog2.js +26 -0
- package/dist/components/AnalogClock/AnalogClock.css +1 -0
- package/dist/components/AnalogClock/AnalogClock2.js +293 -0
- package/dist/components/AngleSlider/AngleSlider.css +1 -0
- package/dist/components/AngleSlider/AngleSlider2.js +135 -0
- package/dist/components/AppHeader/AppHeader.css +1 -0
- package/dist/components/AppHeader/AppHeader2.js +44 -0
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal.css +1 -0
- package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal2.js +138 -0
- package/dist/components/Auth/Login/Login.css +1 -0
- package/dist/components/Auth/Login/Login2.js +155 -0
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal.css +1 -0
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +327 -0
- package/dist/components/AvatarInitials/AvatarInitials.css +1 -0
- package/dist/components/AvatarInitials/AvatarInitials2.js +73 -0
- package/dist/components/BMI/BMI.css +1 -0
- package/dist/components/BMI/BMI2.js +53 -0
- package/dist/components/BMI/bmiUtils.js +265 -0
- package/dist/components/Badge/Badge.css +1 -0
- package/dist/components/Badge/Badge2.js +30 -0
- package/dist/components/Banner/Banner.css +1 -0
- package/dist/components/Banner/Banner2.js +57 -0
- package/dist/components/Blockquote/Blockquote.css +1 -0
- package/dist/components/Blockquote/Blockquote2.js +55 -0
- package/dist/components/Breadcrumb/Breadcrumb.css +1 -0
- package/dist/components/Breadcrumb/Breadcrumb2.js +36 -0
- package/dist/components/BulkActionBar/BulkActionBar.css +1 -0
- package/dist/components/BulkActionBar/BulkActionBar2.js +39 -0
- package/dist/components/Button/Button.css +1 -0
- package/dist/components/Button/Button2.js +32 -0
- package/dist/components/Calendar/Calendar.css +1 -0
- package/dist/components/Calendar/Calendar2.js +279 -0
- package/dist/components/CalendarHeatmap/CalendarHeatmap.css +1 -0
- package/dist/components/CalendarHeatmap/CalendarHeatmap2.js +91 -0
- package/dist/components/Card/Card.css +1 -0
- package/dist/components/Card/Card2.js +47 -0
- package/dist/components/Checkbox/Checkbox.css +1 -0
- package/dist/components/Checkbox/Checkbox2.js +35 -0
- package/dist/components/Chip/Chip.css +1 -0
- package/dist/components/Chip/Chip2.js +31 -0
- package/dist/components/CollapsibleSection/CollapsibleSection.css +1 -0
- package/dist/components/CollapsibleSection/CollapsibleSection2.js +68 -0
- package/dist/components/ColorPicker/ColorPicker.css +1 -0
- package/dist/components/ColorPicker/ColorPicker2.js +257 -0
- package/dist/components/CommandPalette/CommandPalette.css +1 -0
- package/dist/components/CommandPalette/CommandPalette2.js +97 -0
- package/dist/components/Confetti/Confetti.css +1 -0
- package/dist/components/Confetti/Confetti2.js +175 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.css +1 -0
- package/dist/components/ConfirmDialog/ConfirmDialog2.js +37 -0
- package/dist/components/ConfirmPopover/ConfirmPopover.css +1 -0
- package/dist/components/ConfirmPopover/ConfirmPopover2.js +55 -0
- package/dist/components/ContextMenu/ContextMenu.css +1 -0
- package/dist/components/ContextMenu/ContextMenu2.js +53 -0
- package/dist/components/ContextToast/ContextToast.css +1 -0
- package/dist/components/ContextToast/ContextToast2.js +96 -0
- package/dist/components/ControlPanel/ControlPanel.css +1 -0
- package/dist/components/ControlPanel/ControlPanel.types.js +21 -0
- package/dist/components/ControlPanel/ControlPanel2.js +137 -0
- package/dist/components/ControlPanel/ControlPanelContext.js +31 -0
- package/dist/components/ControlPanel/ControlPanelFilter.js +386 -0
- package/dist/components/ControlPanel/ControlPanelNav.js +74 -0
- package/dist/components/ControlPanel/ControlPanelOptions.js +197 -0
- package/dist/components/CopyButton/CopyButton.css +1 -0
- package/dist/components/CopyButton/CopyButton2.js +48 -0
- package/dist/components/CountryWithFlag/CountryWithFlag.css +1 -0
- package/dist/components/CountryWithFlag/CountryWithFlag2.js +21 -0
- package/dist/components/DataView/DataView.CardView.js +189 -0
- package/dist/components/DataView/DataView.ColumnSelector.js +51 -0
- package/dist/components/DataView/DataView.MiniSort.js +25 -0
- package/dist/components/DataView/DataView.css +1 -0
- package/dist/components/DataView/DataView2.js +433 -0
- package/dist/components/DatePicker/DatePicker.css +1 -0
- package/dist/components/DatePicker/DatePicker2.js +151 -0
- package/dist/components/DateRangePicker/DateRangePicker.css +1 -0
- package/dist/components/DateRangePicker/DateRangePicker2.js +223 -0
- package/dist/components/DayAgenda/DayAgenda.css +1 -0
- package/dist/components/DayAgenda/DayAgenda2.js +120 -0
- package/dist/components/DiffViewer/DiffViewer.css +1 -0
- package/dist/components/DiffViewer/DiffViewer2.js +270 -0
- package/dist/components/Drawer/Drawer.css +1 -0
- package/dist/components/Drawer/Drawer2.js +119 -0
- package/dist/components/Dropdown/Dropdown.css +1 -0
- package/dist/components/Dropdown/Dropdown2.js +413 -0
- package/dist/components/EmojiPicker/EmojiPicker.css +1 -0
- package/dist/components/EmojiPicker/EmojiPicker2.js +789 -0
- package/dist/components/EmojiPicker/emojiKeywords/activities.js +508 -0
- package/dist/components/EmojiPicker/emojiKeywords/animals.js +501 -0
- package/dist/components/EmojiPicker/emojiKeywords/food.js +540 -0
- package/dist/components/EmojiPicker/emojiKeywords/index.js +21 -0
- package/dist/components/EmojiPicker/emojiKeywords/objects.js +652 -0
- package/dist/components/EmojiPicker/emojiKeywords/people.js +488 -0
- package/dist/components/EmojiPicker/emojiKeywords/smileys.js +538 -0
- package/dist/components/EmojiPicker/emojiKeywords/symbols.js +597 -0
- package/dist/components/EmojiPicker/emojiKeywords/travel.js +507 -0
- package/dist/components/EmptyState/EmptyState.css +1 -0
- package/dist/components/EmptyState/EmptyState2.js +47 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.css +1 -0
- package/dist/components/ErrorBoundary/ErrorBoundary2.js +37 -0
- package/dist/components/EventCalendar/EventCalendar.Chip.js +45 -0
- package/dist/components/EventCalendar/EventCalendar.Month.js +118 -0
- package/dist/components/EventCalendar/EventCalendar.Week.js +131 -0
- package/dist/components/EventCalendar/EventCalendar.css +1 -0
- package/dist/components/EventCalendar/EventCalendar.helpers.js +72 -0
- package/dist/components/EventCalendar/EventCalendar2.js +157 -0
- package/dist/components/FileDropzone/FileDropzone.css +1 -0
- package/dist/components/FileDropzone/FileDropzone2.js +71 -0
- package/dist/components/Flag/Flag.css +1 -0
- package/dist/components/Flag/Flag2.js +36 -0
- package/dist/components/FloatButton/FloatButton.css +1 -0
- package/dist/components/FloatButton/FloatButton2.js +68 -0
- package/dist/components/FloatingWindow/FloatingWindow.css +1 -0
- package/dist/components/FloatingWindow/FloatingWindow2.js +203 -0
- package/dist/components/FolderBrowserModal/FolderBrowserModal.css +1 -0
- package/dist/components/FolderBrowserModal/FolderBrowserModal2.js +144 -0
- package/dist/components/Grid/Col.js +17 -0
- package/dist/components/Grid/Grid.css +1 -0
- package/dist/components/Grid/Grid2.js +28 -0
- package/dist/components/Icon/Icon.css +1 -0
- package/dist/components/Icon/Icon2.js +23 -0
- package/dist/components/IconPicker/IconPicker.css +1 -0
- package/dist/components/IconPicker/IconPicker2.js +51 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.css +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll2.js +66 -0
- package/dist/components/InputDate/InputDate.css +1 -0
- package/dist/components/InputDate/InputDate2.js +87 -0
- package/dist/components/InputEmail/InputEmail.css +1 -0
- package/dist/components/InputEmail/InputEmail2.js +73 -0
- package/dist/components/InputFile/InputFile.css +1 -0
- package/dist/components/InputFile/InputFile2.js +41 -0
- package/dist/components/InputMask/InputMask.css +1 -0
- package/dist/components/InputMask/InputMask2.js +163 -0
- package/dist/components/InputNumber/InputNumber.css +1 -0
- package/dist/components/InputNumber/InputNumber2.js +60 -0
- package/dist/components/InputPIN/InputPIN.css +1 -0
- package/dist/components/InputPIN/InputPIN2.js +121 -0
- package/dist/components/InputPassword/InputPassword.css +1 -0
- package/dist/components/InputPassword/InputPassword2.js +47 -0
- package/dist/components/InputPhone/InputPhone.css +1 -0
- package/dist/components/InputPhone/InputPhone2.js +82 -0
- package/dist/components/InputSearch/InputSearch.css +1 -0
- package/dist/components/InputSearch/InputSearch2.js +53 -0
- package/dist/components/InputText/InputText.css +1 -0
- package/dist/components/InputText/InputText2.js +47 -0
- package/dist/components/InputTextarea/InputTextarea.css +1 -0
- package/dist/components/InputTextarea/InputTextarea2.js +46 -0
- package/dist/components/InputTime/InputTime.css +1 -0
- package/dist/components/InputTime/InputTime2.js +85 -0
- package/dist/components/InputUrl/InputUrl.css +1 -0
- package/dist/components/InputUrl/InputUrl2.js +65 -0
- package/dist/components/JourneyWizard/JourneyWizard.css +1 -0
- package/dist/components/JourneyWizard/JourneyWizard2.js +147 -0
- package/dist/components/List/List.css +1 -0
- package/dist/components/List/List2.js +28 -0
- package/dist/components/Loading/Loading.css +1 -0
- package/dist/components/Loading/Loading2.js +11 -0
- package/dist/components/MenuHamburger/MenuHamburger.css +1 -0
- package/dist/components/MenuHamburger/MenuHamburger2.js +65 -0
- package/dist/components/MiniSort/MiniSort.css +1 -0
- package/dist/components/MiniSort/MiniSort2.js +52 -0
- package/dist/components/MiniStatsCard/MiniStatsCard.css +1 -0
- package/dist/components/MiniStatsCard/MiniStatsCard2.js +67 -0
- package/dist/components/Minimap/Minimap.css +1 -0
- package/dist/components/Minimap/Minimap2.js +62 -0
- package/dist/components/Modal/Modal.css +1 -0
- package/dist/components/Modal/Modal2.js +87 -0
- package/dist/components/NavBar/NavBar.css +1 -0
- package/dist/components/NavBar/NavBar2.js +64 -0
- package/dist/components/NotificationPanel/NotificationPanel.css +1 -0
- package/dist/components/NotificationPanel/NotificationPanel2.js +66 -0
- package/dist/components/Pagination/Pagination.css +1 -0
- package/dist/components/Pagination/Pagination2.js +92 -0
- package/dist/components/PieChart/PieChart.css +1 -0
- package/dist/components/PieChart/PieChart2.js +142 -0
- package/dist/components/Popover/Popover.css +1 -0
- package/dist/components/Popover/Popover2.js +109 -0
- package/dist/components/Popover/hooks/Popover.hook.js +33 -0
- package/dist/components/ProgressBar/ProgressBar.css +1 -0
- package/dist/components/ProgressBar/ProgressBar2.js +48 -0
- package/dist/components/ProgressRing/ProgressRing.css +1 -0
- package/dist/components/ProgressRing/ProgressRing2.js +54 -0
- package/dist/components/QuantitySelector/QuantitySelector.css +1 -0
- package/dist/components/QuantitySelector/QuantitySelector2.js +94 -0
- package/dist/components/QuickAdd/QuickAdd.css +1 -0
- package/dist/components/QuickAdd/QuickAdd2.js +56 -0
- package/dist/components/QuickNumberUpdate/QuickNumberUpdate.css +1 -0
- package/dist/components/QuickNumberUpdate/QuickNumberUpdate2.js +52 -0
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate.css +1 -0
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate2.js +67 -0
- package/dist/components/Radio/Radio.css +1 -0
- package/dist/components/Radio/Radio2.js +36 -0
- package/dist/components/RangeSlider/RangeSlider.css +1 -0
- package/dist/components/RangeSlider/RangeSlider2.js +157 -0
- package/dist/components/Rating/Rating.css +1 -0
- package/dist/components/Rating/Rating2.js +148 -0
- package/dist/components/Rating/RatingIcon.js +102 -0
- package/dist/components/RichTextEditor/RichTextEditor.css +1 -0
- package/dist/components/RichTextEditor/RichTextEditor2.js +212 -0
- package/dist/components/RichTextEditor/RteLinkPrompt.js +42 -0
- package/dist/components/RichTextEditor/RteTableToolbar.js +95 -0
- package/dist/components/RichTextEditor/RteToolbar.js +106 -0
- package/dist/components/RichTextEditor/helpers.js +73 -0
- package/dist/components/RichTextEditor/hooks/useEditorHistory.js +39 -0
- package/dist/components/RichTextEditor/hooks/useLinkPrompt.js +61 -0
- package/dist/components/RichTextEditor/hooks/useTableOps.js +134 -0
- package/dist/components/RollingNumber/RollingNumber.css +1 -0
- package/dist/components/RollingNumber/RollingNumber2.js +71 -0
- package/dist/components/ScrollToTop/ScrollToTop.css +1 -0
- package/dist/components/ScrollToTop/ScrollToTop2.js +40 -0
- package/dist/components/Separator/Separator.css +1 -0
- package/dist/components/Separator/Separator2.js +39 -0
- package/dist/components/Sidebar/Sidebar.css +1 -0
- package/dist/components/Sidebar/Sidebar2.js +115 -0
- package/dist/components/Sidebar/SidebarContext.js +31 -0
- package/dist/components/SignalStrength/SignalStrength.css +1 -0
- package/dist/components/SignalStrength/SignalStrength2.js +56 -0
- package/dist/components/Skeleton/Skeleton.css +1 -0
- package/dist/components/Skeleton/Skeleton2.js +50 -0
- package/dist/components/Slider/Slider.css +1 -0
- package/dist/components/Slider/Slider2.js +39 -0
- package/dist/components/SplitPanel/SplitPanel.css +1 -0
- package/dist/components/SplitPanel/SplitPanel2.js +69 -0
- package/dist/components/Splitter/Splitter.css +1 -0
- package/dist/components/Splitter/Splitter2.js +89 -0
- package/dist/components/StackedBar/StackedBar.css +1 -0
- package/dist/components/StackedBar/StackedBar2.js +50 -0
- package/dist/components/Stats/Stats.css +1 -0
- package/dist/components/Stats/Stats2.js +26 -0
- package/dist/components/StickyBar/StickyBar.css +1 -0
- package/dist/components/StickyBar/StickyBar2.js +29 -0
- package/dist/components/SuggestionsList/SuggestionsList.css +1 -0
- package/dist/components/SuggestionsList/SuggestionsList2.js +121 -0
- package/dist/components/ThemeSettings/ThemeContext.js +138 -0
- package/dist/components/ThemeSettings/ThemeContextValue.js +5 -0
- package/dist/components/ThemeSettings/ThemeSettings.css +1 -0
- package/dist/components/ThemeSettings/ThemeSettings2.js +245 -0
- package/dist/components/ThemeSettings/themeConfig.js +7 -0
- package/dist/components/ThemeSettings/useTheme.js +10 -0
- package/dist/components/TimePicker/TimePicker.css +1 -0
- package/dist/components/TimePicker/TimePicker2.js +118 -0
- package/dist/components/TimePicker/TimeSpinner.js +59 -0
- package/dist/components/Timeline/Timeline.css +1 -0
- package/dist/components/Timeline/Timeline2.js +57 -0
- package/dist/components/TimelineMarkers/TimelineMarkers.css +1 -0
- package/dist/components/TimelineMarkers/TimelineMarkers2.js +73 -0
- package/dist/components/TipsOfTheDay/TipsOfTheDay.css +1 -0
- package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +24 -0
- package/dist/components/Toast/Toast.css +1 -0
- package/dist/components/Toast/Toast2.js +39 -0
- package/dist/components/ToggleButtons/ToggleButtons.css +1 -0
- package/dist/components/ToggleButtons/ToggleButtons2.js +47 -0
- package/dist/components/ToggleSwitch/ToggleSwitch.css +1 -0
- package/dist/components/ToggleSwitch/ToggleSwitch2.js +27 -0
- package/dist/components/Toolbar/Toolbar.css +1 -0
- package/dist/components/Toolbar/Toolbar2.js +129 -0
- package/dist/components/Tooltip/Tooltip.css +1 -0
- package/dist/components/Tooltip/Tooltip2.js +93 -0
- package/dist/components/TourHud/TourHud.css +1 -0
- package/dist/components/TourHud/TourHud2.js +70 -0
- package/dist/components/Transition/Transition.css +1 -0
- package/dist/components/Transition/Transition2.js +68 -0
- package/dist/components/Tree/Tree.css +1 -0
- package/dist/components/Tree/Tree2.js +95 -0
- package/dist/components/VirtualList/VirtualList.css +1 -0
- package/dist/components/VirtualList/VirtualList2.js +64 -0
- package/dist/components/WHtR/WHtR.css +1 -0
- package/dist/components/WHtR/WHtR2.js +115 -0
- package/dist/contexts/AuthContext/AuthContext.js +113 -0
- package/dist/helpers/AppPersistenceStorage.js +50 -0
- package/dist/helpers/Datetime.js +114 -0
- package/dist/helpers/Format.js +21 -0
- package/dist/helpers/Highlight.js +36 -0
- package/dist/helpers/HtmlContent.js +118 -0
- package/dist/helpers/LogicalOperators.js +15 -0
- package/dist/helpers/Numbers.js +15 -0
- package/dist/helpers/Pagination.js +7 -0
- package/dist/helpers/Search.js +15 -0
- package/dist/helpers/Strings.js +10 -0
- package/dist/helpers/Urls.js +68 -0
- package/dist/helpers/VersionInfo.js +36 -0
- package/dist/hooks/useAppPersistence.js +51 -0
- package/dist/hooks/useAuth/useAuth.js +10 -0
- package/dist/hooks/useBodyScrollLock.js +31 -0
- package/dist/hooks/useBreakpoint.js +65 -0
- package/dist/hooks/useComponentEffect.js +8 -0
- package/dist/hooks/useSwipe.js +45 -0
- package/dist/index.css +1 -2
- package/dist/index.esm.js +1 -17211
- package/dist/index.js +348 -0
- package/dist/mfa.js +4 -0
- package/dist/node_modules/qrcode.react/lib/esm/index.js +979 -0
- package/dist/validators/Vin.js +69 -0
- package/dist/version.js +8 -0
- package/dist/version.json +4 -4
- package/package.json +8 -7
- package/dist/mfa.esm.js +0 -1293
- package/dist/useAuth-BBqdDG2z.js +0 -467
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import './DateRangePicker.css';
|
|
2
|
+
import { Button as _ } from "../Button/Button2.js";
|
|
3
|
+
import { Tooltip as J } from "../Tooltip/Tooltip2.js";
|
|
4
|
+
import { addMonths as x } from "../../helpers/Datetime.js";
|
|
5
|
+
import { Calendar as Q } from "../Calendar/Calendar2.js";
|
|
6
|
+
import { InputText as U } from "../InputText/InputText2.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { useCallback as ce, useEffect as k, useMemo as le, useRef as W, useState as m } from "react";
|
|
9
|
+
import { Fragment as he, jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
10
|
+
import { createPortal as me } from "react-dom";
|
|
11
|
+
var u = (a) => {
|
|
12
|
+
if (!a) return;
|
|
13
|
+
const [d, w, c] = a.split("-").map((g) => Number(g));
|
|
14
|
+
if (!(!d || !w || !c))
|
|
15
|
+
return new Date(d, w - 1, c);
|
|
16
|
+
}, R = (a) => `${a.getFullYear()}-${String(a.getMonth() + 1).padStart(2, "0")}-${String(a.getDate()).padStart(2, "0")}`, De = ({ label: a, value: d, onChange: w, min: c, max: g, alwaysOpen: i = !1, autoClose: X = !0, presets: f, firstDayOfWeek: B = 0 }) => {
|
|
17
|
+
const [Z, O] = m({}), [l, M] = m(() => /* @__PURE__ */ new Date()), [F, I] = m(null), [$, p] = m(i), [ee, z] = m({
|
|
18
|
+
position: "fixed",
|
|
19
|
+
visibility: "hidden"
|
|
20
|
+
}), [S, N] = m(d?.start ?? ""), [L, E] = m(d?.end ?? ""), D = W(null), b = W(null), r = d ?? Z, H = u(r.start), P = u(r.end), T = H && P ? {
|
|
21
|
+
start: H,
|
|
22
|
+
end: P
|
|
23
|
+
} : void 0, y = (e) => {
|
|
24
|
+
d || O(e), w?.(e);
|
|
25
|
+
}, A = (e) => {
|
|
26
|
+
e && typeof e == "object" && "start" in e && (y({
|
|
27
|
+
start: R(e.start),
|
|
28
|
+
end: R(e.end)
|
|
29
|
+
}), I(null), !i && X && p(!1));
|
|
30
|
+
}, j = (e) => {
|
|
31
|
+
I(e);
|
|
32
|
+
}, V = (e) => /^\d{4}-\d{2}-\d{2}$/.test(e) && u(e) !== void 0, te = () => {
|
|
33
|
+
V(S) ? y({
|
|
34
|
+
...r,
|
|
35
|
+
start: S
|
|
36
|
+
}) : N(r.start ?? "");
|
|
37
|
+
}, ne = () => {
|
|
38
|
+
V(L) ? y({
|
|
39
|
+
...r,
|
|
40
|
+
end: L
|
|
41
|
+
}) : E(r.end ?? "");
|
|
42
|
+
}, q = (e) => {
|
|
43
|
+
const o = /* @__PURE__ */ new Date(), n = /* @__PURE__ */ new Date();
|
|
44
|
+
n.setDate(n.getDate() - e), y({
|
|
45
|
+
start: R(n),
|
|
46
|
+
end: R(o)
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
k(() => {
|
|
50
|
+
N(r.start ?? "");
|
|
51
|
+
}, [r.start]), k(() => {
|
|
52
|
+
E(r.end ?? "");
|
|
53
|
+
}, [r.end]);
|
|
54
|
+
const Y = le(() => x(l, 1), [l]), K = i || $, h = !i && $, v = ce(() => {
|
|
55
|
+
if (!h || !D.current || !b.current) return;
|
|
56
|
+
const e = D.current.getBoundingClientRect(), o = b.current.getBoundingClientRect(), n = 16, C = 8, ae = window.innerHeight - e.bottom - n, re = e.top - n, oe = ae < o.height && re > o.height ? e.top - o.height - C : e.bottom + C, ie = Math.max(n, Math.min(oe, window.innerHeight - o.height - n)), se = e.left, de = Math.max(n, Math.min(se, window.innerWidth - o.width - n));
|
|
57
|
+
z({
|
|
58
|
+
position: "fixed",
|
|
59
|
+
top: `${ie}px`,
|
|
60
|
+
left: `${de}px`,
|
|
61
|
+
zIndex: 1e3
|
|
62
|
+
});
|
|
63
|
+
}, [h]);
|
|
64
|
+
k(() => {
|
|
65
|
+
i && p(!0);
|
|
66
|
+
}, [i]), k(() => {
|
|
67
|
+
if (!h) {
|
|
68
|
+
z({
|
|
69
|
+
position: "fixed",
|
|
70
|
+
visibility: "hidden"
|
|
71
|
+
});
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const e = requestAnimationFrame(() => requestAnimationFrame(v));
|
|
75
|
+
return window.addEventListener("resize", v), window.addEventListener("scroll", v, !0), () => {
|
|
76
|
+
cancelAnimationFrame(e), window.removeEventListener("resize", v), window.removeEventListener("scroll", v, !0);
|
|
77
|
+
};
|
|
78
|
+
}, [h, v]), k(() => {
|
|
79
|
+
if (!h) return;
|
|
80
|
+
const e = (n) => {
|
|
81
|
+
const C = n.target;
|
|
82
|
+
D.current?.contains(C) || b.current?.contains(C) || p(!1);
|
|
83
|
+
}, o = (n) => {
|
|
84
|
+
n.key === "Escape" && p(!1);
|
|
85
|
+
};
|
|
86
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", o), () => {
|
|
87
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", o);
|
|
88
|
+
};
|
|
89
|
+
}, [h]);
|
|
90
|
+
const G = /* @__PURE__ */ s("div", {
|
|
91
|
+
className: "date-range-picker__calendar",
|
|
92
|
+
children: [/* @__PURE__ */ s("div", {
|
|
93
|
+
className: "date-range-picker__nav",
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ t(J, {
|
|
96
|
+
title: "Previous month",
|
|
97
|
+
children: /* @__PURE__ */ t(_, {
|
|
98
|
+
variant: "default",
|
|
99
|
+
icon: "caret-left",
|
|
100
|
+
onClick: () => M(x(l, -1))
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ s("span", { children: [
|
|
104
|
+
l.toLocaleString("default", { month: "long" }),
|
|
105
|
+
" ",
|
|
106
|
+
l.getFullYear(),
|
|
107
|
+
" -",
|
|
108
|
+
Y.toLocaleString("default", { month: "long" }),
|
|
109
|
+
" ",
|
|
110
|
+
Y.getFullYear()
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ t(J, {
|
|
113
|
+
title: "Next month",
|
|
114
|
+
children: /* @__PURE__ */ t(_, {
|
|
115
|
+
variant: "default",
|
|
116
|
+
icon: "caret-right",
|
|
117
|
+
onClick: () => M(x(l, 1))
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
}), /* @__PURE__ */ s("div", {
|
|
122
|
+
className: "date-range-picker__months",
|
|
123
|
+
children: [/* @__PURE__ */ t(Q, {
|
|
124
|
+
mode: "range",
|
|
125
|
+
value: T,
|
|
126
|
+
onChange: A,
|
|
127
|
+
rangeStart: F,
|
|
128
|
+
onRangeStartChange: j,
|
|
129
|
+
currentMonth: l,
|
|
130
|
+
onMonthChange: M,
|
|
131
|
+
showHeader: !1,
|
|
132
|
+
showToday: !1,
|
|
133
|
+
firstDayOfWeek: B,
|
|
134
|
+
minDate: c ? u(c) : void 0,
|
|
135
|
+
maxDate: g ? u(g) : void 0
|
|
136
|
+
}), /* @__PURE__ */ t(Q, {
|
|
137
|
+
mode: "range",
|
|
138
|
+
value: T,
|
|
139
|
+
onChange: A,
|
|
140
|
+
rangeStart: F,
|
|
141
|
+
onRangeStartChange: j,
|
|
142
|
+
currentMonth: Y,
|
|
143
|
+
onMonthChange: M,
|
|
144
|
+
showHeader: !1,
|
|
145
|
+
showToday: !1,
|
|
146
|
+
firstDayOfWeek: B,
|
|
147
|
+
minDate: c ? u(c) : void 0,
|
|
148
|
+
maxDate: g ? u(g) : void 0
|
|
149
|
+
})]
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
return /* @__PURE__ */ s("div", {
|
|
153
|
+
ref: D,
|
|
154
|
+
className: "date-range-picker",
|
|
155
|
+
children: [
|
|
156
|
+
a && f && f.length > 0 ? /* @__PURE__ */ s("div", {
|
|
157
|
+
className: "date-range-picker__label-row",
|
|
158
|
+
children: [/* @__PURE__ */ t("label", {
|
|
159
|
+
className: "date-range-picker__label",
|
|
160
|
+
children: a
|
|
161
|
+
}), /* @__PURE__ */ t("div", {
|
|
162
|
+
className: "date-range-picker__presets",
|
|
163
|
+
children: f.map((e) => /* @__PURE__ */ t(_, {
|
|
164
|
+
size: "small",
|
|
165
|
+
variant: "default",
|
|
166
|
+
onClick: () => q(e.days),
|
|
167
|
+
children: e.label
|
|
168
|
+
}, e.days))
|
|
169
|
+
})]
|
|
170
|
+
}) : /* @__PURE__ */ s(he, { children: [a && /* @__PURE__ */ t("label", {
|
|
171
|
+
className: "date-range-picker__label",
|
|
172
|
+
children: a
|
|
173
|
+
}), f && f.length > 0 && /* @__PURE__ */ t("div", {
|
|
174
|
+
className: "date-range-picker__presets",
|
|
175
|
+
children: f.map((e) => /* @__PURE__ */ t(_, {
|
|
176
|
+
size: "small",
|
|
177
|
+
variant: "default",
|
|
178
|
+
onClick: () => q(e.days),
|
|
179
|
+
children: e.label
|
|
180
|
+
}, e.days))
|
|
181
|
+
})] }),
|
|
182
|
+
/* @__PURE__ */ s("div", {
|
|
183
|
+
className: "date-range-picker__inputs",
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ t(U, {
|
|
186
|
+
value: S,
|
|
187
|
+
placeholder: "YYYY-MM-DD",
|
|
188
|
+
maxLength: 10,
|
|
189
|
+
onChange: N,
|
|
190
|
+
onBlur: te
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ t("span", {
|
|
193
|
+
className: "date-range-picker__separator",
|
|
194
|
+
children: "to"
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ t(U, {
|
|
197
|
+
value: L,
|
|
198
|
+
placeholder: "YYYY-MM-DD",
|
|
199
|
+
maxLength: 10,
|
|
200
|
+
onChange: E,
|
|
201
|
+
onBlur: ne
|
|
202
|
+
}),
|
|
203
|
+
!i && /* @__PURE__ */ t(_, {
|
|
204
|
+
className: "date-range-picker__toggle",
|
|
205
|
+
variant: "default",
|
|
206
|
+
onClick: () => p((e) => !e),
|
|
207
|
+
children: K ? "Hide calendar" : "Choose dates"
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
}),
|
|
211
|
+
i && K && G,
|
|
212
|
+
h && me(/* @__PURE__ */ t("div", {
|
|
213
|
+
ref: b,
|
|
214
|
+
className: "date-range-picker__overlay",
|
|
215
|
+
style: ee,
|
|
216
|
+
children: G
|
|
217
|
+
}), document.body)
|
|
218
|
+
]
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
export {
|
|
222
|
+
De as DateRangePicker
|
|
223
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.day-agenda .drawer__content{flex-direction:column;min-height:0;display:flex}.day-agenda__weekday{justify-content:space-between;align-items:baseline;gap:var(--spacing-8);margin-bottom:var(--spacing-12);font-size:var(--font-size-sm);color:var(--body-color-muted);display:flex}.day-agenda__empty{font-size:var(--font-size-xs);color:var(--body-sub-title-color);opacity:.7}.day-agenda__all-day,.day-agenda__body{border:1px solid var(--card-border-color);background-color:var(--card-background-color)}.day-agenda__all-day{border-radius:var(--radius) var(--radius) 0 0;background-color:var(--card-background-accent-color);border-bottom:none;display:flex}.day-agenda__gutter-label,.day-agenda__gutter{flex:0 0 var(--spacing-48);width:var(--spacing-48);border-right:1px solid var(--card-border-color)}.day-agenda__gutter-label{padding:var(--spacing-4) var(--spacing-6);font-size:var(--font-size-xxs);color:var(--body-color-muted);justify-content:flex-end;align-items:center;display:flex}.day-agenda__all-day-cell{gap:var(--spacing-2);min-width:0;padding:var(--spacing-4);flex-direction:column;flex:auto;display:flex}.day-agenda__body{touch-action:pan-y;border-radius:var(--radius);flex:auto;min-height:0;display:flex;overflow-y:auto}.day-agenda__all-day+.day-agenda__body{border-radius:0 0 var(--radius) var(--radius)}.day-agenda__gutter{flex-direction:column;display:flex}.day-agenda__gutter-hour{padding-right:var(--spacing-6);font-size:var(--font-size-xxs);font-variant-numeric:tabular-nums;color:var(--body-color-muted);justify-content:flex-end;display:flex}.day-agenda__gutter-hour span{transform:translateY(-50%)}.day-agenda__gutter-hour:first-child span{transform:none}.day-agenda__gutter-hour--inactive{opacity:.5}.day-agenda__column{flex-direction:column;flex:auto;min-width:0;display:flex;position:relative}.day-agenda__slot{border-bottom:1px solid color-mix(in srgb, var(--card-border-color) 60%, transparent);transition:background-color var(--transition-fast)}.day-agenda__slot:last-of-type{border-bottom:none}.day-agenda__slot--inactive{background-color:color-mix(in srgb, var(--body-background) 60%, transparent)}.day-agenda__slot--clickable:hover{cursor:pointer;background-color:color-mix(in srgb, var(--body-accent-color) 10%, transparent)}.day-agenda .day-agenda__chip{align-items:center;gap:var(--spacing-6);padding:0 var(--spacing-6);flex-direction:row}.day-agenda .day-agenda__chip .event-calendar__chip-title{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}.day-agenda .day-agenda__chip .event-calendar__chip-leading,.day-agenda .day-agenda__chip .event-calendar__chip-time{align-self:center}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import './DayAgenda.css';
|
|
2
|
+
import { addDays as k, formatDate as S } from "../../helpers/Datetime.js";
|
|
3
|
+
import { useSwipe as T } from "../../hooks/useSwipe.js";
|
|
4
|
+
import { Drawer as O } from "../Drawer/Drawer2.js";
|
|
5
|
+
import { bucketEventsByDay as U, formatHourLabel as F, isActiveHour as L, layoutDayEvents as q, startOfDay as c } from "../EventCalendar/EventCalendar.helpers.js";
|
|
6
|
+
import { EventCalendarChip as M } from "../EventCalendar/EventCalendar.Chip.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import { useEffect as z, useMemo as g, useRef as G } from "react";
|
|
9
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
10
|
+
var I = 8, m = () => {
|
|
11
|
+
};
|
|
12
|
+
function H({ activeHours: r, className: j, date: n, dayEndHour: d = 24, dayStartHour: t = 0, defaultDurationMinutes: f = 30, emptyLabel: B = "Nothing scheduled", events: v, hourHeight: o = 44, isOpen: p, onAdd: D, onClose: E, onDateChange: _, onEventClick: w, position: R = "right", renderEvent: N, width: $ = "min(480px, 100vw)" }) {
|
|
13
|
+
const y = G(null), l = g(() => U(v, [c(n)])[0], [n, v]), h = g(() => Array.from({ length: Math.max(d - t, 1) }, (a, i) => t + i), [t, d]), A = g(() => q(l.timed, t, d, f), [
|
|
14
|
+
l.timed,
|
|
15
|
+
d,
|
|
16
|
+
t,
|
|
17
|
+
f
|
|
18
|
+
]), b = g(() => {
|
|
19
|
+
const a = l.timed.map((i) => i.start.getHours());
|
|
20
|
+
return a.length > 0 ? Math.min(...a) : r?.start ?? I;
|
|
21
|
+
}, [r, l.timed]);
|
|
22
|
+
z(() => {
|
|
23
|
+
!p || !y.current || (y.current.scrollTop = Math.max(b - t - 1, 0) * o);
|
|
24
|
+
}, [
|
|
25
|
+
t,
|
|
26
|
+
b,
|
|
27
|
+
o,
|
|
28
|
+
p
|
|
29
|
+
]);
|
|
30
|
+
const Y = T({
|
|
31
|
+
enabled: !!_,
|
|
32
|
+
onSwipeLeft: () => _?.(k(c(n), 1)),
|
|
33
|
+
onSwipeRight: () => _?.(k(c(n), -1)),
|
|
34
|
+
restraint: 50
|
|
35
|
+
}), C = (a) => {
|
|
36
|
+
const i = c(n);
|
|
37
|
+
return i.setHours(a, 0, 0, 0), i;
|
|
38
|
+
}, u = h.length * o, x = { flex: `1 0 ${o}px` };
|
|
39
|
+
return /* @__PURE__ */ s(O, {
|
|
40
|
+
className: ["day-agenda", j ?? ""].filter(Boolean).join(" "),
|
|
41
|
+
isOpen: p,
|
|
42
|
+
onClose: E,
|
|
43
|
+
position: R,
|
|
44
|
+
showOverlay: !0,
|
|
45
|
+
title: S(n, "DD MMM YYYY"),
|
|
46
|
+
width: $,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ s("div", {
|
|
49
|
+
className: "day-agenda__weekday",
|
|
50
|
+
children: [/* @__PURE__ */ e("span", { children: n.toLocaleDateString(void 0, { weekday: "long" }) }), l.allDay.length === 0 && l.timed.length === 0 && /* @__PURE__ */ e("span", {
|
|
51
|
+
className: "day-agenda__empty",
|
|
52
|
+
children: B
|
|
53
|
+
})]
|
|
54
|
+
}),
|
|
55
|
+
l.allDay.length > 0 && /* @__PURE__ */ s("div", {
|
|
56
|
+
className: "day-agenda__all-day",
|
|
57
|
+
children: [/* @__PURE__ */ e("div", {
|
|
58
|
+
className: "day-agenda__gutter-label",
|
|
59
|
+
children: "All day"
|
|
60
|
+
}), /* @__PURE__ */ e("div", {
|
|
61
|
+
className: "day-agenda__all-day-cell",
|
|
62
|
+
children: l.allDay.map((a) => /* @__PURE__ */ e(M, {
|
|
63
|
+
dragEnabled: !1,
|
|
64
|
+
event: a,
|
|
65
|
+
isDragging: !1,
|
|
66
|
+
onClick: w,
|
|
67
|
+
onDragEnd: m,
|
|
68
|
+
onDragStart: m,
|
|
69
|
+
renderEvent: N
|
|
70
|
+
}, a.id))
|
|
71
|
+
})]
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ s("div", {
|
|
74
|
+
className: "day-agenda__body",
|
|
75
|
+
ref: y,
|
|
76
|
+
...Y,
|
|
77
|
+
children: [/* @__PURE__ */ e("div", {
|
|
78
|
+
className: "day-agenda__gutter",
|
|
79
|
+
style: { minHeight: u },
|
|
80
|
+
children: h.map((a) => /* @__PURE__ */ e("div", {
|
|
81
|
+
className: ["day-agenda__gutter-hour", L(a, r) ? "" : "day-agenda__gutter-hour--inactive"].filter(Boolean).join(" "),
|
|
82
|
+
style: x,
|
|
83
|
+
children: /* @__PURE__ */ e("span", { children: F(a) })
|
|
84
|
+
}, a))
|
|
85
|
+
}), /* @__PURE__ */ s("div", {
|
|
86
|
+
className: "day-agenda__column",
|
|
87
|
+
style: { minHeight: u },
|
|
88
|
+
children: [h.map((a) => /* @__PURE__ */ e("div", {
|
|
89
|
+
className: [
|
|
90
|
+
"day-agenda__slot",
|
|
91
|
+
L(a, r) ? "" : "day-agenda__slot--inactive",
|
|
92
|
+
D ? "day-agenda__slot--clickable" : ""
|
|
93
|
+
].filter(Boolean).join(" "),
|
|
94
|
+
onClick: () => D?.(C(a)),
|
|
95
|
+
style: x
|
|
96
|
+
}, a)), A.map((a) => /* @__PURE__ */ e(M, {
|
|
97
|
+
className: "event-calendar__chip--positioned day-agenda__chip",
|
|
98
|
+
dragEnabled: !1,
|
|
99
|
+
event: a.event,
|
|
100
|
+
isDragging: !1,
|
|
101
|
+
onClick: w,
|
|
102
|
+
onDragEnd: m,
|
|
103
|
+
onDragStart: m,
|
|
104
|
+
renderEvent: N,
|
|
105
|
+
showTime: !0,
|
|
106
|
+
style: {
|
|
107
|
+
top: `${a.top}%`,
|
|
108
|
+
height: `${a.height}%`,
|
|
109
|
+
left: `calc(${a.left}% + var(--spacing-2))`,
|
|
110
|
+
width: `calc(${a.width}% - var(--spacing-4))`
|
|
111
|
+
}
|
|
112
|
+
}, a.event.id))]
|
|
113
|
+
})]
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
H as DayAgenda
|
|
120
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.dv{border:var(--spacing-1) solid var(--form-control-border-color);border-radius:var(--radius-sm);background-color:var(--form-control-background-color);font-family:var(--font-family-mono);font-size:var(--font-size-sm);line-height:var(--line-height-normal);flex-direction:column;width:100%;display:flex;overflow:hidden}.dv__header{background-color:var(--form-control-focus-background-color);border-bottom:var(--spacing-1) solid var(--form-control-border-color);font-family:var(--font-family,sans-serif);font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);color:var(--body-title-color);min-height:var(--spacing-40);align-items:center;display:flex}.dv__header-side{padding:var(--spacing-8) var(--spacing-12);flex:1}.dv__header-side:first-child{border-right:var(--spacing-1) solid var(--form-control-border-color)}.dv__header-inline{align-items:center;gap:var(--spacing-8);padding:var(--spacing-8) var(--spacing-12);flex:1;display:flex}.dv__header-arrow{color:var(--body-color-muted)}.dv__stats{gap:var(--spacing-4);padding:var(--spacing-8) var(--spacing-12);flex-shrink:0;display:flex}.dv__stat{font-size:var(--font-size-xs);font-weight:var(--font-weight-semibold);padding:var(--spacing-2) var(--spacing-8);border-radius:var(--radius-full)}.dv__stat--removed{color:#dc2626;background-color:#dc26261f}.dv__stat--added{color:#16a34a;background-color:#16a34a1f}.dv__body{max-height:600px;overflow:auto}.dv__split{width:100%;min-width:max-content;display:flex}.dv__pane{flex:1;min-width:0}.dv__pane--old{border-right:var(--spacing-1) solid var(--form-control-border-color)}.dv__inline{width:100%;min-width:max-content}.dv__row{min-height:var(--spacing-20);white-space:pre;align-items:baseline;display:flex}.dv__row--equal{background-color:#0000}.dv__row--removed{background-color:#dc262614}.dv__row--added{background-color:#16a34a14}.dv__row--blank{background-color:var(--form-control-focus-background-color);opacity:.5}.dv__row:hover{filter:brightness(.97)}.dv__lineno{min-width:var(--spacing-40);padding:0 var(--spacing-8);text-align:right;color:var(--body-color-muted);font-size:var(--font-size-xs);-webkit-user-select:none;user-select:none;border-right:var(--spacing-1) solid var(--form-control-border-color);background-color:var(--form-control-focus-background-color);flex-shrink:0}.dv__gutter{width:var(--spacing-20);padding:0 var(--spacing-4);text-align:center;font-weight:var(--font-weight-bold);-webkit-user-select:none;user-select:none;color:var(--body-color-muted);flex-shrink:0}.dv__row--removed .dv__gutter{color:#dc2626}.dv__row--added .dv__gutter{color:#16a34a}.dv__code{padding:0 var(--spacing-12) 0 var(--spacing-8);color:var(--form-control-color);flex:1;overflow:hidden}.dv .dv-word{border-radius:2px;padding:0 1px}.dv .dv-word--del{color:#b91c1c;background-color:#dc26264d;-webkit-text-decoration:line-through #b91c1c80;text-decoration:line-through #b91c1c80}.dv .dv-word--ins{color:#15803d;background-color:#16a34a4d}.dv--code .dv-token--keyword{color:#8b5cf6;font-weight:var(--font-weight-semibold)}.dv--code .dv-token--string{color:#16a34a}.dv--code .dv-token--comment{color:var(--body-color-muted);font-style:italic}.dv--code .dv-token--number{color:#f59e0b}.dv--code .dv-token--function{color:#0891b2}.dv--code .dv-token--tag{color:#dc2626}.dv--code .dv-token--attr{color:#f97316}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import './DiffViewer.css';
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { useMemo as w } from "react";
|
|
4
|
+
import { Fragment as u, jsx as d, jsxs as _ } from "react/jsx-runtime";
|
|
5
|
+
function g(s, t) {
|
|
6
|
+
const e = s.length, a = t.length, c = e + a, v = new Array(2 * c + 1).fill(0), r = [];
|
|
7
|
+
e: for (let o = 0; o <= c; o++) {
|
|
8
|
+
r.push([...v]);
|
|
9
|
+
for (let l = -o; l <= o; l += 2) {
|
|
10
|
+
const h = l + c;
|
|
11
|
+
let p = l === -o || l !== o && v[h - 1] < v[h + 1] ? v[h + 1] : v[h - 1] + 1, f = p - l;
|
|
12
|
+
for (; p < e && f < a && s[p] === t[f]; )
|
|
13
|
+
p++, f++;
|
|
14
|
+
if (v[h] = p, p >= e && f >= a) break e;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const i = [];
|
|
18
|
+
let m = e, n = a;
|
|
19
|
+
for (let o = r.length - 1; o >= 0 && (m > 0 || n > 0); o--) {
|
|
20
|
+
const l = r[o], h = m - n, p = h + c, f = h === -o || h !== o && l[p - 1] < l[p + 1] ? h + 1 : h - 1, k = l[f + c], x = k - f;
|
|
21
|
+
for (; m > k + 1 && n > x + 1; )
|
|
22
|
+
m--, n--, i.unshift({
|
|
23
|
+
kind: "eq",
|
|
24
|
+
val: s[m]
|
|
25
|
+
});
|
|
26
|
+
for (o > 0 && (m > k ? (m--, i.unshift({
|
|
27
|
+
kind: "del",
|
|
28
|
+
val: s[m]
|
|
29
|
+
})) : (n--, i.unshift({
|
|
30
|
+
kind: "ins",
|
|
31
|
+
val: t[n]
|
|
32
|
+
}))); m > k && n > x; )
|
|
33
|
+
m--, n--, i.unshift({
|
|
34
|
+
kind: "eq",
|
|
35
|
+
val: s[m]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return i;
|
|
39
|
+
}
|
|
40
|
+
function $(s, t) {
|
|
41
|
+
const e = g(s.split(`
|
|
42
|
+
`), t.split(`
|
|
43
|
+
`)), a = [];
|
|
44
|
+
let c = 1, v = 1, r = 0;
|
|
45
|
+
for (; r < e.length; ) {
|
|
46
|
+
const i = e[r];
|
|
47
|
+
i.kind === "eq" ? (a.push({
|
|
48
|
+
kind: "equal",
|
|
49
|
+
oldLineNo: c++,
|
|
50
|
+
newLineNo: v++,
|
|
51
|
+
text: i.val
|
|
52
|
+
}), r++) : i.kind === "del" && r + 1 < e.length && e[r + 1].kind === "ins" ? (a.push({
|
|
53
|
+
kind: "removed",
|
|
54
|
+
oldLineNo: c++,
|
|
55
|
+
oldText: i.val,
|
|
56
|
+
newText: e[r + 1].val
|
|
57
|
+
}), a.push({
|
|
58
|
+
kind: "added",
|
|
59
|
+
newLineNo: v++,
|
|
60
|
+
oldText: i.val,
|
|
61
|
+
newText: e[r + 1].val
|
|
62
|
+
}), r += 2) : i.kind === "del" ? (a.push({
|
|
63
|
+
kind: "removed",
|
|
64
|
+
oldLineNo: c++,
|
|
65
|
+
oldText: i.val
|
|
66
|
+
}), r++) : (a.push({
|
|
67
|
+
kind: "added",
|
|
68
|
+
newLineNo: v++,
|
|
69
|
+
newText: i.val
|
|
70
|
+
}), r++);
|
|
71
|
+
}
|
|
72
|
+
return a;
|
|
73
|
+
}
|
|
74
|
+
function T(s, t) {
|
|
75
|
+
const e = (a) => a.match(/\S+|\s+/g) ?? [];
|
|
76
|
+
return g(e(s), e(t));
|
|
77
|
+
}
|
|
78
|
+
var b = ({ a: s, b: t, side: e }) => /* @__PURE__ */ d(u, { children: T(s, t).map((a, c) => a.kind === "eq" ? /* @__PURE__ */ d("span", { children: a.val }, c) : a.kind === "del" && e === "old" ? /* @__PURE__ */ d("mark", {
|
|
79
|
+
className: "dv-word dv-word--del",
|
|
80
|
+
children: a.val
|
|
81
|
+
}, c) : a.kind === "ins" && e === "new" ? /* @__PURE__ */ d("mark", {
|
|
82
|
+
className: "dv-word dv-word--ins",
|
|
83
|
+
children: a.val
|
|
84
|
+
}, c) : null) }), L = [
|
|
85
|
+
{
|
|
86
|
+
name: "comment",
|
|
87
|
+
pattern: /\/\/.*$|\/\*[\s\S]*?\*\/|#.*$/m
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "string",
|
|
91
|
+
pattern: /`[\s\S]*?`|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "keyword",
|
|
95
|
+
pattern: /\b(const|let|var|function|return|if|else|for|while|class|import|export|default|from|async|await|new|typeof|instanceof|void|null|undefined|true|false|extends|implements|interface|type|enum|public|private|protected|static|readonly|abstract|def|print|pass|lambda|yield|in|is|not|and|or)\b/
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "number",
|
|
99
|
+
pattern: /\b\d+\.?\d*\b/
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "tag",
|
|
103
|
+
pattern: /<\/?[a-zA-Z][a-zA-Z0-9]*(?:\s[^>]*)?>/
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "attr",
|
|
107
|
+
pattern: /\b[a-zA-Z-]+(?==)/
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "function",
|
|
111
|
+
pattern: /\b[a-zA-Z_$][a-zA-Z0-9_$]*(?=\s*\()/
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
function y(s) {
|
|
115
|
+
const t = [];
|
|
116
|
+
let e = s;
|
|
117
|
+
for (; e.length > 0; ) {
|
|
118
|
+
let a = !1;
|
|
119
|
+
for (const { name: c, pattern: v } of L) {
|
|
120
|
+
const r = e.match(new RegExp(`^(?:${v.source})`, v.flags));
|
|
121
|
+
if (r) {
|
|
122
|
+
t.push({
|
|
123
|
+
name: c,
|
|
124
|
+
val: r[0]
|
|
125
|
+
}), e = e.slice(r[0].length), a = !0;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
a || (t.push({
|
|
130
|
+
name: "plain",
|
|
131
|
+
val: e[0]
|
|
132
|
+
}), e = e.slice(1));
|
|
133
|
+
}
|
|
134
|
+
return t;
|
|
135
|
+
}
|
|
136
|
+
var A = ({ text: s }) => /* @__PURE__ */ d(u, { children: w(() => y(s), [s]).map((t, e) => t.name === "plain" ? /* @__PURE__ */ d("span", { children: t.val }, e) : /* @__PURE__ */ d("span", {
|
|
137
|
+
className: `dv-token dv-token--${t.name}`,
|
|
138
|
+
children: t.val
|
|
139
|
+
}, e)) }), N = ({ line: s, side: t, type: e }) => {
|
|
140
|
+
const a = t === "old" ? s.text ?? s.oldText ?? "" : s.text ?? s.newText ?? "";
|
|
141
|
+
return s.kind !== "equal" && s.oldText !== void 0 && s.newText !== void 0 ? /* @__PURE__ */ d(b, {
|
|
142
|
+
a: s.oldText,
|
|
143
|
+
b: s.newText,
|
|
144
|
+
side: t
|
|
145
|
+
}) : e === "code" ? /* @__PURE__ */ d(A, { text: a }) : /* @__PURE__ */ d(u, { children: a });
|
|
146
|
+
}, Z = ({ oldValue: s, newValue: t, mode: e = "split", type: a = "text", oldTitle: c = "Before", newTitle: v = "After", showLineNumbers: r = !0 }) => {
|
|
147
|
+
const i = w(() => $(s, t), [s, t]), m = w(() => ({
|
|
148
|
+
added: i.filter((n) => n.kind === "added").length,
|
|
149
|
+
removed: i.filter((n) => n.kind === "removed").length
|
|
150
|
+
}), [i]);
|
|
151
|
+
return /* @__PURE__ */ _("div", {
|
|
152
|
+
className: `dv dv--${e} dv--${a}`,
|
|
153
|
+
children: [/* @__PURE__ */ _("div", {
|
|
154
|
+
className: "dv__header",
|
|
155
|
+
children: [e === "split" ? /* @__PURE__ */ _(u, { children: [/* @__PURE__ */ d("div", {
|
|
156
|
+
className: "dv__header-side",
|
|
157
|
+
children: c
|
|
158
|
+
}), /* @__PURE__ */ d("div", {
|
|
159
|
+
className: "dv__header-side",
|
|
160
|
+
children: v
|
|
161
|
+
})] }) : /* @__PURE__ */ _("div", {
|
|
162
|
+
className: "dv__header-inline",
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ d("span", { children: c }),
|
|
165
|
+
/* @__PURE__ */ d("span", {
|
|
166
|
+
className: "dv__header-arrow",
|
|
167
|
+
children: "→"
|
|
168
|
+
}),
|
|
169
|
+
/* @__PURE__ */ d("span", { children: v })
|
|
170
|
+
]
|
|
171
|
+
}), /* @__PURE__ */ _("div", {
|
|
172
|
+
className: "dv__stats",
|
|
173
|
+
children: [m.removed > 0 && /* @__PURE__ */ _("span", {
|
|
174
|
+
className: "dv__stat dv__stat--removed",
|
|
175
|
+
children: ["−", m.removed]
|
|
176
|
+
}), m.added > 0 && /* @__PURE__ */ _("span", {
|
|
177
|
+
className: "dv__stat dv__stat--added",
|
|
178
|
+
children: ["+", m.added]
|
|
179
|
+
})]
|
|
180
|
+
})]
|
|
181
|
+
}), /* @__PURE__ */ d("div", {
|
|
182
|
+
className: "dv__body",
|
|
183
|
+
children: e === "split" ? /* @__PURE__ */ _("div", {
|
|
184
|
+
className: "dv__split",
|
|
185
|
+
children: [/* @__PURE__ */ d("div", {
|
|
186
|
+
className: "dv__pane dv__pane--old",
|
|
187
|
+
children: i.map((n, o) => {
|
|
188
|
+
const l = n.kind === "added";
|
|
189
|
+
return /* @__PURE__ */ _("div", {
|
|
190
|
+
className: `dv__row ${l ? "dv__row--blank" : `dv__row--${n.kind}`}`,
|
|
191
|
+
children: [
|
|
192
|
+
r && /* @__PURE__ */ d("span", {
|
|
193
|
+
className: "dv__lineno",
|
|
194
|
+
children: l ? "" : n.oldLineNo
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ d("span", {
|
|
197
|
+
className: "dv__gutter",
|
|
198
|
+
children: l ? "" : n.kind === "removed" ? "−" : " "
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ d("span", {
|
|
201
|
+
className: "dv__code",
|
|
202
|
+
children: !l && /* @__PURE__ */ d(N, {
|
|
203
|
+
line: n,
|
|
204
|
+
side: "old",
|
|
205
|
+
type: a
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
}, o);
|
|
210
|
+
})
|
|
211
|
+
}), /* @__PURE__ */ d("div", {
|
|
212
|
+
className: "dv__pane dv__pane--new",
|
|
213
|
+
children: i.map((n, o) => {
|
|
214
|
+
const l = n.kind === "removed";
|
|
215
|
+
return /* @__PURE__ */ _("div", {
|
|
216
|
+
className: `dv__row ${l ? "dv__row--blank" : `dv__row--${n.kind}`}`,
|
|
217
|
+
children: [
|
|
218
|
+
r && /* @__PURE__ */ d("span", {
|
|
219
|
+
className: "dv__lineno",
|
|
220
|
+
children: l ? "" : n.newLineNo
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ d("span", {
|
|
223
|
+
className: "dv__gutter",
|
|
224
|
+
children: l ? "" : n.kind === "added" ? "+" : " "
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ d("span", {
|
|
227
|
+
className: "dv__code",
|
|
228
|
+
children: !l && /* @__PURE__ */ d(N, {
|
|
229
|
+
line: n,
|
|
230
|
+
side: "new",
|
|
231
|
+
type: a
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
}, o);
|
|
236
|
+
})
|
|
237
|
+
})]
|
|
238
|
+
}) : /* @__PURE__ */ d("div", {
|
|
239
|
+
className: "dv__inline",
|
|
240
|
+
children: i.map((n, o) => /* @__PURE__ */ _("div", {
|
|
241
|
+
className: `dv__row dv__row--${n.kind}`,
|
|
242
|
+
children: [
|
|
243
|
+
r && /* @__PURE__ */ _(u, { children: [/* @__PURE__ */ d("span", {
|
|
244
|
+
className: "dv__lineno",
|
|
245
|
+
children: n.kind !== "added" ? n.oldLineNo : ""
|
|
246
|
+
}), /* @__PURE__ */ d("span", {
|
|
247
|
+
className: "dv__lineno",
|
|
248
|
+
children: n.kind !== "removed" ? n.newLineNo : ""
|
|
249
|
+
})] }),
|
|
250
|
+
/* @__PURE__ */ d("span", {
|
|
251
|
+
className: "dv__gutter",
|
|
252
|
+
children: n.kind === "removed" ? "−" : n.kind === "added" ? "+" : " "
|
|
253
|
+
}),
|
|
254
|
+
/* @__PURE__ */ d("span", {
|
|
255
|
+
className: "dv__code",
|
|
256
|
+
children: /* @__PURE__ */ d(N, {
|
|
257
|
+
line: n,
|
|
258
|
+
side: n.kind === "removed" ? "old" : "new",
|
|
259
|
+
type: a
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
}, o))
|
|
264
|
+
})
|
|
265
|
+
})]
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
export {
|
|
269
|
+
Z as DiffViewer
|
|
270
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.drawer-overlay{--drawer-overlay-backdrop-filter:blur(8px) saturate(.9);background:var(--backdrop-color);z-index:1000;-webkit-backdrop-filter:var(--drawer-overlay-backdrop-filter);animation:.3s fadeIn;position:fixed;inset:0}.drawer{--drawer-width:320px;--drawer-max-width:none;--drawer-margin:0;--drawer-border-radius:0;--drawer-shadow:none;--drawer-slide-offset:-100%;--drawer-background-color:var(--modal-background-color,var(--card-background-color));--drawer-border-color:var(--modal-border-color,var(--card-border-color,var(--delimiter-color)));--drawer-backdrop-filter:var(--modal-backdrop-filter,var(--card-backdrop-filter,none));--drawer-header-background-color:var(--card-background-accent-color);width:var(--drawer-width);max-width:var(--drawer-max-width);margin:var(--drawer-margin);background:var(--drawer-background-color);-webkit-backdrop-filter:var(--drawer-backdrop-filter);border:var(--spacing-1) solid var(--drawer-border-color);border-radius:var(--drawer-border-radius);z-index:1001;min-height:0;box-shadow:var(--drawer-shadow);flex-direction:column;animation:.3s drawerSlideIn;display:flex;position:fixed;top:0;bottom:0;overflow:hidden}.drawer--left{--drawer-slide-offset:-100%;left:0}.drawer--right{--drawer-slide-offset:100%;right:0}.drawer__header{justify-content:space-between;align-items:center;gap:var(--spacing-12);padding:var(--spacing-16);border-bottom:var(--spacing-1) solid var(--drawer-border-color);background:var(--drawer-header-background-color);flex-shrink:0;display:flex}.drawer__title{align-items:center;gap:var(--spacing-8);min-width:0;color:var(--modal-title-color,var(--body-color-accent));font-family:var(--modal-title-font-family,var(--font-family,sans-serif));font-size:var(--modal-title-font-size,var(--font-size-xl));font-style:var(--modal-title-font-style,normal);font-weight:var(--modal-title-font-weight,var(--font-weight-semibold));letter-spacing:var(--modal-title-letter-spacing,normal);text-transform:var(--modal-title-text-transform,none);flex:1;margin:0;display:flex}.drawer__title-text{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.drawer__header-actions{align-items:center;gap:var(--spacing-8);flex-shrink:0;display:flex}.drawer__back{flex-shrink:0;align-self:center}.drawer__close{width:32px;height:32px;padding:var(--spacing-4);flex-shrink:0;justify-content:center;align-items:center;font-size:1.5rem;line-height:1;display:flex}.drawer__close:focus{outline:2px solid var(--body-accent-color);outline-offset:2px}.drawer__content{min-height:0;padding:var(--spacing-16);flex:1;overflow-y:auto}.drawer__footer{justify-content:flex-end;align-items:center;gap:var(--spacing-16);padding:var(--spacing-16);border-top:var(--spacing-1) solid var(--drawer-border-color);background:var(--drawer-header-background-color);flex-shrink:0;display:flex}.drawer__footer-content{flex:1;min-width:0}.drawer__footer-actions{justify-content:flex-end;align-items:center;gap:var(--spacing-12);flex-shrink:0;display:flex}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes drawerSlideIn{0%{transform:translateX(var(--drawer-slide-offset))}to{transform:translate(0)}}@media (width<=768px){.drawer{max-width:var(--drawer-max-width);width:min(var(--drawer-width), 100vw - var(--spacing-32))!important}}.drawer__content::-webkit-scrollbar{width:var(--scrollbar-size)}.drawer__content::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.drawer__content::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb-color);border-radius:var(--scrollbar-radius)}.drawer__content::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover-color)}
|