@memobit/libs 3.19.0 → 3.19.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.
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { HIGHLIGHT_WAIT_MS as h } from "./useListMotion.js";
|
|
2
|
+
import { useCallback as s, useEffect as o, useState as g } from "react";
|
|
3
|
+
var m = () => {
|
|
4
|
+
const [t, i] = g([]), r = s((...e) => i(e), []);
|
|
5
|
+
return o(() => {
|
|
6
|
+
if (t.length === 0) return;
|
|
7
|
+
const e = setTimeout(() => i([]), h);
|
|
8
|
+
return () => clearTimeout(e);
|
|
9
|
+
}, [t]), {
|
|
5
10
|
highlightIds: t,
|
|
6
|
-
highlight:
|
|
11
|
+
highlight: r
|
|
7
12
|
};
|
|
8
13
|
};
|
|
9
14
|
export {
|
|
10
|
-
|
|
15
|
+
m as useHighlight
|
|
11
16
|
};
|
|
@@ -48,8 +48,8 @@ var Q = "data-motion-key", z = "data-motion-root", Z = "list-motion-ghost", k =
|
|
|
48
48
|
ghost: c,
|
|
49
49
|
host: u
|
|
50
50
|
};
|
|
51
|
-
},
|
|
52
|
-
const { enabled: a = !0, flashEntering: u = !0, highlightKeys: c, maxMembershipChanges: y = 10, maxReorderMoves: p = 40 } = o, h = T(null), b = T("normal"), v = T(/* @__PURE__ */ new Set()), S = T(/* @__PURE__ */ new Set()), I = T(/* @__PURE__ */ new Map()), w = T(null), V = T(
|
|
51
|
+
}, de = (t, o = {}) => {
|
|
52
|
+
const { enabled: a = !0, flashEntering: u = !0, highlightKeys: c, maxMembershipChanges: y = 10, maxReorderMoves: p = 40 } = o, h = T(null), b = T("normal"), v = T(/* @__PURE__ */ new Set()), S = T(/* @__PURE__ */ new Set()), I = T(/* @__PURE__ */ new Map()), w = T(null), V = T(void 0), N = t.current;
|
|
53
53
|
if (N?.hasAttribute(z)) {
|
|
54
54
|
const e = J(N);
|
|
55
55
|
h.current = e.length > Y ? null : D(N, e);
|
|
@@ -88,24 +88,24 @@ var Q = "data-motion-key", z = "data-motion-root", Z = "list-motion-ghost", k =
|
|
|
88
88
|
if (!x && P > y) return;
|
|
89
89
|
const O = [];
|
|
90
90
|
if (i.order.forEach((l) => {
|
|
91
|
-
const r = s.items.get(l),
|
|
92
|
-
if (!r || !
|
|
93
|
-
const
|
|
94
|
-
(Math.abs(
|
|
95
|
-
dx:
|
|
91
|
+
const r = s.items.get(l), d = i.items.get(l);
|
|
92
|
+
if (!r || !d) return;
|
|
93
|
+
const f = r.box.left - d.box.left, g = r.box.top - d.box.top;
|
|
94
|
+
(Math.abs(f) > 0.5 || Math.abs(g) > 0.5) && O.push({
|
|
95
|
+
dx: f,
|
|
96
96
|
dy: g,
|
|
97
|
-
item:
|
|
97
|
+
item: d
|
|
98
98
|
});
|
|
99
99
|
}), !(!x && P === 0 && O.length > p)) {
|
|
100
100
|
if (n.move > 0) {
|
|
101
101
|
const l = A.length > 0 ? n.exit / 2 : 0;
|
|
102
|
-
O.forEach(({ dx: r, dy:
|
|
103
|
-
const g = H(e,
|
|
102
|
+
O.forEach(({ dx: r, dy: d, item: f }) => {
|
|
103
|
+
const g = H(e, f.box), m = {
|
|
104
104
|
...g,
|
|
105
105
|
left: g.left + r,
|
|
106
|
-
top: g.top +
|
|
106
|
+
top: g.top + d
|
|
107
107
|
};
|
|
108
|
-
!L(m) && !L(g) || R(
|
|
108
|
+
!L(m) && !L(g) || R(f.element.animate([{ transform: `translate(${r}px, ${d}px)` }, { transform: "translate(0, 0)" }], {
|
|
109
109
|
delay: l,
|
|
110
110
|
duration: n.move,
|
|
111
111
|
easing: n.easing,
|
|
@@ -117,28 +117,28 @@ var Q = "data-motion-key", z = "data-motion-root", Z = "list-motion-ghost", k =
|
|
|
117
117
|
const l = A.map((r) => s.items.get(r)).filter((r) => r !== void 0);
|
|
118
118
|
l.forEach((r) => {
|
|
119
119
|
if (l.some((j) => j !== r && j.element.contains(r.element)) || r.element.isConnected) return;
|
|
120
|
-
const
|
|
121
|
-
if (!L(
|
|
122
|
-
const
|
|
123
|
-
if (!(
|
|
124
|
-
|
|
125
|
-
const g =
|
|
126
|
-
ghost:
|
|
120
|
+
const d = H(e, r.box);
|
|
121
|
+
if (!L(d)) return;
|
|
122
|
+
const f = r.element.cloneNode(!0);
|
|
123
|
+
if (!(f instanceof HTMLElement)) return;
|
|
124
|
+
f.removeAttribute(Q), f.classList.remove(k);
|
|
125
|
+
const g = f instanceof HTMLTableRowElement ? ce(f, r.parent) : {
|
|
126
|
+
ghost: f,
|
|
127
127
|
host: r.parent?.isConnected ? r.parent : e
|
|
128
128
|
};
|
|
129
129
|
if (!g) return;
|
|
130
130
|
const { ghost: m, host: te } = g;
|
|
131
131
|
m.classList.add(Z), Object.assign(m.style, {
|
|
132
132
|
boxSizing: "border-box",
|
|
133
|
-
height: `${
|
|
133
|
+
height: `${d.height}px`,
|
|
134
134
|
left: "0px",
|
|
135
135
|
margin: "0px",
|
|
136
136
|
position: "absolute",
|
|
137
137
|
top: "0px",
|
|
138
|
-
width: `${
|
|
138
|
+
width: `${d.width}px`
|
|
139
139
|
}), te.append(m);
|
|
140
140
|
const U = m.getBoundingClientRect();
|
|
141
|
-
m.style.left = `${
|
|
141
|
+
m.style.left = `${d.left - U.left}px`, m.style.top = `${d.top - U.top}px`, S.current.add(m);
|
|
142
142
|
const X = () => {
|
|
143
143
|
m.remove(), S.current.delete(m);
|
|
144
144
|
};
|
|
@@ -223,6 +223,7 @@ var Q = "data-motion-key", z = "data-motion-root", Z = "list-motion-ghost", k =
|
|
|
223
223
|
}), [F, K]);
|
|
224
224
|
};
|
|
225
225
|
export {
|
|
226
|
+
ne as HIGHLIGHT_WAIT_MS,
|
|
226
227
|
Q as LIST_MOTION_KEY_ATTRIBUTE,
|
|
227
|
-
|
|
228
|
+
de as useListMotion
|
|
228
229
|
};
|
package/dist/index.js
CHANGED
|
@@ -55,8 +55,8 @@ import { CopyButton as yo } from "./components/CopyButton/CopyButton2.js";
|
|
|
55
55
|
import { Flag as bo } from "./components/Flag/Flag2.js";
|
|
56
56
|
import { CountryWithFlag as Oo } from "./components/CountryWithFlag/CountryWithFlag2.js";
|
|
57
57
|
import { getResultsCount as Ho } from "./helpers/Pagination.js";
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
58
|
+
import { LIST_MOTION_KEY_ATTRIBUTE as Uo, useListMotion as wo } from "./hooks/useListMotion/useListMotion.js";
|
|
59
|
+
import { useHighlight as Wo } from "./hooks/useListMotion/useHighlight.js";
|
|
60
60
|
import { EmptyState as Ko } from "./components/EmptyState/EmptyState2.js";
|
|
61
61
|
import { Pagination as Go } from "./components/Pagination/Pagination2.js";
|
|
62
62
|
import { calculateTimelineMarkers as Yo } from "./components/TimelineMarkers/calculateTimelineMarkers.js";
|
|
@@ -246,7 +246,7 @@ export {
|
|
|
246
246
|
Ip as LIB_BUILD_NUMBER,
|
|
247
247
|
Sp as LIB_COMMIT,
|
|
248
248
|
Ap as LIB_VERSION,
|
|
249
|
-
|
|
249
|
+
Uo as LIST_MOTION_KEY_ATTRIBUTE,
|
|
250
250
|
Pm as List,
|
|
251
251
|
kt as Loading,
|
|
252
252
|
hm as MenuHamburger,
|
|
@@ -391,8 +391,8 @@ export {
|
|
|
391
391
|
s as useComponentEffect,
|
|
392
392
|
Po as useControlPanel,
|
|
393
393
|
Do as useControlPanelContext,
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
Wo as useHighlight,
|
|
395
|
+
wo as useListMotion,
|
|
396
396
|
Kr as usePopover,
|
|
397
397
|
gi as useSidebar,
|
|
398
398
|
pt as useSwipe,
|
package/dist/version.js
CHANGED
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memobit/libs",
|
|
3
|
-
"version": "3.19.
|
|
3
|
+
"version": "3.19.1",
|
|
4
4
|
"description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|