@devalok/shilp-sutra 0.17.2 → 0.18.1
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/_chunks/framer.js +1376 -0
- package/dist/_chunks/link-context.js +19 -0
- package/dist/_chunks/motion-provider.js +24 -0
- package/dist/_chunks/primitives.js +3499 -3920
- package/dist/_chunks/tiptap.js +1 -1
- package/dist/_chunks/tree-view.js +183 -181
- package/dist/_chunks/use-calendar.js +531 -515
- package/dist/_chunks/vendor-client.js +1792 -1049
- package/dist/_chunks/vendor-utils.js +5123 -1169
- package/dist/composed/activity-feed.d.ts.map +1 -1
- package/dist/composed/activity-feed.js +75 -78
- package/dist/composed/avatar-group.js +33 -33
- package/dist/composed/command-palette.d.ts +1 -1
- package/dist/composed/command-palette.d.ts.map +1 -1
- package/dist/composed/command-palette.js +207 -158
- package/dist/composed/confirm-dialog.d.ts +3 -5
- package/dist/composed/confirm-dialog.d.ts.map +1 -1
- package/dist/composed/confirm-dialog.js +47 -42
- package/dist/composed/content-card.d.ts +1 -1
- package/dist/composed/content-card.js +30 -30
- package/dist/composed/date-picker/calendar-grid.d.ts +1 -1
- package/dist/composed/date-picker/calendar-grid.d.ts.map +1 -1
- package/dist/composed/date-picker/date-picker.d.ts +1 -1
- package/dist/composed/date-picker/date-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/date-range-picker.d.ts +1 -1
- package/dist/composed/date-picker/date-range-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/date-time-picker.d.ts +1 -1
- package/dist/composed/date-picker/date-time-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/month-picker.d.ts +1 -1
- package/dist/composed/date-picker/month-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/presets.d.ts +1 -1
- package/dist/composed/date-picker/presets.d.ts.map +1 -1
- package/dist/composed/date-picker/time-picker.d.ts +1 -1
- package/dist/composed/date-picker/time-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/year-picker.d.ts +1 -1
- package/dist/composed/date-picker/year-picker.d.ts.map +1 -1
- package/dist/composed/empty-state.d.ts +1 -0
- package/dist/composed/empty-state.d.ts.map +1 -1
- package/dist/composed/empty-state.js +51 -47
- package/dist/composed/error-boundary.d.ts +1 -1
- package/dist/composed/error-boundary.d.ts.map +1 -1
- package/dist/composed/error-boundary.js +48 -48
- package/dist/composed/extensions/mention-suggestion.d.ts +1 -1
- package/dist/composed/extensions/mention-suggestion.d.ts.map +1 -1
- package/dist/composed/global-loading.d.ts +1 -1
- package/dist/composed/global-loading.d.ts.map +1 -1
- package/dist/composed/global-loading.js +22 -19
- package/dist/composed/index.d.ts +2 -4
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +26 -29
- package/dist/composed/lib/string-utils.d.ts +0 -1
- package/dist/composed/lib/string-utils.js +0 -1
- package/dist/composed/loading-skeleton.d.ts +1 -1
- package/dist/composed/loading-skeleton.d.ts.map +1 -1
- package/dist/composed/loading-skeleton.js +92 -87
- package/dist/composed/member-picker.d.ts +1 -1
- package/dist/composed/member-picker.d.ts.map +1 -1
- package/dist/composed/member-picker.js +47 -43
- package/dist/composed/page-header.js +36 -36
- package/dist/composed/page-skeletons.d.ts +9 -3
- package/dist/composed/page-skeletons.d.ts.map +1 -1
- package/dist/composed/page-skeletons.js +58 -58
- package/dist/composed/priority-indicator.js +24 -24
- package/dist/composed/rich-text-editor.d.ts +3 -3
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +317 -310
- package/dist/composed/schedule-view.js +84 -84
- package/dist/composed/simple-tooltip.d.ts +2 -5
- package/dist/composed/simple-tooltip.d.ts.map +1 -1
- package/dist/composed/simple-tooltip.js +19 -14
- package/dist/composed/status-badge.d.ts +2 -1
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +81 -68
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -4
- package/dist/hooks/use-toast.d.ts +15 -45
- package/dist/hooks/use-toast.d.ts.map +1 -1
- package/dist/hooks/use-toast.js +2 -95
- package/dist/motion/index.d.ts +4 -0
- package/dist/motion/index.d.ts.map +1 -0
- package/dist/motion/index.js +12 -0
- package/dist/motion/motion-provider.d.ts +18 -0
- package/dist/motion/motion-provider.d.ts.map +1 -0
- package/dist/motion/primitives-index.d.ts +3 -0
- package/dist/motion/primitives-index.d.ts.map +1 -0
- package/dist/motion/primitives-index.js +187 -0
- package/dist/motion/primitives.d.ts +38 -0
- package/dist/motion/primitives.d.ts.map +1 -0
- package/dist/shell/app-command-palette.d.ts +14 -5
- package/dist/shell/app-command-palette.d.ts.map +1 -1
- package/dist/shell/app-command-palette.js +152 -130
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +90 -92
- package/dist/shell/command-registry.d.ts +23 -0
- package/dist/shell/command-registry.d.ts.map +1 -0
- package/dist/shell/command-registry.js +18 -0
- package/dist/shell/index.d.ts +2 -1
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +14 -11
- package/dist/shell/link-context.d.ts +6 -10
- package/dist/shell/link-context.d.ts.map +1 -1
- package/dist/shell/link-context.js +3 -16
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +129 -124
- package/dist/shell/notification-preferences.d.ts +10 -5
- package/dist/shell/notification-preferences.d.ts.map +1 -1
- package/dist/shell/notification-preferences.js +169 -165
- package/dist/shell/sidebar.js +104 -104
- package/dist/shell/top-bar.js +67 -67
- package/dist/tailwind/index.cjs +118 -297
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +118 -297
- package/dist/tokens/generate-scale.d.ts +86 -0
- package/dist/tokens/generate-scale.d.ts.map +1 -0
- package/dist/tokens/primitives.css +415 -187
- package/dist/tokens/semantic.css +244 -270
- package/dist/tokens/typography.css +6 -6
- package/dist/ui/accordion.d.ts.map +1 -1
- package/dist/ui/accordion.js +34 -24
- package/dist/ui/alert-dialog.d.ts +4 -1
- package/dist/ui/alert-dialog.d.ts.map +1 -1
- package/dist/ui/alert-dialog.js +115 -74
- package/dist/ui/alert.d.ts +6 -1
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +65 -50
- package/dist/ui/aspect-ratio.d.ts +2 -1
- package/dist/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/ui/aspect-ratio.js +14 -4
- package/dist/ui/autocomplete.d.ts +11 -2
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +85 -60
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +46 -35
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +72 -67
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +54 -40
- package/dist/ui/breadcrumb.d.ts +2 -0
- package/dist/ui/breadcrumb.d.ts.map +1 -1
- package/dist/ui/breadcrumb.js +19 -19
- package/dist/ui/button-group.js +4 -4
- package/dist/ui/button.d.ts +10 -1
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +102 -66
- package/dist/ui/card.d.ts +2 -2
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +61 -53
- package/dist/ui/charts/_internal/animation.d.ts +1 -1
- package/dist/ui/charts/_internal/animation.d.ts.map +1 -1
- package/dist/ui/charts/area-chart.d.ts +3 -5
- package/dist/ui/charts/area-chart.d.ts.map +1 -1
- package/dist/ui/charts/bar-chart.d.ts +3 -5
- package/dist/ui/charts/bar-chart.d.ts.map +1 -1
- package/dist/ui/charts/chart-container.d.ts +2 -5
- package/dist/ui/charts/chart-container.d.ts.map +1 -1
- package/dist/ui/charts/gauge-chart.d.ts +3 -5
- package/dist/ui/charts/gauge-chart.d.ts.map +1 -1
- package/dist/ui/charts/index.js +1204 -1095
- package/dist/ui/charts/line-chart.d.ts +3 -5
- package/dist/ui/charts/line-chart.d.ts.map +1 -1
- package/dist/ui/charts/pie-chart.d.ts +2 -5
- package/dist/ui/charts/pie-chart.d.ts.map +1 -1
- package/dist/ui/charts/radar-chart.d.ts +3 -5
- package/dist/ui/charts/radar-chart.d.ts.map +1 -1
- package/dist/ui/charts/sparkline.d.ts +5 -5
- package/dist/ui/charts/sparkline.d.ts.map +1 -1
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +31 -19
- package/dist/ui/chip.d.ts +3 -2
- package/dist/ui/chip.d.ts.map +1 -1
- package/dist/ui/chip.js +58 -50
- package/dist/ui/code.js +16 -16
- package/dist/ui/collapsible.d.ts.map +1 -1
- package/dist/ui/collapsible.js +23 -15
- package/dist/ui/color-input.d.ts +1 -1
- package/dist/ui/color-input.d.ts.map +1 -1
- package/dist/ui/color-input.js +27 -27
- package/dist/ui/combobox.d.ts +2 -0
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +177 -166
- package/dist/ui/container.js +4 -4
- package/dist/ui/context-menu.d.ts +4 -2
- package/dist/ui/context-menu.d.ts.map +1 -1
- package/dist/ui/context-menu.js +147 -87
- package/dist/ui/data-table-toolbar.d.ts +3 -2
- package/dist/ui/data-table-toolbar.d.ts.map +1 -1
- package/dist/ui/data-table-toolbar.js +65 -63
- package/dist/ui/data-table.d.ts.map +1 -1
- package/dist/ui/data-table.js +275 -240
- package/dist/ui/dialog.d.ts +3 -1
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +114 -74
- package/dist/ui/dropdown-menu.d.ts +5 -3
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +151 -90
- package/dist/ui/file-upload.d.ts.map +1 -1
- package/dist/ui/file-upload.js +170 -128
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +30 -27
- package/dist/ui/hover-card.d.ts +1 -1
- package/dist/ui/hover-card.d.ts.map +1 -1
- package/dist/ui/hover-card.js +53 -21
- package/dist/ui/icon-button.js +9 -9
- package/dist/ui/index.d.ts +18 -18
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +322 -533
- package/dist/ui/input-otp.d.ts +2 -0
- package/dist/ui/input-otp.d.ts.map +1 -1
- package/dist/ui/input-otp.js +8 -8
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +35 -33
- package/dist/ui/label.js +12 -12
- package/dist/ui/lib/date-utils.d.ts +5 -0
- package/dist/ui/lib/date-utils.d.ts.map +1 -0
- package/dist/ui/lib/date-utils.js +12 -0
- package/dist/ui/lib/index.d.ts +7 -0
- package/dist/ui/lib/index.d.ts.map +1 -0
- package/dist/ui/lib/link-context.d.ts +13 -0
- package/dist/ui/lib/link-context.d.ts.map +1 -0
- package/dist/ui/lib/motion.d.ts +44 -9
- package/dist/ui/lib/motion.d.ts.map +1 -1
- package/dist/ui/lib/motion.js +34 -0
- package/dist/ui/lib/use-ripple.d.ts.map +1 -1
- package/dist/ui/lib/utils.js +1 -1
- package/dist/ui/link.js +11 -11
- package/dist/ui/menubar.d.ts +4 -2
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/menubar.js +142 -98
- package/dist/ui/navigation-menu.d.ts +2 -0
- package/dist/ui/navigation-menu.d.ts.map +1 -1
- package/dist/ui/navigation-menu.js +176 -73
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +58 -51
- package/dist/ui/pagination.js +23 -23
- package/dist/ui/popover.d.ts +2 -1
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/popover.js +54 -22
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +58 -42
- package/dist/ui/radio.js +15 -15
- package/dist/ui/search-input.d.ts.map +1 -1
- package/dist/ui/search-input.js +28 -33
- package/dist/ui/segmented-control.d.ts +4 -2
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +146 -123
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +75 -64
- package/dist/ui/separator.js +12 -12
- package/dist/ui/sheet.d.ts +1 -1
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +111 -75
- package/dist/ui/sidebar.d.ts +6 -1
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +574 -36
- package/dist/ui/skeleton.js +2 -2
- package/dist/ui/slider.d.ts +9 -0
- package/dist/ui/slider.d.ts.map +1 -1
- package/dist/ui/slider.js +33 -27
- package/dist/ui/spinner.d.ts +32 -25
- package/dist/ui/spinner.d.ts.map +1 -1
- package/dist/ui/spinner.js +199 -40
- package/dist/ui/stack.js +1 -1
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +181 -114
- package/dist/ui/stepper.d.ts +23 -4
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +126 -48
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +39 -26
- package/dist/ui/table.d.ts +3 -0
- package/dist/ui/table.d.ts.map +1 -1
- package/dist/ui/table.js +29 -29
- package/dist/ui/tabs.d.ts +4 -1
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +94 -44
- package/dist/ui/text.d.ts +3 -3
- package/dist/ui/text.js +2 -2
- package/dist/ui/textarea.d.ts.map +1 -1
- package/dist/ui/textarea.js +27 -25
- package/dist/ui/toast-types.d.ts +43 -0
- package/dist/ui/toast-types.d.ts.map +1 -0
- package/dist/ui/toast-types.js +2 -0
- package/dist/ui/toast.d.ts +60 -26
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +535 -89
- package/dist/ui/toaster.d.ts +19 -23
- package/dist/ui/toaster.d.ts.map +1 -1
- package/dist/ui/toaster.js +31 -21
- package/dist/ui/toggle-group.d.ts +2 -2
- package/dist/ui/toggle-group.d.ts.map +1 -1
- package/dist/ui/toggle-group.js +29 -26
- package/dist/ui/toggle.d.ts +2 -2
- package/dist/ui/toggle.d.ts.map +1 -1
- package/dist/ui/toggle.js +21 -17
- package/dist/ui/tooltip.d.ts +2 -1
- package/dist/ui/tooltip.d.ts.map +1 -1
- package/dist/ui/tooltip.js +58 -21
- package/dist/ui/tree-view/tree-view.d.ts +1 -1
- package/dist/ui/tree-view/tree-view.d.ts.map +1 -1
- package/dist/ui/visually-hidden.js +3 -3
- package/llms-full.txt +3440 -1528
- package/llms.txt +67 -14
- package/package.json +50 -9
- package/dist/_chunks/avatar.js +0 -50
- package/dist/_chunks/button.js +0 -95
- package/dist/_chunks/checkbox.js +0 -14
- package/dist/_chunks/form.js +0 -27
- package/dist/_chunks/sidebar.js +0 -592
- package/dist/_chunks/spinner.js +0 -34
- package/dist/_chunks/switch.js +0 -10
- package/dist/_chunks/tooltip.js +0 -13
- package/dist/_chunks/utils.js +0 -17
- package/dist/composed/upload-progress.d.ts +0 -33
- package/dist/composed/upload-progress.d.ts.map +0 -1
- package/dist/composed/upload-progress.js +0 -386
- package/dist/ui/lib/use-reduced-motion.d.ts +0 -4
- package/dist/ui/lib/use-reduced-motion.d.ts.map +0 -1
- package/dist/ui/transitions.d.ts +0 -17
- package/dist/ui/transitions.d.ts.map +0 -1
- package/dist/ui/transitions.js +0 -111
|
@@ -0,0 +1,1376 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as V, Fragment as le, jsxs as fe } from "react/jsx-runtime";
|
|
3
|
+
import * as q from "react";
|
|
4
|
+
import { createContext as I, useRef as x, useLayoutEffect as de, useEffect as ut, useId as lt, useContext as w, useInsertionEffect as ft, useMemo as b, useCallback as z, Children as he, isValidElement as me, useState as $, Fragment as Wt, createElement as pe, forwardRef as ge, Component as ve } from "react";
|
|
5
|
+
import { i as tt, f as M, n as vt, g as ye, s as Ht, a as dt, r as Pe, b as Nt, c as yt, d as we, e as Ee, h as Ce, j as xe, k as Se, l as Me, m as Bt, o as Le, p as Ve, q as be, t as De, w as Ae, u as Ut, v as zt, S as Te, H as Ie, F as A, x as Re, y as ke, z as $t, A as _, B as Pt, C as _t, D as Fe, E as wt, G as je, I as Y, J as rt, K as Et, L as Oe, M as Ge, N as D, O as We, P as He, Q as Ne, R as Ct, T as Be, U as Ue, V as xt, W as ze, X as $e, Y as U, Z as _e, _ as Ye, $ as Yt, a0 as Xe, a1 as qe, a2 as Ke, a3 as Je, a4 as Ze } from "./vendor-utils.js";
|
|
6
|
+
const O = I({});
|
|
7
|
+
function K(e) {
|
|
8
|
+
const t = x(null);
|
|
9
|
+
return t.current === null && (t.current = e()), t.current;
|
|
10
|
+
}
|
|
11
|
+
const Qe = typeof window < "u", ht = Qe ? de : ut, J = /* @__PURE__ */ I(null), G = I({
|
|
12
|
+
transformPagePoint: (e) => e,
|
|
13
|
+
isStatic: !1,
|
|
14
|
+
reducedMotion: "never"
|
|
15
|
+
});
|
|
16
|
+
function St(e, t) {
|
|
17
|
+
if (typeof e == "function")
|
|
18
|
+
return e(t);
|
|
19
|
+
e != null && (e.current = t);
|
|
20
|
+
}
|
|
21
|
+
function tn(...e) {
|
|
22
|
+
return (t) => {
|
|
23
|
+
let n = !1;
|
|
24
|
+
const s = e.map((o) => {
|
|
25
|
+
const i = St(o, t);
|
|
26
|
+
return !n && typeof i == "function" && (n = !0), i;
|
|
27
|
+
});
|
|
28
|
+
if (n)
|
|
29
|
+
return () => {
|
|
30
|
+
for (let o = 0; o < s.length; o++) {
|
|
31
|
+
const i = s[o];
|
|
32
|
+
typeof i == "function" ? i() : St(e[o], null);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function en(...e) {
|
|
38
|
+
return q.useCallback(tn(...e), e);
|
|
39
|
+
}
|
|
40
|
+
class nn extends q.Component {
|
|
41
|
+
getSnapshotBeforeUpdate(t) {
|
|
42
|
+
const n = this.props.childRef.current;
|
|
43
|
+
if (tt(n) && t.isPresent && !this.props.isPresent && this.props.pop !== !1) {
|
|
44
|
+
const s = n.offsetParent, o = tt(s) && s.offsetWidth || 0, i = tt(s) && s.offsetHeight || 0, r = getComputedStyle(n), a = this.props.sizeRef.current;
|
|
45
|
+
a.height = parseFloat(r.height), a.width = parseFloat(r.width), a.top = n.offsetTop, a.left = n.offsetLeft, a.right = o - a.width - a.left, a.bottom = i - a.height - a.top;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Required with getSnapshotBeforeUpdate to stop React complaining.
|
|
51
|
+
*/
|
|
52
|
+
componentDidUpdate() {
|
|
53
|
+
}
|
|
54
|
+
render() {
|
|
55
|
+
return this.props.children;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function sn({ children: e, isPresent: t, anchorX: n, anchorY: s, root: o, pop: i }) {
|
|
59
|
+
var c;
|
|
60
|
+
const r = lt(), a = x(null), f = x({
|
|
61
|
+
width: 0,
|
|
62
|
+
height: 0,
|
|
63
|
+
top: 0,
|
|
64
|
+
left: 0,
|
|
65
|
+
right: 0,
|
|
66
|
+
bottom: 0
|
|
67
|
+
}), { nonce: d } = w(G), m = ((c = e.props) == null ? void 0 : c.ref) ?? (e == null ? void 0 : e.ref), u = en(a, m);
|
|
68
|
+
return ft(() => {
|
|
69
|
+
const { width: h, height: l, top: p, left: g, right: v, bottom: y } = f.current;
|
|
70
|
+
if (t || i === !1 || !a.current || !h || !l)
|
|
71
|
+
return;
|
|
72
|
+
const P = n === "left" ? `left: ${g}` : `right: ${v}`, E = s === "bottom" ? `bottom: ${y}` : `top: ${p}`;
|
|
73
|
+
a.current.dataset.motionPopId = r;
|
|
74
|
+
const S = document.createElement("style");
|
|
75
|
+
d && (S.nonce = d);
|
|
76
|
+
const T = o ?? document.head;
|
|
77
|
+
return T.appendChild(S), S.sheet && S.sheet.insertRule(`
|
|
78
|
+
[data-motion-pop-id="${r}"] {
|
|
79
|
+
position: absolute !important;
|
|
80
|
+
width: ${h}px !important;
|
|
81
|
+
height: ${l}px !important;
|
|
82
|
+
${P}px !important;
|
|
83
|
+
${E}px !important;
|
|
84
|
+
}
|
|
85
|
+
`), () => {
|
|
86
|
+
var R;
|
|
87
|
+
(R = a.current) == null || R.removeAttribute("data-motion-pop-id"), T.contains(S) && T.removeChild(S);
|
|
88
|
+
};
|
|
89
|
+
}, [t]), V(nn, { isPresent: t, childRef: a, sizeRef: f, pop: i, children: i === !1 ? e : q.cloneElement(e, { ref: u }) });
|
|
90
|
+
}
|
|
91
|
+
const on = ({ children: e, initial: t, isPresent: n, onExitComplete: s, custom: o, presenceAffectsLayout: i, mode: r, anchorX: a, anchorY: f, root: d }) => {
|
|
92
|
+
const m = K(rn), u = lt();
|
|
93
|
+
let c = !0, h = b(() => (c = !1, {
|
|
94
|
+
id: u,
|
|
95
|
+
initial: t,
|
|
96
|
+
isPresent: n,
|
|
97
|
+
custom: o,
|
|
98
|
+
onExitComplete: (l) => {
|
|
99
|
+
m.set(l, !0);
|
|
100
|
+
for (const p of m.values())
|
|
101
|
+
if (!p)
|
|
102
|
+
return;
|
|
103
|
+
s && s();
|
|
104
|
+
},
|
|
105
|
+
register: (l) => (m.set(l, !1), () => m.delete(l))
|
|
106
|
+
}), [n, m, s]);
|
|
107
|
+
return i && c && (h = { ...h }), b(() => {
|
|
108
|
+
m.forEach((l, p) => m.set(p, !1));
|
|
109
|
+
}, [n]), q.useEffect(() => {
|
|
110
|
+
!n && !m.size && s && s();
|
|
111
|
+
}, [n]), e = V(sn, { pop: r === "popLayout", isPresent: n, anchorX: a, anchorY: f, root: d, children: e }), V(J.Provider, { value: h, children: e });
|
|
112
|
+
};
|
|
113
|
+
function rn() {
|
|
114
|
+
return /* @__PURE__ */ new Map();
|
|
115
|
+
}
|
|
116
|
+
function Xt(e = !0) {
|
|
117
|
+
const t = w(J);
|
|
118
|
+
if (t === null)
|
|
119
|
+
return [!0, null];
|
|
120
|
+
const { isPresent: n, onExitComplete: s, register: o } = t, i = lt();
|
|
121
|
+
ut(() => {
|
|
122
|
+
if (e)
|
|
123
|
+
return o(i);
|
|
124
|
+
}, [e]);
|
|
125
|
+
const r = z(() => e && s && s(i), [i, s, e]);
|
|
126
|
+
return !n && s ? [!1, r] : [!0];
|
|
127
|
+
}
|
|
128
|
+
const H = (e) => e.key || "";
|
|
129
|
+
function Mt(e) {
|
|
130
|
+
const t = [];
|
|
131
|
+
return he.forEach(e, (n) => {
|
|
132
|
+
me(n) && t.push(n);
|
|
133
|
+
}), t;
|
|
134
|
+
}
|
|
135
|
+
const ws = ({ children: e, custom: t, initial: n = !0, onExitComplete: s, presenceAffectsLayout: o = !0, mode: i = "sync", propagate: r = !1, anchorX: a = "left", anchorY: f = "top", root: d }) => {
|
|
136
|
+
const [m, u] = Xt(r), c = b(() => Mt(e), [e]), h = r && !m ? [] : c.map(H), l = x(!0), p = x(c), g = K(() => /* @__PURE__ */ new Map()), v = x(/* @__PURE__ */ new Set()), [y, P] = $(c), [E, S] = $(c);
|
|
137
|
+
ht(() => {
|
|
138
|
+
l.current = !1, p.current = c;
|
|
139
|
+
for (let L = 0; L < E.length; L++) {
|
|
140
|
+
const C = H(E[L]);
|
|
141
|
+
h.includes(C) ? (g.delete(C), v.current.delete(C)) : g.get(C) !== !0 && g.set(C, !1);
|
|
142
|
+
}
|
|
143
|
+
}, [E, h.length, h.join("-")]);
|
|
144
|
+
const T = [];
|
|
145
|
+
if (c !== y) {
|
|
146
|
+
let L = [...c];
|
|
147
|
+
for (let C = 0; C < E.length; C++) {
|
|
148
|
+
const k = E[C], Q = H(k);
|
|
149
|
+
h.includes(Q) || (L.splice(C, 0, k), T.push(k));
|
|
150
|
+
}
|
|
151
|
+
return i === "wait" && T.length && (L = T), S(Mt(L)), P(c), null;
|
|
152
|
+
}
|
|
153
|
+
process.env.NODE_ENV !== "production" && i === "wait" && E.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
|
|
154
|
+
const { forceRender: R } = w(O);
|
|
155
|
+
return V(le, { children: E.map((L) => {
|
|
156
|
+
const C = H(L), k = r && !m ? !1 : c === E || h.includes(C), Q = () => {
|
|
157
|
+
if (v.current.has(C))
|
|
158
|
+
return;
|
|
159
|
+
if (g.has(C))
|
|
160
|
+
v.current.add(C), g.set(C, !0);
|
|
161
|
+
else
|
|
162
|
+
return;
|
|
163
|
+
let gt = !0;
|
|
164
|
+
g.forEach((ue) => {
|
|
165
|
+
ue || (gt = !1);
|
|
166
|
+
}), gt && (R == null || R(), S(p.current), r && (u == null || u()), s && s());
|
|
167
|
+
};
|
|
168
|
+
return V(on, { isPresent: k, initial: !l.current || n ? void 0 : !1, custom: t, presenceAffectsLayout: o, mode: i, root: d, onExitComplete: k ? void 0 : Q, anchorX: a, anchorY: f, children: L }, C);
|
|
169
|
+
}) });
|
|
170
|
+
}, an = I(null);
|
|
171
|
+
function cn() {
|
|
172
|
+
const e = x(!1);
|
|
173
|
+
return ht(() => (e.current = !0, () => {
|
|
174
|
+
e.current = !1;
|
|
175
|
+
}), []), e;
|
|
176
|
+
}
|
|
177
|
+
function un() {
|
|
178
|
+
const e = cn(), [t, n] = $(0), s = z(() => {
|
|
179
|
+
e.current && n(t + 1);
|
|
180
|
+
}, [t]);
|
|
181
|
+
return [z(() => M.postRender(s), [s]), t];
|
|
182
|
+
}
|
|
183
|
+
const qt = (e) => e === !0, ln = (e) => qt(e === !0) || e === "id", Es = ({ children: e, id: t, inherit: n = !0 }) => {
|
|
184
|
+
const s = w(O), o = w(an), [i, r] = un(), a = x(null), f = s.id || o;
|
|
185
|
+
a.current === null && (ln(n) && f && (t = t ? f + "-" + t : f), a.current = {
|
|
186
|
+
id: t,
|
|
187
|
+
group: qt(n) ? s.group || vt() : vt()
|
|
188
|
+
});
|
|
189
|
+
const d = b(() => ({ ...a.current, forceRender: i }), [r]);
|
|
190
|
+
return V(O.Provider, { value: d, children: e });
|
|
191
|
+
}, Kt = I({ strict: !1 }), Lt = {
|
|
192
|
+
animation: [
|
|
193
|
+
"animate",
|
|
194
|
+
"variants",
|
|
195
|
+
"whileHover",
|
|
196
|
+
"whileTap",
|
|
197
|
+
"exit",
|
|
198
|
+
"whileInView",
|
|
199
|
+
"whileFocus",
|
|
200
|
+
"whileDrag"
|
|
201
|
+
],
|
|
202
|
+
exit: ["exit"],
|
|
203
|
+
drag: ["drag", "dragControls"],
|
|
204
|
+
focus: ["whileFocus"],
|
|
205
|
+
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
|
|
206
|
+
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
|
|
207
|
+
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
|
|
208
|
+
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
|
|
209
|
+
layout: ["layout", "layoutId"]
|
|
210
|
+
};
|
|
211
|
+
let Vt = !1;
|
|
212
|
+
function fn() {
|
|
213
|
+
if (Vt)
|
|
214
|
+
return;
|
|
215
|
+
const e = {};
|
|
216
|
+
for (const t in Lt)
|
|
217
|
+
e[t] = {
|
|
218
|
+
isEnabled: (n) => Lt[t].some((s) => !!n[s])
|
|
219
|
+
};
|
|
220
|
+
Ht(e), Vt = !0;
|
|
221
|
+
}
|
|
222
|
+
function Jt() {
|
|
223
|
+
return fn(), ye();
|
|
224
|
+
}
|
|
225
|
+
function dn(e) {
|
|
226
|
+
const t = Jt();
|
|
227
|
+
for (const n in e)
|
|
228
|
+
t[n] = {
|
|
229
|
+
...t[n],
|
|
230
|
+
...e[n]
|
|
231
|
+
};
|
|
232
|
+
Ht(t);
|
|
233
|
+
}
|
|
234
|
+
const hn = /* @__PURE__ */ new Set([
|
|
235
|
+
"animate",
|
|
236
|
+
"exit",
|
|
237
|
+
"variants",
|
|
238
|
+
"initial",
|
|
239
|
+
"style",
|
|
240
|
+
"values",
|
|
241
|
+
"variants",
|
|
242
|
+
"transition",
|
|
243
|
+
"transformTemplate",
|
|
244
|
+
"custom",
|
|
245
|
+
"inherit",
|
|
246
|
+
"onBeforeLayoutMeasure",
|
|
247
|
+
"onAnimationStart",
|
|
248
|
+
"onAnimationComplete",
|
|
249
|
+
"onUpdate",
|
|
250
|
+
"onDragStart",
|
|
251
|
+
"onDrag",
|
|
252
|
+
"onDragEnd",
|
|
253
|
+
"onMeasureDragConstraints",
|
|
254
|
+
"onDirectionLock",
|
|
255
|
+
"onDragTransitionEnd",
|
|
256
|
+
"_dragX",
|
|
257
|
+
"_dragY",
|
|
258
|
+
"onHoverStart",
|
|
259
|
+
"onHoverEnd",
|
|
260
|
+
"onViewportEnter",
|
|
261
|
+
"onViewportLeave",
|
|
262
|
+
"globalTapTarget",
|
|
263
|
+
"propagate",
|
|
264
|
+
"ignoreStrict",
|
|
265
|
+
"viewport"
|
|
266
|
+
]);
|
|
267
|
+
function X(e) {
|
|
268
|
+
return e.startsWith("while") || e.startsWith("drag") && e !== "draggable" || e.startsWith("layout") || e.startsWith("onTap") || e.startsWith("onPan") || e.startsWith("onLayout") || hn.has(e);
|
|
269
|
+
}
|
|
270
|
+
let Zt = (e) => !X(e);
|
|
271
|
+
function Qt(e) {
|
|
272
|
+
typeof e == "function" && (Zt = (t) => t.startsWith("on") ? !X(t) : e(t));
|
|
273
|
+
}
|
|
274
|
+
try {
|
|
275
|
+
Qt(require("@emotion/is-prop-valid").default);
|
|
276
|
+
} catch {
|
|
277
|
+
}
|
|
278
|
+
function mn(e, t, n) {
|
|
279
|
+
const s = {};
|
|
280
|
+
for (const o in e)
|
|
281
|
+
o === "values" && typeof e.values == "object" || dt(e[o]) || (Zt(o) || n === !0 && X(o) || !t && !X(o) || // If trying to use native HTML drag events, forward drag listeners
|
|
282
|
+
e.draggable && o.startsWith("onDrag")) && (s[o] = e[o]);
|
|
283
|
+
return s;
|
|
284
|
+
}
|
|
285
|
+
function Cs({ children: e, isValidProp: t, ...n }) {
|
|
286
|
+
t && Qt(t);
|
|
287
|
+
const s = w(G);
|
|
288
|
+
n = { ...s, ...n }, n.transition = Pe(n.transition, s.transition), n.isStatic = K(() => n.isStatic);
|
|
289
|
+
const o = b(() => n, [
|
|
290
|
+
JSON.stringify(n.transition),
|
|
291
|
+
n.transformPagePoint,
|
|
292
|
+
n.reducedMotion,
|
|
293
|
+
n.skipAnimations
|
|
294
|
+
]);
|
|
295
|
+
return V(G.Provider, { value: o, children: e });
|
|
296
|
+
}
|
|
297
|
+
const Z = /* @__PURE__ */ I({});
|
|
298
|
+
function pn(e, t) {
|
|
299
|
+
if (Nt(e)) {
|
|
300
|
+
const { initial: n, animate: s } = e;
|
|
301
|
+
return {
|
|
302
|
+
initial: n === !1 || yt(n) ? n : void 0,
|
|
303
|
+
animate: yt(s) ? s : void 0
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
return e.inherit !== !1 ? t : {};
|
|
307
|
+
}
|
|
308
|
+
function gn(e) {
|
|
309
|
+
const { initial: t, animate: n } = pn(e, w(Z));
|
|
310
|
+
return b(() => ({ initial: t, animate: n }), [bt(t), bt(n)]);
|
|
311
|
+
}
|
|
312
|
+
function bt(e) {
|
|
313
|
+
return Array.isArray(e) ? e.join(" ") : e;
|
|
314
|
+
}
|
|
315
|
+
const mt = () => ({
|
|
316
|
+
style: {},
|
|
317
|
+
transform: {},
|
|
318
|
+
transformOrigin: {},
|
|
319
|
+
vars: {}
|
|
320
|
+
});
|
|
321
|
+
function te(e, t, n) {
|
|
322
|
+
for (const s in t)
|
|
323
|
+
!dt(t[s]) && !we(s, n) && (e[s] = t[s]);
|
|
324
|
+
}
|
|
325
|
+
function vn({ transformTemplate: e }, t) {
|
|
326
|
+
return b(() => {
|
|
327
|
+
const n = mt();
|
|
328
|
+
return Ee(n, t, e), Object.assign({}, n.vars, n.style);
|
|
329
|
+
}, [t]);
|
|
330
|
+
}
|
|
331
|
+
function yn(e, t) {
|
|
332
|
+
const n = e.style || {}, s = {};
|
|
333
|
+
return te(s, n, e), Object.assign(s, vn(e, t)), s;
|
|
334
|
+
}
|
|
335
|
+
function Pn(e, t) {
|
|
336
|
+
const n = {}, s = yn(e, t);
|
|
337
|
+
return e.drag && e.dragListener !== !1 && (n.draggable = !1, s.userSelect = s.WebkitUserSelect = s.WebkitTouchCallout = "none", s.touchAction = e.drag === !0 ? "none" : `pan-${e.drag === "x" ? "y" : "x"}`), e.tabIndex === void 0 && (e.onTap || e.onTapStart || e.whileTap) && (n.tabIndex = 0), n.style = s, n;
|
|
338
|
+
}
|
|
339
|
+
const ee = () => ({
|
|
340
|
+
...mt(),
|
|
341
|
+
attrs: {}
|
|
342
|
+
});
|
|
343
|
+
function wn(e, t, n, s) {
|
|
344
|
+
const o = b(() => {
|
|
345
|
+
const i = ee();
|
|
346
|
+
return Ce(i, t, xe(s), e.transformTemplate, e.style), {
|
|
347
|
+
...i.attrs,
|
|
348
|
+
style: { ...i.style }
|
|
349
|
+
};
|
|
350
|
+
}, [t]);
|
|
351
|
+
if (e.style) {
|
|
352
|
+
const i = {};
|
|
353
|
+
te(i, e.style, e), o.style = { ...i, ...o.style };
|
|
354
|
+
}
|
|
355
|
+
return o;
|
|
356
|
+
}
|
|
357
|
+
const En = [
|
|
358
|
+
"animate",
|
|
359
|
+
"circle",
|
|
360
|
+
"defs",
|
|
361
|
+
"desc",
|
|
362
|
+
"ellipse",
|
|
363
|
+
"g",
|
|
364
|
+
"image",
|
|
365
|
+
"line",
|
|
366
|
+
"filter",
|
|
367
|
+
"marker",
|
|
368
|
+
"mask",
|
|
369
|
+
"metadata",
|
|
370
|
+
"path",
|
|
371
|
+
"pattern",
|
|
372
|
+
"polygon",
|
|
373
|
+
"polyline",
|
|
374
|
+
"rect",
|
|
375
|
+
"stop",
|
|
376
|
+
"switch",
|
|
377
|
+
"symbol",
|
|
378
|
+
"svg",
|
|
379
|
+
"text",
|
|
380
|
+
"tspan",
|
|
381
|
+
"use",
|
|
382
|
+
"view"
|
|
383
|
+
];
|
|
384
|
+
function pt(e) {
|
|
385
|
+
return (
|
|
386
|
+
/**
|
|
387
|
+
* If it's not a string, it's a custom React component. Currently we only support
|
|
388
|
+
* HTML custom React components.
|
|
389
|
+
*/
|
|
390
|
+
typeof e != "string" || /**
|
|
391
|
+
* If it contains a dash, the element is a custom HTML webcomponent.
|
|
392
|
+
*/
|
|
393
|
+
e.includes("-") ? !1 : (
|
|
394
|
+
/**
|
|
395
|
+
* If it's in our list of lowercase SVG tags, it's an SVG component
|
|
396
|
+
*/
|
|
397
|
+
!!(En.indexOf(e) > -1 || /**
|
|
398
|
+
* If it contains a capital letter, it's an SVG component
|
|
399
|
+
*/
|
|
400
|
+
/[A-Z]/u.test(e))
|
|
401
|
+
)
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
function Cn(e, t, n, { latestValues: s }, o, i = !1, r) {
|
|
405
|
+
const f = (r ?? pt(e) ? wn : Pn)(t, s, o, e), d = mn(t, typeof e == "string", i), m = e !== Wt ? { ...d, ...f, ref: n } : {}, { children: u } = t, c = b(() => dt(u) ? u.get() : u, [u]);
|
|
406
|
+
return pe(e, {
|
|
407
|
+
...m,
|
|
408
|
+
children: c
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
function xn({ scrapeMotionValuesFromProps: e, createRenderState: t }, n, s, o) {
|
|
412
|
+
return {
|
|
413
|
+
latestValues: Sn(n, s, o, e),
|
|
414
|
+
renderState: t()
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function Sn(e, t, n, s) {
|
|
418
|
+
const o = {}, i = s(e, {});
|
|
419
|
+
for (const c in i)
|
|
420
|
+
o[c] = Se(i[c]);
|
|
421
|
+
let { initial: r, animate: a } = e;
|
|
422
|
+
const f = Nt(e), d = Me(e);
|
|
423
|
+
t && d && !f && e.inherit !== !1 && (r === void 0 && (r = t.initial), a === void 0 && (a = t.animate));
|
|
424
|
+
let m = n ? n.initial === !1 : !1;
|
|
425
|
+
m = m || r === !1;
|
|
426
|
+
const u = m ? a : r;
|
|
427
|
+
if (u && typeof u != "boolean" && !Bt(u)) {
|
|
428
|
+
const c = Array.isArray(u) ? u : [u];
|
|
429
|
+
for (let h = 0; h < c.length; h++) {
|
|
430
|
+
const l = Le(e, c[h]);
|
|
431
|
+
if (l) {
|
|
432
|
+
const { transitionEnd: p, transition: g, ...v } = l;
|
|
433
|
+
for (const y in v) {
|
|
434
|
+
let P = v[y];
|
|
435
|
+
if (Array.isArray(P)) {
|
|
436
|
+
const E = m ? P.length - 1 : 0;
|
|
437
|
+
P = P[E];
|
|
438
|
+
}
|
|
439
|
+
P !== null && (o[y] = P);
|
|
440
|
+
}
|
|
441
|
+
for (const y in p)
|
|
442
|
+
o[y] = p[y];
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return o;
|
|
447
|
+
}
|
|
448
|
+
const ne = (e) => (t, n) => {
|
|
449
|
+
const s = w(Z), o = w(J), i = () => xn(e, t, s, o);
|
|
450
|
+
return n ? i() : K(i);
|
|
451
|
+
}, Mn = /* @__PURE__ */ ne({
|
|
452
|
+
scrapeMotionValuesFromProps: Ve,
|
|
453
|
+
createRenderState: mt
|
|
454
|
+
}), Ln = /* @__PURE__ */ ne({
|
|
455
|
+
scrapeMotionValuesFromProps: be,
|
|
456
|
+
createRenderState: ee
|
|
457
|
+
}), Vn = Symbol.for("motionComponentSymbol");
|
|
458
|
+
function bn(e, t, n) {
|
|
459
|
+
const s = x(n);
|
|
460
|
+
ft(() => {
|
|
461
|
+
s.current = n;
|
|
462
|
+
});
|
|
463
|
+
const o = x(null);
|
|
464
|
+
return z((i) => {
|
|
465
|
+
var a;
|
|
466
|
+
i && ((a = e.onMount) == null || a.call(e, i));
|
|
467
|
+
const r = s.current;
|
|
468
|
+
if (typeof r == "function")
|
|
469
|
+
if (i) {
|
|
470
|
+
const f = r(i);
|
|
471
|
+
typeof f == "function" && (o.current = f);
|
|
472
|
+
} else o.current ? (o.current(), o.current = null) : r(i);
|
|
473
|
+
else r && (r.current = i);
|
|
474
|
+
t && (i ? t.mount(i) : t.unmount());
|
|
475
|
+
}, [t]);
|
|
476
|
+
}
|
|
477
|
+
const se = I({});
|
|
478
|
+
function F(e) {
|
|
479
|
+
return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "current");
|
|
480
|
+
}
|
|
481
|
+
function Dn(e, t, n, s, o, i) {
|
|
482
|
+
var P, E;
|
|
483
|
+
const { visualElement: r } = w(Z), a = w(Kt), f = w(J), d = w(G), m = d.reducedMotion, u = d.skipAnimations, c = x(null), h = x(!1);
|
|
484
|
+
s = s || a.renderer, !c.current && s && (c.current = s(e, {
|
|
485
|
+
visualState: t,
|
|
486
|
+
parent: r,
|
|
487
|
+
props: n,
|
|
488
|
+
presenceContext: f,
|
|
489
|
+
blockInitialAnimation: f ? f.initial === !1 : !1,
|
|
490
|
+
reducedMotionConfig: m,
|
|
491
|
+
skipAnimations: u,
|
|
492
|
+
isSVG: i
|
|
493
|
+
}), h.current && c.current && (c.current.manuallyAnimateOnMount = !0));
|
|
494
|
+
const l = c.current, p = w(se);
|
|
495
|
+
l && !l.projection && o && (l.type === "html" || l.type === "svg") && An(c.current, n, o, p);
|
|
496
|
+
const g = x(!1);
|
|
497
|
+
ft(() => {
|
|
498
|
+
l && g.current && l.update(n, f);
|
|
499
|
+
});
|
|
500
|
+
const v = n[De], y = x(!!v && typeof window < "u" && !((P = window.MotionHandoffIsComplete) != null && P.call(window, v)) && ((E = window.MotionHasOptimisedAnimation) == null ? void 0 : E.call(window, v)));
|
|
501
|
+
return ht(() => {
|
|
502
|
+
h.current = !0, l && (g.current = !0, window.MotionIsMounted = !0, l.updateFeatures(), l.scheduleRenderMicrotask(), y.current && l.animationState && l.animationState.animateChanges());
|
|
503
|
+
}), ut(() => {
|
|
504
|
+
l && (!y.current && l.animationState && l.animationState.animateChanges(), y.current && (queueMicrotask(() => {
|
|
505
|
+
var S;
|
|
506
|
+
(S = window.MotionHandoffMarkAsComplete) == null || S.call(window, v);
|
|
507
|
+
}), y.current = !1), l.enteringChildren = void 0);
|
|
508
|
+
}), l;
|
|
509
|
+
}
|
|
510
|
+
function An(e, t, n, s) {
|
|
511
|
+
const { layoutId: o, layout: i, drag: r, dragConstraints: a, layoutScroll: f, layoutRoot: d, layoutCrossfade: m } = t;
|
|
512
|
+
e.projection = new n(e.latestValues, t["data-framer-portal-id"] ? void 0 : oe(e.parent)), e.projection.setOptions({
|
|
513
|
+
layoutId: o,
|
|
514
|
+
layout: i,
|
|
515
|
+
alwaysMeasureLayout: !!r || a && F(a),
|
|
516
|
+
visualElement: e,
|
|
517
|
+
/**
|
|
518
|
+
* TODO: Update options in an effect. This could be tricky as it'll be too late
|
|
519
|
+
* to update by the time layout animations run.
|
|
520
|
+
* We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
|
|
521
|
+
* ensuring it gets called if there's no potential layout animations.
|
|
522
|
+
*
|
|
523
|
+
*/
|
|
524
|
+
animationType: typeof i == "string" ? i : "both",
|
|
525
|
+
initialPromotionConfig: s,
|
|
526
|
+
crossfade: m,
|
|
527
|
+
layoutScroll: f,
|
|
528
|
+
layoutRoot: d
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
function oe(e) {
|
|
532
|
+
if (e)
|
|
533
|
+
return e.options.allowProjection !== !1 ? e.projection : oe(e.parent);
|
|
534
|
+
}
|
|
535
|
+
function et(e, { forwardMotionProps: t = !1, type: n } = {}, s, o) {
|
|
536
|
+
s && dn(s);
|
|
537
|
+
const i = n ? n === "svg" : pt(e), r = i ? Ln : Mn;
|
|
538
|
+
function a(d, m) {
|
|
539
|
+
let u;
|
|
540
|
+
const c = {
|
|
541
|
+
...w(G),
|
|
542
|
+
...d,
|
|
543
|
+
layoutId: Tn(d)
|
|
544
|
+
}, { isStatic: h } = c, l = gn(d), p = r(d, h);
|
|
545
|
+
if (!h && typeof window < "u") {
|
|
546
|
+
In(c, s);
|
|
547
|
+
const g = Rn(c);
|
|
548
|
+
u = g.MeasureLayout, l.visualElement = Dn(e, p, c, o, g.ProjectionNode, i);
|
|
549
|
+
}
|
|
550
|
+
return fe(Z.Provider, { value: l, children: [u && l.visualElement ? V(u, { visualElement: l.visualElement, ...c }) : null, Cn(e, d, bn(p, l.visualElement, m), p, h, t, i)] });
|
|
551
|
+
}
|
|
552
|
+
a.displayName = `motion.${typeof e == "string" ? e : `create(${e.displayName ?? e.name ?? ""})`}`;
|
|
553
|
+
const f = ge(a);
|
|
554
|
+
return f[Vn] = e, f;
|
|
555
|
+
}
|
|
556
|
+
function Tn({ layoutId: e }) {
|
|
557
|
+
const t = w(O).id;
|
|
558
|
+
return t && e !== void 0 ? t + "-" + e : e;
|
|
559
|
+
}
|
|
560
|
+
function In(e, t) {
|
|
561
|
+
const n = w(Kt).strict;
|
|
562
|
+
if (process.env.NODE_ENV !== "production" && t && n) {
|
|
563
|
+
const s = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
|
|
564
|
+
e.ignoreStrict ? Ae(!1, s, "lazy-strict-mode") : Ut(!1, s, "lazy-strict-mode");
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function Rn(e) {
|
|
568
|
+
const t = Jt(), { drag: n, layout: s } = t;
|
|
569
|
+
if (!n && !s)
|
|
570
|
+
return {};
|
|
571
|
+
const o = { ...n, ...s };
|
|
572
|
+
return {
|
|
573
|
+
MeasureLayout: n != null && n.isEnabled(e) || s != null && s.isEnabled(e) ? o.MeasureLayout : void 0,
|
|
574
|
+
ProjectionNode: o.ProjectionNode
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function kn(e, t) {
|
|
578
|
+
if (typeof Proxy > "u")
|
|
579
|
+
return et;
|
|
580
|
+
const n = /* @__PURE__ */ new Map(), s = (i, r) => et(i, r, e, t), o = (i, r) => (process.env.NODE_ENV !== "production" && zt(!1, "motion() is deprecated. Use motion.create() instead."), s(i, r));
|
|
581
|
+
return new Proxy(o, {
|
|
582
|
+
/**
|
|
583
|
+
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
|
|
584
|
+
* The prop name is passed through as `key` and we can use that to generate a `motion`
|
|
585
|
+
* DOM component with that name.
|
|
586
|
+
*/
|
|
587
|
+
get: (i, r) => r === "create" ? s : (n.has(r) || n.set(r, et(r, void 0, e, t)), n.get(r))
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
const Fn = (e, t) => t.isSVG ?? pt(e) ? new Te(t) : new Ie(t, {
|
|
591
|
+
allowProjection: e !== Wt
|
|
592
|
+
});
|
|
593
|
+
class jn extends A {
|
|
594
|
+
/**
|
|
595
|
+
* We dynamically generate the AnimationState manager as it contains a reference
|
|
596
|
+
* to the underlying animation library. We only want to load that if we load this,
|
|
597
|
+
* so people can optionally code split it out using the `m` component.
|
|
598
|
+
*/
|
|
599
|
+
constructor(t) {
|
|
600
|
+
super(t), t.animationState || (t.animationState = Re(t));
|
|
601
|
+
}
|
|
602
|
+
updateAnimationControlsSubscription() {
|
|
603
|
+
const { animate: t } = this.node.getProps();
|
|
604
|
+
Bt(t) && (this.unmountControls = t.subscribe(this.node));
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Subscribe any provided AnimationControls to the component's VisualElement
|
|
608
|
+
*/
|
|
609
|
+
mount() {
|
|
610
|
+
this.updateAnimationControlsSubscription();
|
|
611
|
+
}
|
|
612
|
+
update() {
|
|
613
|
+
const { animate: t } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
|
|
614
|
+
t !== n && this.updateAnimationControlsSubscription();
|
|
615
|
+
}
|
|
616
|
+
unmount() {
|
|
617
|
+
var t;
|
|
618
|
+
this.node.animationState.reset(), (t = this.unmountControls) == null || t.call(this);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
let On = 0;
|
|
622
|
+
class Gn extends A {
|
|
623
|
+
constructor() {
|
|
624
|
+
super(...arguments), this.id = On++, this.isExitComplete = !1;
|
|
625
|
+
}
|
|
626
|
+
update() {
|
|
627
|
+
var i;
|
|
628
|
+
if (!this.node.presenceContext)
|
|
629
|
+
return;
|
|
630
|
+
const { isPresent: t, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
|
|
631
|
+
if (!this.node.animationState || t === s)
|
|
632
|
+
return;
|
|
633
|
+
if (t && s === !1) {
|
|
634
|
+
if (this.isExitComplete) {
|
|
635
|
+
const { initial: r, custom: a } = this.node.getProps();
|
|
636
|
+
if (typeof r == "string") {
|
|
637
|
+
const f = ke(this.node, r, a);
|
|
638
|
+
if (f) {
|
|
639
|
+
const { transition: d, transitionEnd: m, ...u } = f;
|
|
640
|
+
for (const c in u)
|
|
641
|
+
(i = this.node.getValue(c)) == null || i.jump(u[c]);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
this.node.animationState.reset(), this.node.animationState.animateChanges();
|
|
645
|
+
} else
|
|
646
|
+
this.node.animationState.setActive("exit", !1);
|
|
647
|
+
this.isExitComplete = !1;
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
const o = this.node.animationState.setActive("exit", !t);
|
|
651
|
+
n && !t && o.then(() => {
|
|
652
|
+
this.isExitComplete = !0, n(this.id);
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
mount() {
|
|
656
|
+
const { register: t, onExitComplete: n } = this.node.presenceContext || {};
|
|
657
|
+
n && n(this.id), t && (this.unmount = t(this.id));
|
|
658
|
+
}
|
|
659
|
+
unmount() {
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
const Wn = {
|
|
663
|
+
animation: {
|
|
664
|
+
Feature: jn
|
|
665
|
+
},
|
|
666
|
+
exit: {
|
|
667
|
+
Feature: Gn
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
function W(e) {
|
|
671
|
+
return {
|
|
672
|
+
point: {
|
|
673
|
+
x: e.pageX,
|
|
674
|
+
y: e.pageY
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
const Hn = (e) => (t) => $t(t) && e(t, W(t));
|
|
679
|
+
function j(e, t, n, s) {
|
|
680
|
+
return _(e, t, Hn(n), s);
|
|
681
|
+
}
|
|
682
|
+
const ie = ({ current: e }) => e ? e.ownerDocument.defaultView : null, Dt = (e, t) => Math.abs(e - t);
|
|
683
|
+
function Nn(e, t) {
|
|
684
|
+
const n = Dt(e.x, t.x), s = Dt(e.y, t.y);
|
|
685
|
+
return Math.sqrt(n ** 2 + s ** 2);
|
|
686
|
+
}
|
|
687
|
+
const At = /* @__PURE__ */ new Set(["auto", "scroll"]);
|
|
688
|
+
class re {
|
|
689
|
+
constructor(t, n, { transformPagePoint: s, contextWindow: o = window, dragSnapToOrigin: i = !1, distanceThreshold: r = 3, element: a } = {}) {
|
|
690
|
+
if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.lastRawMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.scrollPositions = /* @__PURE__ */ new Map(), this.removeScrollListeners = null, this.onElementScroll = (h) => {
|
|
691
|
+
this.handleScroll(h.target);
|
|
692
|
+
}, this.onWindowScroll = () => {
|
|
693
|
+
this.handleScroll(window);
|
|
694
|
+
}, this.updatePoint = () => {
|
|
695
|
+
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
696
|
+
return;
|
|
697
|
+
this.lastRawMoveEventInfo && (this.lastMoveEventInfo = N(this.lastRawMoveEventInfo, this.transformPagePoint));
|
|
698
|
+
const h = nt(this.lastMoveEventInfo, this.history), l = this.startEvent !== null, p = Nn(h.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
|
|
699
|
+
if (!l && !p)
|
|
700
|
+
return;
|
|
701
|
+
const { point: g } = h, { timestamp: v } = Pt;
|
|
702
|
+
this.history.push({ ...g, timestamp: v });
|
|
703
|
+
const { onStart: y, onMove: P } = this.handlers;
|
|
704
|
+
l || (y && y(this.lastMoveEvent, h), this.startEvent = this.lastMoveEvent), P && P(this.lastMoveEvent, h);
|
|
705
|
+
}, this.handlePointerMove = (h, l) => {
|
|
706
|
+
this.lastMoveEvent = h, this.lastRawMoveEventInfo = l, this.lastMoveEventInfo = N(l, this.transformPagePoint), M.update(this.updatePoint, !0);
|
|
707
|
+
}, this.handlePointerUp = (h, l) => {
|
|
708
|
+
this.end();
|
|
709
|
+
const { onEnd: p, onSessionEnd: g, resumeAnimation: v } = this.handlers;
|
|
710
|
+
if ((this.dragSnapToOrigin || !this.startEvent) && v && v(), !(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
711
|
+
return;
|
|
712
|
+
const y = nt(h.type === "pointercancel" ? this.lastMoveEventInfo : N(l, this.transformPagePoint), this.history);
|
|
713
|
+
this.startEvent && p && p(h, y), g && g(h, y);
|
|
714
|
+
}, !$t(t))
|
|
715
|
+
return;
|
|
716
|
+
this.dragSnapToOrigin = i, this.handlers = n, this.transformPagePoint = s, this.distanceThreshold = r, this.contextWindow = o || window;
|
|
717
|
+
const f = W(t), d = N(f, this.transformPagePoint), { point: m } = d, { timestamp: u } = Pt;
|
|
718
|
+
this.history = [{ ...m, timestamp: u }];
|
|
719
|
+
const { onSessionStart: c } = n;
|
|
720
|
+
c && c(t, nt(d, this.history)), this.removeListeners = _t(j(this.contextWindow, "pointermove", this.handlePointerMove), j(this.contextWindow, "pointerup", this.handlePointerUp), j(this.contextWindow, "pointercancel", this.handlePointerUp)), a && this.startScrollTracking(a);
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Start tracking scroll on ancestors and window.
|
|
724
|
+
*/
|
|
725
|
+
startScrollTracking(t) {
|
|
726
|
+
let n = t.parentElement;
|
|
727
|
+
for (; n; ) {
|
|
728
|
+
const s = getComputedStyle(n);
|
|
729
|
+
(At.has(s.overflowX) || At.has(s.overflowY)) && this.scrollPositions.set(n, {
|
|
730
|
+
x: n.scrollLeft,
|
|
731
|
+
y: n.scrollTop
|
|
732
|
+
}), n = n.parentElement;
|
|
733
|
+
}
|
|
734
|
+
this.scrollPositions.set(window, {
|
|
735
|
+
x: window.scrollX,
|
|
736
|
+
y: window.scrollY
|
|
737
|
+
}), window.addEventListener("scroll", this.onElementScroll, {
|
|
738
|
+
capture: !0
|
|
739
|
+
}), window.addEventListener("scroll", this.onWindowScroll), this.removeScrollListeners = () => {
|
|
740
|
+
window.removeEventListener("scroll", this.onElementScroll, {
|
|
741
|
+
capture: !0
|
|
742
|
+
}), window.removeEventListener("scroll", this.onWindowScroll);
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Handle scroll compensation during drag.
|
|
747
|
+
*
|
|
748
|
+
* For element scroll: adjusts history origin since pageX/pageY doesn't change.
|
|
749
|
+
* For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.
|
|
750
|
+
*/
|
|
751
|
+
handleScroll(t) {
|
|
752
|
+
const n = this.scrollPositions.get(t);
|
|
753
|
+
if (!n)
|
|
754
|
+
return;
|
|
755
|
+
const s = t === window, o = s ? { x: window.scrollX, y: window.scrollY } : {
|
|
756
|
+
x: t.scrollLeft,
|
|
757
|
+
y: t.scrollTop
|
|
758
|
+
}, i = { x: o.x - n.x, y: o.y - n.y };
|
|
759
|
+
i.x === 0 && i.y === 0 || (s ? this.lastMoveEventInfo && (this.lastMoveEventInfo.point.x += i.x, this.lastMoveEventInfo.point.y += i.y) : this.history.length > 0 && (this.history[0].x -= i.x, this.history[0].y -= i.y), this.scrollPositions.set(t, o), M.update(this.updatePoint, !0));
|
|
760
|
+
}
|
|
761
|
+
updateHandlers(t) {
|
|
762
|
+
this.handlers = t;
|
|
763
|
+
}
|
|
764
|
+
end() {
|
|
765
|
+
this.removeListeners && this.removeListeners(), this.removeScrollListeners && this.removeScrollListeners(), this.scrollPositions.clear(), Fe(this.updatePoint);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
function N(e, t) {
|
|
769
|
+
return t ? { point: t(e.point) } : e;
|
|
770
|
+
}
|
|
771
|
+
function Tt(e, t) {
|
|
772
|
+
return { x: e.x - t.x, y: e.y - t.y };
|
|
773
|
+
}
|
|
774
|
+
function nt({ point: e }, t) {
|
|
775
|
+
return {
|
|
776
|
+
point: e,
|
|
777
|
+
delta: Tt(e, ae(t)),
|
|
778
|
+
offset: Tt(e, Bn(t)),
|
|
779
|
+
velocity: Un(t, 0.1)
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
function Bn(e) {
|
|
783
|
+
return e[0];
|
|
784
|
+
}
|
|
785
|
+
function ae(e) {
|
|
786
|
+
return e[e.length - 1];
|
|
787
|
+
}
|
|
788
|
+
function Un(e, t) {
|
|
789
|
+
if (e.length < 2)
|
|
790
|
+
return { x: 0, y: 0 };
|
|
791
|
+
let n = e.length - 1, s = null;
|
|
792
|
+
const o = ae(e);
|
|
793
|
+
for (; n >= 0 && (s = e[n], !(o.timestamp - s.timestamp > wt(t))); )
|
|
794
|
+
n--;
|
|
795
|
+
if (!s)
|
|
796
|
+
return { x: 0, y: 0 };
|
|
797
|
+
s === e[0] && e.length > 2 && o.timestamp - s.timestamp > wt(t) * 2 && (s = e[1]);
|
|
798
|
+
const i = je(o.timestamp - s.timestamp);
|
|
799
|
+
if (i === 0)
|
|
800
|
+
return { x: 0, y: 0 };
|
|
801
|
+
const r = {
|
|
802
|
+
x: (o.x - s.x) / i,
|
|
803
|
+
y: (o.y - s.y) / i
|
|
804
|
+
};
|
|
805
|
+
return r.x === 1 / 0 && (r.x = 0), r.y === 1 / 0 && (r.y = 0), r;
|
|
806
|
+
}
|
|
807
|
+
function zn(e, { min: t, max: n }, s) {
|
|
808
|
+
return t !== void 0 && e < t ? e = s ? Y(t, e, s.min) : Math.max(e, t) : n !== void 0 && e > n && (e = s ? Y(n, e, s.max) : Math.min(e, n)), e;
|
|
809
|
+
}
|
|
810
|
+
function It(e, t, n) {
|
|
811
|
+
return {
|
|
812
|
+
min: t !== void 0 ? e.min + t : void 0,
|
|
813
|
+
max: n !== void 0 ? e.max + n - (e.max - e.min) : void 0
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
function $n(e, { top: t, left: n, bottom: s, right: o }) {
|
|
817
|
+
return {
|
|
818
|
+
x: It(e.x, n, o),
|
|
819
|
+
y: It(e.y, t, s)
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function Rt(e, t) {
|
|
823
|
+
let n = t.min - e.min, s = t.max - e.max;
|
|
824
|
+
return t.max - t.min < e.max - e.min && ([n, s] = [s, n]), { min: n, max: s };
|
|
825
|
+
}
|
|
826
|
+
function _n(e, t) {
|
|
827
|
+
return {
|
|
828
|
+
x: Rt(e.x, t.x),
|
|
829
|
+
y: Rt(e.y, t.y)
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
function Yn(e, t) {
|
|
833
|
+
let n = 0.5;
|
|
834
|
+
const s = rt(e), o = rt(t);
|
|
835
|
+
return o > s ? n = Et(t.min, t.max - s, e.min) : s > o && (n = Et(e.min, e.max - o, t.min)), Oe(0, 1, n);
|
|
836
|
+
}
|
|
837
|
+
function Xn(e, t) {
|
|
838
|
+
const n = {};
|
|
839
|
+
return t.min !== void 0 && (n.min = t.min - e.min), t.max !== void 0 && (n.max = t.max - e.min), n;
|
|
840
|
+
}
|
|
841
|
+
const at = 0.35;
|
|
842
|
+
function qn(e = at) {
|
|
843
|
+
return e === !1 ? e = 0 : e === !0 && (e = at), {
|
|
844
|
+
x: kt(e, "left", "right"),
|
|
845
|
+
y: kt(e, "top", "bottom")
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
function kt(e, t, n) {
|
|
849
|
+
return {
|
|
850
|
+
min: Ft(e, t),
|
|
851
|
+
max: Ft(e, n)
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
function Ft(e, t) {
|
|
855
|
+
return typeof e == "number" ? e : e[t] || 0;
|
|
856
|
+
}
|
|
857
|
+
const Kn = /* @__PURE__ */ new WeakMap();
|
|
858
|
+
class Jn {
|
|
859
|
+
constructor(t) {
|
|
860
|
+
this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = Ge(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = t;
|
|
861
|
+
}
|
|
862
|
+
start(t, { snapToCursor: n = !1, distanceThreshold: s } = {}) {
|
|
863
|
+
const { presenceContext: o } = this.visualElement;
|
|
864
|
+
if (o && o.isPresent === !1)
|
|
865
|
+
return;
|
|
866
|
+
const i = (u) => {
|
|
867
|
+
n && this.snapToCursor(W(u).point), this.stopAnimation();
|
|
868
|
+
}, r = (u, c) => {
|
|
869
|
+
const { drag: h, dragPropagation: l, onDragStart: p } = this.getProps();
|
|
870
|
+
if (h && !l && (this.openDragLock && this.openDragLock(), this.openDragLock = Ue(h), !this.openDragLock))
|
|
871
|
+
return;
|
|
872
|
+
this.latestPointerEvent = u, this.latestPanInfo = c, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), D((v) => {
|
|
873
|
+
let y = this.getAxisMotionValue(v).get() || 0;
|
|
874
|
+
if (ze.test(y)) {
|
|
875
|
+
const { projection: P } = this.visualElement;
|
|
876
|
+
if (P && P.layout) {
|
|
877
|
+
const E = P.layout.layoutBox[v];
|
|
878
|
+
E && (y = rt(E) * (parseFloat(y) / 100));
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
this.originPoint[v] = y;
|
|
882
|
+
}), p && M.update(() => p(u, c), !1, !0), Ct(this.visualElement, "transform");
|
|
883
|
+
const { animationState: g } = this.visualElement;
|
|
884
|
+
g && g.setActive("whileDrag", !0);
|
|
885
|
+
}, a = (u, c) => {
|
|
886
|
+
this.latestPointerEvent = u, this.latestPanInfo = c;
|
|
887
|
+
const { dragPropagation: h, dragDirectionLock: l, onDirectionLock: p, onDrag: g } = this.getProps();
|
|
888
|
+
if (!h && !this.openDragLock)
|
|
889
|
+
return;
|
|
890
|
+
const { offset: v } = c;
|
|
891
|
+
if (l && this.currentDirection === null) {
|
|
892
|
+
this.currentDirection = Qn(v), this.currentDirection !== null && p && p(this.currentDirection);
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
this.updateAxis("x", c.point, v), this.updateAxis("y", c.point, v), this.visualElement.render(), g && M.update(() => g(u, c), !1, !0);
|
|
896
|
+
}, f = (u, c) => {
|
|
897
|
+
this.latestPointerEvent = u, this.latestPanInfo = c, this.stop(u, c), this.latestPointerEvent = null, this.latestPanInfo = null;
|
|
898
|
+
}, d = () => {
|
|
899
|
+
const { dragSnapToOrigin: u } = this.getProps();
|
|
900
|
+
(u || this.constraints) && this.startAnimation({ x: 0, y: 0 });
|
|
901
|
+
}, { dragSnapToOrigin: m } = this.getProps();
|
|
902
|
+
this.panSession = new re(t, {
|
|
903
|
+
onSessionStart: i,
|
|
904
|
+
onStart: r,
|
|
905
|
+
onMove: a,
|
|
906
|
+
onSessionEnd: f,
|
|
907
|
+
resumeAnimation: d
|
|
908
|
+
}, {
|
|
909
|
+
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
910
|
+
dragSnapToOrigin: m,
|
|
911
|
+
distanceThreshold: s,
|
|
912
|
+
contextWindow: ie(this.visualElement),
|
|
913
|
+
element: this.visualElement.current
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* @internal
|
|
918
|
+
*/
|
|
919
|
+
stop(t, n) {
|
|
920
|
+
const s = t || this.latestPointerEvent, o = n || this.latestPanInfo, i = this.isDragging;
|
|
921
|
+
if (this.cancel(), !i || !o || !s)
|
|
922
|
+
return;
|
|
923
|
+
const { velocity: r } = o;
|
|
924
|
+
this.startAnimation(r);
|
|
925
|
+
const { onDragEnd: a } = this.getProps();
|
|
926
|
+
a && M.postRender(() => a(s, o));
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* @internal
|
|
930
|
+
*/
|
|
931
|
+
cancel() {
|
|
932
|
+
this.isDragging = !1;
|
|
933
|
+
const { projection: t, animationState: n } = this.visualElement;
|
|
934
|
+
t && (t.isAnimationBlocked = !1), this.endPanSession();
|
|
935
|
+
const { dragPropagation: s } = this.getProps();
|
|
936
|
+
!s && this.openDragLock && (this.openDragLock(), this.openDragLock = null), n && n.setActive("whileDrag", !1);
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Clean up the pan session without modifying other drag state.
|
|
940
|
+
* This is used during unmount to ensure event listeners are removed
|
|
941
|
+
* without affecting projection animations or drag locks.
|
|
942
|
+
* @internal
|
|
943
|
+
*/
|
|
944
|
+
endPanSession() {
|
|
945
|
+
this.panSession && this.panSession.end(), this.panSession = void 0;
|
|
946
|
+
}
|
|
947
|
+
updateAxis(t, n, s) {
|
|
948
|
+
const { drag: o } = this.getProps();
|
|
949
|
+
if (!s || !B(t, o, this.currentDirection))
|
|
950
|
+
return;
|
|
951
|
+
const i = this.getAxisMotionValue(t);
|
|
952
|
+
let r = this.originPoint[t] + s[t];
|
|
953
|
+
this.constraints && this.constraints[t] && (r = zn(r, this.constraints[t], this.elastic[t])), i.set(r);
|
|
954
|
+
}
|
|
955
|
+
resolveConstraints() {
|
|
956
|
+
var i;
|
|
957
|
+
const { dragConstraints: t, dragElastic: n } = this.getProps(), s = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (i = this.visualElement.projection) == null ? void 0 : i.layout, o = this.constraints;
|
|
958
|
+
t && F(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && s ? this.constraints = $n(s.layoutBox, t) : this.constraints = !1, this.elastic = qn(n), o !== this.constraints && !F(t) && s && this.constraints && !this.hasMutatedConstraints && D((r) => {
|
|
959
|
+
this.constraints !== !1 && this.getAxisMotionValue(r) && (this.constraints[r] = Xn(s.layoutBox[r], this.constraints[r]));
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
resolveRefConstraints() {
|
|
963
|
+
const { dragConstraints: t, onMeasureDragConstraints: n } = this.getProps();
|
|
964
|
+
if (!t || !F(t))
|
|
965
|
+
return !1;
|
|
966
|
+
const s = t.current;
|
|
967
|
+
Ut(s !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
|
|
968
|
+
const { projection: o } = this.visualElement;
|
|
969
|
+
if (!o || !o.layout)
|
|
970
|
+
return !1;
|
|
971
|
+
const i = We(s, o.root, this.visualElement.getTransformPagePoint());
|
|
972
|
+
let r = _n(o.layout.layoutBox, i);
|
|
973
|
+
if (n) {
|
|
974
|
+
const a = n(He(r));
|
|
975
|
+
this.hasMutatedConstraints = !!a, a && (r = Ne(a));
|
|
976
|
+
}
|
|
977
|
+
return r;
|
|
978
|
+
}
|
|
979
|
+
startAnimation(t) {
|
|
980
|
+
const { drag: n, dragMomentum: s, dragElastic: o, dragTransition: i, dragSnapToOrigin: r, onDragTransitionEnd: a } = this.getProps(), f = this.constraints || {}, d = D((m) => {
|
|
981
|
+
if (!B(m, n, this.currentDirection))
|
|
982
|
+
return;
|
|
983
|
+
let u = f && f[m] || {};
|
|
984
|
+
(r === !0 || r === m) && (u = { min: 0, max: 0 });
|
|
985
|
+
const c = o ? 200 : 1e6, h = o ? 40 : 1e7, l = {
|
|
986
|
+
type: "inertia",
|
|
987
|
+
velocity: s ? t[m] : 0,
|
|
988
|
+
bounceStiffness: c,
|
|
989
|
+
bounceDamping: h,
|
|
990
|
+
timeConstant: 750,
|
|
991
|
+
restDelta: 1,
|
|
992
|
+
restSpeed: 10,
|
|
993
|
+
...i,
|
|
994
|
+
...u
|
|
995
|
+
};
|
|
996
|
+
return this.startAxisValueAnimation(m, l);
|
|
997
|
+
});
|
|
998
|
+
return Promise.all(d).then(a);
|
|
999
|
+
}
|
|
1000
|
+
startAxisValueAnimation(t, n) {
|
|
1001
|
+
const s = this.getAxisMotionValue(t);
|
|
1002
|
+
return Ct(this.visualElement, t), s.start(Be(t, s, 0, n, this.visualElement, !1));
|
|
1003
|
+
}
|
|
1004
|
+
stopAnimation() {
|
|
1005
|
+
D((t) => this.getAxisMotionValue(t).stop());
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Drag works differently depending on which props are provided.
|
|
1009
|
+
*
|
|
1010
|
+
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
|
|
1011
|
+
* - Otherwise, we apply the delta to the x/y motion values.
|
|
1012
|
+
*/
|
|
1013
|
+
getAxisMotionValue(t) {
|
|
1014
|
+
const n = `_drag${t.toUpperCase()}`, s = this.visualElement.getProps(), o = s[n];
|
|
1015
|
+
return o || this.visualElement.getValue(t, (s.initial ? s.initial[t] : void 0) || 0);
|
|
1016
|
+
}
|
|
1017
|
+
snapToCursor(t) {
|
|
1018
|
+
D((n) => {
|
|
1019
|
+
const { drag: s } = this.getProps();
|
|
1020
|
+
if (!B(n, s, this.currentDirection))
|
|
1021
|
+
return;
|
|
1022
|
+
const { projection: o } = this.visualElement, i = this.getAxisMotionValue(n);
|
|
1023
|
+
if (o && o.layout) {
|
|
1024
|
+
const { min: r, max: a } = o.layout.layoutBox[n], f = i.get() || 0;
|
|
1025
|
+
i.set(t[n] - Y(r, a, 0.5) + f);
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* When the viewport resizes we want to check if the measured constraints
|
|
1031
|
+
* have changed and, if so, reposition the element within those new constraints
|
|
1032
|
+
* relative to where it was before the resize.
|
|
1033
|
+
*/
|
|
1034
|
+
scalePositionWithinConstraints() {
|
|
1035
|
+
if (!this.visualElement.current)
|
|
1036
|
+
return;
|
|
1037
|
+
const { drag: t, dragConstraints: n } = this.getProps(), { projection: s } = this.visualElement;
|
|
1038
|
+
if (!F(n) || !s || !this.constraints)
|
|
1039
|
+
return;
|
|
1040
|
+
this.stopAnimation();
|
|
1041
|
+
const o = { x: 0, y: 0 };
|
|
1042
|
+
D((r) => {
|
|
1043
|
+
const a = this.getAxisMotionValue(r);
|
|
1044
|
+
if (a && this.constraints !== !1) {
|
|
1045
|
+
const f = a.get();
|
|
1046
|
+
o[r] = Yn({ min: f, max: f }, this.constraints[r]);
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
const { transformTemplate: i } = this.visualElement.getProps();
|
|
1050
|
+
this.visualElement.current.style.transform = i ? i({}, "") : "none", s.root && s.root.updateScroll(), s.updateLayout(), this.constraints = !1, this.resolveConstraints(), D((r) => {
|
|
1051
|
+
if (!B(r, t, null))
|
|
1052
|
+
return;
|
|
1053
|
+
const a = this.getAxisMotionValue(r), { min: f, max: d } = this.constraints[r];
|
|
1054
|
+
a.set(Y(f, d, o[r]));
|
|
1055
|
+
}), this.visualElement.render();
|
|
1056
|
+
}
|
|
1057
|
+
addListeners() {
|
|
1058
|
+
if (!this.visualElement.current)
|
|
1059
|
+
return;
|
|
1060
|
+
Kn.set(this.visualElement, this);
|
|
1061
|
+
const t = this.visualElement.current, n = j(t, "pointerdown", (d) => {
|
|
1062
|
+
const { drag: m, dragListener: u = !0 } = this.getProps(), c = d.target, h = c !== t && $e(c);
|
|
1063
|
+
m && u && !h && this.start(d);
|
|
1064
|
+
});
|
|
1065
|
+
let s;
|
|
1066
|
+
const o = () => {
|
|
1067
|
+
const { dragConstraints: d } = this.getProps();
|
|
1068
|
+
F(d) && d.current && (this.constraints = this.resolveRefConstraints(), s || (s = Zn(t, d.current, () => this.scalePositionWithinConstraints())));
|
|
1069
|
+
}, { projection: i } = this.visualElement, r = i.addEventListener("measure", o);
|
|
1070
|
+
i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), M.read(o);
|
|
1071
|
+
const a = _(window, "resize", () => this.scalePositionWithinConstraints()), f = i.addEventListener("didUpdate", ({ delta: d, hasLayoutChanged: m }) => {
|
|
1072
|
+
this.isDragging && m && (D((u) => {
|
|
1073
|
+
const c = this.getAxisMotionValue(u);
|
|
1074
|
+
c && (this.originPoint[u] += d[u].translate, c.set(c.get() + d[u].translate));
|
|
1075
|
+
}), this.visualElement.render());
|
|
1076
|
+
});
|
|
1077
|
+
return () => {
|
|
1078
|
+
a(), n(), r(), f && f(), s && s();
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
getProps() {
|
|
1082
|
+
const t = this.visualElement.getProps(), { drag: n = !1, dragDirectionLock: s = !1, dragPropagation: o = !1, dragConstraints: i = !1, dragElastic: r = at, dragMomentum: a = !0 } = t;
|
|
1083
|
+
return {
|
|
1084
|
+
...t,
|
|
1085
|
+
drag: n,
|
|
1086
|
+
dragDirectionLock: s,
|
|
1087
|
+
dragPropagation: o,
|
|
1088
|
+
dragConstraints: i,
|
|
1089
|
+
dragElastic: r,
|
|
1090
|
+
dragMomentum: a
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
function jt(e) {
|
|
1095
|
+
let t = !0;
|
|
1096
|
+
return () => {
|
|
1097
|
+
if (t) {
|
|
1098
|
+
t = !1;
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
e();
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
function Zn(e, t, n) {
|
|
1105
|
+
const s = xt(e, jt(n)), o = xt(t, jt(n));
|
|
1106
|
+
return () => {
|
|
1107
|
+
s(), o();
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
function B(e, t, n) {
|
|
1111
|
+
return (t === !0 || t === e) && (n === null || n === e);
|
|
1112
|
+
}
|
|
1113
|
+
function Qn(e, t = 10) {
|
|
1114
|
+
let n = null;
|
|
1115
|
+
return Math.abs(e.y) > t ? n = "y" : Math.abs(e.x) > t && (n = "x"), n;
|
|
1116
|
+
}
|
|
1117
|
+
class ts extends A {
|
|
1118
|
+
constructor(t) {
|
|
1119
|
+
super(t), this.removeGroupControls = U, this.removeListeners = U, this.controls = new Jn(t);
|
|
1120
|
+
}
|
|
1121
|
+
mount() {
|
|
1122
|
+
const { dragControls: t } = this.node.getProps();
|
|
1123
|
+
t && (this.removeGroupControls = t.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || U;
|
|
1124
|
+
}
|
|
1125
|
+
update() {
|
|
1126
|
+
const { dragControls: t } = this.node.getProps(), { dragControls: n } = this.node.prevProps || {};
|
|
1127
|
+
t !== n && (this.removeGroupControls(), t && (this.removeGroupControls = t.subscribe(this.controls)));
|
|
1128
|
+
}
|
|
1129
|
+
unmount() {
|
|
1130
|
+
this.removeGroupControls(), this.removeListeners(), this.controls.isDragging || this.controls.endPanSession();
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
const st = (e) => (t, n) => {
|
|
1134
|
+
e && M.update(() => e(t, n), !1, !0);
|
|
1135
|
+
};
|
|
1136
|
+
class es extends A {
|
|
1137
|
+
constructor() {
|
|
1138
|
+
super(...arguments), this.removePointerDownListener = U;
|
|
1139
|
+
}
|
|
1140
|
+
onPointerDown(t) {
|
|
1141
|
+
this.session = new re(t, this.createPanHandlers(), {
|
|
1142
|
+
transformPagePoint: this.node.getTransformPagePoint(),
|
|
1143
|
+
contextWindow: ie(this.node)
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
createPanHandlers() {
|
|
1147
|
+
const { onPanSessionStart: t, onPanStart: n, onPan: s, onPanEnd: o } = this.node.getProps();
|
|
1148
|
+
return {
|
|
1149
|
+
onSessionStart: st(t),
|
|
1150
|
+
onStart: st(n),
|
|
1151
|
+
onMove: st(s),
|
|
1152
|
+
onEnd: (i, r) => {
|
|
1153
|
+
delete this.session, o && M.postRender(() => o(i, r));
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
mount() {
|
|
1158
|
+
this.removePointerDownListener = j(this.node.current, "pointerdown", (t) => this.onPointerDown(t));
|
|
1159
|
+
}
|
|
1160
|
+
update() {
|
|
1161
|
+
this.session && this.session.updateHandlers(this.createPanHandlers());
|
|
1162
|
+
}
|
|
1163
|
+
unmount() {
|
|
1164
|
+
this.removePointerDownListener(), this.session && this.session.end();
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
let ot = !1;
|
|
1168
|
+
class ns extends ve {
|
|
1169
|
+
/**
|
|
1170
|
+
* This only mounts projection nodes for components that
|
|
1171
|
+
* need measuring, we might want to do it for all components
|
|
1172
|
+
* in order to incorporate transforms
|
|
1173
|
+
*/
|
|
1174
|
+
componentDidMount() {
|
|
1175
|
+
const { visualElement: t, layoutGroup: n, switchLayoutGroup: s, layoutId: o } = this.props, { projection: i } = t;
|
|
1176
|
+
i && (n.group && n.group.add(i), s && s.register && o && s.register(i), ot && i.root.didUpdate(), i.addEventListener("animationComplete", () => {
|
|
1177
|
+
this.safeToRemove();
|
|
1178
|
+
}), i.setOptions({
|
|
1179
|
+
...i.options,
|
|
1180
|
+
layoutDependency: this.props.layoutDependency,
|
|
1181
|
+
onExitComplete: () => this.safeToRemove()
|
|
1182
|
+
})), Ye.hasEverUpdated = !0;
|
|
1183
|
+
}
|
|
1184
|
+
getSnapshotBeforeUpdate(t) {
|
|
1185
|
+
const { layoutDependency: n, visualElement: s, drag: o, isPresent: i } = this.props, { projection: r } = s;
|
|
1186
|
+
return r && (r.isPresent = i, t.layoutDependency !== n && r.setOptions({
|
|
1187
|
+
...r.options,
|
|
1188
|
+
layoutDependency: n
|
|
1189
|
+
}), ot = !0, o || t.layoutDependency !== n || n === void 0 || t.isPresent !== i ? r.willUpdate() : this.safeToRemove(), t.isPresent !== i && (i ? r.promote() : r.relegate() || M.postRender(() => {
|
|
1190
|
+
const a = r.getStack();
|
|
1191
|
+
(!a || !a.members.length) && this.safeToRemove();
|
|
1192
|
+
}))), null;
|
|
1193
|
+
}
|
|
1194
|
+
componentDidUpdate() {
|
|
1195
|
+
const { projection: t } = this.props.visualElement;
|
|
1196
|
+
t && (t.root.didUpdate(), _e.postRender(() => {
|
|
1197
|
+
!t.currentAnimation && t.isLead() && this.safeToRemove();
|
|
1198
|
+
}));
|
|
1199
|
+
}
|
|
1200
|
+
componentWillUnmount() {
|
|
1201
|
+
const { visualElement: t, layoutGroup: n, switchLayoutGroup: s } = this.props, { projection: o } = t;
|
|
1202
|
+
ot = !0, o && (o.scheduleCheckAfterUnmount(), n && n.group && n.group.remove(o), s && s.deregister && s.deregister(o));
|
|
1203
|
+
}
|
|
1204
|
+
safeToRemove() {
|
|
1205
|
+
const { safeToRemove: t } = this.props;
|
|
1206
|
+
t && t();
|
|
1207
|
+
}
|
|
1208
|
+
render() {
|
|
1209
|
+
return null;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
function ce(e) {
|
|
1213
|
+
const [t, n] = Xt(), s = w(O);
|
|
1214
|
+
return V(ns, { ...e, layoutGroup: s, switchLayoutGroup: w(se), isPresent: t, safeToRemove: n });
|
|
1215
|
+
}
|
|
1216
|
+
const ss = {
|
|
1217
|
+
pan: {
|
|
1218
|
+
Feature: es
|
|
1219
|
+
},
|
|
1220
|
+
drag: {
|
|
1221
|
+
Feature: ts,
|
|
1222
|
+
ProjectionNode: Yt,
|
|
1223
|
+
MeasureLayout: ce
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
function Ot(e, t, n) {
|
|
1227
|
+
const { props: s } = e;
|
|
1228
|
+
e.animationState && s.whileHover && e.animationState.setActive("whileHover", n === "Start");
|
|
1229
|
+
const o = "onHover" + n, i = s[o];
|
|
1230
|
+
i && M.postRender(() => i(t, W(t)));
|
|
1231
|
+
}
|
|
1232
|
+
class os extends A {
|
|
1233
|
+
mount() {
|
|
1234
|
+
const { current: t } = this.node;
|
|
1235
|
+
t && (this.unmount = Xe(t, (n, s) => (Ot(this.node, s, "Start"), (o) => Ot(this.node, o, "End"))));
|
|
1236
|
+
}
|
|
1237
|
+
unmount() {
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
class is extends A {
|
|
1241
|
+
constructor() {
|
|
1242
|
+
super(...arguments), this.isActive = !1;
|
|
1243
|
+
}
|
|
1244
|
+
onFocus() {
|
|
1245
|
+
let t = !1;
|
|
1246
|
+
try {
|
|
1247
|
+
t = this.node.current.matches(":focus-visible");
|
|
1248
|
+
} catch {
|
|
1249
|
+
t = !0;
|
|
1250
|
+
}
|
|
1251
|
+
!t || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
|
|
1252
|
+
}
|
|
1253
|
+
onBlur() {
|
|
1254
|
+
!this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
|
|
1255
|
+
}
|
|
1256
|
+
mount() {
|
|
1257
|
+
this.unmount = _t(_(this.node.current, "focus", () => this.onFocus()), _(this.node.current, "blur", () => this.onBlur()));
|
|
1258
|
+
}
|
|
1259
|
+
unmount() {
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
function Gt(e, t, n) {
|
|
1263
|
+
const { props: s } = e;
|
|
1264
|
+
if (e.current instanceof HTMLButtonElement && e.current.disabled)
|
|
1265
|
+
return;
|
|
1266
|
+
e.animationState && s.whileTap && e.animationState.setActive("whileTap", n === "Start");
|
|
1267
|
+
const o = "onTap" + (n === "End" ? "" : n), i = s[o];
|
|
1268
|
+
i && M.postRender(() => i(t, W(t)));
|
|
1269
|
+
}
|
|
1270
|
+
class rs extends A {
|
|
1271
|
+
mount() {
|
|
1272
|
+
const { current: t } = this.node;
|
|
1273
|
+
if (!t)
|
|
1274
|
+
return;
|
|
1275
|
+
const { globalTapTarget: n, propagate: s } = this.node.props;
|
|
1276
|
+
this.unmount = qe(t, (o, i) => (Gt(this.node, i, "Start"), (r, { success: a }) => Gt(this.node, r, a ? "End" : "Cancel")), {
|
|
1277
|
+
useGlobalTarget: n,
|
|
1278
|
+
stopPropagation: (s == null ? void 0 : s.tap) === !1
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
unmount() {
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
const ct = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), as = (e) => {
|
|
1285
|
+
const t = ct.get(e.target);
|
|
1286
|
+
t && t(e);
|
|
1287
|
+
}, cs = (e) => {
|
|
1288
|
+
e.forEach(as);
|
|
1289
|
+
};
|
|
1290
|
+
function us({ root: e, ...t }) {
|
|
1291
|
+
const n = e || document;
|
|
1292
|
+
it.has(n) || it.set(n, {});
|
|
1293
|
+
const s = it.get(n), o = JSON.stringify(t);
|
|
1294
|
+
return s[o] || (s[o] = new IntersectionObserver(cs, { root: e, ...t })), s[o];
|
|
1295
|
+
}
|
|
1296
|
+
function ls(e, t, n) {
|
|
1297
|
+
const s = us(t);
|
|
1298
|
+
return ct.set(e, n), s.observe(e), () => {
|
|
1299
|
+
ct.delete(e), s.unobserve(e);
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
const fs = {
|
|
1303
|
+
some: 0,
|
|
1304
|
+
all: 1
|
|
1305
|
+
};
|
|
1306
|
+
class ds extends A {
|
|
1307
|
+
constructor() {
|
|
1308
|
+
super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
|
|
1309
|
+
}
|
|
1310
|
+
startObserver() {
|
|
1311
|
+
this.unmount();
|
|
1312
|
+
const { viewport: t = {} } = this.node.getProps(), { root: n, margin: s, amount: o = "some", once: i } = t, r = {
|
|
1313
|
+
root: n ? n.current : void 0,
|
|
1314
|
+
rootMargin: s,
|
|
1315
|
+
threshold: typeof o == "number" ? o : fs[o]
|
|
1316
|
+
}, a = (f) => {
|
|
1317
|
+
const { isIntersecting: d } = f;
|
|
1318
|
+
if (this.isInView === d || (this.isInView = d, i && !d && this.hasEnteredView))
|
|
1319
|
+
return;
|
|
1320
|
+
d && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", d);
|
|
1321
|
+
const { onViewportEnter: m, onViewportLeave: u } = this.node.getProps(), c = d ? m : u;
|
|
1322
|
+
c && c(f);
|
|
1323
|
+
};
|
|
1324
|
+
return ls(this.node.current, r, a);
|
|
1325
|
+
}
|
|
1326
|
+
mount() {
|
|
1327
|
+
this.startObserver();
|
|
1328
|
+
}
|
|
1329
|
+
update() {
|
|
1330
|
+
if (typeof IntersectionObserver > "u")
|
|
1331
|
+
return;
|
|
1332
|
+
const { props: t, prevProps: n } = this.node;
|
|
1333
|
+
["amount", "margin", "root"].some(hs(t, n)) && this.startObserver();
|
|
1334
|
+
}
|
|
1335
|
+
unmount() {
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
function hs({ viewport: e = {} }, { viewport: t = {} } = {}) {
|
|
1339
|
+
return (n) => e[n] !== t[n];
|
|
1340
|
+
}
|
|
1341
|
+
const ms = {
|
|
1342
|
+
inView: {
|
|
1343
|
+
Feature: ds
|
|
1344
|
+
},
|
|
1345
|
+
tap: {
|
|
1346
|
+
Feature: rs
|
|
1347
|
+
},
|
|
1348
|
+
focus: {
|
|
1349
|
+
Feature: is
|
|
1350
|
+
},
|
|
1351
|
+
hover: {
|
|
1352
|
+
Feature: os
|
|
1353
|
+
}
|
|
1354
|
+
}, ps = {
|
|
1355
|
+
layout: {
|
|
1356
|
+
ProjectionNode: Yt,
|
|
1357
|
+
MeasureLayout: ce
|
|
1358
|
+
}
|
|
1359
|
+
}, gs = {
|
|
1360
|
+
...Wn,
|
|
1361
|
+
...ms,
|
|
1362
|
+
...ss,
|
|
1363
|
+
...ps
|
|
1364
|
+
}, xs = /* @__PURE__ */ kn(gs, Fn);
|
|
1365
|
+
function Ss() {
|
|
1366
|
+
!Ke.current && Je();
|
|
1367
|
+
const [e] = $(Ze.current);
|
|
1368
|
+
return process.env.NODE_ENV !== "production" && zt(e !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), e;
|
|
1369
|
+
}
|
|
1370
|
+
export {
|
|
1371
|
+
ws as A,
|
|
1372
|
+
Es as L,
|
|
1373
|
+
Cs as M,
|
|
1374
|
+
xs as m,
|
|
1375
|
+
Ss as u
|
|
1376
|
+
};
|