@kubuild/editor 0.1.2 → 0.1.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/index.cjs +43 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -28
- package/dist/index.js.map +1 -1
- package/dist/layers-panel.d.ts.map +1 -1
- package/dist/table-spreadsheet-editor.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -3208,15 +3208,18 @@ var TableSpreadsheetEditor = ({
|
|
|
3208
3208
|
setIsImportModalOpen(false);
|
|
3209
3209
|
setCsvInputText("");
|
|
3210
3210
|
};
|
|
3211
|
-
const [pos, setPos] = (0, import_react7.useState)(
|
|
3211
|
+
const [pos, setPos] = (0, import_react7.useState)(() => ({
|
|
3212
|
+
x: typeof window !== "undefined" ? Math.max(10, Math.min(window.innerWidth - 400, 20)) : 20,
|
|
3213
|
+
y: 120
|
|
3214
|
+
}));
|
|
3212
3215
|
const [isDragging, setIsDragging] = (0, import_react7.useState)(false);
|
|
3213
3216
|
const dragStartRef = (0, import_react7.useRef)({
|
|
3214
3217
|
startX: 0,
|
|
3215
3218
|
startY: 0,
|
|
3216
|
-
posX:
|
|
3219
|
+
posX: 20,
|
|
3217
3220
|
posY: 120
|
|
3218
3221
|
});
|
|
3219
|
-
const
|
|
3222
|
+
const handleHeaderPointerDown = (e) => {
|
|
3220
3223
|
if (e.target.closest("button, input, select, textarea")) return;
|
|
3221
3224
|
setIsDragging(true);
|
|
3222
3225
|
dragStartRef.current = {
|
|
@@ -3228,22 +3231,26 @@ var TableSpreadsheetEditor = ({
|
|
|
3228
3231
|
};
|
|
3229
3232
|
(0, import_react7.useEffect)(() => {
|
|
3230
3233
|
if (!isDragging) return;
|
|
3231
|
-
const
|
|
3234
|
+
const handlePointerMove = (e) => {
|
|
3232
3235
|
const dx = e.clientX - dragStartRef.current.startX;
|
|
3233
3236
|
const dy = e.clientY - dragStartRef.current.startY;
|
|
3237
|
+
const maxX = Math.max(8, window.innerWidth - 320);
|
|
3238
|
+
const maxY = Math.max(8, window.innerHeight - 100);
|
|
3234
3239
|
setPos({
|
|
3235
|
-
x: Math.max(
|
|
3236
|
-
y: Math.max(
|
|
3240
|
+
x: Math.max(8, Math.min(maxX, dragStartRef.current.posX + dx)),
|
|
3241
|
+
y: Math.max(8, Math.min(maxY, dragStartRef.current.posY + dy))
|
|
3237
3242
|
});
|
|
3238
3243
|
};
|
|
3239
|
-
const
|
|
3244
|
+
const handlePointerUp = () => {
|
|
3240
3245
|
setIsDragging(false);
|
|
3241
3246
|
};
|
|
3242
|
-
window.addEventListener("
|
|
3243
|
-
window.addEventListener("
|
|
3247
|
+
window.addEventListener("pointermove", handlePointerMove);
|
|
3248
|
+
window.addEventListener("pointerup", handlePointerUp);
|
|
3249
|
+
window.addEventListener("pointercancel", handlePointerUp);
|
|
3244
3250
|
return () => {
|
|
3245
|
-
window.removeEventListener("
|
|
3246
|
-
window.removeEventListener("
|
|
3251
|
+
window.removeEventListener("pointermove", handlePointerMove);
|
|
3252
|
+
window.removeEventListener("pointerup", handlePointerUp);
|
|
3253
|
+
window.removeEventListener("pointercancel", handlePointerUp);
|
|
3247
3254
|
};
|
|
3248
3255
|
}, [isDragging]);
|
|
3249
3256
|
if (!tableNode) return null;
|
|
@@ -3797,9 +3804,9 @@ var TableSpreadsheetEditor = ({
|
|
|
3797
3804
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3798
3805
|
"div",
|
|
3799
3806
|
{
|
|
3800
|
-
style: { left: `${pos.x}px`, top: `${pos.y}px
|
|
3801
|
-
|
|
3802
|
-
className: `fixed z-40 min-w-[380px] max-w-[620px] bg-white/95 backdrop-blur-md rounded-xl shadow-2xl border border-slate-300 flex flex-col max-h-[460px] overflow-hidden ${className}`,
|
|
3807
|
+
style: { left: `${pos.x}px`, top: `${pos.y}px`, touchAction: "none" },
|
|
3808
|
+
onPointerDown: handleHeaderPointerDown,
|
|
3809
|
+
className: `fixed z-40 min-w-[320px] sm:min-w-[380px] max-w-[620px] bg-white/95 backdrop-blur-md rounded-xl shadow-2xl border border-slate-300 flex flex-col max-h-[460px] overflow-hidden cursor-grab active:cursor-grabbing touch-none ${className}`,
|
|
3803
3810
|
children: content
|
|
3804
3811
|
}
|
|
3805
3812
|
)
|
|
@@ -6861,16 +6868,19 @@ var LayersPanel = ({ registry, className }) => {
|
|
|
6861
6868
|
const [expandedIds, setExpandedIds] = (0, import_react14.useState)(() => /* @__PURE__ */ new Set([document2.document.id]));
|
|
6862
6869
|
const [draggingId, setDraggingId] = (0, import_react14.useState)(null);
|
|
6863
6870
|
const [dropCandidate, setDropCandidate] = (0, import_react14.useState)(null);
|
|
6864
|
-
const [pos, setPos] = (0, import_react14.useState)(
|
|
6871
|
+
const [pos, setPos] = (0, import_react14.useState)(() => ({
|
|
6872
|
+
x: typeof window !== "undefined" ? Math.max(12, Math.min(window.innerWidth - 300, 24)) : 24,
|
|
6873
|
+
y: 70
|
|
6874
|
+
}));
|
|
6865
6875
|
const [isDraggingWindow, setIsDraggingWindow] = (0, import_react14.useState)(false);
|
|
6866
6876
|
const dragStartRef = (0, import_react14.useRef)({
|
|
6867
6877
|
startX: 0,
|
|
6868
6878
|
startY: 0,
|
|
6869
|
-
posX:
|
|
6879
|
+
posX: 24,
|
|
6870
6880
|
posY: 70
|
|
6871
6881
|
});
|
|
6872
|
-
const
|
|
6873
|
-
if (e.target.closest("button")) return;
|
|
6882
|
+
const handleHeaderPointerDown = (e) => {
|
|
6883
|
+
if (e.target.closest("button, input, select, textarea")) return;
|
|
6874
6884
|
setIsDraggingWindow(true);
|
|
6875
6885
|
dragStartRef.current = {
|
|
6876
6886
|
startX: e.clientX,
|
|
@@ -6881,22 +6891,26 @@ var LayersPanel = ({ registry, className }) => {
|
|
|
6881
6891
|
};
|
|
6882
6892
|
(0, import_react14.useEffect)(() => {
|
|
6883
6893
|
if (!isDraggingWindow) return;
|
|
6884
|
-
const
|
|
6894
|
+
const handlePointerMove = (e) => {
|
|
6885
6895
|
const dx = e.clientX - dragStartRef.current.startX;
|
|
6886
6896
|
const dy = e.clientY - dragStartRef.current.startY;
|
|
6897
|
+
const maxX = Math.max(8, window.innerWidth - 296);
|
|
6898
|
+
const maxY = Math.max(8, window.innerHeight - 100);
|
|
6887
6899
|
setPos({
|
|
6888
|
-
x: Math.max(
|
|
6889
|
-
y: Math.max(
|
|
6900
|
+
x: Math.max(8, Math.min(maxX, dragStartRef.current.posX + dx)),
|
|
6901
|
+
y: Math.max(8, Math.min(maxY, dragStartRef.current.posY + dy))
|
|
6890
6902
|
});
|
|
6891
6903
|
};
|
|
6892
|
-
const
|
|
6904
|
+
const handlePointerUp = () => {
|
|
6893
6905
|
setIsDraggingWindow(false);
|
|
6894
6906
|
};
|
|
6895
|
-
window.addEventListener("
|
|
6896
|
-
window.addEventListener("
|
|
6907
|
+
window.addEventListener("pointermove", handlePointerMove);
|
|
6908
|
+
window.addEventListener("pointerup", handlePointerUp);
|
|
6909
|
+
window.addEventListener("pointercancel", handlePointerUp);
|
|
6897
6910
|
return () => {
|
|
6898
|
-
window.removeEventListener("
|
|
6899
|
-
window.removeEventListener("
|
|
6911
|
+
window.removeEventListener("pointermove", handlePointerMove);
|
|
6912
|
+
window.removeEventListener("pointerup", handlePointerUp);
|
|
6913
|
+
window.removeEventListener("pointercancel", handlePointerUp);
|
|
6900
6914
|
};
|
|
6901
6915
|
}, [isDraggingWindow]);
|
|
6902
6916
|
(0, import_react14.useEffect)(() => {
|
|
@@ -7047,8 +7061,9 @@ var LayersPanel = ({ registry, className }) => {
|
|
|
7047
7061
|
const header = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
7048
7062
|
"div",
|
|
7049
7063
|
{
|
|
7050
|
-
|
|
7051
|
-
|
|
7064
|
+
onPointerDown: isFloating ? handleHeaderPointerDown : void 0,
|
|
7065
|
+
style: { touchAction: isFloating ? "none" : "auto" },
|
|
7066
|
+
className: `flex items-center justify-between px-3 py-2 border-b border-slate-200/90 select-none ${isFloating ? "cursor-grab active:cursor-grabbing bg-slate-50/90 rounded-t-xl touch-none" : "bg-slate-50"}`,
|
|
7052
7067
|
children: [
|
|
7053
7068
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1.5 font-semibold text-xs text-slate-700", children: [
|
|
7054
7069
|
isFloating && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react7.GripVertical, { className: "w-3 h-3 text-slate-400 mr-0.5", "aria-hidden": "true" }),
|