@arronqzy/react-view 1.0.22 → 1.0.24
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/package.json +11 -11
- package/src/panel/ReactViewPanel.tsx +109 -965
- package/src/panel/components/PanelConfigSidebar.tsx +297 -3712
- package/src/panel/components/PanelHistoryPopover.tsx +163 -0
- package/src/panel/components/PanelLayerDock.tsx +412 -0
- package/src/panel/components/PanelMenubar.tsx +149 -0
- package/src/panel/components/PanelWorkspaceDialogs.tsx +271 -0
- package/src/panel/components/config/PanelConfigAudioSection.tsx +334 -0
- package/src/panel/components/config/PanelConfigChartSection.tsx +799 -0
- package/src/panel/components/config/PanelConfigGeometrySection.tsx +233 -0
- package/src/panel/components/config/PanelConfigGridChildSpan.tsx +70 -0
- package/src/panel/components/config/PanelConfigGridSection.tsx +118 -0
- package/src/panel/components/config/PanelConfigMultiSelect.tsx +1291 -0
- package/src/panel/components/config/PanelConfigNodeInfo.tsx +169 -0
- package/src/panel/components/config/PanelConfigReferenceSection.tsx +99 -0
- package/src/panel/components/config/PanelConfigScene3dSection.tsx +6 -2
- package/src/panel/components/config/PanelConfigStyleSections.tsx +249 -0
- package/src/panel/components/config/PanelConfigTextSection.tsx +268 -0
- package/src/panel/components/config/PanelConfigVideoSection.tsx +133 -0
- package/src/panel/components/config/PanelConfigViewportSection.tsx +139 -0
- package/src/panel/components/config/helpers.ts +85 -0
- package/src/panel/icons.tsx +160 -0
- package/src/panel/utils/panelSelection.ts +57 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export function IconPlus() {
|
|
4
|
+
return (
|
|
5
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
6
|
+
<path d="M12 5v14M5 12h14" />
|
|
7
|
+
</svg>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function IconMerge() {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
14
|
+
<path d="M7 7h4a4 4 0 0 1 4 4v6" />
|
|
15
|
+
<path d="m12 14 3 3 3-3" />
|
|
16
|
+
<path d="M7 17h2" />
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function IconLock({ locked }: { locked: boolean }) {
|
|
22
|
+
return locked ? (
|
|
23
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
24
|
+
<rect x="4" y="11" width="16" height="9" rx="2" />
|
|
25
|
+
<path d="M8 11V8a4 4 0 0 1 8 0v3" />
|
|
26
|
+
</svg>
|
|
27
|
+
) : (
|
|
28
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
29
|
+
<rect x="4" y="11" width="16" height="9" rx="2" />
|
|
30
|
+
<path d="M16 11V8a4 4 0 0 0-7-2.5" />
|
|
31
|
+
</svg>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function IconEdit() {
|
|
36
|
+
return (
|
|
37
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
38
|
+
<path d="M12 20h9" />
|
|
39
|
+
<path d="m16.5 3.5 4 4L8 20l-5 1 1-5Z" />
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function IconTrash() {
|
|
45
|
+
return (
|
|
46
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
47
|
+
<path d="M3 6h18" />
|
|
48
|
+
<path d="M8 6V4h8v2" />
|
|
49
|
+
<path d="M19 6l-1 14H6L5 6" />
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function IconCheck() {
|
|
55
|
+
return (
|
|
56
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
57
|
+
<path d="m5 12 5 5L20 7" />
|
|
58
|
+
</svg>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function IconClose() {
|
|
63
|
+
return (
|
|
64
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
65
|
+
<path d="M6 6l12 12M18 6 6 18" />
|
|
66
|
+
</svg>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function IconChevron({ expanded }: { expanded: boolean }) {
|
|
71
|
+
return (
|
|
72
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
73
|
+
{expanded ? <path d="m6 14 6-6 6 6" /> : <path d="m6 10 6 6 6-6" />}
|
|
74
|
+
</svg>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function IconUndo() {
|
|
79
|
+
return (
|
|
80
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
81
|
+
<path d="M9 14 4 9l5-5" />
|
|
82
|
+
<path d="M20 20a9 9 0 0 0-9-9H4" />
|
|
83
|
+
</svg>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function IconRedo() {
|
|
88
|
+
return (
|
|
89
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
90
|
+
<path d="m15 14 5-5-5-5" />
|
|
91
|
+
<path d="M4 20a9 9 0 0 1 9-9h7" />
|
|
92
|
+
</svg>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function IconHistory() {
|
|
97
|
+
return (
|
|
98
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
99
|
+
<path d="M3 12a9 9 0 1 0 3-6.7" />
|
|
100
|
+
<path d="M3 4v4h4" />
|
|
101
|
+
<path d="M12 7v5l3 2" />
|
|
102
|
+
</svg>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function IconBringFront() {
|
|
107
|
+
return (
|
|
108
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
109
|
+
<path d="M7 17h10M12 17V7" />
|
|
110
|
+
<path d="m8.5 9 3.5-3.5L15.5 9" />
|
|
111
|
+
</svg>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function IconSendBack() {
|
|
116
|
+
return (
|
|
117
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
118
|
+
<path d="M7 7h10M12 17V7" />
|
|
119
|
+
<path d="m15.5 15-3.5 3.5L8.5 15" />
|
|
120
|
+
</svg>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function IconForward() {
|
|
125
|
+
return (
|
|
126
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
127
|
+
<path d="M12 18V6" />
|
|
128
|
+
<path d="m8.5 9 3.5-3.5L15.5 9" />
|
|
129
|
+
</svg>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function IconBackward() {
|
|
134
|
+
return (
|
|
135
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
136
|
+
<path d="M12 6v12" />
|
|
137
|
+
<path d="m15.5 15-3.5 3.5L8.5 15" />
|
|
138
|
+
</svg>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function IconLayers() {
|
|
143
|
+
return (
|
|
144
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
145
|
+
<path d="m12 4 8 4-8 4-8-4 8-4Z" />
|
|
146
|
+
<path d="m4 12 8 4 8-4" />
|
|
147
|
+
<path d="m4 16 8 4 8-4" />
|
|
148
|
+
</svg>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function IconImage() {
|
|
153
|
+
return (
|
|
154
|
+
<svg viewBox="0 0 24 24" className="h-3.5 w-3.5" fill="none" stroke="currentColor" strokeWidth="2">
|
|
155
|
+
<rect x="3" y="5" width="18" height="14" rx="2" />
|
|
156
|
+
<circle cx="9" cy="10" r="1.5" />
|
|
157
|
+
<path d="m21 16-5.5-5.5L7 19" />
|
|
158
|
+
</svg>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export function formatRelativeTime(
|
|
2
|
+
timestamp: number,
|
|
3
|
+
now: number,
|
|
4
|
+
t: (key: string, params?: Record<string, string | number>) => string
|
|
5
|
+
): string {
|
|
6
|
+
const diff = Math.max(0, now - timestamp);
|
|
7
|
+
const sec = Math.floor(diff / 1000);
|
|
8
|
+
if (sec < 60) return t("common.secondsAgo", { sec });
|
|
9
|
+
const min = Math.floor(sec / 60);
|
|
10
|
+
if (min < 60) return t("common.minutesAgo", { min });
|
|
11
|
+
const hour = Math.floor(min / 60);
|
|
12
|
+
if (hour < 24) return t("common.hoursAgo", { hour });
|
|
13
|
+
const day = Math.floor(hour / 24);
|
|
14
|
+
return t("common.daysAgo", { day });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getSelectedTargetsFromIds(
|
|
18
|
+
container: HTMLElement | null,
|
|
19
|
+
ids: string[],
|
|
20
|
+
) {
|
|
21
|
+
if (!container) return [];
|
|
22
|
+
const targets: HTMLElement[] = [];
|
|
23
|
+
for (const id of ids) {
|
|
24
|
+
const el = container.querySelector<HTMLElement>(
|
|
25
|
+
`[data-element-id="${id}"]`,
|
|
26
|
+
);
|
|
27
|
+
if (el) targets.push(el);
|
|
28
|
+
}
|
|
29
|
+
return targets;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function shouldClearSelectionOnBlank(target: HTMLElement | null) {
|
|
33
|
+
if (!target) return false;
|
|
34
|
+
if (
|
|
35
|
+
target.closest(".rv-selectable") ||
|
|
36
|
+
target.closest(".moveable-control-box") ||
|
|
37
|
+
target.closest(".moveable-group") ||
|
|
38
|
+
target.closest(".moveable-line") ||
|
|
39
|
+
target.closest(".moveable-control") ||
|
|
40
|
+
target.closest(".moveable-direction")
|
|
41
|
+
) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (
|
|
45
|
+
target.closest("button") ||
|
|
46
|
+
target.closest("input") ||
|
|
47
|
+
target.closest("select") ||
|
|
48
|
+
target.closest("textarea") ||
|
|
49
|
+
target.closest("label") ||
|
|
50
|
+
target.closest("a") ||
|
|
51
|
+
target.closest("[role='menuitem']") ||
|
|
52
|
+
target.closest("[data-radix-popper-content-wrapper]")
|
|
53
|
+
) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|