zs_library 0.5.0 → 0.5.3
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/desktop/items/sortable-item.d.ts +3 -0
- package/dist/index.js +181 -176
- package/package.json +11 -15
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { ContextMenuProps } from '../context-menu';
|
|
2
3
|
import { SortItem } from '../types';
|
|
3
4
|
export interface SortableItemProps<D, C> {
|
|
4
5
|
data: SortItem<D, C>;
|
|
@@ -10,6 +11,8 @@ export interface SortableItemProps<D, C> {
|
|
|
10
11
|
children?: React.ReactNode;
|
|
11
12
|
parentIds?: (string | number)[];
|
|
12
13
|
childrenLength?: number;
|
|
14
|
+
contextMenuProps?: false | Partial<ContextMenuProps<D, C>>;
|
|
15
|
+
icon?: React.ReactNode;
|
|
13
16
|
}
|
|
14
17
|
export declare const SortableItemDefaultContent: <D, C>(props: SortableItemProps<D, C>) => import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
declare const SortableItem: <D, C>(props: SortableItemProps<D, C>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -232,7 +232,7 @@ const ao = zt({
|
|
|
232
232
|
onChange: r,
|
|
233
233
|
storageKey: n = "ZS_LIBRARY_DESKTOP_SORTABLE_CONFIG",
|
|
234
234
|
enableCaching: a = !0
|
|
235
|
-
} = t, [s, l] = E(), [d, m] = E(), [c, u] = E(null), g = ne(c), [
|
|
235
|
+
} = t, [s, l] = E(), [d, m] = E(), [c, u] = E(null), g = ne(c), [y, b] = E(null), [f, k] = E([]), [D, v] = E(
|
|
236
236
|
null
|
|
237
237
|
), [h, S] = E(
|
|
238
238
|
null
|
|
@@ -242,9 +242,9 @@ const ao = zt({
|
|
|
242
242
|
defaultValue: [],
|
|
243
243
|
listenStorageChange: !0
|
|
244
244
|
}), j = () => {
|
|
245
|
-
|
|
245
|
+
b(null), clearTimeout(s), l(void 0), g.current = null;
|
|
246
246
|
}, re = (M, H) => {
|
|
247
|
-
|
|
247
|
+
b({ ...M, pageX: M.pageX, pageY: M.pageY, data: H }), clearTimeout(s);
|
|
248
248
|
}, Ne = (M, H = !0) => {
|
|
249
249
|
const { config: U = {} } = M;
|
|
250
250
|
return U.allowContextMenu === !1 ? {} : {
|
|
@@ -398,14 +398,14 @@ const ao = zt({
|
|
|
398
398
|
value: {
|
|
399
399
|
list: f,
|
|
400
400
|
setList: oe,
|
|
401
|
-
contextMenu:
|
|
402
|
-
setContextMenu:
|
|
401
|
+
contextMenu: y,
|
|
402
|
+
setContextMenu: b,
|
|
403
403
|
listStatus: c,
|
|
404
404
|
setListStatus: u,
|
|
405
405
|
contextMenuFuns: Ne,
|
|
406
406
|
hideContextMenu: j,
|
|
407
407
|
showInfoItemData: D,
|
|
408
|
-
setShowInfoItemData:
|
|
408
|
+
setShowInfoItemData: v,
|
|
409
409
|
openGroupItemData: h,
|
|
410
410
|
setOpenGroupItemData: S,
|
|
411
411
|
longPressTriggered: N,
|
|
@@ -503,12 +503,12 @@ const ao = zt({
|
|
|
503
503
|
hideContextMenu: c,
|
|
504
504
|
setShowInfoItemData: u,
|
|
505
505
|
removeItem: g,
|
|
506
|
-
updateItemConfig:
|
|
507
|
-
} = Re(), { theme:
|
|
506
|
+
updateItemConfig: y
|
|
507
|
+
} = Re(), { theme: b } = Se(), { data: f } = d ?? {}, { config: k = {} } = f ?? {}, D = () => {
|
|
508
508
|
var S;
|
|
509
|
-
const
|
|
510
|
-
for (let N = 1; N <= ((
|
|
511
|
-
for (let L = 1; L <= ((
|
|
509
|
+
const v = tt[(S = d == null ? void 0 : d.data) == null ? void 0 : S.type], h = [];
|
|
510
|
+
for (let N = 1; N <= ((v == null ? void 0 : v.maxRow) ?? 2); N++)
|
|
511
|
+
for (let L = 1; L <= ((v == null ? void 0 : v.maxCol) ?? 2); L++)
|
|
512
512
|
h.push(`${N}x${L}`);
|
|
513
513
|
return h;
|
|
514
514
|
};
|
|
@@ -518,8 +518,8 @@ const ao = zt({
|
|
|
518
518
|
initial: { opacity: 0 },
|
|
519
519
|
animate: { opacity: 1 },
|
|
520
520
|
exit: { opacity: 0 },
|
|
521
|
-
onMouseDown: (
|
|
522
|
-
|
|
521
|
+
onMouseDown: (v) => {
|
|
522
|
+
v.stopPropagation(), v.preventDefault();
|
|
523
523
|
},
|
|
524
524
|
children: [
|
|
525
525
|
/* @__PURE__ */ i(
|
|
@@ -529,8 +529,8 @@ const ao = zt({
|
|
|
529
529
|
I`
|
|
530
530
|
border-radius: 0.5rem;
|
|
531
531
|
overflow: hidden;
|
|
532
|
-
background-color: ${
|
|
533
|
-
box-shadow: 0 0 0.5rem ${
|
|
532
|
+
background-color: ${b.token.contextMenuBackgroundColor};
|
|
533
|
+
box-shadow: 0 0 0.5rem ${b.token.contextMenuShadowColor};
|
|
534
534
|
`
|
|
535
535
|
),
|
|
536
536
|
children: n && k.allowResize !== !1 && /* @__PURE__ */ i(
|
|
@@ -546,19 +546,19 @@ const ao = zt({
|
|
|
546
546
|
label: "修改大小",
|
|
547
547
|
key: "size",
|
|
548
548
|
icon: /* @__PURE__ */ i(Fo, { size: 14 }),
|
|
549
|
-
items: D().map((
|
|
550
|
-
label:
|
|
551
|
-
key:
|
|
549
|
+
items: D().map((v) => ({
|
|
550
|
+
label: v,
|
|
551
|
+
key: v,
|
|
552
552
|
onClick: () => {
|
|
553
|
-
const [h, S] =
|
|
554
|
-
|
|
553
|
+
const [h, S] = v.split("x").map(Number);
|
|
554
|
+
y(d.data.id, {
|
|
555
555
|
row: h,
|
|
556
556
|
col: S
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
}))
|
|
560
560
|
}
|
|
561
|
-
].map((
|
|
561
|
+
].map((v) => /* @__PURE__ */ p(
|
|
562
562
|
$.li,
|
|
563
563
|
{
|
|
564
564
|
className: I`
|
|
@@ -579,12 +579,12 @@ const ao = zt({
|
|
|
579
579
|
gap: 0.5rem;
|
|
580
580
|
padding-bottom: 0.5rem;
|
|
581
581
|
margin: 0;
|
|
582
|
-
color: ${
|
|
582
|
+
color: ${b.token.contextMenuTextColor};
|
|
583
583
|
`,
|
|
584
584
|
children: [
|
|
585
|
-
|
|
585
|
+
v.icon,
|
|
586
586
|
" ",
|
|
587
|
-
|
|
587
|
+
v.label
|
|
588
588
|
]
|
|
589
589
|
}
|
|
590
590
|
),
|
|
@@ -596,7 +596,7 @@ const ao = zt({
|
|
|
596
596
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
597
597
|
gap: 0.25rem;
|
|
598
598
|
`,
|
|
599
|
-
children:
|
|
599
|
+
children: v.items.map((h) => /* @__PURE__ */ i(
|
|
600
600
|
$.div,
|
|
601
601
|
{
|
|
602
602
|
className: T(
|
|
@@ -612,13 +612,13 @@ const ao = zt({
|
|
|
612
612
|
line-height: 1.25rem;
|
|
613
613
|
cursor: pointer;
|
|
614
614
|
text-align: center;
|
|
615
|
-
color: ${
|
|
615
|
+
color: ${b.token.contextMenuTextColor};
|
|
616
616
|
&:hover {
|
|
617
|
-
background-color: ${
|
|
617
|
+
background-color: ${b.token.contextMenuActiveColor};
|
|
618
618
|
}
|
|
619
619
|
`,
|
|
620
620
|
`${k.row}x${k.col}` === h.key && I`
|
|
621
|
-
background-color: ${
|
|
621
|
+
background-color: ${b.token.contextMenuActiveColor};
|
|
622
622
|
`
|
|
623
623
|
),
|
|
624
624
|
onClick: h.onClick,
|
|
@@ -630,7 +630,7 @@ const ao = zt({
|
|
|
630
630
|
)
|
|
631
631
|
]
|
|
632
632
|
},
|
|
633
|
-
|
|
633
|
+
v.key
|
|
634
634
|
))
|
|
635
635
|
}
|
|
636
636
|
)
|
|
@@ -641,8 +641,8 @@ const ao = zt({
|
|
|
641
641
|
{
|
|
642
642
|
className: T(
|
|
643
643
|
I`
|
|
644
|
-
background-color: ${
|
|
645
|
-
box-shadow: 0 0 0.5rem ${
|
|
644
|
+
background-color: ${b.token.contextMenuBackgroundColor};
|
|
645
|
+
box-shadow: 0 0 0.5rem ${b.token.contextMenuShadowColor};
|
|
646
646
|
display: flex;
|
|
647
647
|
justify-content: space-around;
|
|
648
648
|
align-items: center;
|
|
@@ -705,7 +705,11 @@ const ao = zt({
|
|
|
705
705
|
}
|
|
706
706
|
) });
|
|
707
707
|
}, fa = (t) => {
|
|
708
|
-
const { data: e, noLetters: o = !1
|
|
708
|
+
const { data: e, noLetters: o = !1, icon: r } = t, { contextMenuFuns: n } = Re(), {
|
|
709
|
+
itemIconBuilder: a,
|
|
710
|
+
theme: s,
|
|
711
|
+
contextMenu: l
|
|
712
|
+
} = Se(), { data: d = {} } = e, { name: m } = d, c = () => r || (a ? typeof a == "function" ? a(e) : a : null);
|
|
709
713
|
return /* @__PURE__ */ p(Ce, { children: [
|
|
710
714
|
/* @__PURE__ */ i(
|
|
711
715
|
$.div,
|
|
@@ -713,9 +717,9 @@ const ao = zt({
|
|
|
713
717
|
className: I`
|
|
714
718
|
width: 4rem;
|
|
715
719
|
height: 4rem;
|
|
716
|
-
background-color: ${
|
|
720
|
+
background-color: ${s.token.itemIconBackgroundColor};
|
|
717
721
|
border-radius: 0.75rem;
|
|
718
|
-
box-shadow: 0 0 0.5rem ${
|
|
722
|
+
box-shadow: 0 0 0.5rem ${s.token.itemIconShadowColor};
|
|
719
723
|
cursor: pointer;
|
|
720
724
|
position: relative;
|
|
721
725
|
overflow: hidden;
|
|
@@ -730,10 +734,10 @@ const ao = zt({
|
|
|
730
734
|
top: 0;
|
|
731
735
|
width: 100%;
|
|
732
736
|
height: 100%;
|
|
733
|
-
color: ${
|
|
737
|
+
color: ${s.token.itemNameColor};
|
|
734
738
|
`,
|
|
735
|
-
...
|
|
736
|
-
children:
|
|
739
|
+
...n(e, l !== !1),
|
|
740
|
+
children: c()
|
|
737
741
|
}
|
|
738
742
|
)
|
|
739
743
|
}
|
|
@@ -744,13 +748,13 @@ const ao = zt({
|
|
|
744
748
|
className: T(
|
|
745
749
|
"whitespace-nowrap text-ellipsis overflow-hidden text-center mt-1 mb-0 max-w-16",
|
|
746
750
|
I`
|
|
747
|
-
color: ${
|
|
751
|
+
color: ${s.token.itemNameColor};
|
|
748
752
|
`,
|
|
749
753
|
o && I`
|
|
750
754
|
color: transparent;
|
|
751
755
|
`
|
|
752
756
|
),
|
|
753
|
-
children:
|
|
757
|
+
children: m
|
|
754
758
|
}
|
|
755
759
|
)
|
|
756
760
|
] });
|
|
@@ -763,9 +767,21 @@ const ao = zt({
|
|
|
763
767
|
disabledDrag: a = !1,
|
|
764
768
|
children: s,
|
|
765
769
|
parentIds: l,
|
|
766
|
-
childrenLength: d
|
|
767
|
-
|
|
768
|
-
|
|
770
|
+
childrenLength: d,
|
|
771
|
+
contextMenuProps: m
|
|
772
|
+
} = t, { contextMenu: c, setContextMenu: u } = Re(), { contextMenu: g } = Se(), y = m === !1 || m === void 0 && g === !1, b = m === !1 ? !1 : typeof m == "object" ? m : g, f = () => /* @__PURE__ */ i(
|
|
773
|
+
$.div,
|
|
774
|
+
{
|
|
775
|
+
"data-id": e.id,
|
|
776
|
+
"data-index": r,
|
|
777
|
+
"data-parent-ids": l == null ? void 0 : l.join(","),
|
|
778
|
+
"data-children-length": d,
|
|
779
|
+
onClick: () => n == null ? void 0 : n(e),
|
|
780
|
+
className: T(a && "drag-disabled", o),
|
|
781
|
+
children: s ?? /* @__PURE__ */ i(fa, { ...t })
|
|
782
|
+
}
|
|
783
|
+
);
|
|
784
|
+
return y ? f() : /* @__PURE__ */ i(
|
|
769
785
|
Bt,
|
|
770
786
|
{
|
|
771
787
|
placement: "bottom",
|
|
@@ -777,24 +793,13 @@ const ao = zt({
|
|
|
777
793
|
border: none;
|
|
778
794
|
}
|
|
779
795
|
`,
|
|
780
|
-
overlay: /* @__PURE__ */ i(ga, { ...
|
|
781
|
-
visible: (
|
|
782
|
-
onVisibleChange: (
|
|
783
|
-
|
|
796
|
+
overlay: /* @__PURE__ */ i(ga, { ...b }),
|
|
797
|
+
visible: (c == null ? void 0 : c.data.id) === e.id,
|
|
798
|
+
onVisibleChange: (k) => {
|
|
799
|
+
k || u(null);
|
|
784
800
|
},
|
|
785
801
|
destroyTooltipOnHide: !0,
|
|
786
|
-
children:
|
|
787
|
-
$.div,
|
|
788
|
-
{
|
|
789
|
-
"data-id": e.id,
|
|
790
|
-
"data-index": r,
|
|
791
|
-
"data-parent-ids": l == null ? void 0 : l.join(","),
|
|
792
|
-
"data-children-length": d,
|
|
793
|
-
onClick: () => n == null ? void 0 : n(e),
|
|
794
|
-
className: T(a && "drag-disabled", o),
|
|
795
|
-
children: s ?? /* @__PURE__ */ i(fa, { ...t })
|
|
796
|
-
}
|
|
797
|
-
)
|
|
802
|
+
children: f()
|
|
798
803
|
}
|
|
799
804
|
);
|
|
800
805
|
}, so = (t) => {
|
|
@@ -812,12 +817,12 @@ const ao = zt({
|
|
|
812
817
|
longPressTriggered: c,
|
|
813
818
|
moveItemId: u,
|
|
814
819
|
moveTargetId: g,
|
|
815
|
-
setMoveTargetId:
|
|
816
|
-
listStatus:
|
|
817
|
-
} = Re(), { itemIconBuilder: f, theme: k, contextMenu: D } = Se(), { children:
|
|
820
|
+
setMoveTargetId: y,
|
|
821
|
+
listStatus: b
|
|
822
|
+
} = Re(), { itemIconBuilder: f, theme: k, contextMenu: D } = Se(), { children: v, data: h, config: S } = e, { row: N = 1, col: L = 1 } = S ?? {}, Y = {
|
|
818
823
|
visible: { opacity: 1, scale: 1 },
|
|
819
824
|
hidden: { opacity: 0, scale: 0.95 }
|
|
820
|
-
}, Z = ((
|
|
825
|
+
}, Z = ((v == null ? void 0 : v.length) ?? 0) === 0, R = Z ? [e] : [...v ?? []].slice(0, 9), P = Q(() => u === e.id.toString(), [e.id, u]), O = Q(() => g === e.id, [e.id, g]), F = I`
|
|
821
826
|
overflow: hidden;
|
|
822
827
|
cursor: pointer;
|
|
823
828
|
background-color: ${k.token.itemIconBackgroundColor};
|
|
@@ -971,7 +976,7 @@ const ao = zt({
|
|
|
971
976
|
data: e,
|
|
972
977
|
itemIndex: n,
|
|
973
978
|
parentIds: r,
|
|
974
|
-
childrenLength:
|
|
979
|
+
childrenLength: v == null ? void 0 : v.length,
|
|
975
980
|
className: T(
|
|
976
981
|
I`
|
|
977
982
|
grid-row: span ${N};
|
|
@@ -1029,7 +1034,7 @@ const ao = zt({
|
|
|
1029
1034
|
top: 0.375rem;
|
|
1030
1035
|
width: calc(100% - 0.75rem);
|
|
1031
1036
|
height: calc(100% - 0.75rem);
|
|
1032
|
-
pointer-events: ${
|
|
1037
|
+
pointer-events: ${b === null ? "none" : "auto"};
|
|
1033
1038
|
> * {
|
|
1034
1039
|
opacity: 0;
|
|
1035
1040
|
}
|
|
@@ -1038,12 +1043,12 @@ const ao = zt({
|
|
|
1038
1043
|
group: { name: "nested", pull: !1, put: !0 },
|
|
1039
1044
|
animation: 150,
|
|
1040
1045
|
fallbackOnBody: !0,
|
|
1041
|
-
list:
|
|
1046
|
+
list: v ?? [],
|
|
1042
1047
|
setList: (C) => d(C, r),
|
|
1043
1048
|
filter: () => !0,
|
|
1044
1049
|
"data-id": e.id,
|
|
1045
1050
|
onChange: () => {
|
|
1046
|
-
|
|
1051
|
+
y(e.id);
|
|
1047
1052
|
}
|
|
1048
1053
|
}
|
|
1049
1054
|
)
|
|
@@ -1092,10 +1097,10 @@ const ao = zt({
|
|
|
1092
1097
|
setMoveItemId: l,
|
|
1093
1098
|
setMoveTargetId: d,
|
|
1094
1099
|
updateItem: m
|
|
1095
|
-
} = Re(), { theme: c } = Se(), [u, g] = E("文件夹"),
|
|
1100
|
+
} = Re(), { theme: c } = Se(), [u, g] = E("文件夹"), y = [...(e == null ? void 0 : e.children) ?? []];
|
|
1096
1101
|
return q(() => {
|
|
1097
|
-
var
|
|
1098
|
-
e && g((
|
|
1102
|
+
var b;
|
|
1103
|
+
e && g((b = e.data) == null ? void 0 : b.name);
|
|
1099
1104
|
}, [e]), /* @__PURE__ */ i(
|
|
1100
1105
|
Yt,
|
|
1101
1106
|
{
|
|
@@ -1124,8 +1129,8 @@ const ao = zt({
|
|
|
1124
1129
|
}
|
|
1125
1130
|
`,
|
|
1126
1131
|
value: u,
|
|
1127
|
-
onChange: (
|
|
1128
|
-
g(
|
|
1132
|
+
onChange: (b) => {
|
|
1133
|
+
g(b.target.value);
|
|
1129
1134
|
},
|
|
1130
1135
|
onBlur: () => {
|
|
1131
1136
|
e && m(e.id, {
|
|
@@ -1171,9 +1176,9 @@ const ao = zt({
|
|
|
1171
1176
|
max-height: 60vh;
|
|
1172
1177
|
padding: 1.25rem 0;
|
|
1173
1178
|
`,
|
|
1174
|
-
onDragLeave: (
|
|
1175
|
-
const f =
|
|
1176
|
-
f && (
|
|
1179
|
+
onDragLeave: (b) => {
|
|
1180
|
+
const f = b.relatedTarget;
|
|
1181
|
+
f && (b.currentTarget.contains(f) || setTimeout(() => {
|
|
1177
1182
|
o();
|
|
1178
1183
|
}, 500));
|
|
1179
1184
|
},
|
|
@@ -1192,28 +1197,28 @@ const ao = zt({
|
|
|
1192
1197
|
animation: 150,
|
|
1193
1198
|
fallbackOnBody: !0,
|
|
1194
1199
|
list: (e == null ? void 0 : e.children) ?? [],
|
|
1195
|
-
setList: (
|
|
1196
|
-
var D,
|
|
1197
|
-
const f =
|
|
1198
|
-
f.length === (k == null ? void 0 : k.length) && f.every((h, S) => h === k[S]) || f.length < ((k == null ? void 0 : k.length) ?? 0) || a(
|
|
1200
|
+
setList: (b) => {
|
|
1201
|
+
var D, v;
|
|
1202
|
+
const f = b.map((h) => h.id), k = (v = (D = n.find((h) => h.id === (e == null ? void 0 : e.id))) == null ? void 0 : D.children) == null ? void 0 : v.map((h) => h.id);
|
|
1203
|
+
f.length === (k == null ? void 0 : k.length) && f.every((h, S) => h === k[S]) || f.length < ((k == null ? void 0 : k.length) ?? 0) || a(b, [...(e == null ? void 0 : e.parentIds) ?? [], e == null ? void 0 : e.id]);
|
|
1199
1204
|
},
|
|
1200
1205
|
onMove: () => (d(null), s("onMove"), !0),
|
|
1201
|
-
onStart: (
|
|
1202
|
-
const f =
|
|
1206
|
+
onStart: (b) => {
|
|
1207
|
+
const f = b.item.dataset;
|
|
1203
1208
|
f != null && f.id && l(f.id), s("onMove");
|
|
1204
1209
|
},
|
|
1205
1210
|
onEnd: () => {
|
|
1206
1211
|
l(null), d(null), s(null);
|
|
1207
1212
|
},
|
|
1208
1213
|
ghostClass: lo,
|
|
1209
|
-
children:
|
|
1214
|
+
children: y.map((b, f) => /* @__PURE__ */ i(
|
|
1210
1215
|
at,
|
|
1211
1216
|
{
|
|
1212
|
-
data:
|
|
1217
|
+
data: b,
|
|
1213
1218
|
itemIndex: f,
|
|
1214
1219
|
onClick: r
|
|
1215
1220
|
},
|
|
1216
|
-
|
|
1221
|
+
b.id
|
|
1217
1222
|
))
|
|
1218
1223
|
}
|
|
1219
1224
|
)
|
|
@@ -1267,12 +1272,12 @@ const ao = zt({
|
|
|
1267
1272
|
} = t, l = ne(null), d = ne(null), [m, c] = E(0), {
|
|
1268
1273
|
list: u,
|
|
1269
1274
|
setList: g,
|
|
1270
|
-
setListStatus:
|
|
1271
|
-
showInfoItemData:
|
|
1275
|
+
setListStatus: y,
|
|
1276
|
+
showInfoItemData: b,
|
|
1272
1277
|
setShowInfoItemData: f,
|
|
1273
1278
|
openGroupItemData: k,
|
|
1274
1279
|
setOpenGroupItemData: D,
|
|
1275
|
-
setMoveItemId:
|
|
1280
|
+
setMoveItemId: v,
|
|
1276
1281
|
setMoveTargetId: h,
|
|
1277
1282
|
addItem: S
|
|
1278
1283
|
} = Re(), { pagingDotBuilder: N, pagingDotsBuilder: L, itemBuilder: Y } = Se(), Z = Q(() => e === !1 ? {} : {
|
|
@@ -1452,16 +1457,16 @@ const ao = zt({
|
|
|
1452
1457
|
setList: (P) => g(P, [R.id]),
|
|
1453
1458
|
filter: ".drag-disabled",
|
|
1454
1459
|
onMove: (P) => {
|
|
1455
|
-
|
|
1460
|
+
y("onMove");
|
|
1456
1461
|
const { dragged: O, related: F } = P, te = O.dataset, C = F.dataset;
|
|
1457
1462
|
return h(null), !((Object.keys(C).length === 0 || C.parentIds) && Number(te.childrenLength) > 0 && F.classList.contains("sortable-group-item"));
|
|
1458
1463
|
},
|
|
1459
1464
|
onStart: (P) => {
|
|
1460
1465
|
const O = P.item.dataset;
|
|
1461
|
-
O != null && O.id &&
|
|
1466
|
+
O != null && O.id && v(O.id), y("onMove");
|
|
1462
1467
|
},
|
|
1463
1468
|
onEnd: () => {
|
|
1464
|
-
|
|
1469
|
+
v(null), h(null), y(null);
|
|
1465
1470
|
},
|
|
1466
1471
|
ghostClass: lo,
|
|
1467
1472
|
children: [
|
|
@@ -1511,7 +1516,7 @@ const ao = zt({
|
|
|
1511
1516
|
/* @__PURE__ */ i(
|
|
1512
1517
|
ha,
|
|
1513
1518
|
{
|
|
1514
|
-
data:
|
|
1519
|
+
data: b,
|
|
1515
1520
|
onClose: () => {
|
|
1516
1521
|
f(null);
|
|
1517
1522
|
}
|
|
@@ -1542,8 +1547,8 @@ const ao = zt({
|
|
|
1542
1547
|
itemBuilder: c,
|
|
1543
1548
|
itemIconBuilder: u,
|
|
1544
1549
|
pagingDotBuilder: g,
|
|
1545
|
-
pagingDotsBuilder:
|
|
1546
|
-
...
|
|
1550
|
+
pagingDotsBuilder: y,
|
|
1551
|
+
...b
|
|
1547
1552
|
} = t;
|
|
1548
1553
|
return /* @__PURE__ */ i(io, { ...{
|
|
1549
1554
|
list: o,
|
|
@@ -1554,19 +1559,19 @@ const ao = zt({
|
|
|
1554
1559
|
theme: s,
|
|
1555
1560
|
noLetters: l,
|
|
1556
1561
|
contextMenu: d,
|
|
1557
|
-
pagingDotsBuilder:
|
|
1562
|
+
pagingDotsBuilder: y,
|
|
1558
1563
|
pagingDotBuilder: g,
|
|
1559
1564
|
itemBuilder: c,
|
|
1560
1565
|
itemIconBuilder: u,
|
|
1561
1566
|
contextMenuBuilder: m
|
|
1562
1567
|
}, children: [
|
|
1563
1568
|
/* @__PURE__ */ i(() => {
|
|
1564
|
-
const
|
|
1569
|
+
const v = Re(), h = Se();
|
|
1565
1570
|
return q(() => {
|
|
1566
|
-
e && (typeof e == "function" ? e({ state:
|
|
1567
|
-
}, [
|
|
1571
|
+
e && (typeof e == "function" ? e({ state: v, config: h }) : e.current = { state: v, config: h });
|
|
1572
|
+
}, [v, h]), null;
|
|
1568
1573
|
}, {}),
|
|
1569
|
-
/* @__PURE__ */ i(co, { ...
|
|
1574
|
+
/* @__PURE__ */ i(co, { ...b })
|
|
1570
1575
|
] }) });
|
|
1571
1576
|
}
|
|
1572
1577
|
), va = {
|
|
@@ -1968,8 +1973,8 @@ const ao = zt({
|
|
|
1968
1973
|
},
|
|
1969
1974
|
headings: u,
|
|
1970
1975
|
link: g,
|
|
1971
|
-
codeBlock:
|
|
1972
|
-
codeMirror:
|
|
1976
|
+
codeBlock: y,
|
|
1977
|
+
codeMirror: b = {
|
|
1973
1978
|
codeBlockLanguages: {
|
|
1974
1979
|
js: "JavaScript",
|
|
1975
1980
|
css: "CSS",
|
|
@@ -1983,8 +1988,8 @@ const ao = zt({
|
|
|
1983
1988
|
}
|
|
1984
1989
|
} = n ?? {}, [k, D] = E("");
|
|
1985
1990
|
return q(() => {
|
|
1986
|
-
var
|
|
1987
|
-
e !== void 0 && d.current && ((
|
|
1991
|
+
var v;
|
|
1992
|
+
e !== void 0 && d.current && ((v = d.current) == null || v.setMarkdown(e), D(e));
|
|
1988
1993
|
}, [e, d]), /* @__PURE__ */ i(
|
|
1989
1994
|
un,
|
|
1990
1995
|
{
|
|
@@ -1997,8 +2002,8 @@ const ao = zt({
|
|
|
1997
2002
|
),
|
|
1998
2003
|
contentEditableClassName: uo,
|
|
1999
2004
|
markdown: k,
|
|
2000
|
-
onChange: (
|
|
2001
|
-
!e && !o && D(
|
|
2005
|
+
onChange: (v) => {
|
|
2006
|
+
!e && !o && D(v), o && o(v);
|
|
2002
2007
|
},
|
|
2003
2008
|
translation: r ?? xa,
|
|
2004
2009
|
plugins: [
|
|
@@ -2034,8 +2039,8 @@ const ao = zt({
|
|
|
2034
2039
|
xn(),
|
|
2035
2040
|
kn(),
|
|
2036
2041
|
Cn(),
|
|
2037
|
-
wn(
|
|
2038
|
-
Sn(
|
|
2042
|
+
wn(y),
|
|
2043
|
+
Sn(b),
|
|
2039
2044
|
Nn(),
|
|
2040
2045
|
In(f)
|
|
2041
2046
|
],
|
|
@@ -2124,7 +2129,7 @@ const bt = (t) => {
|
|
|
2124
2129
|
var O;
|
|
2125
2130
|
const P = ((O = u.current) == null ? void 0 : O.getBoundingClientRect()) ?? { x: 0, width: 0 };
|
|
2126
2131
|
return R - P.x - P.width / 2;
|
|
2127
|
-
}),
|
|
2132
|
+
}), y = ze(g, [-150, 0, 150], [40, 80, 40]), b = ze(g, [-150, 0, 150], [40, 80, 40]), f = ze(
|
|
2128
2133
|
g,
|
|
2129
2134
|
[-150, 0, 150],
|
|
2130
2135
|
[20, 40, 20]
|
|
@@ -2132,11 +2137,11 @@ const bt = (t) => {
|
|
|
2132
2137
|
g,
|
|
2133
2138
|
[-150, 0, 150],
|
|
2134
2139
|
[20, 40, 20]
|
|
2135
|
-
), D = Ze(
|
|
2140
|
+
), D = Ze(y, {
|
|
2136
2141
|
mass: 0.1,
|
|
2137
2142
|
stiffness: 150,
|
|
2138
2143
|
damping: 12
|
|
2139
|
-
}),
|
|
2144
|
+
}), v = Ze(b, {
|
|
2140
2145
|
mass: 0.1,
|
|
2141
2146
|
stiffness: 150,
|
|
2142
2147
|
damping: 12
|
|
@@ -2152,7 +2157,7 @@ const bt = (t) => {
|
|
|
2152
2157
|
s,
|
|
2153
2158
|
{
|
|
2154
2159
|
ref: u,
|
|
2155
|
-
style: { width: D, height:
|
|
2160
|
+
style: { width: D, height: v },
|
|
2156
2161
|
onMouseEnter: () => Y(!0),
|
|
2157
2162
|
onMouseLeave: () => Y(!1),
|
|
2158
2163
|
className: Fe(
|
|
@@ -2417,29 +2422,29 @@ function Ta(t) {
|
|
|
2417
2422
|
t
|
|
2418
2423
|
);
|
|
2419
2424
|
if (!(g instanceof Element)) return;
|
|
2420
|
-
let
|
|
2421
|
-
if (
|
|
2422
|
-
|
|
2423
|
-
const { from:
|
|
2424
|
-
let
|
|
2425
|
+
let y = wt(g, u, t);
|
|
2426
|
+
if (y == null || y < 0) return;
|
|
2427
|
+
y = Je(y, u);
|
|
2428
|
+
const { from: b, to: f } = u.state.selection, k = b - f, D = Je(b, u);
|
|
2429
|
+
let v = !1;
|
|
2425
2430
|
const h = u.state.doc.resolve(D);
|
|
2426
|
-
if (h.node().type.name === "doc")
|
|
2431
|
+
if (h.node().type.name === "doc") v = !0;
|
|
2427
2432
|
else {
|
|
2428
2433
|
const Z = ue.create(
|
|
2429
2434
|
u.state.doc,
|
|
2430
2435
|
h.before()
|
|
2431
2436
|
);
|
|
2432
|
-
|
|
2437
|
+
v = !(y + 1 >= Z.$from.pos && y <= Z.$to.pos);
|
|
2433
2438
|
}
|
|
2434
2439
|
let S = u.state.selection;
|
|
2435
|
-
if (!
|
|
2440
|
+
if (!v && k !== 0 && !(u.state.selection instanceof ue)) {
|
|
2436
2441
|
const Z = ue.create(u.state.doc, f - 1);
|
|
2437
2442
|
S = _r.create(
|
|
2438
2443
|
u.state.doc,
|
|
2439
|
-
|
|
2444
|
+
y,
|
|
2440
2445
|
Z.$to.pos
|
|
2441
2446
|
);
|
|
2442
|
-
} else if (S = ue.create(u.state.doc,
|
|
2447
|
+
} else if (S = ue.create(u.state.doc, y), S.node.type.isInline || S.node.type.name === "tableRow") {
|
|
2443
2448
|
const Z = u.state.doc.resolve(S.from);
|
|
2444
2449
|
S = ue.create(u.state.doc, Z.before());
|
|
2445
2450
|
}
|
|
@@ -2455,15 +2460,15 @@ function Ta(t) {
|
|
|
2455
2460
|
n && n.classList.remove("hide");
|
|
2456
2461
|
}
|
|
2457
2462
|
function l(c, u) {
|
|
2458
|
-
const g = Je(u, c),
|
|
2459
|
-
c.dispatch(c.state.tr.setSelection(
|
|
2463
|
+
const g = Je(u, c), y = ue.create(c.state.doc, g);
|
|
2464
|
+
c.dispatch(c.state.tr.setSelection(y)), c.focus(), o = !0;
|
|
2460
2465
|
}
|
|
2461
2466
|
function d(c) {
|
|
2462
2467
|
if (o = c.state.selection instanceof ue, o && (n != null && n.dataset.nodePos)) {
|
|
2463
2468
|
const g = parseInt(n.dataset.nodePos, 10);
|
|
2464
2469
|
try {
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2470
|
+
const y = c.state.doc.resolve(g);
|
|
2471
|
+
y && y.parent && y.parent.type.name !== "doc" || (o = !1, a());
|
|
2467
2472
|
} catch {
|
|
2468
2473
|
o = !1, a();
|
|
2469
2474
|
}
|
|
@@ -2477,40 +2482,40 @@ function Ta(t) {
|
|
|
2477
2482
|
o || a();
|
|
2478
2483
|
return;
|
|
2479
2484
|
}
|
|
2480
|
-
const g = u.closest(".drag-handle") || u.classList.contains("drag-handle"),
|
|
2481
|
-
!g && !
|
|
2485
|
+
const g = u.closest(".drag-handle") || u.classList.contains("drag-handle"), y = u.closest(".tiptap") || u.classList.contains("tiptap");
|
|
2486
|
+
!g && !y && !o && a();
|
|
2482
2487
|
}
|
|
2483
2488
|
return new Er({
|
|
2484
2489
|
key: new zr(t.pluginKey),
|
|
2485
2490
|
view: (c) => {
|
|
2486
|
-
var f, k, D,
|
|
2491
|
+
var f, k, D, v;
|
|
2487
2492
|
const u = t.dragHandleSelector ? document.querySelector(t.dragHandleSelector) : null;
|
|
2488
2493
|
n = u ?? document.createElement("div"), n.draggable = !0, n.dataset.dragHandle = "", n.classList.add("drag-handle");
|
|
2489
2494
|
function g(h) {
|
|
2490
2495
|
r(h, c);
|
|
2491
2496
|
}
|
|
2492
2497
|
n.addEventListener("dragstart", g);
|
|
2493
|
-
function
|
|
2498
|
+
function y(h) {
|
|
2494
2499
|
u || (h.preventDefault(), h.stopPropagation());
|
|
2495
2500
|
const S = n == null ? void 0 : n.dataset.nodePos;
|
|
2496
2501
|
S && l(c, parseInt(S, 10));
|
|
2497
2502
|
}
|
|
2498
|
-
n.addEventListener("click",
|
|
2499
|
-
function
|
|
2503
|
+
n.addEventListener("click", y);
|
|
2504
|
+
function b(h) {
|
|
2500
2505
|
a();
|
|
2501
2506
|
const S = window.scrollY;
|
|
2502
2507
|
h.clientY < t.scrollTreshold ? window.scrollTo({ top: S - 30, behavior: "smooth" }) : window.innerHeight - h.clientY < t.scrollTreshold && window.scrollTo({ top: S + 30, behavior: "smooth" });
|
|
2503
2508
|
}
|
|
2504
|
-
return n.addEventListener("drag",
|
|
2509
|
+
return n.addEventListener("drag", b), a(), u || (k = (f = c == null ? void 0 : c.dom) == null ? void 0 : f.parentElement) == null || k.appendChild(n), (v = (D = c == null ? void 0 : c.dom) == null ? void 0 : D.parentElement) == null || v.addEventListener(
|
|
2505
2510
|
"mouseout",
|
|
2506
2511
|
m
|
|
2507
2512
|
), {
|
|
2508
2513
|
destroy: () => {
|
|
2509
2514
|
var h, S, N;
|
|
2510
|
-
u || (h = n == null ? void 0 : n.remove) == null || h.call(n), n == null || n.removeEventListener("drag",
|
|
2515
|
+
u || (h = n == null ? void 0 : n.remove) == null || h.call(n), n == null || n.removeEventListener("drag", b), n == null || n.removeEventListener(
|
|
2511
2516
|
"dragstart",
|
|
2512
2517
|
g
|
|
2513
|
-
), n == null || n.removeEventListener("click",
|
|
2518
|
+
), n == null || n.removeEventListener("click", y), n = null, (N = (S = c == null ? void 0 : c.dom) == null ? void 0 : S.parentElement) == null || N.removeEventListener(
|
|
2514
2519
|
"mouseout",
|
|
2515
2520
|
m
|
|
2516
2521
|
);
|
|
@@ -2528,8 +2533,8 @@ function Ta(t) {
|
|
|
2528
2533
|
y: u.clientY
|
|
2529
2534
|
},
|
|
2530
2535
|
t
|
|
2531
|
-
),
|
|
2532
|
-
if (!(g instanceof Element) || g.matches(
|
|
2536
|
+
), y = g == null ? void 0 : g.closest(".not-draggable"), b = t.excludedTags.concat(["ol", "ul"]).join(", ");
|
|
2537
|
+
if (!(g instanceof Element) || g.matches(b) || y) {
|
|
2533
2538
|
o || a();
|
|
2534
2539
|
return;
|
|
2535
2540
|
}
|
|
@@ -2537,8 +2542,8 @@ function Ta(t) {
|
|
|
2537
2542
|
f != null && f >= 0 && (n.dataset.nodePos = String(
|
|
2538
2543
|
Je(f, c)
|
|
2539
2544
|
));
|
|
2540
|
-
const k = window.getComputedStyle(g), D = parseInt(k.lineHeight, 10),
|
|
2541
|
-
S.top += (
|
|
2545
|
+
const k = window.getComputedStyle(g), D = parseInt(k.lineHeight, 10), v = isNaN(D) ? parseInt(k.fontSize) * 1.2 : D, h = parseInt(k.paddingTop, 10), S = Ma(g);
|
|
2546
|
+
S.top += (v - 24) / 2, S.top += h, g.matches("ul:not([data-type=taskList]) li, ol li") && (S.left -= t.dragHandleWidth - 28), S.width = t.dragHandleWidth, n && (n.style.position = "absolute", n.style.left = `${S.left - S.width}px`, n.style.top = `${S.top}px`, s());
|
|
2542
2547
|
},
|
|
2543
2548
|
keydown: () => {
|
|
2544
2549
|
o || a();
|
|
@@ -2558,18 +2563,18 @@ function Ta(t) {
|
|
|
2558
2563
|
var k;
|
|
2559
2564
|
c.dom.classList.remove("dragging"), a();
|
|
2560
2565
|
let g = null;
|
|
2561
|
-
const
|
|
2566
|
+
const y = c.posAtCoords({
|
|
2562
2567
|
left: u.clientX,
|
|
2563
2568
|
top: u.clientY
|
|
2564
2569
|
});
|
|
2565
|
-
if (!
|
|
2566
|
-
const f = c.state.doc.resolve(
|
|
2570
|
+
if (!y || (c.state.selection instanceof ue && (g = c.state.selection.node), !g)) return;
|
|
2571
|
+
const f = c.state.doc.resolve(y.pos).parent.type.name === "listItem";
|
|
2567
2572
|
if (c.state.selection instanceof ue && c.state.selection.node.type.name === "listItem" && !f && e == "OL") {
|
|
2568
2573
|
const D = (k = c.state.schema.nodes.orderedList) == null ? void 0 : k.createAndFill(
|
|
2569
2574
|
null,
|
|
2570
2575
|
g
|
|
2571
|
-
),
|
|
2572
|
-
c.dragging = { slice:
|
|
2576
|
+
), v = new Br($r.from(D), 0, 0);
|
|
2577
|
+
c.dragging = { slice: v, move: u.ctrlKey };
|
|
2573
2578
|
}
|
|
2574
2579
|
},
|
|
2575
2580
|
dragend: (c) => {
|
|
@@ -2582,11 +2587,11 @@ function Ta(t) {
|
|
|
2582
2587
|
init() {
|
|
2583
2588
|
return {};
|
|
2584
2589
|
},
|
|
2585
|
-
apply(c, u, g,
|
|
2590
|
+
apply(c, u, g, y) {
|
|
2586
2591
|
if (c.docChanged && n && n.dataset.nodePos) {
|
|
2587
|
-
const
|
|
2592
|
+
const b = parseInt(n.dataset.nodePos, 10);
|
|
2588
2593
|
try {
|
|
2589
|
-
const f =
|
|
2594
|
+
const f = y.doc.resolve(b);
|
|
2590
2595
|
(!f || f.parent.type.name === "doc") && (o = !1, a());
|
|
2591
2596
|
} catch {
|
|
2592
2597
|
o = !1, a();
|
|
@@ -4044,9 +4049,9 @@ const hi = ({ children: t, ...e }) => {
|
|
|
4044
4049
|
editorRef: m,
|
|
4045
4050
|
enableAI: c = !1,
|
|
4046
4051
|
aiOptions: u
|
|
4047
|
-
} = t, [g,
|
|
4052
|
+
} = t, [g, y] = E(
|
|
4048
4053
|
o
|
|
4049
|
-
), [
|
|
4054
|
+
), [b, f] = E("Saved"), [k, D] = E(), [v, h] = E(!1), [S, N] = E(!1), [L, Y] = E(!1), [Z, R] = E(!1), P = (C) => {
|
|
4050
4055
|
const j = new DOMParser().parseFromString(C, "text/html");
|
|
4051
4056
|
return j.querySelectorAll("pre code").forEach((re) => {
|
|
4052
4057
|
aa.highlightElement(re);
|
|
@@ -4112,7 +4117,7 @@ const hi = ({ children: t, ...e }) => {
|
|
|
4112
4117
|
if (q(() => {
|
|
4113
4118
|
if (!a) return;
|
|
4114
4119
|
const C = window.localStorage.getItem(n);
|
|
4115
|
-
|
|
4120
|
+
y(C ? JSON.parse(C) : pi);
|
|
4116
4121
|
}, [n, a]), !g) return null;
|
|
4117
4122
|
const te = [
|
|
4118
4123
|
...ho,
|
|
@@ -4122,7 +4127,7 @@ const hi = ({ children: t, ...e }) => {
|
|
|
4122
4127
|
];
|
|
4123
4128
|
return /* @__PURE__ */ p("div", { className: T("relative w-full max-w-screen-lg", e), children: [
|
|
4124
4129
|
(a && s || l) && /* @__PURE__ */ p("div", { className: "flex absolute right-5 top-5 z-10 mb-5 gap-2", children: [
|
|
4125
|
-
a && s && /* @__PURE__ */ i("div", { className: "rounded-lg bg-accent px-2 py-1 text-sm text-muted-foreground", children:
|
|
4130
|
+
a && s && /* @__PURE__ */ i("div", { className: "rounded-lg bg-accent px-2 py-1 text-sm text-muted-foreground", children: b }),
|
|
4126
4131
|
l && /* @__PURE__ */ p(
|
|
4127
4132
|
"div",
|
|
4128
4133
|
{
|
|
@@ -4188,7 +4193,7 @@ const hi = ({ children: t, ...e }) => {
|
|
|
4188
4193
|
aiOptions: u,
|
|
4189
4194
|
children: [
|
|
4190
4195
|
c && /* @__PURE__ */ i(Be, { orientation: "vertical" }),
|
|
4191
|
-
/* @__PURE__ */ i(Ja, { open:
|
|
4196
|
+
/* @__PURE__ */ i(Ja, { open: v, onOpenChange: h }),
|
|
4192
4197
|
/* @__PURE__ */ i(Be, { orientation: "vertical" }),
|
|
4193
4198
|
/* @__PURE__ */ i(Za, { open: L, onOpenChange: Y }),
|
|
4194
4199
|
/* @__PURE__ */ i(Be, { orientation: "vertical" }),
|
|
@@ -4591,13 +4596,13 @@ function Ai(t, e) {
|
|
|
4591
4596
|
return;
|
|
4592
4597
|
if (!g)
|
|
4593
4598
|
throw new Error("Invalid mapLib");
|
|
4594
|
-
const
|
|
4595
|
-
if (!
|
|
4599
|
+
const y = "Map" in g ? g : g.default;
|
|
4600
|
+
if (!y.Map)
|
|
4596
4601
|
throw new Error("Invalid mapLib");
|
|
4597
|
-
Ti(
|
|
4602
|
+
Ti(y, t), t.reuseMaps && (u = Oe.reuse(t, a.current)), u || (u = new Oe(y.Map, t, a.current)), s.map = Ii(u), s.mapLib = y, n(u), o == null || o.onMapMount(s.map, t.id);
|
|
4598
4603
|
}).catch((g) => {
|
|
4599
|
-
const { onError:
|
|
4600
|
-
|
|
4604
|
+
const { onError: y } = t;
|
|
4605
|
+
y ? y({
|
|
4601
4606
|
type: "error",
|
|
4602
4607
|
target: null,
|
|
4603
4608
|
originalEvent: null,
|
|
@@ -4652,10 +4657,10 @@ const dt = be(qe((t, e) => {
|
|
|
4652
4657
|
J.Children.forEach(t.children, (S) => {
|
|
4653
4658
|
S && (D = !0);
|
|
4654
4659
|
});
|
|
4655
|
-
const
|
|
4660
|
+
const v = {
|
|
4656
4661
|
...t,
|
|
4657
4662
|
element: D ? document.createElement("div") : void 0
|
|
4658
|
-
}, h = new r.Marker(
|
|
4663
|
+
}, h = new r.Marker(v);
|
|
4659
4664
|
return h.setLngLat([t.longitude, t.latitude]), h.getElement().addEventListener("click", (S) => {
|
|
4660
4665
|
var N, L;
|
|
4661
4666
|
(L = (N = n.current.props).onClick) == null || L.call(N, {
|
|
@@ -4680,12 +4685,12 @@ const dt = be(qe((t, e) => {
|
|
|
4680
4685
|
q(() => (a.addTo(o.getMap()), () => {
|
|
4681
4686
|
a.remove();
|
|
4682
4687
|
}), []);
|
|
4683
|
-
const { longitude: s, latitude: l, offset: d, style: m, draggable: c = !1, popup: u = null, rotation: g = 0, rotationAlignment:
|
|
4688
|
+
const { longitude: s, latitude: l, offset: d, style: m, draggable: c = !1, popup: u = null, rotation: g = 0, rotationAlignment: y = "auto", pitchAlignment: b = "auto" } = t;
|
|
4684
4689
|
q(() => {
|
|
4685
4690
|
ve(a.getElement(), m);
|
|
4686
4691
|
}, [m]), rt(e, () => a, []);
|
|
4687
4692
|
const f = n.current.props;
|
|
4688
|
-
(a.getLngLat().lng !== s || a.getLngLat().lat !== l) && a.setLngLat([s, l]), d && !ki(a.getOffset(), d) && a.setOffset(d), a.isDraggable() !== c && a.setDraggable(c), a.getRotation() !== g && a.setRotation(g), a.getRotationAlignment() !==
|
|
4693
|
+
(a.getLngLat().lng !== s || a.getLngLat().lat !== l) && a.setLngLat([s, l]), d && !ki(a.getOffset(), d) && a.setOffset(d), a.isDraggable() !== c && a.setDraggable(c), a.getRotation() !== g && a.setRotation(g), a.getRotationAlignment() !== y && a.setRotationAlignment(y), a.getPitchAlignment() !== b && a.setPitchAlignment(b), a.getPopup() !== u && a.setPopup(u);
|
|
4689
4694
|
const k = Io(f.className, t.className);
|
|
4690
4695
|
if (k)
|
|
4691
4696
|
for (const D of k)
|
|
@@ -4978,32 +4983,32 @@ const qi = (t) => {
|
|
|
4978
4983
|
);
|
|
4979
4984
|
if (e.features.forEach((g) => {
|
|
4980
4985
|
if (!g.properties || !g.properties.adcode) return;
|
|
4981
|
-
const { adcode:
|
|
4982
|
-
if (!
|
|
4986
|
+
const { adcode: y } = g.properties, b = u.get(y);
|
|
4987
|
+
if (!b) return;
|
|
4983
4988
|
let f = qi(g);
|
|
4984
|
-
if (!f &&
|
|
4985
|
-
const { longitude: N, latitude: L } =
|
|
4989
|
+
if (!f && b) {
|
|
4990
|
+
const { longitude: N, latitude: L } = b;
|
|
4986
4991
|
f = [N - 2, L - 2, N + 2, L + 2];
|
|
4987
4992
|
}
|
|
4988
4993
|
if (!f) return;
|
|
4989
|
-
const [k, D,
|
|
4990
|
-
!(
|
|
4994
|
+
const [k, D, v, h] = f;
|
|
4995
|
+
!(v < n || // 省份完全在视图左侧
|
|
4991
4996
|
k > a || // 省份完全在视图右侧
|
|
4992
4997
|
h < s || // 省份完全在视图下方
|
|
4993
|
-
D > l) && c.push(
|
|
4998
|
+
D > l) && c.push(b);
|
|
4994
4999
|
}), c.length < 3 && (console.log("找到的相交区域太少,尝试其他检查方法..."), o.forEach((g) => {
|
|
4995
5000
|
if (c.some((k) => k.code === g.code)) return;
|
|
4996
|
-
const { longitude:
|
|
4997
|
-
|
|
5001
|
+
const { longitude: b, latitude: f } = g;
|
|
5002
|
+
b >= n && b <= a && f >= s && f <= l && c.push(g);
|
|
4998
5003
|
}), c.length < 3 && (d > 10 || m > 10))) {
|
|
4999
5004
|
console.log("扩大检查范围...");
|
|
5000
|
-
const g = n - 2,
|
|
5005
|
+
const g = n - 2, y = a + 2, b = s - 2, f = l + 2;
|
|
5001
5006
|
o.forEach((k) => {
|
|
5002
5007
|
if (c.some(
|
|
5003
5008
|
(S) => S.code === k.code
|
|
5004
5009
|
)) return;
|
|
5005
|
-
const { longitude:
|
|
5006
|
-
|
|
5010
|
+
const { longitude: v, latitude: h } = k;
|
|
5011
|
+
v >= g && v <= y && h >= b && h <= f && c.push(k);
|
|
5007
5012
|
});
|
|
5008
5013
|
}
|
|
5009
5014
|
return console.log(`找到 ${c.length} 个区域与视图相交`), c;
|
|
@@ -5036,7 +5041,7 @@ const qi = (t) => {
|
|
|
5036
5041
|
fetchGeoData: c,
|
|
5037
5042
|
children: u
|
|
5038
5043
|
}) => {
|
|
5039
|
-
const g = ne(null), [
|
|
5044
|
+
const g = ne(null), [y, b] = E(Et), [f, k] = E(null), [D, v] = E(t), [h, S] = E([]), N = ne({}), [L, Y] = E({}), [Z, R] = E({}), [P, O] = E(!1), [F, te] = E([]), [C, j] = E({}), [re, Ne] = E({}), [oe, xe] = E(!1), [Ie, Le] = E([]), ae = Q(
|
|
5040
5045
|
() => c || Yi,
|
|
5041
5046
|
[c]
|
|
5042
5047
|
), { run: Me } = Ho(
|
|
@@ -5209,8 +5214,8 @@ const qi = (t) => {
|
|
|
5209
5214
|
m
|
|
5210
5215
|
]);
|
|
5211
5216
|
q(() => {
|
|
5212
|
-
Me(
|
|
5213
|
-
}, [
|
|
5217
|
+
Me(y);
|
|
5218
|
+
}, [y, Me]), q(() => {
|
|
5214
5219
|
if (g.current && h.length > 0) {
|
|
5215
5220
|
const x = requestAnimationFrame(() => {
|
|
5216
5221
|
A();
|
|
@@ -5234,16 +5239,16 @@ const qi = (t) => {
|
|
|
5234
5239
|
west: w.getWest()
|
|
5235
5240
|
}, _ = !N.current.bounds || Math.abs(N.current.bounds.north - B.north) >= 1e-3 || Math.abs(N.current.bounds.south - B.south) >= 1e-3 || Math.abs(N.current.bounds.east - B.east) >= 1e-3 || Math.abs(N.current.bounds.west - B.west) >= 1e-3;
|
|
5236
5241
|
if (ie) {
|
|
5237
|
-
|
|
5242
|
+
v(W), N.current.zoom = W;
|
|
5238
5243
|
let se = 6;
|
|
5239
5244
|
for (const [Lo, Mo] of Object.entries(n))
|
|
5240
5245
|
W >= Mo && (se = parseInt(Lo, 10));
|
|
5241
|
-
|
|
5246
|
+
y.length !== se && b(Et);
|
|
5242
5247
|
}
|
|
5243
5248
|
(_ || ie) && A();
|
|
5244
5249
|
}
|
|
5245
5250
|
},
|
|
5246
|
-
[
|
|
5251
|
+
[y, n, D, A]
|
|
5247
5252
|
), X = Ae(() => {
|
|
5248
5253
|
h.length > 0 && g.current && A();
|
|
5249
5254
|
}, [h, A]), z = Q(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zs_library",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"homepage": "https://zs-library.virs.xyz/",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/virzs/zs_library/issues"
|
|
@@ -27,15 +27,6 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "tsc -b && vite build",
|
|
32
|
-
"dev": "vite",
|
|
33
|
-
"docs:build": "vite build && rspress build",
|
|
34
|
-
"docs:dev": "rspress dev --host 0.0.0.0 --port 4372",
|
|
35
|
-
"docs:preview": "rspress preview",
|
|
36
|
-
"lint": "eslint .",
|
|
37
|
-
"prepare": "husky"
|
|
38
|
-
},
|
|
39
30
|
"dependencies": {
|
|
40
31
|
"@ai-sdk/react": "^1.1.17",
|
|
41
32
|
"@emotion/css": "^11.13.5",
|
|
@@ -55,6 +46,7 @@
|
|
|
55
46
|
"@tiptap/pm": "^2.11.5",
|
|
56
47
|
"@types/polylabel": "^1.1.3",
|
|
57
48
|
"ahooks": "^3.8.4",
|
|
49
|
+
"bumpp": "^10.1.1",
|
|
58
50
|
"class-variance-authority": "^0.7.1",
|
|
59
51
|
"clsx": "^2.1.1",
|
|
60
52
|
"cmdk": "^1.0.4",
|
|
@@ -142,9 +134,13 @@
|
|
|
142
134
|
"react": ">=18.0.0 <19.0.0",
|
|
143
135
|
"react-dom": ">=18.0.0 <19.0.0"
|
|
144
136
|
},
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
"scripts": {
|
|
138
|
+
"release": "bumpp && pnpm vite build && pnpm publish",
|
|
139
|
+
"build": "tsc -b && vite build",
|
|
140
|
+
"dev": "vite",
|
|
141
|
+
"docs:build": "vite build && rspress build",
|
|
142
|
+
"docs:dev": "rspress dev --host 0.0.0.0 --port 4372",
|
|
143
|
+
"docs:preview": "rspress preview",
|
|
144
|
+
"lint": "eslint ."
|
|
149
145
|
}
|
|
150
|
-
}
|
|
146
|
+
}
|