@noya-app/noya-designsystem 0.1.55 → 0.1.57
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +113 -36
- package/dist/index.d.ts +113 -36
- package/dist/index.js +1042 -665
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +995 -625
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/validateDropIndicator.test.ts +35 -9
- package/src/components/Collection.tsx +3 -0
- package/src/components/List.tsx +4 -0
- package/src/components/ListView.tsx +12 -8
- package/src/components/Toolbar.tsx +15 -2
- package/src/components/sorting/DragRegistration.tsx +107 -0
- package/src/components/sorting/SharedDragProvider.tsx +376 -0
- package/src/components/sorting/Sortable.tsx +357 -0
- package/src/components/sorting/createSharedDrag.tsx +41 -0
- package/src/components/sorting/sorting.ts +215 -0
- package/src/index.tsx +4 -2
- package/src/utils/moveTreeItem.ts +4 -2
- package/src/components/Sortable.tsx +0 -468
package/dist/index.mjs
CHANGED
|
@@ -3668,7 +3668,7 @@ var Chip = memo14(
|
|
|
3668
3668
|
);
|
|
3669
3669
|
|
|
3670
3670
|
// src/components/Collection.tsx
|
|
3671
|
-
import
|
|
3671
|
+
import React51 from "react";
|
|
3672
3672
|
|
|
3673
3673
|
// src/components/Grid.tsx
|
|
3674
3674
|
import React43, { useImperativeHandle as useImperativeHandle3, useRef as useRef17, useState as useState21 } from "react";
|
|
@@ -4410,22 +4410,22 @@ var Grid = memoGeneric(
|
|
|
4410
4410
|
);
|
|
4411
4411
|
|
|
4412
4412
|
// src/components/List.tsx
|
|
4413
|
-
import
|
|
4413
|
+
import React50, { memo as memo19, useImperativeHandle as useImperativeHandle5, useRef as useRef20, useState as useState23 } from "react";
|
|
4414
4414
|
|
|
4415
4415
|
// src/components/ListView.tsx
|
|
4416
4416
|
import { range } from "@noya-app/noya-utils";
|
|
4417
4417
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
4418
|
-
import
|
|
4418
|
+
import React48, {
|
|
4419
4419
|
Children as Children3,
|
|
4420
|
-
createContext as
|
|
4420
|
+
createContext as createContext11,
|
|
4421
4421
|
forwardRef as forwardRef19,
|
|
4422
4422
|
isValidElement as isValidElement3,
|
|
4423
|
-
memo as
|
|
4424
|
-
useCallback as
|
|
4425
|
-
useContext as
|
|
4423
|
+
memo as memo18,
|
|
4424
|
+
useCallback as useCallback23,
|
|
4425
|
+
useContext as useContext11,
|
|
4426
4426
|
useImperativeHandle as useImperativeHandle4,
|
|
4427
4427
|
useLayoutEffect as useLayoutEffect5,
|
|
4428
|
-
useMemo as
|
|
4428
|
+
useMemo as useMemo21,
|
|
4429
4429
|
useRef as useRef19
|
|
4430
4430
|
} from "react";
|
|
4431
4431
|
import { WindowScroller } from "react-virtualized";
|
|
@@ -4454,25 +4454,317 @@ function mergeEventHandlers(...handlerMaps) {
|
|
|
4454
4454
|
);
|
|
4455
4455
|
}
|
|
4456
4456
|
|
|
4457
|
-
// src/components/Sortable.tsx
|
|
4457
|
+
// src/components/sorting/Sortable.tsx
|
|
4458
|
+
import { useDroppable } from "@dnd-kit/core";
|
|
4459
|
+
import {
|
|
4460
|
+
horizontalListSortingStrategy,
|
|
4461
|
+
SortableContext,
|
|
4462
|
+
useSortable,
|
|
4463
|
+
verticalListSortingStrategy
|
|
4464
|
+
} from "@dnd-kit/sortable";
|
|
4465
|
+
import * as React47 from "react";
|
|
4466
|
+
|
|
4467
|
+
// src/components/sorting/DragRegistration.tsx
|
|
4468
|
+
import React44 from "react";
|
|
4469
|
+
var DragRegistrationContext = React44.createContext(null);
|
|
4470
|
+
function useDragRegistration(context) {
|
|
4471
|
+
const value = React44.useContext(context);
|
|
4472
|
+
if (!value) {
|
|
4473
|
+
throw new Error(
|
|
4474
|
+
"useDragRegistration must be used within a DragRegistrationProvider"
|
|
4475
|
+
);
|
|
4476
|
+
}
|
|
4477
|
+
return value;
|
|
4478
|
+
}
|
|
4479
|
+
function useDragRegistrationManager() {
|
|
4480
|
+
const [registeredLists, setRegisteredLists] = React44.useState(/* @__PURE__ */ new Map());
|
|
4481
|
+
const registerList = React44.useCallback((list) => {
|
|
4482
|
+
setRegisteredLists((prev) => new Map(prev).set(list.id, list));
|
|
4483
|
+
}, []);
|
|
4484
|
+
const unregisterList = React44.useCallback((listId) => {
|
|
4485
|
+
setRegisteredLists((prev) => {
|
|
4486
|
+
const newMap = new Map(prev);
|
|
4487
|
+
newMap.delete(listId);
|
|
4488
|
+
return newMap;
|
|
4489
|
+
});
|
|
4490
|
+
}, []);
|
|
4491
|
+
return { registerList, unregisterList, registeredLists };
|
|
4492
|
+
}
|
|
4493
|
+
var ActiveDragContext = React44.createContext(null);
|
|
4494
|
+
function useActiveDrag(context) {
|
|
4495
|
+
const value = React44.useContext(context);
|
|
4496
|
+
if (!value) {
|
|
4497
|
+
throw new Error("useActiveDrag must be used within a ActiveDragProvider");
|
|
4498
|
+
}
|
|
4499
|
+
return value;
|
|
4500
|
+
}
|
|
4501
|
+
var AnyDragContext = React44.createContext(false);
|
|
4502
|
+
|
|
4503
|
+
// src/components/sorting/SharedDragProvider.tsx
|
|
4458
4504
|
import {
|
|
4459
4505
|
closestCenter,
|
|
4460
4506
|
DndContext,
|
|
4461
4507
|
DragOverlay,
|
|
4462
4508
|
PointerSensor,
|
|
4463
|
-
|
|
4509
|
+
pointerWithin,
|
|
4464
4510
|
useSensor,
|
|
4465
4511
|
useSensors
|
|
4466
4512
|
} from "@dnd-kit/core";
|
|
4467
|
-
import
|
|
4468
|
-
|
|
4469
|
-
SortableContext,
|
|
4470
|
-
useSortable,
|
|
4471
|
-
verticalListSortingStrategy
|
|
4472
|
-
} from "@dnd-kit/sortable";
|
|
4473
|
-
import * as React44 from "react";
|
|
4474
|
-
import { memo as memo18 } from "react";
|
|
4513
|
+
import * as React45 from "react";
|
|
4514
|
+
import { useMemo as useMemo19 } from "react";
|
|
4475
4515
|
import { createPortal as createPortal2 } from "react-dom";
|
|
4516
|
+
function SharedDragProvider({
|
|
4517
|
+
children,
|
|
4518
|
+
sharedDragProps = {
|
|
4519
|
+
dragRegistrationContext: DragRegistrationContext,
|
|
4520
|
+
activeDragContext: ActiveDragContext
|
|
4521
|
+
}
|
|
4522
|
+
}) {
|
|
4523
|
+
const sensors = useSensors(
|
|
4524
|
+
useSensor(PointerSensor, {
|
|
4525
|
+
activationConstraint: {
|
|
4526
|
+
distance: 4
|
|
4527
|
+
}
|
|
4528
|
+
})
|
|
4529
|
+
);
|
|
4530
|
+
const mounted = useMounted();
|
|
4531
|
+
const [dragState, setDragState] = React45.useState({
|
|
4532
|
+
source: null,
|
|
4533
|
+
target: null,
|
|
4534
|
+
indicator: null
|
|
4535
|
+
});
|
|
4536
|
+
const { registerList, unregisterList, registeredLists } = useDragRegistrationManager();
|
|
4537
|
+
const activatorEventRef = React45.useRef(null);
|
|
4538
|
+
const handleDragStart = React45.useCallback(
|
|
4539
|
+
(event) => {
|
|
4540
|
+
activatorEventRef.current = event.activatorEvent;
|
|
4541
|
+
for (const [listId, list] of registeredLists) {
|
|
4542
|
+
const itemIndex = list.keys.findIndex((key) => key === event.active.id);
|
|
4543
|
+
if (itemIndex >= 0) {
|
|
4544
|
+
const dragItem = {
|
|
4545
|
+
itemId: event.active.id,
|
|
4546
|
+
listId,
|
|
4547
|
+
index: itemIndex
|
|
4548
|
+
};
|
|
4549
|
+
setDragState({
|
|
4550
|
+
source: dragItem,
|
|
4551
|
+
target: null,
|
|
4552
|
+
indicator: null
|
|
4553
|
+
});
|
|
4554
|
+
break;
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4557
|
+
},
|
|
4558
|
+
[registeredLists]
|
|
4559
|
+
);
|
|
4560
|
+
const handleDragMove = React45.useCallback(
|
|
4561
|
+
(event) => {
|
|
4562
|
+
const { active, over } = event;
|
|
4563
|
+
if (!activatorEventRef.current || !dragState.source) return;
|
|
4564
|
+
const dropTarget = findDropTarget({
|
|
4565
|
+
activationPoint: {
|
|
4566
|
+
x: activatorEventRef.current.clientX,
|
|
4567
|
+
y: activatorEventRef.current.clientY
|
|
4568
|
+
},
|
|
4569
|
+
delta: { x: event.delta.x, y: event.delta.y },
|
|
4570
|
+
over,
|
|
4571
|
+
active,
|
|
4572
|
+
source: dragState.source,
|
|
4573
|
+
registeredLists
|
|
4574
|
+
});
|
|
4575
|
+
setDragState({
|
|
4576
|
+
source: dragState.source,
|
|
4577
|
+
target: dropTarget?.target ?? null,
|
|
4578
|
+
indicator: dropTarget?.indicator ?? null
|
|
4579
|
+
});
|
|
4580
|
+
},
|
|
4581
|
+
[registeredLists, dragState.source]
|
|
4582
|
+
);
|
|
4583
|
+
const handleDragEnd = React45.useCallback(
|
|
4584
|
+
(event) => {
|
|
4585
|
+
const { active, over } = event;
|
|
4586
|
+
if (!activatorEventRef.current || !dragState.source) return;
|
|
4587
|
+
const dropTarget = findDropTarget({
|
|
4588
|
+
activationPoint: {
|
|
4589
|
+
x: activatorEventRef.current.clientX,
|
|
4590
|
+
y: activatorEventRef.current.clientY
|
|
4591
|
+
},
|
|
4592
|
+
delta: { x: event.delta.x, y: event.delta.y },
|
|
4593
|
+
over,
|
|
4594
|
+
active,
|
|
4595
|
+
source: dragState.source,
|
|
4596
|
+
registeredLists
|
|
4597
|
+
});
|
|
4598
|
+
setDragState({
|
|
4599
|
+
source: null,
|
|
4600
|
+
target: null,
|
|
4601
|
+
indicator: null
|
|
4602
|
+
});
|
|
4603
|
+
activatorEventRef.current = null;
|
|
4604
|
+
if (!dropTarget) return;
|
|
4605
|
+
const sourceList = registeredLists.get(dropTarget.source.listId);
|
|
4606
|
+
const targetList = registeredLists.get(dropTarget.target.listId);
|
|
4607
|
+
if (!sourceList || !targetList) return;
|
|
4608
|
+
sourceList.onMoveItem(
|
|
4609
|
+
dropTarget.source.index,
|
|
4610
|
+
dropTarget.target.index,
|
|
4611
|
+
dropTarget.indicator,
|
|
4612
|
+
dropTarget.source.listId,
|
|
4613
|
+
dropTarget.target.listId
|
|
4614
|
+
);
|
|
4615
|
+
},
|
|
4616
|
+
[registeredLists, dragState.source]
|
|
4617
|
+
);
|
|
4618
|
+
const contextValue = React45.useMemo(
|
|
4619
|
+
() => ({
|
|
4620
|
+
registerList,
|
|
4621
|
+
unregisterList
|
|
4622
|
+
}),
|
|
4623
|
+
[registerList, unregisterList]
|
|
4624
|
+
);
|
|
4625
|
+
const activeList = dragState.source ? registeredLists.get(dragState.source.listId) : null;
|
|
4626
|
+
const activeDragContextValue = React45.useMemo(
|
|
4627
|
+
() => dragState,
|
|
4628
|
+
[dragState]
|
|
4629
|
+
);
|
|
4630
|
+
const collisionDetection = useMemo19(() => {
|
|
4631
|
+
return getItemFirstCollisionDetection(Array.from(registeredLists.keys()));
|
|
4632
|
+
}, [registeredLists]);
|
|
4633
|
+
return /* @__PURE__ */ React45.createElement(AnyDragContext.Provider, { value: true }, /* @__PURE__ */ React45.createElement(sharedDragProps.dragRegistrationContext.Provider, { value: contextValue }, /* @__PURE__ */ React45.createElement(
|
|
4634
|
+
sharedDragProps.activeDragContext.Provider,
|
|
4635
|
+
{
|
|
4636
|
+
value: activeDragContextValue
|
|
4637
|
+
},
|
|
4638
|
+
/* @__PURE__ */ React45.createElement(
|
|
4639
|
+
DndContext,
|
|
4640
|
+
{
|
|
4641
|
+
sensors,
|
|
4642
|
+
collisionDetection,
|
|
4643
|
+
onDragStart: handleDragStart,
|
|
4644
|
+
onDragMove: handleDragMove,
|
|
4645
|
+
onDragEnd: handleDragEnd
|
|
4646
|
+
},
|
|
4647
|
+
children,
|
|
4648
|
+
mounted && activeList?.renderOverlay && dragState.source && createPortal2(
|
|
4649
|
+
/* @__PURE__ */ React45.createElement(DragOverlay, { dropAnimation: null }, activeList.renderOverlay(dragState.source.itemId)),
|
|
4650
|
+
document.body
|
|
4651
|
+
)
|
|
4652
|
+
)
|
|
4653
|
+
)));
|
|
4654
|
+
}
|
|
4655
|
+
function useMounted() {
|
|
4656
|
+
const [mounted, setMounted] = React45.useState(false);
|
|
4657
|
+
React45.useEffect(() => {
|
|
4658
|
+
setMounted(true);
|
|
4659
|
+
}, []);
|
|
4660
|
+
return mounted;
|
|
4661
|
+
}
|
|
4662
|
+
function withDragProvider(Component) {
|
|
4663
|
+
return function WithDragProvider(props) {
|
|
4664
|
+
const anyDragContext = React45.useContext(AnyDragContext);
|
|
4665
|
+
if (!anyDragContext) {
|
|
4666
|
+
return /* @__PURE__ */ React45.createElement(SharedDragProvider, null, /* @__PURE__ */ React45.createElement(Component, { ...props }));
|
|
4667
|
+
}
|
|
4668
|
+
return /* @__PURE__ */ React45.createElement(Component, { ...props });
|
|
4669
|
+
};
|
|
4670
|
+
}
|
|
4671
|
+
var getItemFirstCollisionDetection = (registeredListIds) => (parameters) => {
|
|
4672
|
+
const pointerCollisions = pointerWithin(parameters);
|
|
4673
|
+
if (pointerCollisions.length > 0) {
|
|
4674
|
+
const itemCollisions = pointerCollisions.filter((collision) => {
|
|
4675
|
+
for (const listId of registeredListIds) {
|
|
4676
|
+
if (collision.id === listId) {
|
|
4677
|
+
return false;
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
return true;
|
|
4681
|
+
});
|
|
4682
|
+
if (itemCollisions.length > 0) {
|
|
4683
|
+
return itemCollisions;
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
return pointerCollisions.length > 0 ? pointerCollisions : closestCenter(parameters);
|
|
4687
|
+
};
|
|
4688
|
+
function findDropTarget({
|
|
4689
|
+
activationPoint,
|
|
4690
|
+
delta,
|
|
4691
|
+
over,
|
|
4692
|
+
active,
|
|
4693
|
+
source,
|
|
4694
|
+
registeredLists
|
|
4695
|
+
}) {
|
|
4696
|
+
if (!over || active.id === over.id) return;
|
|
4697
|
+
let targetListId = null;
|
|
4698
|
+
let targetIndex = -1;
|
|
4699
|
+
for (const [listId, list] of registeredLists) {
|
|
4700
|
+
const itemIndex = list.keys.findIndex((key) => key === over.id);
|
|
4701
|
+
if (itemIndex >= 0) {
|
|
4702
|
+
targetListId = listId;
|
|
4703
|
+
targetIndex = itemIndex;
|
|
4704
|
+
break;
|
|
4705
|
+
}
|
|
4706
|
+
if (over.id === listId) {
|
|
4707
|
+
targetListId = listId;
|
|
4708
|
+
targetIndex = list.keys.length;
|
|
4709
|
+
break;
|
|
4710
|
+
}
|
|
4711
|
+
}
|
|
4712
|
+
const targetList = targetListId !== null ? registeredLists.get(targetListId) : null;
|
|
4713
|
+
const sourceList = registeredLists.get(source.listId);
|
|
4714
|
+
if (!targetList || !sourceList || !targetList.acceptsFromList({
|
|
4715
|
+
sourceListId: sourceList.id,
|
|
4716
|
+
targetListId: targetList.id
|
|
4717
|
+
})) {
|
|
4718
|
+
return;
|
|
4719
|
+
}
|
|
4720
|
+
if (over.id === targetList.id) {
|
|
4721
|
+
const canDrop = targetList.acceptsDrop(
|
|
4722
|
+
source.index,
|
|
4723
|
+
Math.max(0, targetList.keys.length - 1),
|
|
4724
|
+
// Use last valid index or 0 for empty lists
|
|
4725
|
+
"below",
|
|
4726
|
+
sourceList.id,
|
|
4727
|
+
targetList.id
|
|
4728
|
+
);
|
|
4729
|
+
if (canDrop) {
|
|
4730
|
+
return {
|
|
4731
|
+
source,
|
|
4732
|
+
target: {
|
|
4733
|
+
itemId: over.id,
|
|
4734
|
+
listId: targetList.id,
|
|
4735
|
+
index: targetIndex
|
|
4736
|
+
},
|
|
4737
|
+
indicator: "below"
|
|
4738
|
+
};
|
|
4739
|
+
}
|
|
4740
|
+
}
|
|
4741
|
+
const eventX = activationPoint.x;
|
|
4742
|
+
const eventY = activationPoint.y;
|
|
4743
|
+
const currentX = eventX + delta.x;
|
|
4744
|
+
const currentY = eventY + delta.y;
|
|
4745
|
+
const absolutePosition = { x: currentX, y: currentY };
|
|
4746
|
+
const indicator = targetList.getDropIndicator({
|
|
4747
|
+
absolutePosition,
|
|
4748
|
+
active,
|
|
4749
|
+
over,
|
|
4750
|
+
sourceListId: sourceList.id,
|
|
4751
|
+
targetListId: targetList.id
|
|
4752
|
+
});
|
|
4753
|
+
if (indicator) {
|
|
4754
|
+
return {
|
|
4755
|
+
source,
|
|
4756
|
+
target: {
|
|
4757
|
+
itemId: over.id,
|
|
4758
|
+
listId: targetList.id,
|
|
4759
|
+
index: targetIndex
|
|
4760
|
+
},
|
|
4761
|
+
indicator
|
|
4762
|
+
};
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4765
|
+
|
|
4766
|
+
// src/components/sorting/sorting.ts
|
|
4767
|
+
import * as React46 from "react";
|
|
4476
4768
|
var normalizeListTargetIndex = (index, position) => {
|
|
4477
4769
|
return position === "above" ? index : index + 1;
|
|
4478
4770
|
};
|
|
@@ -4484,14 +4776,15 @@ var defaultAcceptsDrop = (sourceIndex, targetIndex, position) => {
|
|
|
4484
4776
|
}
|
|
4485
4777
|
return true;
|
|
4486
4778
|
};
|
|
4487
|
-
var SortableItemContext =
|
|
4779
|
+
var SortableItemContext = React46.createContext({
|
|
4488
4780
|
keys: [],
|
|
4489
4781
|
acceptsDrop: defaultAcceptsDrop,
|
|
4490
4782
|
axis: "y",
|
|
4491
4783
|
position: { x: 0, y: 0 },
|
|
4492
4784
|
setActivatorEvent: () => {
|
|
4493
4785
|
},
|
|
4494
|
-
getDropTargetParentIndex: void 0
|
|
4786
|
+
getDropTargetParentIndex: void 0,
|
|
4787
|
+
listId: ""
|
|
4495
4788
|
});
|
|
4496
4789
|
function validateDropIndicator({
|
|
4497
4790
|
acceptsDrop: acceptsDrop2,
|
|
@@ -4500,12 +4793,21 @@ function validateDropIndicator({
|
|
|
4500
4793
|
overId,
|
|
4501
4794
|
offsetStart,
|
|
4502
4795
|
elementStart,
|
|
4503
|
-
elementSize
|
|
4796
|
+
elementSize,
|
|
4797
|
+
sourceListId,
|
|
4798
|
+
targetListId
|
|
4504
4799
|
}) {
|
|
4505
4800
|
const activeIndex = keys.findIndex((id) => id === activeId);
|
|
4506
4801
|
const overIndex = keys.findIndex((id) => id === overId);
|
|
4507
|
-
if (
|
|
4508
|
-
|
|
4802
|
+
if (overIndex === -1) return void 0;
|
|
4803
|
+
if (activeIndex === -1 && sourceListId === targetListId) return void 0;
|
|
4804
|
+
const acceptsDropInside = acceptsDrop2(
|
|
4805
|
+
activeIndex,
|
|
4806
|
+
overIndex,
|
|
4807
|
+
"inside",
|
|
4808
|
+
sourceListId,
|
|
4809
|
+
targetListId
|
|
4810
|
+
);
|
|
4509
4811
|
if (isContainedInMiddleThird(elementStart, elementSize, offsetStart) && acceptsDropInside) {
|
|
4510
4812
|
return "inside";
|
|
4511
4813
|
}
|
|
@@ -4514,7 +4816,16 @@ function validateDropIndicator({
|
|
|
4514
4816
|
elementSize,
|
|
4515
4817
|
offsetStart
|
|
4516
4818
|
);
|
|
4517
|
-
|
|
4819
|
+
if (!isContained(elementStart, elementSize, offsetStart) && sourceListId === targetListId) {
|
|
4820
|
+
return void 0;
|
|
4821
|
+
}
|
|
4822
|
+
const acceptedHalf = acceptsDrop2(
|
|
4823
|
+
activeIndex,
|
|
4824
|
+
overIndex,
|
|
4825
|
+
containingHalf,
|
|
4826
|
+
sourceListId,
|
|
4827
|
+
targetListId
|
|
4828
|
+
);
|
|
4518
4829
|
return acceptedHalf ? containingHalf : (
|
|
4519
4830
|
// Lastly, check if inside but not middle third
|
|
4520
4831
|
acceptsDropInside ? "inside" : void 0
|
|
@@ -4523,193 +4834,204 @@ function validateDropIndicator({
|
|
|
4523
4834
|
function isContainedInMiddleThird(elementStart, elementSize, offsetStart) {
|
|
4524
4835
|
return offsetStart >= elementStart + elementSize / 3 && offsetStart <= elementStart + elementSize * 2 / 3;
|
|
4525
4836
|
}
|
|
4837
|
+
function isContained(elementStart, elementSize, offsetStart) {
|
|
4838
|
+
return offsetStart >= elementStart && offsetStart <= elementStart + elementSize;
|
|
4839
|
+
}
|
|
4526
4840
|
function getContainingHalf(elementStart, elementSize, offsetStart) {
|
|
4527
4841
|
if (offsetStart < elementStart + elementSize / 2) return "above";
|
|
4528
4842
|
return "below";
|
|
4529
4843
|
}
|
|
4844
|
+
function createDragItemKey(listId, itemId) {
|
|
4845
|
+
return `${listId}-~-${itemId}`;
|
|
4846
|
+
}
|
|
4847
|
+
function parseDragItemKey(key) {
|
|
4848
|
+
const [listId, itemId] = key.split("-~-");
|
|
4849
|
+
return { listId, itemId };
|
|
4850
|
+
}
|
|
4851
|
+
|
|
4852
|
+
// src/components/sorting/Sortable.tsx
|
|
4853
|
+
var SortableItemContext2 = React47.createContext({
|
|
4854
|
+
acceptsDrop: defaultAcceptsDrop,
|
|
4855
|
+
listId: "",
|
|
4856
|
+
getDropTargetParentIndex: void 0,
|
|
4857
|
+
activeDragContext: ActiveDragContext
|
|
4858
|
+
});
|
|
4859
|
+
function useSortableDropIndicator({
|
|
4860
|
+
index,
|
|
4861
|
+
itemId,
|
|
4862
|
+
listId,
|
|
4863
|
+
acceptsDrop: acceptsDrop2,
|
|
4864
|
+
getDropTargetParentIndex
|
|
4865
|
+
}) {
|
|
4866
|
+
const { activeDragContext } = React47.useContext(SortableItemContext2);
|
|
4867
|
+
const activeDrag = useActiveDrag(activeDragContext);
|
|
4868
|
+
const { source, target } = activeDrag;
|
|
4869
|
+
if (!source || !target) return;
|
|
4870
|
+
const indicator = target.listId === listId && target.itemId === itemId ? activeDrag.indicator : void 0;
|
|
4871
|
+
const targetParentIndex = target.index === -1 ? void 0 : getDropTargetParentIndex?.(target.index);
|
|
4872
|
+
const isValidParent = targetParentIndex === void 0 || targetParentIndex === -1 ? false : acceptsDrop2(
|
|
4873
|
+
source.index,
|
|
4874
|
+
targetParentIndex,
|
|
4875
|
+
"inside",
|
|
4876
|
+
source.listId,
|
|
4877
|
+
target.listId
|
|
4878
|
+
);
|
|
4879
|
+
const overIdAcceptsDrop = target.index === -1 ? void 0 : acceptsDrop2(
|
|
4880
|
+
source.index,
|
|
4881
|
+
target.index,
|
|
4882
|
+
"inside",
|
|
4883
|
+
source.listId,
|
|
4884
|
+
target.listId
|
|
4885
|
+
);
|
|
4886
|
+
const thisItemIsTargetParent = targetParentIndex === index;
|
|
4887
|
+
const showDragInsideIndicatorOnParent = !overIdAcceptsDrop && isValidParent && thisItemIsTargetParent;
|
|
4888
|
+
return indicator ?? (showDragInsideIndicatorOnParent ? "inside" : void 0);
|
|
4889
|
+
}
|
|
4530
4890
|
function SortableItem({
|
|
4531
4891
|
id,
|
|
4532
4892
|
disabled,
|
|
4533
4893
|
children
|
|
4534
4894
|
}) {
|
|
4535
|
-
const {
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
const {
|
|
4546
|
-
active,
|
|
4547
|
-
attributes,
|
|
4548
|
-
listeners,
|
|
4549
|
-
setNodeRef,
|
|
4550
|
-
isDragging,
|
|
4895
|
+
const { acceptsDrop: acceptsDrop2, listId, getDropTargetParentIndex } = React47.useContext(SortableItemContext2);
|
|
4896
|
+
const dragItemKey = createDragItemKey(listId, id);
|
|
4897
|
+
const { attributes, listeners, setNodeRef, isDragging, index } = useSortable({
|
|
4898
|
+
id: dragItemKey,
|
|
4899
|
+
disabled
|
|
4900
|
+
});
|
|
4901
|
+
const ref = React47.useCallback(
|
|
4902
|
+
(node) => setNodeRef(node),
|
|
4903
|
+
[setNodeRef]
|
|
4904
|
+
);
|
|
4905
|
+
const relativeDropPosition = useSortableDropIndicator({
|
|
4551
4906
|
index,
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
over
|
|
4555
|
-
} = sortable;
|
|
4556
|
-
if (activatorEvent) {
|
|
4557
|
-
setActivatorEvent(activatorEvent);
|
|
4558
|
-
}
|
|
4559
|
-
const eventX = activatorEvent?.clientX ?? 0;
|
|
4560
|
-
const eventY = activatorEvent?.clientY ?? 0;
|
|
4561
|
-
const offsetLeft = eventX + position.x;
|
|
4562
|
-
const offsetTop = eventY + position.y;
|
|
4563
|
-
const ref = React44.useCallback((node) => setNodeRef(node), [setNodeRef]);
|
|
4564
|
-
const parentIndex = overIndex === -1 ? void 0 : getDropTargetParentIndex?.(overIndex);
|
|
4565
|
-
const isValidParent = parentIndex === void 0 || parentIndex === -1 ? false : acceptsDrop2(activeIndex, parentIndex, "inside");
|
|
4566
|
-
const overIdAcceptsDrop = overIndex === -1 ? void 0 : acceptsDrop2(activeIndex, overIndex, "inside");
|
|
4567
|
-
const relativeDropPosition = index >= 0 && index === overIndex && !isDragging && active && over ? validateDropIndicator({
|
|
4907
|
+
itemId: dragItemKey,
|
|
4908
|
+
listId,
|
|
4568
4909
|
acceptsDrop: acceptsDrop2,
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
overId: over.id,
|
|
4572
|
-
offsetStart: axis === "x" ? offsetLeft : offsetTop,
|
|
4573
|
-
elementStart: axis === "x" ? over.rect.left : over.rect.top,
|
|
4574
|
-
elementSize: axis === "x" ? over.rect.width : over.rect.height
|
|
4575
|
-
}) : void 0;
|
|
4576
|
-
const showDragInsideIndicatorOnParent = !overIdAcceptsDrop && isValidParent && parentIndex === index;
|
|
4910
|
+
getDropTargetParentIndex
|
|
4911
|
+
});
|
|
4577
4912
|
return children({
|
|
4578
4913
|
ref,
|
|
4579
4914
|
...attributes,
|
|
4580
4915
|
...listeners,
|
|
4581
|
-
relativeDropPosition
|
|
4916
|
+
relativeDropPosition,
|
|
4917
|
+
style: {
|
|
4918
|
+
opacity: isDragging ? 0.5 : 1
|
|
4919
|
+
}
|
|
4582
4920
|
});
|
|
4583
4921
|
}
|
|
4584
|
-
function
|
|
4585
|
-
|
|
4586
|
-
|
|
4922
|
+
function SortableRoot_({
|
|
4923
|
+
id: idProp,
|
|
4924
|
+
keys: keysProp,
|
|
4587
4925
|
onMoveItem,
|
|
4588
4926
|
renderOverlay,
|
|
4927
|
+
acceptsFromList,
|
|
4589
4928
|
acceptsDrop: acceptsDrop2 = defaultAcceptsDrop,
|
|
4590
4929
|
axis = "y",
|
|
4591
|
-
|
|
4930
|
+
children,
|
|
4931
|
+
getDropTargetParentIndex,
|
|
4932
|
+
sharedDragProps,
|
|
4933
|
+
containerRef
|
|
4592
4934
|
}) {
|
|
4593
|
-
const
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
const
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4935
|
+
const defaultId = React47.useId();
|
|
4936
|
+
const id = idProp ?? defaultId;
|
|
4937
|
+
const keys = React47.useMemo(() => {
|
|
4938
|
+
return keysProp.map((key) => createDragItemKey(id, key));
|
|
4939
|
+
}, [keysProp, id]);
|
|
4940
|
+
const { registerList, unregisterList } = useDragRegistration(
|
|
4941
|
+
sharedDragProps?.dragRegistrationContext ?? DragRegistrationContext
|
|
4942
|
+
);
|
|
4943
|
+
const { setNodeRef: setDroppableRef } = useDroppable({
|
|
4944
|
+
id,
|
|
4945
|
+
// Make the container droppable only when the list is empty
|
|
4946
|
+
// This avoids conflicts with individual sortable items.
|
|
4947
|
+
// This isn't strictly necessary since we also use a custom collision detection
|
|
4948
|
+
// that prioritizes items over containers, but it helps with dropping into
|
|
4949
|
+
// the best position (either above or below, rather than always below).
|
|
4950
|
+
disabled: keys.length > 0
|
|
4605
4951
|
});
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
const oldIndex = keys.findIndex((id) => id === active.id);
|
|
4625
|
-
const newIndex = keys.findIndex((id) => id === over.id);
|
|
4626
|
-
if (oldIndex === -1 || newIndex === -1) return;
|
|
4627
|
-
const eventX = activatorEvent.current?.clientX ?? 0;
|
|
4628
|
-
const eventY = activatorEvent.current?.clientY ?? 0;
|
|
4629
|
-
const offsetLeft = eventX + position.x;
|
|
4630
|
-
const offsetTop = eventY + position.y;
|
|
4631
|
-
const indicator = validateDropIndicator({
|
|
4952
|
+
React47.useEffect(() => {
|
|
4953
|
+
const listConfig = {
|
|
4954
|
+
id,
|
|
4955
|
+
keys,
|
|
4956
|
+
onMoveItem: onMoveItem ?? (() => {
|
|
4957
|
+
}),
|
|
4958
|
+
renderOverlay: (id2) => {
|
|
4959
|
+
const index = keys.findIndex((key) => key === id2);
|
|
4960
|
+
return renderOverlay?.(index) ?? null;
|
|
4961
|
+
},
|
|
4962
|
+
acceptsFromList: acceptsFromList ?? (() => true),
|
|
4963
|
+
acceptsDrop: acceptsDrop2,
|
|
4964
|
+
getDropIndicator: (parameters) => {
|
|
4965
|
+
const { absolutePosition, active, over, sourceListId, targetListId } = parameters;
|
|
4966
|
+
const offsetStart = axis === "x" ? absolutePosition.x : absolutePosition.y;
|
|
4967
|
+
const elementStart = axis === "x" ? over.rect.left : over.rect.top;
|
|
4968
|
+
const elementSize = axis === "x" ? over.rect.width : over.rect.height;
|
|
4969
|
+
const relativeDropPosition = validateDropIndicator({
|
|
4632
4970
|
acceptsDrop: acceptsDrop2,
|
|
4633
4971
|
keys,
|
|
4634
4972
|
activeId: active.id,
|
|
4635
4973
|
overId: over.id,
|
|
4636
|
-
offsetStart
|
|
4637
|
-
elementStart
|
|
4638
|
-
elementSize
|
|
4974
|
+
offsetStart,
|
|
4975
|
+
elementStart,
|
|
4976
|
+
elementSize,
|
|
4977
|
+
sourceListId,
|
|
4978
|
+
targetListId
|
|
4639
4979
|
});
|
|
4640
|
-
|
|
4641
|
-
onMoveItem?.(oldIndex, newIndex, indicator);
|
|
4980
|
+
return relativeDropPosition;
|
|
4642
4981
|
}
|
|
4643
|
-
}
|
|
4644
|
-
|
|
4982
|
+
};
|
|
4983
|
+
registerList(listConfig);
|
|
4984
|
+
return () => {
|
|
4985
|
+
unregisterList(id);
|
|
4986
|
+
};
|
|
4987
|
+
}, [
|
|
4988
|
+
id,
|
|
4989
|
+
onMoveItem,
|
|
4990
|
+
renderOverlay,
|
|
4991
|
+
acceptsFromList,
|
|
4992
|
+
acceptsDrop2,
|
|
4993
|
+
axis,
|
|
4994
|
+
registerList,
|
|
4995
|
+
unregisterList,
|
|
4996
|
+
keys
|
|
4997
|
+
]);
|
|
4998
|
+
const contextValue = React47.useMemo(
|
|
4999
|
+
() => ({
|
|
5000
|
+
keys,
|
|
5001
|
+
acceptsDrop: acceptsDrop2,
|
|
5002
|
+
listId: id,
|
|
5003
|
+
getDropTargetParentIndex,
|
|
5004
|
+
activeDragContext: sharedDragProps?.activeDragContext ?? ActiveDragContext
|
|
5005
|
+
}),
|
|
5006
|
+
[keys, acceptsDrop2, id, getDropTargetParentIndex, sharedDragProps]
|
|
4645
5007
|
);
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
5008
|
+
React47.useEffect(() => {
|
|
5009
|
+
if (containerRef) {
|
|
5010
|
+
setDroppableRef(containerRef.current);
|
|
5011
|
+
}
|
|
5012
|
+
});
|
|
5013
|
+
return /* @__PURE__ */ React47.createElement(SortableItemContext2.Provider, { value: contextValue }, /* @__PURE__ */ React47.createElement(
|
|
5014
|
+
SortableContext,
|
|
4652
5015
|
{
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
keys,
|
|
4656
|
-
acceptsDrop: acceptsDrop2,
|
|
4657
|
-
position,
|
|
4658
|
-
setActivatorEvent,
|
|
4659
|
-
axis,
|
|
4660
|
-
getDropTargetParentIndex
|
|
4661
|
-
}),
|
|
4662
|
-
[
|
|
4663
|
-
acceptsDrop2,
|
|
4664
|
-
axis,
|
|
4665
|
-
getDropTargetParentIndex,
|
|
4666
|
-
keys,
|
|
4667
|
-
position,
|
|
4668
|
-
setActivatorEvent
|
|
4669
|
-
]
|
|
4670
|
-
)
|
|
5016
|
+
items: keys,
|
|
5017
|
+
strategy: axis === "x" ? horizontalListSortingStrategy : verticalListSortingStrategy
|
|
4671
5018
|
},
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
{
|
|
4675
|
-
sensors,
|
|
4676
|
-
collisionDetection: closestCenter,
|
|
4677
|
-
onDragStart: handleDragStart,
|
|
4678
|
-
onDragMove: handleDragMove,
|
|
4679
|
-
onDragEnd: handleDragEnd
|
|
4680
|
-
},
|
|
4681
|
-
/* @__PURE__ */ React44.createElement(
|
|
4682
|
-
SortableContext,
|
|
4683
|
-
{
|
|
4684
|
-
items: keys,
|
|
4685
|
-
strategy: axis === "x" ? horizontalListSortingStrategy : verticalListSortingStrategy
|
|
4686
|
-
},
|
|
4687
|
-
children
|
|
4688
|
-
),
|
|
4689
|
-
mounted && renderOverlay && createPortal2(
|
|
4690
|
-
/* @__PURE__ */ React44.createElement(DragOverlay, { dropAnimation: null }, activeIndex !== void 0 && activeIndex >= 0 && renderOverlay(activeIndex)),
|
|
4691
|
-
document.body
|
|
4692
|
-
)
|
|
4693
|
-
)
|
|
4694
|
-
);
|
|
5019
|
+
children
|
|
5020
|
+
));
|
|
4695
5021
|
}
|
|
4696
|
-
var
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
shouldRenderOverlay = true,
|
|
4706
|
-
...rest
|
|
4707
|
-
} = props;
|
|
4708
|
-
const keys = React44.useMemo(
|
|
5022
|
+
var SortableRoot = withDragProvider(SortableRoot_);
|
|
5023
|
+
var Sortable_ = function Sortable_2({
|
|
5024
|
+
items,
|
|
5025
|
+
keyExtractor,
|
|
5026
|
+
shouldRenderOverlay = true,
|
|
5027
|
+
renderItem,
|
|
5028
|
+
...rest
|
|
5029
|
+
}) {
|
|
5030
|
+
const keys = React47.useMemo(
|
|
4709
5031
|
() => items.map(keyExtractor),
|
|
4710
5032
|
[items, keyExtractor]
|
|
4711
5033
|
);
|
|
4712
|
-
const renderOverlay =
|
|
5034
|
+
const renderOverlay = React47.useCallback(
|
|
4713
5035
|
(index) => {
|
|
4714
5036
|
return renderItem(
|
|
4715
5037
|
items[index],
|
|
@@ -4729,32 +5051,31 @@ var SortableComponent = memoGeneric(function Sortable(props) {
|
|
|
4729
5051
|
},
|
|
4730
5052
|
[renderItem, items]
|
|
4731
5053
|
);
|
|
4732
|
-
return /* @__PURE__ */
|
|
4733
|
-
|
|
5054
|
+
return /* @__PURE__ */ React47.createElement(
|
|
5055
|
+
SortableRoot,
|
|
4734
5056
|
{
|
|
4735
5057
|
...rest,
|
|
4736
5058
|
keys,
|
|
4737
5059
|
renderOverlay: shouldRenderOverlay ? renderOverlay : void 0
|
|
4738
5060
|
},
|
|
4739
|
-
keys.map((key, index) => /* @__PURE__ */
|
|
4740
|
-
return renderItem(
|
|
4741
|
-
items[index],
|
|
4742
|
-
props2,
|
|
4743
|
-
{ isOverlay: false }
|
|
4744
|
-
);
|
|
5061
|
+
keys.map((key, index) => /* @__PURE__ */ React47.createElement(SortableItem, { key, id: key }, (props) => {
|
|
5062
|
+
return renderItem(items[index], props, { isOverlay: false });
|
|
4745
5063
|
}))
|
|
4746
5064
|
);
|
|
5065
|
+
};
|
|
5066
|
+
var Sortable = Object.assign(Sortable_, {
|
|
5067
|
+
Root: SortableRoot,
|
|
5068
|
+
Item: SortableItem
|
|
4747
5069
|
});
|
|
4748
|
-
var Sortable2 = Object.assign(SortableComponent, SortableSubcomponents);
|
|
4749
5070
|
|
|
4750
5071
|
// src/components/ListView.tsx
|
|
4751
5072
|
var ROW_HEIGHT = 31;
|
|
4752
5073
|
var SECTION_HEADER_LABEL_HEIGHT = INPUT_HEIGHT;
|
|
4753
|
-
var ListViewDraggingContext =
|
|
5074
|
+
var ListViewDraggingContext = createContext11({
|
|
4754
5075
|
indentation: 12
|
|
4755
5076
|
});
|
|
4756
5077
|
ListViewDraggingContext.displayName = "ListViewDraggingContext";
|
|
4757
|
-
var ListRowContext =
|
|
5078
|
+
var ListRowContext = createContext11({
|
|
4758
5079
|
marginType: "none",
|
|
4759
5080
|
selectedPosition: "only",
|
|
4760
5081
|
sortable: false,
|
|
@@ -4772,7 +5093,7 @@ var ListViewRowTitle = ({
|
|
|
4772
5093
|
className,
|
|
4773
5094
|
children,
|
|
4774
5095
|
...props
|
|
4775
|
-
}) => /* @__PURE__ */
|
|
5096
|
+
}) => /* @__PURE__ */ React48.createElement(
|
|
4776
5097
|
"span",
|
|
4777
5098
|
{
|
|
4778
5099
|
className: cx(
|
|
@@ -4800,7 +5121,7 @@ function ListViewEditableRowTitle({
|
|
|
4800
5121
|
element.select();
|
|
4801
5122
|
}, 1);
|
|
4802
5123
|
}, [autoFocus]);
|
|
4803
|
-
return /* @__PURE__ */
|
|
5124
|
+
return /* @__PURE__ */ React48.createElement(
|
|
4804
5125
|
InputField2.Input,
|
|
4805
5126
|
{
|
|
4806
5127
|
ref: inputRef,
|
|
@@ -4839,7 +5160,7 @@ var RowContainer = forwardRef19(
|
|
|
4839
5160
|
"aria-selected": ariaSelected,
|
|
4840
5161
|
...props
|
|
4841
5162
|
}, ref) => {
|
|
4842
|
-
return /* @__PURE__ */
|
|
5163
|
+
return /* @__PURE__ */ React48.createElement(
|
|
4843
5164
|
"div",
|
|
4844
5165
|
{
|
|
4845
5166
|
ref,
|
|
@@ -4917,7 +5238,7 @@ var ListViewDragIndicatorElement = forwardRef19(
|
|
|
4917
5238
|
style: style2,
|
|
4918
5239
|
...props
|
|
4919
5240
|
}, ref) => {
|
|
4920
|
-
return /* @__PURE__ */
|
|
5241
|
+
return /* @__PURE__ */ React48.createElement(
|
|
4921
5242
|
"div",
|
|
4922
5243
|
{
|
|
4923
5244
|
ref,
|
|
@@ -4984,12 +5305,12 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
4984
5305
|
divider,
|
|
4985
5306
|
gap: listGap,
|
|
4986
5307
|
colorScheme
|
|
4987
|
-
} =
|
|
5308
|
+
} = useContext11(ListRowContext);
|
|
4988
5309
|
const { hoverProps } = useHover({
|
|
4989
5310
|
onHoverChange
|
|
4990
5311
|
});
|
|
4991
|
-
const { indentation, isDragOverlay } =
|
|
4992
|
-
const handlePress =
|
|
5312
|
+
const { indentation, isDragOverlay } = useContext11(ListViewDraggingContext);
|
|
5313
|
+
const handlePress = useCallback23(
|
|
4993
5314
|
(event) => {
|
|
4994
5315
|
event.preventDefault();
|
|
4995
5316
|
if (event.button !== 0) return;
|
|
@@ -4997,14 +5318,14 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
4997
5318
|
},
|
|
4998
5319
|
[onPress]
|
|
4999
5320
|
);
|
|
5000
|
-
const handleDoubleClick =
|
|
5321
|
+
const handleDoubleClick = useCallback23(
|
|
5001
5322
|
(event) => {
|
|
5002
5323
|
event.stopPropagation();
|
|
5003
5324
|
onDoubleClick?.();
|
|
5004
5325
|
},
|
|
5005
5326
|
[onDoubleClick]
|
|
5006
5327
|
);
|
|
5007
|
-
const mergedStyle =
|
|
5328
|
+
const mergedStyle = useMemo21(() => {
|
|
5008
5329
|
return isDragOverlay ? {
|
|
5009
5330
|
// TODO: Where do these offsets actually come from?
|
|
5010
5331
|
transform: `translate3d(-36px, -6px, 0)`,
|
|
@@ -5018,7 +5339,7 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5018
5339
|
}, ref) => {
|
|
5019
5340
|
const Component = RowContainer;
|
|
5020
5341
|
const relativeDropPosition = testRelativeDropPosition ?? relativeDropPositionProp;
|
|
5021
|
-
const element = /* @__PURE__ */
|
|
5342
|
+
const element = /* @__PURE__ */ React48.createElement(
|
|
5022
5343
|
Component,
|
|
5023
5344
|
{
|
|
5024
5345
|
ref,
|
|
@@ -5052,7 +5373,7 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5052
5373
|
className,
|
|
5053
5374
|
$clickable: !!onPress
|
|
5054
5375
|
},
|
|
5055
|
-
relativeDropPosition && /* @__PURE__ */
|
|
5376
|
+
relativeDropPosition && /* @__PURE__ */ React48.createElement(
|
|
5056
5377
|
ListViewDragIndicatorElement,
|
|
5057
5378
|
{
|
|
5058
5379
|
key: relativeDropPosition,
|
|
@@ -5067,11 +5388,11 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5067
5388
|
}) : dragIndicatorStyle
|
|
5068
5389
|
}
|
|
5069
5390
|
),
|
|
5070
|
-
depth > 0 && /* @__PURE__ */
|
|
5391
|
+
depth > 0 && /* @__PURE__ */ React48.createElement(Spacer.Horizontal, { size: depth * indentation }),
|
|
5071
5392
|
children
|
|
5072
5393
|
);
|
|
5073
5394
|
if (menuItems && onSelectMenuItem) {
|
|
5074
|
-
return /* @__PURE__ */
|
|
5395
|
+
return /* @__PURE__ */ React48.createElement(
|
|
5075
5396
|
ContextMenu,
|
|
5076
5397
|
{
|
|
5077
5398
|
items: menuItems,
|
|
@@ -5084,23 +5405,23 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5084
5405
|
return element;
|
|
5085
5406
|
};
|
|
5086
5407
|
if (sortable && id) {
|
|
5087
|
-
return /* @__PURE__ */
|
|
5408
|
+
return /* @__PURE__ */ React48.createElement(Sortable.Item, { id, disabled: overrideSortable === false }, ({ ref: sortableRef, ...sortableProps }) => renderContent(
|
|
5088
5409
|
sortableProps,
|
|
5089
5410
|
composeRefs2(sortableRef, forwardedRef)
|
|
5090
5411
|
));
|
|
5091
5412
|
}
|
|
5092
5413
|
return renderContent({}, forwardedRef);
|
|
5093
5414
|
});
|
|
5094
|
-
var RenderItemContext =
|
|
5415
|
+
var RenderItemContext = createContext11(
|
|
5095
5416
|
() => null
|
|
5096
5417
|
);
|
|
5097
5418
|
RenderItemContext.displayName = "RenderItemContext";
|
|
5098
|
-
var VirtualizedListRow =
|
|
5419
|
+
var VirtualizedListRow = memo18(function VirtualizedListRow2({
|
|
5099
5420
|
index,
|
|
5100
5421
|
style: style2
|
|
5101
5422
|
}) {
|
|
5102
|
-
const renderItem =
|
|
5103
|
-
return /* @__PURE__ */
|
|
5423
|
+
const renderItem = useContext11(RenderItemContext);
|
|
5424
|
+
return /* @__PURE__ */ React48.createElement("div", { key: index, style: style2 }, renderItem(index));
|
|
5104
5425
|
});
|
|
5105
5426
|
var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
5106
5427
|
size: size2,
|
|
@@ -5123,7 +5444,7 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5123
5444
|
// since it doesn't currently support row height changes
|
|
5124
5445
|
items
|
|
5125
5446
|
]);
|
|
5126
|
-
const listStyle =
|
|
5447
|
+
const listStyle = useMemo21(
|
|
5127
5448
|
() => ({
|
|
5128
5449
|
overflowX: "initial",
|
|
5129
5450
|
overflowY: "initial",
|
|
@@ -5131,18 +5452,18 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5131
5452
|
}),
|
|
5132
5453
|
[]
|
|
5133
5454
|
);
|
|
5134
|
-
return /* @__PURE__ */
|
|
5455
|
+
return /* @__PURE__ */ React48.createElement(RenderItemContext.Provider, { value: renderItem }, /* @__PURE__ */ React48.createElement(
|
|
5135
5456
|
WindowScroller,
|
|
5136
5457
|
{
|
|
5137
5458
|
scrollElement,
|
|
5138
|
-
style:
|
|
5459
|
+
style: useMemo21(() => ({ flex: "1 1 auto" }), [])
|
|
5139
5460
|
},
|
|
5140
|
-
|
|
5461
|
+
useCallback23(
|
|
5141
5462
|
({
|
|
5142
5463
|
registerChild,
|
|
5143
5464
|
onChildScroll,
|
|
5144
5465
|
scrollTop
|
|
5145
|
-
}) => /* @__PURE__ */
|
|
5466
|
+
}) => /* @__PURE__ */ React48.createElement("div", { ref: registerChild }, /* @__PURE__ */ React48.createElement(
|
|
5146
5467
|
VariableSizeList,
|
|
5147
5468
|
{
|
|
5148
5469
|
ref: listRef,
|
|
@@ -5172,7 +5493,7 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5172
5493
|
)
|
|
5173
5494
|
));
|
|
5174
5495
|
});
|
|
5175
|
-
var VirtualizedList =
|
|
5496
|
+
var VirtualizedList = memo18(
|
|
5176
5497
|
VirtualizedListInner
|
|
5177
5498
|
);
|
|
5178
5499
|
var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
@@ -5206,9 +5527,11 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5206
5527
|
onDragLeave,
|
|
5207
5528
|
onDrop,
|
|
5208
5529
|
renderEmptyState,
|
|
5209
|
-
getDropTargetParentIndex
|
|
5530
|
+
getDropTargetParentIndex,
|
|
5531
|
+
sharedDragProps,
|
|
5532
|
+
sortableId
|
|
5210
5533
|
}, forwardedRef) {
|
|
5211
|
-
const handleClick =
|
|
5534
|
+
const handleClick = useCallback23(
|
|
5212
5535
|
(event) => {
|
|
5213
5536
|
if (event.target instanceof HTMLElement && event.target.classList.contains("scroll-component"))
|
|
5214
5537
|
return;
|
|
@@ -5218,11 +5541,11 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5218
5541
|
},
|
|
5219
5542
|
[onPress]
|
|
5220
5543
|
);
|
|
5221
|
-
const renderChild =
|
|
5544
|
+
const renderChild = useCallback23(
|
|
5222
5545
|
(index) => renderItem(data[index], index, { isDragOverlay: false }),
|
|
5223
5546
|
[data, renderItem]
|
|
5224
5547
|
);
|
|
5225
|
-
const defaultContextValue =
|
|
5548
|
+
const defaultContextValue = useMemo21(
|
|
5226
5549
|
() => ({
|
|
5227
5550
|
colorScheme,
|
|
5228
5551
|
marginType: "none",
|
|
@@ -5247,7 +5570,7 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5247
5570
|
sectionHeaderVariant
|
|
5248
5571
|
]
|
|
5249
5572
|
);
|
|
5250
|
-
const getItemContextValue =
|
|
5573
|
+
const getItemContextValue = useCallback23(
|
|
5251
5574
|
(i) => {
|
|
5252
5575
|
if (variant === "bare" || variant === "normal")
|
|
5253
5576
|
return defaultContextValue;
|
|
@@ -5309,37 +5632,39 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5309
5632
|
gap
|
|
5310
5633
|
]
|
|
5311
5634
|
);
|
|
5312
|
-
const draggingContextOverlayValue =
|
|
5635
|
+
const draggingContextOverlayValue = useMemo21(
|
|
5313
5636
|
() => ({ indentation, isDragOverlay: true }),
|
|
5314
5637
|
[indentation]
|
|
5315
5638
|
);
|
|
5316
|
-
const renderOverlay =
|
|
5317
|
-
(index) => /* @__PURE__ */
|
|
5639
|
+
const renderOverlay = useCallback23(
|
|
5640
|
+
(index) => /* @__PURE__ */ React48.createElement("div", { style: { opacity: 0.25 } }, /* @__PURE__ */ React48.createElement(ListViewDraggingContext.Provider, { value: draggingContextOverlayValue }, renderItem(data[index], index, { isDragOverlay: true }))),
|
|
5318
5641
|
[draggingContextOverlayValue, renderItem, data]
|
|
5319
5642
|
);
|
|
5320
|
-
const renderWrappedChild =
|
|
5643
|
+
const renderWrappedChild = useCallback23(
|
|
5321
5644
|
(index) => {
|
|
5322
5645
|
const contextValue = getItemContextValue(index);
|
|
5323
5646
|
const current = renderChild(index);
|
|
5324
5647
|
if (!contextValue || !isValidElement3(current)) return null;
|
|
5325
|
-
return /* @__PURE__ */
|
|
5648
|
+
return /* @__PURE__ */ React48.createElement(ListRowContext.Provider, { key: current.key, value: contextValue }, current);
|
|
5326
5649
|
},
|
|
5327
5650
|
[getItemContextValue, renderChild]
|
|
5328
5651
|
);
|
|
5329
|
-
const ids =
|
|
5330
|
-
const withSortable = (children) => sortable ? /* @__PURE__ */
|
|
5331
|
-
|
|
5652
|
+
const ids = useMemo21(() => data.map(keyExtractor), [keyExtractor, data]);
|
|
5653
|
+
const withSortable = (children) => sortable ? /* @__PURE__ */ React48.createElement(
|
|
5654
|
+
Sortable.Root,
|
|
5332
5655
|
{
|
|
5656
|
+
id: sortableId,
|
|
5333
5657
|
onMoveItem,
|
|
5334
5658
|
keys: ids,
|
|
5335
5659
|
renderOverlay,
|
|
5336
5660
|
acceptsDrop: acceptsDrop2,
|
|
5337
|
-
getDropTargetParentIndex
|
|
5661
|
+
getDropTargetParentIndex,
|
|
5662
|
+
sharedDragProps
|
|
5338
5663
|
},
|
|
5339
5664
|
children
|
|
5340
5665
|
) : children;
|
|
5341
|
-
const withScrollable = (children) => scrollable ? /* @__PURE__ */
|
|
5342
|
-
const getItemHeight =
|
|
5666
|
+
const withScrollable = (children) => scrollable ? /* @__PURE__ */ React48.createElement(ScrollArea, null, children) : children(null);
|
|
5667
|
+
const getItemHeight = useCallback23(
|
|
5343
5668
|
(index) => {
|
|
5344
5669
|
const child = getItemContextValue(index);
|
|
5345
5670
|
const height = child?.isSectionHeader && child.sectionHeaderVariant === "label" ? SECTION_HEADER_LABEL_HEIGHT : ROW_HEIGHT;
|
|
@@ -5347,13 +5672,13 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5347
5672
|
},
|
|
5348
5673
|
[getItemContextValue]
|
|
5349
5674
|
);
|
|
5350
|
-
const getKey =
|
|
5675
|
+
const getKey = useCallback23(
|
|
5351
5676
|
(index) => keyExtractor(data[index], index),
|
|
5352
5677
|
[data, keyExtractor]
|
|
5353
5678
|
);
|
|
5354
|
-
const draggingContextValue =
|
|
5355
|
-
const gapStyle =
|
|
5356
|
-
return /* @__PURE__ */
|
|
5679
|
+
const draggingContextValue = useMemo21(() => ({ indentation }), [indentation]);
|
|
5680
|
+
const gapStyle = useMemo21(() => ({ gap: `${gap}px` }), [gap]);
|
|
5681
|
+
return /* @__PURE__ */ React48.createElement(ListViewDraggingContext.Provider, { value: draggingContextValue }, /* @__PURE__ */ React48.createElement(
|
|
5357
5682
|
"div",
|
|
5358
5683
|
{
|
|
5359
5684
|
id,
|
|
@@ -5382,7 +5707,7 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5382
5707
|
},
|
|
5383
5708
|
data.length === 0 && renderEmptyState ? renderEmptyState() : withScrollable(
|
|
5384
5709
|
(scrollElementRef) => withSortable(
|
|
5385
|
-
virtualized ? /* @__PURE__ */
|
|
5710
|
+
virtualized ? /* @__PURE__ */ React48.createElement(
|
|
5386
5711
|
VirtualizedList,
|
|
5387
5712
|
{
|
|
5388
5713
|
ref: forwardedRef,
|
|
@@ -5400,39 +5725,39 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5400
5725
|
});
|
|
5401
5726
|
var ListViewRoot = memoGeneric(ListViewRootInner);
|
|
5402
5727
|
var ChildrenListViewInner = forwardRef19(function ChildrenListViewInner2({ children, ...rest }, forwardedRef) {
|
|
5403
|
-
const items =
|
|
5728
|
+
const items = useMemo21(
|
|
5404
5729
|
() => Children3.toArray(children).flatMap(
|
|
5405
5730
|
(child) => isValidElement3(child) ? [child] : []
|
|
5406
5731
|
),
|
|
5407
5732
|
[children]
|
|
5408
5733
|
);
|
|
5409
|
-
return /* @__PURE__ */
|
|
5734
|
+
return /* @__PURE__ */ React48.createElement(
|
|
5410
5735
|
ListViewRoot,
|
|
5411
5736
|
{
|
|
5412
5737
|
ref: forwardedRef,
|
|
5413
5738
|
...rest,
|
|
5414
5739
|
data: items,
|
|
5415
|
-
keyExtractor:
|
|
5740
|
+
keyExtractor: useCallback23(
|
|
5416
5741
|
({ key }, index) => typeof key === "string" ? key : (key ?? index).toString(),
|
|
5417
5742
|
[]
|
|
5418
5743
|
),
|
|
5419
|
-
renderItem:
|
|
5744
|
+
renderItem: useCallback23((item) => item, [])
|
|
5420
5745
|
}
|
|
5421
5746
|
);
|
|
5422
5747
|
});
|
|
5423
|
-
var ChildrenListView =
|
|
5748
|
+
var ChildrenListView = memo18(ChildrenListViewInner);
|
|
5424
5749
|
var SimpleListViewInner = forwardRefGeneric(function SimpleListViewInner2(props, forwardedRef) {
|
|
5425
5750
|
if ("children" in props) {
|
|
5426
|
-
return /* @__PURE__ */
|
|
5751
|
+
return /* @__PURE__ */ React48.createElement(ChildrenListView, { ref: forwardedRef, ...props });
|
|
5427
5752
|
} else {
|
|
5428
|
-
return /* @__PURE__ */
|
|
5753
|
+
return /* @__PURE__ */ React48.createElement(ListViewRoot, { ref: forwardedRef, ...props });
|
|
5429
5754
|
}
|
|
5430
5755
|
});
|
|
5431
5756
|
var SimpleListView = memoGeneric(SimpleListViewInner);
|
|
5432
5757
|
var ListView;
|
|
5433
5758
|
((ListView2) => {
|
|
5434
|
-
ListView2.RowTitle =
|
|
5435
|
-
ListView2.EditableRowTitle =
|
|
5759
|
+
ListView2.RowTitle = memo18(ListViewRowTitle);
|
|
5760
|
+
ListView2.EditableRowTitle = memo18(ListViewEditableRowTitle);
|
|
5436
5761
|
ListView2.Row = memoGeneric(ListViewRow);
|
|
5437
5762
|
ListView2.Root = SimpleListView;
|
|
5438
5763
|
ListView2.RowContext = ListRowContext;
|
|
@@ -5449,7 +5774,7 @@ var ListView;
|
|
|
5449
5774
|
})(ListView || (ListView = {}));
|
|
5450
5775
|
|
|
5451
5776
|
// src/components/TreeView.tsx
|
|
5452
|
-
import
|
|
5777
|
+
import React49, { useCallback as useCallback24, useContext as useContext12 } from "react";
|
|
5453
5778
|
var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
5454
5779
|
icon,
|
|
5455
5780
|
expanded,
|
|
@@ -5458,15 +5783,15 @@ var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
|
5458
5783
|
children,
|
|
5459
5784
|
...rest
|
|
5460
5785
|
}, forwardedRef) {
|
|
5461
|
-
const { expandable } =
|
|
5462
|
-
const handleClickChevron =
|
|
5786
|
+
const { expandable } = useContext12(ListView.RowContext);
|
|
5787
|
+
const handleClickChevron = useCallback24(
|
|
5463
5788
|
(event) => {
|
|
5464
5789
|
event.stopPropagation();
|
|
5465
5790
|
onClickChevron?.({ altKey: event.altKey });
|
|
5466
5791
|
},
|
|
5467
5792
|
[onClickChevron]
|
|
5468
5793
|
);
|
|
5469
|
-
return /* @__PURE__ */
|
|
5794
|
+
return /* @__PURE__ */ React49.createElement(ListView.Row, { ref: forwardedRef, ...rest }, expandable && /* @__PURE__ */ React49.createElement(React49.Fragment, null, expanded === void 0 ? /* @__PURE__ */ React49.createElement(Spacer.Horizontal, { size: 19 }) : /* @__PURE__ */ React49.createElement(
|
|
5470
5795
|
IconButton,
|
|
5471
5796
|
{
|
|
5472
5797
|
className: chevronClassName,
|
|
@@ -5474,7 +5799,7 @@ var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
|
5474
5799
|
onClick: handleClickChevron,
|
|
5475
5800
|
selected: rest.selected
|
|
5476
5801
|
}
|
|
5477
|
-
), /* @__PURE__ */
|
|
5802
|
+
), /* @__PURE__ */ React49.createElement(Spacer.Horizontal, { size: 6 })), icon && /* @__PURE__ */ React49.createElement(React49.Fragment, null, renderIcon(icon), /* @__PURE__ */ React49.createElement(Spacer.Horizontal, { size: 10 })), children);
|
|
5478
5803
|
});
|
|
5479
5804
|
var TreeView;
|
|
5480
5805
|
((TreeView2) => {
|
|
@@ -5527,7 +5852,9 @@ var List = memoGeneric(
|
|
|
5527
5852
|
getDropTargetParentIndex,
|
|
5528
5853
|
getPlaceholder,
|
|
5529
5854
|
onClickItem,
|
|
5530
|
-
dragIndicatorStyle
|
|
5855
|
+
dragIndicatorStyle,
|
|
5856
|
+
sortableId,
|
|
5857
|
+
sharedDragProps
|
|
5531
5858
|
} = props;
|
|
5532
5859
|
const [internalHoveredId, setHoveredId] = useState23();
|
|
5533
5860
|
const [internalRenamingId, setRenamingId] = useState23();
|
|
@@ -5566,7 +5893,7 @@ var List = memoGeneric(
|
|
|
5566
5893
|
setRenamingId(id);
|
|
5567
5894
|
}
|
|
5568
5895
|
}));
|
|
5569
|
-
return /* @__PURE__ */
|
|
5896
|
+
return /* @__PURE__ */ React50.createElement(
|
|
5570
5897
|
ViewComponent.Root,
|
|
5571
5898
|
{
|
|
5572
5899
|
variant: "bare",
|
|
@@ -5588,6 +5915,8 @@ var List = memoGeneric(
|
|
|
5588
5915
|
onMoveItem,
|
|
5589
5916
|
renderEmptyState,
|
|
5590
5917
|
getDropTargetParentIndex,
|
|
5918
|
+
sharedDragProps,
|
|
5919
|
+
sortableId,
|
|
5591
5920
|
...dropTargetProps,
|
|
5592
5921
|
renderItem: (item, _, { isDragOverlay }) => {
|
|
5593
5922
|
const id = getId(item);
|
|
@@ -5609,7 +5938,7 @@ var List = memoGeneric(
|
|
|
5609
5938
|
handleSelect(id);
|
|
5610
5939
|
}
|
|
5611
5940
|
};
|
|
5612
|
-
const action = (isHovered || isSelected) && !isRenaming && (typeof renderAction === "function" ? renderAction({ item, selected: isSelected, onOpenChange }) : renderAction === "menu" && menuItems && /* @__PURE__ */
|
|
5941
|
+
const action = (isHovered || isSelected) && !isRenaming && (typeof renderAction === "function" ? renderAction({ item, selected: isSelected, onOpenChange }) : renderAction === "menu" && menuItems && /* @__PURE__ */ React50.createElement(
|
|
5613
5942
|
ActionMenu,
|
|
5614
5943
|
{
|
|
5615
5944
|
menuItems,
|
|
@@ -5625,7 +5954,7 @@ var List = memoGeneric(
|
|
|
5625
5954
|
));
|
|
5626
5955
|
const end = action || detailPosition === "end" && renderDetail?.(item, isSelected);
|
|
5627
5956
|
const below = detailPosition === "below" && renderDetail?.(item, isSelected);
|
|
5628
|
-
return /* @__PURE__ */
|
|
5957
|
+
return /* @__PURE__ */ React50.createElement(
|
|
5629
5958
|
ViewComponent.Row,
|
|
5630
5959
|
{
|
|
5631
5960
|
id,
|
|
@@ -5673,12 +6002,12 @@ var List = memoGeneric(
|
|
|
5673
6002
|
},
|
|
5674
6003
|
dragIndicatorStyle
|
|
5675
6004
|
},
|
|
5676
|
-
/* @__PURE__ */
|
|
6005
|
+
/* @__PURE__ */ React50.createElement(
|
|
5677
6006
|
"div",
|
|
5678
6007
|
{
|
|
5679
6008
|
className: cx("flex flex-1 items-center px-2", rowGapMap[size2])
|
|
5680
6009
|
},
|
|
5681
|
-
thumbnail && /* @__PURE__ */
|
|
6010
|
+
thumbnail && /* @__PURE__ */ React50.createElement(
|
|
5682
6011
|
"div",
|
|
5683
6012
|
{
|
|
5684
6013
|
className: cx(
|
|
@@ -5691,7 +6020,7 @@ var List = memoGeneric(
|
|
|
5691
6020
|
},
|
|
5692
6021
|
thumbnail
|
|
5693
6022
|
),
|
|
5694
|
-
/* @__PURE__ */
|
|
6023
|
+
/* @__PURE__ */ React50.createElement("div", { className: "flex flex-col flex-1 w-0" }, /* @__PURE__ */ React50.createElement("div", { className: "flex items-center min-h-input-height flex-1 gap-2" }, /* @__PURE__ */ React50.createElement("div", { className: "flex-1 w-0 flex items-center", tabIndex: -1 }, isRenaming ? /* @__PURE__ */ React50.createElement(
|
|
5695
6024
|
ViewComponent.EditableRowTitle,
|
|
5696
6025
|
{
|
|
5697
6026
|
value: getName(item),
|
|
@@ -5706,7 +6035,7 @@ var List = memoGeneric(
|
|
|
5706
6035
|
e.stopPropagation();
|
|
5707
6036
|
}
|
|
5708
6037
|
}
|
|
5709
|
-
) : /* @__PURE__ */
|
|
6038
|
+
) : /* @__PURE__ */ React50.createElement(
|
|
5710
6039
|
ViewComponent.RowTitle,
|
|
5711
6040
|
{
|
|
5712
6041
|
className: cx(
|
|
@@ -5715,8 +6044,8 @@ var List = memoGeneric(
|
|
|
5715
6044
|
)
|
|
5716
6045
|
},
|
|
5717
6046
|
getName(item)
|
|
5718
|
-
)), end && detailPosition === "end" && /* @__PURE__ */
|
|
5719
|
-
end && detailPosition === "below" && /* @__PURE__ */
|
|
6047
|
+
)), end && detailPosition === "end" && /* @__PURE__ */ React50.createElement(DetailContainer, { selected: isSelected }, end)), below && /* @__PURE__ */ React50.createElement(DetailContainer, { selected: isSelected }, below)),
|
|
6048
|
+
end && detailPosition === "below" && /* @__PURE__ */ React50.createElement(DetailContainer, { selected: isSelected }, end)
|
|
5720
6049
|
)
|
|
5721
6050
|
);
|
|
5722
6051
|
}
|
|
@@ -5724,11 +6053,11 @@ var List = memoGeneric(
|
|
|
5724
6053
|
);
|
|
5725
6054
|
})
|
|
5726
6055
|
);
|
|
5727
|
-
var DetailContainer =
|
|
6056
|
+
var DetailContainer = memo19(function DetailContainer2({
|
|
5728
6057
|
children,
|
|
5729
6058
|
selected
|
|
5730
6059
|
}) {
|
|
5731
|
-
return /* @__PURE__ */
|
|
6060
|
+
return /* @__PURE__ */ React50.createElement(
|
|
5732
6061
|
"div",
|
|
5733
6062
|
{
|
|
5734
6063
|
className: cx("flex items-center gap-2", selected && "text-primary"),
|
|
@@ -5773,11 +6102,11 @@ var fontStyleMap = {
|
|
|
5773
6102
|
// src/components/Collection.tsx
|
|
5774
6103
|
var Collection = forwardRefGeneric(function Collection2(props, ref) {
|
|
5775
6104
|
const { viewType, ...rest } = props;
|
|
5776
|
-
return viewType === "grid" ? /* @__PURE__ */
|
|
6105
|
+
return viewType === "grid" ? /* @__PURE__ */ React51.createElement(Grid, { ref, ...rest }) : /* @__PURE__ */ React51.createElement(List, { ref, ...rest });
|
|
5777
6106
|
});
|
|
5778
6107
|
|
|
5779
6108
|
// src/components/ColorSwatch.tsx
|
|
5780
|
-
import
|
|
6109
|
+
import React52, { forwardRef as forwardRef20 } from "react";
|
|
5781
6110
|
var colorSwatchSizeMap = {
|
|
5782
6111
|
xsmall: 21,
|
|
5783
6112
|
small: 27,
|
|
@@ -5786,7 +6115,7 @@ var colorSwatchSizeMap = {
|
|
|
5786
6115
|
};
|
|
5787
6116
|
var ColorSwatch = forwardRef20(function ColorSwatch2({ color, size: size2 = "small", checked, style: style2, ...props }, ref) {
|
|
5788
6117
|
const sizePx = colorSwatchSizeMap[size2];
|
|
5789
|
-
return /* @__PURE__ */
|
|
6118
|
+
return /* @__PURE__ */ React52.createElement(
|
|
5790
6119
|
"button",
|
|
5791
6120
|
{
|
|
5792
6121
|
...props,
|
|
@@ -5807,7 +6136,7 @@ var ColorSwatch = forwardRef20(function ColorSwatch2({ color, size: size2 = "sma
|
|
|
5807
6136
|
|
|
5808
6137
|
// src/components/ColorSwatchControl.tsx
|
|
5809
6138
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
5810
|
-
import
|
|
6139
|
+
import React53, { useMemo as useMemo22 } from "react";
|
|
5811
6140
|
function ColorSwatchControl(props) {
|
|
5812
6141
|
const {
|
|
5813
6142
|
options,
|
|
@@ -5822,7 +6151,7 @@ function ColorSwatchControl(props) {
|
|
|
5822
6151
|
id,
|
|
5823
6152
|
style: style2
|
|
5824
6153
|
} = props;
|
|
5825
|
-
const styles3 =
|
|
6154
|
+
const styles3 = useMemo22(() => {
|
|
5826
6155
|
return {
|
|
5827
6156
|
display: "grid",
|
|
5828
6157
|
gridTemplateColumns: `repeat(auto-fill, minmax(${colorSwatchSizeMap[size2]}px, 1fr))`,
|
|
@@ -5830,8 +6159,8 @@ function ColorSwatchControl(props) {
|
|
|
5830
6159
|
...style2
|
|
5831
6160
|
};
|
|
5832
6161
|
}, [size2, style2]);
|
|
5833
|
-
const content = /* @__PURE__ */
|
|
5834
|
-
const item = /* @__PURE__ */
|
|
6162
|
+
const content = /* @__PURE__ */ React53.createElement("div", { className, id, style: styles3 }, options.map((option) => {
|
|
6163
|
+
const item = /* @__PURE__ */ React53.createElement(
|
|
5835
6164
|
ColorSwatch,
|
|
5836
6165
|
{
|
|
5837
6166
|
key: option,
|
|
@@ -5844,7 +6173,7 @@ function ColorSwatchControl(props) {
|
|
|
5844
6173
|
checked: value === option
|
|
5845
6174
|
}
|
|
5846
6175
|
);
|
|
5847
|
-
return /* @__PURE__ */
|
|
6176
|
+
return /* @__PURE__ */ React53.createElement(
|
|
5848
6177
|
ToggleGroupPrimitive.Item,
|
|
5849
6178
|
{
|
|
5850
6179
|
asChild: true,
|
|
@@ -5855,7 +6184,7 @@ function ColorSwatchControl(props) {
|
|
|
5855
6184
|
item
|
|
5856
6185
|
);
|
|
5857
6186
|
}));
|
|
5858
|
-
return /* @__PURE__ */
|
|
6187
|
+
return /* @__PURE__ */ React53.createElement(
|
|
5859
6188
|
ToggleGroupPrimitive.Root,
|
|
5860
6189
|
{
|
|
5861
6190
|
type: "single",
|
|
@@ -5870,11 +6199,11 @@ function ColorSwatchControl(props) {
|
|
|
5870
6199
|
|
|
5871
6200
|
// src/components/Combobox.tsx
|
|
5872
6201
|
import { DropdownChevronIcon as DropdownChevronIcon2 } from "@noya-app/noya-icons";
|
|
5873
|
-
import
|
|
5874
|
-
useCallback as
|
|
5875
|
-
useEffect as
|
|
6202
|
+
import React55, {
|
|
6203
|
+
useCallback as useCallback25,
|
|
6204
|
+
useEffect as useEffect18,
|
|
5876
6205
|
useImperativeHandle as useImperativeHandle6,
|
|
5877
|
-
useMemo as
|
|
6206
|
+
useMemo as useMemo23,
|
|
5878
6207
|
useRef as useRef21,
|
|
5879
6208
|
useState as useState24
|
|
5880
6209
|
} from "react";
|
|
@@ -6212,7 +6541,7 @@ function useComboboxState(state) {
|
|
|
6212
6541
|
|
|
6213
6542
|
// src/components/ComboboxMenu.tsx
|
|
6214
6543
|
import { CheckIcon } from "@noya-app/noya-icons";
|
|
6215
|
-
import
|
|
6544
|
+
import React54 from "react";
|
|
6216
6545
|
var ComboboxMenu = memoGeneric(
|
|
6217
6546
|
forwardRefGeneric(function ComboboxMenu2({
|
|
6218
6547
|
items,
|
|
@@ -6224,7 +6553,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6224
6553
|
indented,
|
|
6225
6554
|
iconPosition = "right"
|
|
6226
6555
|
}, forwardedRef) {
|
|
6227
|
-
return /* @__PURE__ */
|
|
6556
|
+
return /* @__PURE__ */ React54.createElement(
|
|
6228
6557
|
ListView.Root,
|
|
6229
6558
|
{
|
|
6230
6559
|
ref: forwardedRef,
|
|
@@ -6240,7 +6569,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6240
6569
|
style: style2,
|
|
6241
6570
|
renderItem: (item, i) => {
|
|
6242
6571
|
if (item.type === "sectionHeader") {
|
|
6243
|
-
return /* @__PURE__ */
|
|
6572
|
+
return /* @__PURE__ */ React54.createElement(ListView.Row, { key: item.id, isSectionHeader: true }, indented && /* @__PURE__ */ React54.createElement(
|
|
6244
6573
|
Spacer.Horizontal,
|
|
6245
6574
|
{
|
|
6246
6575
|
size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET + CHECKBOX_INDENT_WIDTH
|
|
@@ -6251,7 +6580,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6251
6580
|
item: typeof item.title === "string" ? item.title : item.value,
|
|
6252
6581
|
itemScore: item
|
|
6253
6582
|
});
|
|
6254
|
-
return /* @__PURE__ */
|
|
6583
|
+
return /* @__PURE__ */ React54.createElement(
|
|
6255
6584
|
ListView.Row,
|
|
6256
6585
|
{
|
|
6257
6586
|
key: item.value,
|
|
@@ -6264,12 +6593,12 @@ var ComboboxMenu = memoGeneric(
|
|
|
6264
6593
|
}
|
|
6265
6594
|
}
|
|
6266
6595
|
},
|
|
6267
|
-
/* @__PURE__ */
|
|
6596
|
+
/* @__PURE__ */ React54.createElement("div", { className: "flex flex-1 min-w-0 items-center" }, indented && /* @__PURE__ */ React54.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }), item.checked ? /* @__PURE__ */ React54.createElement("div", { ...styles.itemIndicator }, /* @__PURE__ */ React54.createElement(CheckIcon, null)) : indented ? /* @__PURE__ */ React54.createElement(
|
|
6268
6597
|
Spacer.Horizontal,
|
|
6269
6598
|
{
|
|
6270
6599
|
size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET
|
|
6271
6600
|
}
|
|
6272
|
-
) : null, iconPosition === "left" && item.icon && /* @__PURE__ */
|
|
6601
|
+
) : null, iconPosition === "left" && item.icon && /* @__PURE__ */ React54.createElement(React54.Fragment, null, renderIcon(item.icon), /* @__PURE__ */ React54.createElement(Spacer.Horizontal, { size: 8 })), tokens.map((token, j) => /* @__PURE__ */ React54.createElement(
|
|
6273
6602
|
"span",
|
|
6274
6603
|
{
|
|
6275
6604
|
key: `${item.value}-token-${j}`,
|
|
@@ -6280,7 +6609,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6280
6609
|
},
|
|
6281
6610
|
token.text
|
|
6282
6611
|
))),
|
|
6283
|
-
(item.shortcut || item.icon && iconPosition === "right") && /* @__PURE__ */
|
|
6612
|
+
(item.shortcut || item.icon && iconPosition === "right") && /* @__PURE__ */ React54.createElement(React54.Fragment, null, item.shortcut ? /* @__PURE__ */ React54.createElement(KeyboardShortcut, { shortcut: item.shortcut }) : item.icon && renderIcon(item.icon))
|
|
6284
6613
|
);
|
|
6285
6614
|
}
|
|
6286
6615
|
}
|
|
@@ -6307,7 +6636,7 @@ var Combobox = memoGeneric(
|
|
|
6307
6636
|
onDeleteWhenEmpty,
|
|
6308
6637
|
...rest
|
|
6309
6638
|
}, forwardedRef) {
|
|
6310
|
-
const props =
|
|
6639
|
+
const props = useMemo23(() => {
|
|
6311
6640
|
if (rest.mode === "string") {
|
|
6312
6641
|
return {
|
|
6313
6642
|
mode: rest.mode,
|
|
@@ -6360,20 +6689,20 @@ var Combobox = memoGeneric(
|
|
|
6360
6689
|
const { fieldId: id } = useLabel({
|
|
6361
6690
|
fieldId: rest.id
|
|
6362
6691
|
});
|
|
6363
|
-
|
|
6692
|
+
useEffect18(() => {
|
|
6364
6693
|
comboboxState.setItems(items);
|
|
6365
6694
|
}, [items, comboboxState]);
|
|
6366
|
-
|
|
6695
|
+
useEffect18(() => {
|
|
6367
6696
|
comboboxState.setFilter(initialValueString);
|
|
6368
6697
|
}, [comboboxState, initialValueString]);
|
|
6369
6698
|
const { filter, selectedIndex, filteredItems } = state;
|
|
6370
6699
|
const shouldShowMenu = isFocused && !(hideMenuWhenEmptyValue && filter === "");
|
|
6371
|
-
|
|
6700
|
+
useEffect18(() => {
|
|
6372
6701
|
if (listRef.current) {
|
|
6373
6702
|
listRef.current.scrollToIndex(selectedIndex);
|
|
6374
6703
|
}
|
|
6375
6704
|
}, [selectedIndex]);
|
|
6376
|
-
const handleBlur =
|
|
6705
|
+
const handleBlur = useCallback25(() => {
|
|
6377
6706
|
ref.current?.blur();
|
|
6378
6707
|
comboboxState.reset(initialValueString);
|
|
6379
6708
|
if (props.mode === "string") {
|
|
@@ -6392,7 +6721,7 @@ var Combobox = memoGeneric(
|
|
|
6392
6721
|
}
|
|
6393
6722
|
setIsFocused(false);
|
|
6394
6723
|
}, [filter, initialValueString, props, state, comboboxState]);
|
|
6395
|
-
const handleFocus =
|
|
6724
|
+
const handleFocus = useCallback25(
|
|
6396
6725
|
(event) => {
|
|
6397
6726
|
setIsFocused(true);
|
|
6398
6727
|
comboboxState.reset(
|
|
@@ -6406,7 +6735,7 @@ var Combobox = memoGeneric(
|
|
|
6406
6735
|
},
|
|
6407
6736
|
[initialValueString, onFocus, openMenuBehavior, comboboxState]
|
|
6408
6737
|
);
|
|
6409
|
-
const handleUpdateSelection =
|
|
6738
|
+
const handleUpdateSelection = useCallback25(
|
|
6410
6739
|
(item) => {
|
|
6411
6740
|
if (item.type !== void 0) return;
|
|
6412
6741
|
const selectedItem = comboboxState.selectCurrentItem(item);
|
|
@@ -6422,7 +6751,7 @@ var Combobox = memoGeneric(
|
|
|
6422
6751
|
},
|
|
6423
6752
|
[props, comboboxState]
|
|
6424
6753
|
);
|
|
6425
|
-
const handleIndexChange =
|
|
6754
|
+
const handleIndexChange = useCallback25(
|
|
6426
6755
|
(index) => {
|
|
6427
6756
|
comboboxState.setSelectedIndex(index);
|
|
6428
6757
|
const item = comboboxState.getSelectedItem();
|
|
@@ -6438,7 +6767,7 @@ var Combobox = memoGeneric(
|
|
|
6438
6767
|
},
|
|
6439
6768
|
[props, comboboxState]
|
|
6440
6769
|
);
|
|
6441
|
-
const handleChange =
|
|
6770
|
+
const handleChange = useCallback25(
|
|
6442
6771
|
(value) => {
|
|
6443
6772
|
if (readOnly) return;
|
|
6444
6773
|
comboboxState.setFilter(value);
|
|
@@ -6453,7 +6782,7 @@ var Combobox = memoGeneric(
|
|
|
6453
6782
|
},
|
|
6454
6783
|
[readOnly, props, comboboxState]
|
|
6455
6784
|
);
|
|
6456
|
-
const handleKeyDown =
|
|
6785
|
+
const handleKeyDown = useCallback25(
|
|
6457
6786
|
(event) => {
|
|
6458
6787
|
let handled = false;
|
|
6459
6788
|
const item = comboboxState.getSelectedItem();
|
|
@@ -6561,7 +6890,7 @@ var Combobox = memoGeneric(
|
|
|
6561
6890
|
ref.current?.setSelectionRange(0, ref.current.value.length);
|
|
6562
6891
|
}
|
|
6563
6892
|
}));
|
|
6564
|
-
const handleChevronClick =
|
|
6893
|
+
const handleChevronClick = useCallback25(
|
|
6565
6894
|
(event) => {
|
|
6566
6895
|
event.stopPropagation();
|
|
6567
6896
|
if (shouldShowMenu) {
|
|
@@ -6581,14 +6910,14 @@ var Combobox = memoGeneric(
|
|
|
6581
6910
|
comboboxState
|
|
6582
6911
|
]
|
|
6583
6912
|
);
|
|
6584
|
-
|
|
6913
|
+
useEffect18(() => {
|
|
6585
6914
|
if (!shouldBlur) return;
|
|
6586
6915
|
if (document.activeElement !== ref.current) return;
|
|
6587
6916
|
setShouldBlur(false);
|
|
6588
6917
|
ref.current?.focus();
|
|
6589
6918
|
handleBlur();
|
|
6590
6919
|
}, [shouldBlur, handleBlur]);
|
|
6591
|
-
const { sectionHeaderCount, menuItemsCount } =
|
|
6920
|
+
const { sectionHeaderCount, menuItemsCount } = useMemo23(
|
|
6592
6921
|
() => ({
|
|
6593
6922
|
sectionHeaderCount: filteredItems.filter(
|
|
6594
6923
|
(item) => isMenuItemSectionHeader(item)
|
|
@@ -6602,19 +6931,19 @@ var Combobox = memoGeneric(
|
|
|
6602
6931
|
const hasCheckedItems = items.some(
|
|
6603
6932
|
(item) => isSelectableMenuItem(item) && item.checked
|
|
6604
6933
|
);
|
|
6605
|
-
return /* @__PURE__ */
|
|
6934
|
+
return /* @__PURE__ */ React55.createElement(
|
|
6606
6935
|
InputField2.Root,
|
|
6607
6936
|
{
|
|
6608
6937
|
id,
|
|
6609
6938
|
size: size2,
|
|
6610
6939
|
sideOffset: 6,
|
|
6611
|
-
end: /* @__PURE__ */
|
|
6940
|
+
end: /* @__PURE__ */ React55.createElement(React55.Fragment, null, loading && /* @__PURE__ */ React55.createElement("div", { className: "pr-1.5" }, /* @__PURE__ */ React55.createElement(ActivityIndicator, null)), !readOnly && /* @__PURE__ */ React55.createElement(
|
|
6612
6941
|
InputField2.Button,
|
|
6613
6942
|
{
|
|
6614
6943
|
variant: "floating",
|
|
6615
6944
|
onClick: handleChevronClick
|
|
6616
6945
|
},
|
|
6617
|
-
/* @__PURE__ */
|
|
6946
|
+
/* @__PURE__ */ React55.createElement(
|
|
6618
6947
|
DropdownChevronIcon2,
|
|
6619
6948
|
{
|
|
6620
6949
|
className: cx(
|
|
@@ -6633,7 +6962,7 @@ var Combobox = memoGeneric(
|
|
|
6633
6962
|
ListView.rowHeight * 10.5
|
|
6634
6963
|
);
|
|
6635
6964
|
const listSize = { width, height };
|
|
6636
|
-
return /* @__PURE__ */
|
|
6965
|
+
return /* @__PURE__ */ React55.createElement(
|
|
6637
6966
|
"div",
|
|
6638
6967
|
{
|
|
6639
6968
|
className: cx(
|
|
@@ -6641,7 +6970,7 @@ var Combobox = memoGeneric(
|
|
|
6641
6970
|
shouldShowMenu && !readOnly ? "flex" : "hidden"
|
|
6642
6971
|
)
|
|
6643
6972
|
},
|
|
6644
|
-
filteredItems.length > 0 && !loading ? /* @__PURE__ */
|
|
6973
|
+
filteredItems.length > 0 && !loading ? /* @__PURE__ */ React55.createElement(
|
|
6645
6974
|
ComboboxMenu,
|
|
6646
6975
|
{
|
|
6647
6976
|
ref: listRef,
|
|
@@ -6655,11 +6984,11 @@ var Combobox = memoGeneric(
|
|
|
6655
6984
|
},
|
|
6656
6985
|
indented: hasCheckedItems
|
|
6657
6986
|
}
|
|
6658
|
-
) : /* @__PURE__ */
|
|
6987
|
+
) : /* @__PURE__ */ React55.createElement("div", { className: "flex flex-col h-[50px] p-5 items-center justify-center" }, /* @__PURE__ */ React55.createElement(Small, { className: "text-text-disabled" }, loading ? "Loading..." : "No results"))
|
|
6659
6988
|
);
|
|
6660
6989
|
}
|
|
6661
6990
|
},
|
|
6662
|
-
/* @__PURE__ */
|
|
6991
|
+
/* @__PURE__ */ React55.createElement(
|
|
6663
6992
|
InputField2.Input,
|
|
6664
6993
|
{
|
|
6665
6994
|
ref,
|
|
@@ -6684,7 +7013,7 @@ var Combobox = memoGeneric(
|
|
|
6684
7013
|
...readOnly ? { readOnly: true } : {}
|
|
6685
7014
|
}
|
|
6686
7015
|
),
|
|
6687
|
-
filter && typeaheadValue && typeaheadValue.toLowerCase().startsWith(filter.toLowerCase()) && /* @__PURE__ */
|
|
7016
|
+
filter && typeaheadValue && typeaheadValue.toLowerCase().startsWith(filter.toLowerCase()) && /* @__PURE__ */ React55.createElement(
|
|
6688
7017
|
InputField2.Typeahead,
|
|
6689
7018
|
{
|
|
6690
7019
|
value: typeaheadValue,
|
|
@@ -6698,30 +7027,30 @@ var Combobox = memoGeneric(
|
|
|
6698
7027
|
);
|
|
6699
7028
|
|
|
6700
7029
|
// src/components/CommandPalette.tsx
|
|
6701
|
-
import
|
|
7030
|
+
import React58, { memo as memo21 } from "react";
|
|
6702
7031
|
|
|
6703
7032
|
// src/components/SearchCompletionMenu.tsx
|
|
6704
7033
|
import { getCurrentPlatform as getCurrentPlatform2, handleKeyboardEvent } from "@noya-app/noya-keymap";
|
|
6705
|
-
import
|
|
7034
|
+
import React57, {
|
|
6706
7035
|
forwardRef as forwardRef21,
|
|
6707
|
-
useCallback as
|
|
6708
|
-
useEffect as
|
|
7036
|
+
useCallback as useCallback26,
|
|
7037
|
+
useEffect as useEffect19,
|
|
6709
7038
|
useImperativeHandle as useImperativeHandle7,
|
|
6710
|
-
useMemo as
|
|
7039
|
+
useMemo as useMemo24,
|
|
6711
7040
|
useRef as useRef22,
|
|
6712
7041
|
useState as useState25
|
|
6713
7042
|
} from "react";
|
|
6714
7043
|
|
|
6715
7044
|
// src/components/Divider.tsx
|
|
6716
|
-
import
|
|
6717
|
-
var Divider =
|
|
7045
|
+
import React56, { memo as memo20 } from "react";
|
|
7046
|
+
var Divider = memo20(function Divider2({
|
|
6718
7047
|
variant = "normal",
|
|
6719
7048
|
overflow = 0,
|
|
6720
7049
|
className,
|
|
6721
7050
|
style: style2,
|
|
6722
7051
|
...props
|
|
6723
7052
|
}) {
|
|
6724
|
-
return /* @__PURE__ */
|
|
7053
|
+
return /* @__PURE__ */ React56.createElement(
|
|
6725
7054
|
"div",
|
|
6726
7055
|
{
|
|
6727
7056
|
className: cx(
|
|
@@ -6741,14 +7070,14 @@ var Divider = memo21(function Divider2({
|
|
|
6741
7070
|
}
|
|
6742
7071
|
);
|
|
6743
7072
|
});
|
|
6744
|
-
var DividerVertical =
|
|
7073
|
+
var DividerVertical = memo20(function DividerVertical2({
|
|
6745
7074
|
variant = "normal",
|
|
6746
7075
|
overflow = 0,
|
|
6747
7076
|
className,
|
|
6748
7077
|
style: style2,
|
|
6749
7078
|
...props
|
|
6750
7079
|
}) {
|
|
6751
|
-
return /* @__PURE__ */
|
|
7080
|
+
return /* @__PURE__ */ React56.createElement(
|
|
6752
7081
|
"div",
|
|
6753
7082
|
{
|
|
6754
7083
|
className: cx(`
|
|
@@ -6782,12 +7111,12 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
|
|
|
6782
7111
|
index: 0
|
|
6783
7112
|
});
|
|
6784
7113
|
const { index, search } = state;
|
|
6785
|
-
const listRef =
|
|
7114
|
+
const listRef = React57.useRef(null);
|
|
6786
7115
|
const hasCheckedItems = items.some((item) => item.checked);
|
|
6787
|
-
|
|
7116
|
+
useEffect19(() => {
|
|
6788
7117
|
listRef.current?.scrollToIndex(index);
|
|
6789
7118
|
}, [index]);
|
|
6790
|
-
const results =
|
|
7119
|
+
const results = useMemo24(
|
|
6791
7120
|
() => fuzzyFilter({
|
|
6792
7121
|
items: items.map(
|
|
6793
7122
|
(item) => typeof item.title === "string" ? item.title : item.value
|
|
@@ -6799,13 +7128,13 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
|
|
|
6799
7128
|
})),
|
|
6800
7129
|
[items, search]
|
|
6801
7130
|
);
|
|
6802
|
-
const setSearch =
|
|
7131
|
+
const setSearch = useCallback26((search2) => {
|
|
6803
7132
|
setState((state2) => ({ ...state2, search: search2, index: 0 }));
|
|
6804
7133
|
}, []);
|
|
6805
|
-
const setIndex =
|
|
7134
|
+
const setIndex = useCallback26((index2) => {
|
|
6806
7135
|
setState((state2) => ({ ...state2, index: index2 }));
|
|
6807
7136
|
}, []);
|
|
6808
|
-
|
|
7137
|
+
useEffect19(() => {
|
|
6809
7138
|
onHover?.(results[index]);
|
|
6810
7139
|
}, [index, onHover, results]);
|
|
6811
7140
|
const searchHeight = 31;
|
|
@@ -6820,14 +7149,14 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
|
|
|
6820
7149
|
width: listSize.width,
|
|
6821
7150
|
height: searchHeight + listSize.height
|
|
6822
7151
|
};
|
|
6823
|
-
const selectAndClose =
|
|
7152
|
+
const selectAndClose = useCallback26(
|
|
6824
7153
|
(item) => {
|
|
6825
7154
|
onSelect(item);
|
|
6826
7155
|
onClose();
|
|
6827
7156
|
},
|
|
6828
7157
|
[onSelect, onClose]
|
|
6829
7158
|
);
|
|
6830
|
-
const handleKeyDown =
|
|
7159
|
+
const handleKeyDown = useCallback26(
|
|
6831
7160
|
(event) => {
|
|
6832
7161
|
handleKeyboardEvent(event.nativeEvent, getCurrentPlatform2(navigator), {
|
|
6833
7162
|
ArrowUp: () => {
|
|
@@ -6861,7 +7190,7 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
|
|
|
6861
7190
|
inputRef.current?.focus();
|
|
6862
7191
|
}
|
|
6863
7192
|
}));
|
|
6864
|
-
return /* @__PURE__ */
|
|
7193
|
+
return /* @__PURE__ */ React57.createElement("div", { ...elementSize, className: "flex flex-col overflow-hidden" }, /* @__PURE__ */ React57.createElement(InputField2.Root, { className: "flex flex-0" }, /* @__PURE__ */ React57.createElement(
|
|
6865
7194
|
InputField2.Input,
|
|
6866
7195
|
{
|
|
6867
7196
|
ref: inputRef,
|
|
@@ -6881,7 +7210,7 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
|
|
|
6881
7210
|
onChange: setSearch,
|
|
6882
7211
|
onKeyDown: handleKeyDown
|
|
6883
7212
|
}
|
|
6884
|
-
)), /* @__PURE__ */
|
|
7213
|
+
)), /* @__PURE__ */ React57.createElement(Divider, null), results.length > 0 ? /* @__PURE__ */ React57.createElement(
|
|
6885
7214
|
ComboboxMenu,
|
|
6886
7215
|
{
|
|
6887
7216
|
ref: listRef,
|
|
@@ -6896,29 +7225,29 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
|
|
|
6896
7225
|
onHoverIndex: setIndex,
|
|
6897
7226
|
indented: hasCheckedItems
|
|
6898
7227
|
}
|
|
6899
|
-
) : /* @__PURE__ */
|
|
7228
|
+
) : /* @__PURE__ */ React57.createElement(
|
|
6900
7229
|
"div",
|
|
6901
7230
|
{
|
|
6902
7231
|
...listSize,
|
|
6903
7232
|
className: "flex flex-col p-20 items-center justify-center"
|
|
6904
7233
|
},
|
|
6905
|
-
/* @__PURE__ */
|
|
7234
|
+
/* @__PURE__ */ React57.createElement(Small, { color: "textDisabled" }, "No results")
|
|
6906
7235
|
));
|
|
6907
7236
|
});
|
|
6908
7237
|
|
|
6909
7238
|
// src/components/CommandPalette.tsx
|
|
6910
|
-
var CommandPalette =
|
|
7239
|
+
var CommandPalette = memo21(function CommandPalette2({
|
|
6911
7240
|
showCommandPalette,
|
|
6912
7241
|
setShowCommandPalette,
|
|
6913
7242
|
items,
|
|
6914
7243
|
onSelect,
|
|
6915
7244
|
onHover
|
|
6916
7245
|
}) {
|
|
6917
|
-
const menuRef =
|
|
6918
|
-
const handleClose =
|
|
7246
|
+
const menuRef = React58.useRef(null);
|
|
7247
|
+
const handleClose = React58.useCallback(() => {
|
|
6919
7248
|
setShowCommandPalette(false);
|
|
6920
7249
|
}, [setShowCommandPalette]);
|
|
6921
|
-
return /* @__PURE__ */
|
|
7250
|
+
return /* @__PURE__ */ React58.createElement(
|
|
6922
7251
|
Dialog,
|
|
6923
7252
|
{
|
|
6924
7253
|
style: {
|
|
@@ -6944,7 +7273,7 @@ var CommandPalette = memo22(function CommandPalette2({
|
|
|
6944
7273
|
}, 0);
|
|
6945
7274
|
}
|
|
6946
7275
|
},
|
|
6947
|
-
/* @__PURE__ */
|
|
7276
|
+
/* @__PURE__ */ React58.createElement("div", { className: "flex flex-col flex-1" }, /* @__PURE__ */ React58.createElement(AutoSizer, null, (size2) => /* @__PURE__ */ React58.createElement(
|
|
6948
7277
|
SearchCompletionMenu,
|
|
6949
7278
|
{
|
|
6950
7279
|
ref: menuRef,
|
|
@@ -6959,21 +7288,21 @@ var CommandPalette = memo22(function CommandPalette2({
|
|
|
6959
7288
|
});
|
|
6960
7289
|
|
|
6961
7290
|
// src/components/connected-users-menu/ConnectedUsersMenuLayout.tsx
|
|
6962
|
-
import
|
|
6963
|
-
var UserAvatar = ({ userId, name, image }) => /* @__PURE__ */
|
|
7291
|
+
import React59 from "react";
|
|
7292
|
+
var UserAvatar = ({ userId, name, image }) => /* @__PURE__ */ React59.createElement(
|
|
6964
7293
|
Tooltip,
|
|
6965
7294
|
{
|
|
6966
7295
|
key: userId,
|
|
6967
|
-
content: /* @__PURE__ */
|
|
7296
|
+
content: /* @__PURE__ */ React59.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React59.createElement(Small, null, name))
|
|
6968
7297
|
},
|
|
6969
|
-
/* @__PURE__ */
|
|
7298
|
+
/* @__PURE__ */ React59.createElement(Avatar, { size: INPUT_HEIGHT, userId, name, image })
|
|
6970
7299
|
);
|
|
6971
7300
|
var ConnectedUsersMenuLayout = ({
|
|
6972
7301
|
renderUsers,
|
|
6973
7302
|
launchAIAssistant,
|
|
6974
7303
|
isAssistantOpen
|
|
6975
7304
|
}) => {
|
|
6976
|
-
return /* @__PURE__ */
|
|
7305
|
+
return /* @__PURE__ */ React59.createElement("div", { className: "flex gap-1.5" }, /* @__PURE__ */ React59.createElement(AvatarStack, { size: INPUT_HEIGHT, className: "mr-1" }, renderUsers()), launchAIAssistant && /* @__PURE__ */ React59.createElement(Tooltip, { content: "AI Assistant" }, /* @__PURE__ */ React59.createElement(
|
|
6977
7306
|
Button_default,
|
|
6978
7307
|
{
|
|
6979
7308
|
active: isAssistantOpen,
|
|
@@ -6986,7 +7315,7 @@ var ConnectedUsersMenuLayout = ({
|
|
|
6986
7315
|
|
|
6987
7316
|
// src/components/DraggableMenuButton.tsx
|
|
6988
7317
|
import { DragHandleDots2Icon } from "@noya-app/noya-icons";
|
|
6989
|
-
import
|
|
7318
|
+
import React60, { useCallback as useCallback27, useState as useState26 } from "react";
|
|
6990
7319
|
var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
6991
7320
|
items,
|
|
6992
7321
|
onSelect,
|
|
@@ -6997,7 +7326,7 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
6997
7326
|
}) {
|
|
6998
7327
|
const [open, setOpen] = useState26(false);
|
|
6999
7328
|
const [downPosition, setDownPosition] = useState26(null);
|
|
7000
|
-
const handlePointerDownCapture =
|
|
7329
|
+
const handlePointerDownCapture = useCallback27(
|
|
7001
7330
|
(event) => {
|
|
7002
7331
|
if (open) {
|
|
7003
7332
|
setDownPosition(null);
|
|
@@ -7010,7 +7339,7 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7010
7339
|
},
|
|
7011
7340
|
[open]
|
|
7012
7341
|
);
|
|
7013
|
-
const handlePointerUp =
|
|
7342
|
+
const handlePointerUp = useCallback27(
|
|
7014
7343
|
(event) => {
|
|
7015
7344
|
if (open || !downPosition) {
|
|
7016
7345
|
setDownPosition(null);
|
|
@@ -7026,13 +7355,13 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7026
7355
|
},
|
|
7027
7356
|
[downPosition, open]
|
|
7028
7357
|
);
|
|
7029
|
-
const handleOpenChange =
|
|
7358
|
+
const handleOpenChange = useCallback27(
|
|
7030
7359
|
(isOpen) => {
|
|
7031
7360
|
if (!isOpen) setOpen(false);
|
|
7032
7361
|
},
|
|
7033
7362
|
[setOpen]
|
|
7034
7363
|
);
|
|
7035
|
-
return /* @__PURE__ */
|
|
7364
|
+
return /* @__PURE__ */ React60.createElement(
|
|
7036
7365
|
"div",
|
|
7037
7366
|
{
|
|
7038
7367
|
className: cx(
|
|
@@ -7048,7 +7377,7 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7048
7377
|
onClick?.();
|
|
7049
7378
|
}
|
|
7050
7379
|
},
|
|
7051
|
-
items && onSelect ? /* @__PURE__ */
|
|
7380
|
+
items && onSelect ? /* @__PURE__ */ React60.createElement(
|
|
7052
7381
|
DropdownMenu,
|
|
7053
7382
|
{
|
|
7054
7383
|
open,
|
|
@@ -7057,13 +7386,13 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7057
7386
|
onSelect,
|
|
7058
7387
|
shouldBindKeyboardShortcuts: false
|
|
7059
7388
|
},
|
|
7060
|
-
/* @__PURE__ */
|
|
7389
|
+
/* @__PURE__ */ React60.createElement("div", { className: "pointer-events-none h-[15px]" }, /* @__PURE__ */ React60.createElement(
|
|
7061
7390
|
DragHandleDots2Icon,
|
|
7062
7391
|
{
|
|
7063
7392
|
color: isVisible || open ? cssVars.colors.icon : "transparent"
|
|
7064
7393
|
}
|
|
7065
7394
|
))
|
|
7066
|
-
) : /* @__PURE__ */
|
|
7395
|
+
) : /* @__PURE__ */ React60.createElement(
|
|
7067
7396
|
DragHandleDots2Icon,
|
|
7068
7397
|
{
|
|
7069
7398
|
color: isVisible || open ? cssVars.colors.icon : "transparent"
|
|
@@ -7074,10 +7403,10 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7074
7403
|
|
|
7075
7404
|
// src/components/Drawer.tsx
|
|
7076
7405
|
import * as Dialog3 from "@radix-ui/react-dialog";
|
|
7077
|
-
import * as
|
|
7406
|
+
import * as React61 from "react";
|
|
7078
7407
|
import { useImperativeHandle as useImperativeHandle8 } from "react";
|
|
7079
|
-
var Drawer =
|
|
7080
|
-
|
|
7408
|
+
var Drawer = React61.memo(
|
|
7409
|
+
React61.forwardRef(function Drawer2({
|
|
7081
7410
|
open,
|
|
7082
7411
|
onOpenChange,
|
|
7083
7412
|
trigger,
|
|
@@ -7107,7 +7436,7 @@ var Drawer = React58.memo(
|
|
|
7107
7436
|
return internalOpen;
|
|
7108
7437
|
}
|
|
7109
7438
|
}));
|
|
7110
|
-
const inner = /* @__PURE__ */
|
|
7439
|
+
const inner = /* @__PURE__ */ React61.createElement(React61.Fragment, null, /* @__PURE__ */ React61.createElement(
|
|
7111
7440
|
Dialog3.Overlay,
|
|
7112
7441
|
{
|
|
7113
7442
|
className: cx(
|
|
@@ -7115,7 +7444,7 @@ var Drawer = React58.memo(
|
|
|
7115
7444
|
positioning === "absolute" ? "absolute" : "fixed"
|
|
7116
7445
|
)
|
|
7117
7446
|
}
|
|
7118
|
-
), /* @__PURE__ */
|
|
7447
|
+
), /* @__PURE__ */ React61.createElement(
|
|
7119
7448
|
Dialog3.Content,
|
|
7120
7449
|
{
|
|
7121
7450
|
id,
|
|
@@ -7127,24 +7456,24 @@ var Drawer = React58.memo(
|
|
|
7127
7456
|
className
|
|
7128
7457
|
)
|
|
7129
7458
|
},
|
|
7130
|
-
title && /* @__PURE__ */
|
|
7459
|
+
title && /* @__PURE__ */ React61.createElement(Dialog3.Title, null, title),
|
|
7131
7460
|
children
|
|
7132
7461
|
));
|
|
7133
|
-
return /* @__PURE__ */
|
|
7462
|
+
return /* @__PURE__ */ React61.createElement(
|
|
7134
7463
|
Dialog3.Root,
|
|
7135
7464
|
{
|
|
7136
7465
|
key: "dialog",
|
|
7137
7466
|
open: internalOpen,
|
|
7138
7467
|
onOpenChange: setInternalOpen
|
|
7139
7468
|
},
|
|
7140
|
-
/* @__PURE__ */
|
|
7141
|
-
portalled ? /* @__PURE__ */
|
|
7469
|
+
/* @__PURE__ */ React61.createElement(Dialog3.Trigger, { key: "trigger" }, trigger),
|
|
7470
|
+
portalled ? /* @__PURE__ */ React61.createElement(Dialog3.Portal, { container: portalContainer }, inner) : inner
|
|
7142
7471
|
);
|
|
7143
7472
|
})
|
|
7144
7473
|
);
|
|
7145
7474
|
|
|
7146
7475
|
// src/components/Fade.tsx
|
|
7147
|
-
import
|
|
7476
|
+
import React62 from "react";
|
|
7148
7477
|
var Fade = ({
|
|
7149
7478
|
children,
|
|
7150
7479
|
direction = "right",
|
|
@@ -7166,7 +7495,7 @@ var Fade = ({
|
|
|
7166
7495
|
top: "left-0 right-0 top-0",
|
|
7167
7496
|
bottom: "left-0 right-0 bottom-0"
|
|
7168
7497
|
}[direction];
|
|
7169
|
-
return /* @__PURE__ */
|
|
7498
|
+
return /* @__PURE__ */ React62.createElement("div", { className: cx("relative", className), style: { height } }, position === "front" ? children : null, /* @__PURE__ */ React62.createElement(
|
|
7170
7499
|
"div",
|
|
7171
7500
|
{
|
|
7172
7501
|
className: cx(
|
|
@@ -7185,17 +7514,17 @@ var Fade = ({
|
|
|
7185
7514
|
};
|
|
7186
7515
|
|
|
7187
7516
|
// src/components/file-explorer/FileExplorerLayout.tsx
|
|
7188
|
-
import
|
|
7517
|
+
import React63 from "react";
|
|
7189
7518
|
var FileExplorerLayout = ({
|
|
7190
7519
|
children,
|
|
7191
7520
|
className,
|
|
7192
7521
|
...props
|
|
7193
|
-
}) => /* @__PURE__ */
|
|
7522
|
+
}) => /* @__PURE__ */ React63.createElement(Section, { className: cx(className, "px-3 flex-1"), ...props }, children);
|
|
7194
7523
|
var FileExplorerUploadButton = ({
|
|
7195
7524
|
showUploadButton,
|
|
7196
7525
|
onUpload,
|
|
7197
7526
|
children
|
|
7198
|
-
}) => /* @__PURE__ */
|
|
7527
|
+
}) => /* @__PURE__ */ React63.createElement("div", { className: "flex items-center gap-2" }, showUploadButton && /* @__PURE__ */ React63.createElement(
|
|
7199
7528
|
IconButton,
|
|
7200
7529
|
{
|
|
7201
7530
|
iconName: "UploadIcon",
|
|
@@ -7206,14 +7535,14 @@ var FileExplorerUploadButton = ({
|
|
|
7206
7535
|
), children);
|
|
7207
7536
|
var FileExplorerCollection = forwardRefGeneric(
|
|
7208
7537
|
function FileExplorerCollection2({ ...props }, ref) {
|
|
7209
|
-
return /* @__PURE__ */
|
|
7538
|
+
return /* @__PURE__ */ React63.createElement(Collection, { ref, className: "-mx-3 flex-1", ...props });
|
|
7210
7539
|
}
|
|
7211
7540
|
);
|
|
7212
7541
|
var FileExplorerDetail = ({
|
|
7213
7542
|
selected,
|
|
7214
7543
|
size: size2,
|
|
7215
7544
|
children
|
|
7216
|
-
}) => /* @__PURE__ */
|
|
7545
|
+
}) => /* @__PURE__ */ React63.createElement(
|
|
7217
7546
|
"span",
|
|
7218
7547
|
{
|
|
7219
7548
|
className: cx(
|
|
@@ -7226,10 +7555,10 @@ var FileExplorerDetail = ({
|
|
|
7226
7555
|
var FileExplorerEmptyState = ({
|
|
7227
7556
|
label = "No files",
|
|
7228
7557
|
...props
|
|
7229
|
-
}) => /* @__PURE__ */
|
|
7558
|
+
}) => /* @__PURE__ */ React63.createElement(Banner, { label, className: "mx-3", ...props });
|
|
7230
7559
|
|
|
7231
7560
|
// src/components/FillInputField.tsx
|
|
7232
|
-
import
|
|
7561
|
+
import React66, { forwardRef as forwardRef23, memo as memo25 } from "react";
|
|
7233
7562
|
|
|
7234
7563
|
// ../noya-file-format/src/types.ts
|
|
7235
7564
|
var types_exports = {};
|
|
@@ -7554,25 +7883,25 @@ var ClassValue = /* @__PURE__ */ ((ClassValue2) => {
|
|
|
7554
7883
|
})(ClassValue || {});
|
|
7555
7884
|
|
|
7556
7885
|
// src/components/FillPreviewBackground.tsx
|
|
7557
|
-
import * as
|
|
7886
|
+
import * as React65 from "react";
|
|
7558
7887
|
|
|
7559
7888
|
// src/contexts/ImageDataContext.tsx
|
|
7560
|
-
import * as
|
|
7561
|
-
var ImageDataContext =
|
|
7889
|
+
import * as React64 from "react";
|
|
7890
|
+
var ImageDataContext = React64.createContext(
|
|
7562
7891
|
void 0
|
|
7563
7892
|
);
|
|
7564
|
-
var ImageDataProvider =
|
|
7893
|
+
var ImageDataProvider = React64.memo(function ImageDataProvider2({
|
|
7565
7894
|
children,
|
|
7566
7895
|
getImageData
|
|
7567
7896
|
}) {
|
|
7568
|
-
const contextValue =
|
|
7897
|
+
const contextValue = React64.useMemo(
|
|
7569
7898
|
() => ({ getImageData: getImageData ?? (() => void 0) }),
|
|
7570
7899
|
[getImageData]
|
|
7571
7900
|
);
|
|
7572
|
-
return /* @__PURE__ */
|
|
7901
|
+
return /* @__PURE__ */ React64.createElement(ImageDataContext.Provider, { value: contextValue }, children);
|
|
7573
7902
|
});
|
|
7574
7903
|
function useImageData(ref) {
|
|
7575
|
-
const value =
|
|
7904
|
+
const value = React64.useContext(ImageDataContext);
|
|
7576
7905
|
if (!value) {
|
|
7577
7906
|
throw new Error("Missing ImageDataProvider");
|
|
7578
7907
|
}
|
|
@@ -7580,9 +7909,9 @@ function useImageData(ref) {
|
|
|
7580
7909
|
}
|
|
7581
7910
|
|
|
7582
7911
|
// src/hooks/useObjectURL.ts
|
|
7583
|
-
import { useLayoutEffect as useLayoutEffect6, useMemo as
|
|
7912
|
+
import { useLayoutEffect as useLayoutEffect6, useMemo as useMemo26 } from "react";
|
|
7584
7913
|
function useObjectURL(object) {
|
|
7585
|
-
const objectURL =
|
|
7914
|
+
const objectURL = useMemo26(() => {
|
|
7586
7915
|
if (object instanceof Blob) return URL.createObjectURL(object);
|
|
7587
7916
|
const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
|
|
7588
7917
|
return URL.createObjectURL(new Blob([bytes]));
|
|
@@ -7642,10 +7971,10 @@ var dotsHorizontalSvg = (fillColor) => `
|
|
|
7642
7971
|
<path d='M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z'></path>
|
|
7643
7972
|
</svg>
|
|
7644
7973
|
`;
|
|
7645
|
-
var Background =
|
|
7974
|
+
var Background = React65.memo(function Background2({
|
|
7646
7975
|
background: background2
|
|
7647
7976
|
}) {
|
|
7648
|
-
return /* @__PURE__ */
|
|
7977
|
+
return /* @__PURE__ */ React65.createElement(
|
|
7649
7978
|
"span",
|
|
7650
7979
|
{
|
|
7651
7980
|
className: `${background2 ? `bg-[${background2}]` : "bg-input-background"} absolute inset-0`
|
|
@@ -7664,7 +7993,7 @@ function getPatternSizeAndPosition(fillType, tileScale) {
|
|
|
7664
7993
|
return "center / 100% 100%";
|
|
7665
7994
|
}
|
|
7666
7995
|
}
|
|
7667
|
-
var PatternPreviewBackground =
|
|
7996
|
+
var PatternPreviewBackground = React65.memo(
|
|
7668
7997
|
function PatternPreviewBackground2({
|
|
7669
7998
|
fillType,
|
|
7670
7999
|
tileScale,
|
|
@@ -7673,7 +8002,7 @@ var PatternPreviewBackground = React62.memo(
|
|
|
7673
8002
|
const image = useImageData(imageRef);
|
|
7674
8003
|
const url = useObjectURL(image);
|
|
7675
8004
|
const size2 = getPatternSizeAndPosition(fillType, tileScale);
|
|
7676
|
-
const background2 =
|
|
8005
|
+
const background2 = React65.useMemo(
|
|
7677
8006
|
() => [
|
|
7678
8007
|
size2,
|
|
7679
8008
|
`url(${url})`,
|
|
@@ -7681,44 +8010,44 @@ var PatternPreviewBackground = React62.memo(
|
|
|
7681
8010
|
].join(" "),
|
|
7682
8011
|
[fillType, size2, url]
|
|
7683
8012
|
);
|
|
7684
|
-
return /* @__PURE__ */
|
|
8013
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7685
8014
|
}
|
|
7686
8015
|
);
|
|
7687
|
-
var ColorPreviewBackground =
|
|
8016
|
+
var ColorPreviewBackground = React65.memo(function ColorPreviewBackground2({
|
|
7688
8017
|
color
|
|
7689
8018
|
}) {
|
|
7690
|
-
const background2 =
|
|
8019
|
+
const background2 = React65.useMemo(
|
|
7691
8020
|
() => sketchColorToRgbaString(color),
|
|
7692
8021
|
[color]
|
|
7693
8022
|
);
|
|
7694
|
-
return /* @__PURE__ */
|
|
8023
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7695
8024
|
});
|
|
7696
|
-
var GradientPreviewBackground =
|
|
8025
|
+
var GradientPreviewBackground = React65.memo(
|
|
7697
8026
|
function GradientPreviewBackground2({
|
|
7698
8027
|
gradient
|
|
7699
8028
|
}) {
|
|
7700
|
-
const background2 =
|
|
8029
|
+
const background2 = React65.useMemo(
|
|
7701
8030
|
() => getGradientBackground(gradient.stops, gradient.gradientType, 180),
|
|
7702
8031
|
[gradient.gradientType, gradient.stops]
|
|
7703
8032
|
);
|
|
7704
|
-
return /* @__PURE__ */
|
|
8033
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7705
8034
|
}
|
|
7706
8035
|
);
|
|
7707
8036
|
var background = `center url("data:image/svg+xml;utf8,${dotsHorizontalSvg(
|
|
7708
8037
|
cssVars.colors.placeholderDots
|
|
7709
8038
|
)}") no-repeat`;
|
|
7710
|
-
var FillPreviewBackground =
|
|
8039
|
+
var FillPreviewBackground = React65.memo(function FillPreviewBackground2({
|
|
7711
8040
|
value
|
|
7712
8041
|
}) {
|
|
7713
|
-
if (!value) return /* @__PURE__ */
|
|
8042
|
+
if (!value) return /* @__PURE__ */ React65.createElement(Background, { background });
|
|
7714
8043
|
switch (value._class) {
|
|
7715
8044
|
case "color":
|
|
7716
|
-
return /* @__PURE__ */
|
|
8045
|
+
return /* @__PURE__ */ React65.createElement(ColorPreviewBackground, { color: value });
|
|
7717
8046
|
case "gradient":
|
|
7718
|
-
return /* @__PURE__ */
|
|
8047
|
+
return /* @__PURE__ */ React65.createElement(GradientPreviewBackground, { gradient: value });
|
|
7719
8048
|
case "pattern":
|
|
7720
8049
|
if (!value.image) return null;
|
|
7721
|
-
return /* @__PURE__ */
|
|
8050
|
+
return /* @__PURE__ */ React65.createElement(
|
|
7722
8051
|
PatternPreviewBackground,
|
|
7723
8052
|
{
|
|
7724
8053
|
fillType: value.patternFillType,
|
|
@@ -7730,7 +8059,7 @@ var FillPreviewBackground = React62.memo(function FillPreviewBackground2({
|
|
|
7730
8059
|
});
|
|
7731
8060
|
|
|
7732
8061
|
// src/components/FillInputField.tsx
|
|
7733
|
-
var FillButton = forwardRef23(({ className, ...props }, ref) => /* @__PURE__ */
|
|
8062
|
+
var FillButton = forwardRef23(({ className, ...props }, ref) => /* @__PURE__ */ React66.createElement(
|
|
7734
8063
|
"button",
|
|
7735
8064
|
{
|
|
7736
8065
|
ref,
|
|
@@ -7741,14 +8070,14 @@ var FillButton = forwardRef23(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
7741
8070
|
...props
|
|
7742
8071
|
}
|
|
7743
8072
|
));
|
|
7744
|
-
var FillInputField =
|
|
8073
|
+
var FillInputField = memo25(
|
|
7745
8074
|
forwardRef23(function FillInputField2({ id, value, ...rest }, ref) {
|
|
7746
|
-
return /* @__PURE__ */
|
|
8075
|
+
return /* @__PURE__ */ React66.createElement(FillButton, { ref, id, ...rest }, /* @__PURE__ */ React66.createElement(FillPreviewBackground, { value }));
|
|
7747
8076
|
})
|
|
7748
8077
|
);
|
|
7749
8078
|
|
|
7750
8079
|
// src/components/FloatingWindow.tsx
|
|
7751
|
-
import
|
|
8080
|
+
import React67, { useCallback as useCallback28, useRef as useRef23, useState as useState27 } from "react";
|
|
7752
8081
|
var styles2 = {
|
|
7753
8082
|
noSelect: {
|
|
7754
8083
|
userSelect: "none",
|
|
@@ -7841,7 +8170,7 @@ function defaultRenderToolbar({
|
|
|
7841
8170
|
toolbarContent,
|
|
7842
8171
|
onClose
|
|
7843
8172
|
}) {
|
|
7844
|
-
return /* @__PURE__ */
|
|
8173
|
+
return /* @__PURE__ */ React67.createElement(React67.Fragment, null, /* @__PURE__ */ React67.createElement(Small, { className: "flex-1 font-medium text-text" }, title), toolbarContent, /* @__PURE__ */ React67.createElement(
|
|
7845
8174
|
IconButton,
|
|
7846
8175
|
{
|
|
7847
8176
|
iconName: "Cross3Icon",
|
|
@@ -7885,7 +8214,7 @@ var FloatingWindow = ({
|
|
|
7885
8214
|
document.body.style.userSelect = "";
|
|
7886
8215
|
}
|
|
7887
8216
|
};
|
|
7888
|
-
const handleMouseDown =
|
|
8217
|
+
const handleMouseDown = useCallback28((e) => {
|
|
7889
8218
|
if (!wrapperRef.current) return;
|
|
7890
8219
|
const rect = wrapperRef.current.getBoundingClientRect();
|
|
7891
8220
|
setDragOffset({
|
|
@@ -7894,7 +8223,7 @@ var FloatingWindow = ({
|
|
|
7894
8223
|
});
|
|
7895
8224
|
setIsDragging(true);
|
|
7896
8225
|
}, []);
|
|
7897
|
-
const handleResizeStart =
|
|
8226
|
+
const handleResizeStart = useCallback28(
|
|
7898
8227
|
(direction) => (e) => {
|
|
7899
8228
|
e.stopPropagation();
|
|
7900
8229
|
setIsResizing(true);
|
|
@@ -7903,7 +8232,7 @@ var FloatingWindow = ({
|
|
|
7903
8232
|
},
|
|
7904
8233
|
[]
|
|
7905
8234
|
);
|
|
7906
|
-
const handleMouseMove =
|
|
8235
|
+
const handleMouseMove = useCallback28(
|
|
7907
8236
|
(e) => {
|
|
7908
8237
|
if (isDragging) {
|
|
7909
8238
|
setPosition({
|
|
@@ -7957,13 +8286,13 @@ var FloatingWindow = ({
|
|
|
7957
8286
|
minHeight
|
|
7958
8287
|
]
|
|
7959
8288
|
);
|
|
7960
|
-
const handleMouseUp =
|
|
8289
|
+
const handleMouseUp = useCallback28((_e) => {
|
|
7961
8290
|
setIsDragging(false);
|
|
7962
8291
|
setIsResizing(false);
|
|
7963
8292
|
setResizeDirection(null);
|
|
7964
8293
|
toggleGlobalTextSelection(false);
|
|
7965
8294
|
}, []);
|
|
7966
|
-
|
|
8295
|
+
React67.useEffect(() => {
|
|
7967
8296
|
document.addEventListener("mousemove", handleMouseMove);
|
|
7968
8297
|
document.addEventListener("mouseup", handleMouseUp);
|
|
7969
8298
|
return () => {
|
|
@@ -7973,11 +8302,11 @@ var FloatingWindow = ({
|
|
|
7973
8302
|
}, [handleMouseMove, handleMouseUp]);
|
|
7974
8303
|
const floatingWindowManager = useFloatingWindowManager();
|
|
7975
8304
|
const currentFloatingWindow = useCurrentFloatingWindowInternal();
|
|
7976
|
-
const handleClose =
|
|
8305
|
+
const handleClose = useCallback28(() => {
|
|
7977
8306
|
if (onClose) onClose();
|
|
7978
8307
|
floatingWindowManager.closeWindow(currentFloatingWindow.id);
|
|
7979
8308
|
}, [currentFloatingWindow.id, floatingWindowManager, onClose]);
|
|
7980
|
-
return /* @__PURE__ */
|
|
8309
|
+
return /* @__PURE__ */ React67.createElement(
|
|
7981
8310
|
"div",
|
|
7982
8311
|
{
|
|
7983
8312
|
ref: wrapperRef,
|
|
@@ -7992,7 +8321,7 @@ var FloatingWindow = ({
|
|
|
7992
8321
|
zIndex: cssVars.zIndex.menu
|
|
7993
8322
|
}
|
|
7994
8323
|
},
|
|
7995
|
-
/* @__PURE__ */
|
|
8324
|
+
/* @__PURE__ */ React67.createElement(
|
|
7996
8325
|
"div",
|
|
7997
8326
|
{
|
|
7998
8327
|
style: {
|
|
@@ -8003,9 +8332,9 @@ var FloatingWindow = ({
|
|
|
8003
8332
|
},
|
|
8004
8333
|
renderToolbar({ title, toolbarContent, onClose: handleClose })
|
|
8005
8334
|
),
|
|
8006
|
-
/* @__PURE__ */
|
|
8007
|
-
/* @__PURE__ */
|
|
8008
|
-
Object.entries(resizeHandlePositions).map(([direction, style2]) => /* @__PURE__ */
|
|
8335
|
+
/* @__PURE__ */ React67.createElement(Divider, null),
|
|
8336
|
+
/* @__PURE__ */ React67.createElement("div", { style: styles2.content }, children),
|
|
8337
|
+
Object.entries(resizeHandlePositions).map(([direction, style2]) => /* @__PURE__ */ React67.createElement(
|
|
8009
8338
|
"div",
|
|
8010
8339
|
{
|
|
8011
8340
|
key: direction,
|
|
@@ -8027,8 +8356,8 @@ import {
|
|
|
8027
8356
|
hsvaToRgba,
|
|
8028
8357
|
rgbaToHsva as rgbaToHsva2
|
|
8029
8358
|
} from "@noya-app/noya-colorpicker";
|
|
8030
|
-
import * as
|
|
8031
|
-
var GradientPicker =
|
|
8359
|
+
import * as React68 from "react";
|
|
8360
|
+
var GradientPicker = React68.memo(function GradientPicker2({
|
|
8032
8361
|
value,
|
|
8033
8362
|
selectedStop,
|
|
8034
8363
|
onChangeColor,
|
|
@@ -8037,7 +8366,7 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8037
8366
|
onDelete,
|
|
8038
8367
|
onSelectStop
|
|
8039
8368
|
}) {
|
|
8040
|
-
const colorModel =
|
|
8369
|
+
const colorModel = React68.useMemo(
|
|
8041
8370
|
() => ({
|
|
8042
8371
|
defaultColor: { r: 0, g: 0, b: 0, a: 1 },
|
|
8043
8372
|
toHsva: rgbaToHsva2,
|
|
@@ -8046,30 +8375,30 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8046
8375
|
}),
|
|
8047
8376
|
[]
|
|
8048
8377
|
);
|
|
8049
|
-
const rgbaColor =
|
|
8378
|
+
const rgbaColor = React68.useMemo(
|
|
8050
8379
|
() => sketchColorToRgba(value[selectedStop].color),
|
|
8051
8380
|
[value, selectedStop]
|
|
8052
8381
|
);
|
|
8053
|
-
const handleChangeColor =
|
|
8382
|
+
const handleChangeColor = React68.useCallback(
|
|
8054
8383
|
(value2) => {
|
|
8055
8384
|
onChangeColor(rgbaToSketchColor(value2));
|
|
8056
8385
|
},
|
|
8057
8386
|
[onChangeColor]
|
|
8058
8387
|
);
|
|
8059
|
-
const handleAddGradientStop =
|
|
8388
|
+
const handleAddGradientStop = React68.useCallback(
|
|
8060
8389
|
(value2, position) => {
|
|
8061
8390
|
onAdd(rgbaToSketchColor(value2), position);
|
|
8062
8391
|
},
|
|
8063
8392
|
[onAdd]
|
|
8064
8393
|
);
|
|
8065
|
-
return /* @__PURE__ */
|
|
8394
|
+
return /* @__PURE__ */ React68.createElement(
|
|
8066
8395
|
NoyaColorPicker,
|
|
8067
8396
|
{
|
|
8068
8397
|
onChange: handleChangeColor,
|
|
8069
8398
|
colorModel,
|
|
8070
8399
|
color: rgbaColor
|
|
8071
8400
|
},
|
|
8072
|
-
/* @__PURE__ */
|
|
8401
|
+
/* @__PURE__ */ React68.createElement(
|
|
8073
8402
|
Gradient,
|
|
8074
8403
|
{
|
|
8075
8404
|
gradients: value,
|
|
@@ -8080,18 +8409,18 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8080
8409
|
onDelete
|
|
8081
8410
|
}
|
|
8082
8411
|
),
|
|
8083
|
-
/* @__PURE__ */
|
|
8084
|
-
/* @__PURE__ */
|
|
8085
|
-
/* @__PURE__ */
|
|
8086
|
-
/* @__PURE__ */
|
|
8087
|
-
/* @__PURE__ */
|
|
8088
|
-
/* @__PURE__ */
|
|
8412
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 10 }),
|
|
8413
|
+
/* @__PURE__ */ React68.createElement(Saturation, null),
|
|
8414
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 12 }),
|
|
8415
|
+
/* @__PURE__ */ React68.createElement(Hue, null),
|
|
8416
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 5 }),
|
|
8417
|
+
/* @__PURE__ */ React68.createElement(Alpha, null)
|
|
8089
8418
|
);
|
|
8090
8419
|
});
|
|
8091
8420
|
|
|
8092
8421
|
// src/components/InspectorContainer.tsx
|
|
8093
|
-
import
|
|
8094
|
-
var InspectorContainer =
|
|
8422
|
+
import React69, { forwardRef as forwardRef24, memo as memo27 } from "react";
|
|
8423
|
+
var InspectorContainer = memo27(
|
|
8095
8424
|
forwardRef24(function InspectorContainer2({
|
|
8096
8425
|
header,
|
|
8097
8426
|
children,
|
|
@@ -8101,7 +8430,7 @@ var InspectorContainer = memo28(
|
|
|
8101
8430
|
className,
|
|
8102
8431
|
style: style2
|
|
8103
8432
|
}, forwardedRef) {
|
|
8104
|
-
return /* @__PURE__ */
|
|
8433
|
+
return /* @__PURE__ */ React69.createElement(
|
|
8105
8434
|
"div",
|
|
8106
8435
|
{
|
|
8107
8436
|
ref: forwardedRef,
|
|
@@ -8116,32 +8445,32 @@ var InspectorContainer = memo28(
|
|
|
8116
8445
|
}
|
|
8117
8446
|
},
|
|
8118
8447
|
header,
|
|
8119
|
-
children ? /* @__PURE__ */
|
|
8448
|
+
children ? /* @__PURE__ */ React69.createElement(ScrollArea, null, /* @__PURE__ */ React69.createElement("div", { className: "flex flex-col relative" }, showDividers ? withSeparatorElements(children, /* @__PURE__ */ React69.createElement(Divider, null)) : children)) : fallback ? /* @__PURE__ */ React69.createElement("div", { className: "flex flex-col relative h-full" }, fallback) : null
|
|
8120
8449
|
);
|
|
8121
8450
|
})
|
|
8122
8451
|
);
|
|
8123
8452
|
|
|
8124
8453
|
// src/components/LabeledElementView.tsx
|
|
8125
8454
|
import * as kiwi from "kiwi.js";
|
|
8126
|
-
import * as
|
|
8127
|
-
var LabeledElementView =
|
|
8455
|
+
import * as React70 from "react";
|
|
8456
|
+
var LabeledElementView = React70.memo(function LabeledElementView2({
|
|
8128
8457
|
children,
|
|
8129
8458
|
renderLabel
|
|
8130
8459
|
}) {
|
|
8131
|
-
const elementIds =
|
|
8132
|
-
(child) =>
|
|
8460
|
+
const elementIds = React70.Children.toArray(children).flatMap(
|
|
8461
|
+
(child) => React70.isValidElement(child) && child.type === React70.Fragment ? child.props.children : [child]
|
|
8133
8462
|
).map(
|
|
8134
|
-
(child) =>
|
|
8463
|
+
(child) => React70.isValidElement(child) && "id" in child.props ? child.props.id : null
|
|
8135
8464
|
).filter((id) => !!id);
|
|
8136
8465
|
const serializedIds = elementIds.join(",");
|
|
8137
|
-
const containerRef =
|
|
8138
|
-
const refs =
|
|
8466
|
+
const containerRef = React70.useRef(null);
|
|
8467
|
+
const refs = React70.useMemo(() => {
|
|
8139
8468
|
return Object.fromEntries(
|
|
8140
|
-
serializedIds.split(",").map((id) => [id,
|
|
8469
|
+
serializedIds.split(",").map((id) => [id, React70.createRef()])
|
|
8141
8470
|
);
|
|
8142
8471
|
}, [serializedIds]);
|
|
8143
|
-
const labelElements =
|
|
8144
|
-
return serializedIds.split(",").map((id, index) => /* @__PURE__ */
|
|
8472
|
+
const labelElements = React70.useMemo(() => {
|
|
8473
|
+
return serializedIds.split(",").map((id, index) => /* @__PURE__ */ React70.createElement(
|
|
8145
8474
|
"span",
|
|
8146
8475
|
{
|
|
8147
8476
|
key: id,
|
|
@@ -8154,7 +8483,7 @@ var LabeledElementView = React67.memo(function LabeledElementView2({
|
|
|
8154
8483
|
})
|
|
8155
8484
|
));
|
|
8156
8485
|
}, [refs, serializedIds, renderLabel]);
|
|
8157
|
-
|
|
8486
|
+
React70.useLayoutEffect(() => {
|
|
8158
8487
|
if (!containerRef.current) return;
|
|
8159
8488
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
8160
8489
|
const solver = new kiwi.Solver();
|
|
@@ -8216,19 +8545,19 @@ var LabeledElementView = React67.memo(function LabeledElementView2({
|
|
|
8216
8545
|
`${Math.max(...heights)}px`
|
|
8217
8546
|
);
|
|
8218
8547
|
}, [refs, labelElements]);
|
|
8219
|
-
return /* @__PURE__ */
|
|
8548
|
+
return /* @__PURE__ */ React70.createElement("div", { className: "flex flex-1 flex-col relative", ref: containerRef }, /* @__PURE__ */ React70.createElement("div", { className: "flex flex-1 items-center" }, children), /* @__PURE__ */ React70.createElement("div", { className: "relative overflow-hidden select-none" }, labelElements));
|
|
8220
8549
|
});
|
|
8221
8550
|
|
|
8222
8551
|
// src/components/LabeledField.tsx
|
|
8223
|
-
import
|
|
8552
|
+
import React72, { memo as memo29, useMemo as useMemo30 } from "react";
|
|
8224
8553
|
|
|
8225
8554
|
// src/hooks/useIndent.ts
|
|
8226
|
-
import
|
|
8227
|
-
var IndentContext =
|
|
8555
|
+
import React71 from "react";
|
|
8556
|
+
var IndentContext = React71.createContext({
|
|
8228
8557
|
indentLevel: 0
|
|
8229
8558
|
});
|
|
8230
8559
|
var useIndent = () => {
|
|
8231
|
-
const { indentLevel } =
|
|
8560
|
+
const { indentLevel } = React71.useContext(IndentContext);
|
|
8232
8561
|
return indentLevel;
|
|
8233
8562
|
};
|
|
8234
8563
|
|
|
@@ -8241,7 +8570,7 @@ var labeledFieldStyles = (labelPosition) => cx(
|
|
|
8241
8570
|
var labelPositionInset = {
|
|
8242
8571
|
position: "inset"
|
|
8243
8572
|
};
|
|
8244
|
-
var LabeledField =
|
|
8573
|
+
var LabeledField = memo29(function LabeledField2({
|
|
8245
8574
|
children,
|
|
8246
8575
|
label,
|
|
8247
8576
|
labelPosition: labelPositionProp,
|
|
@@ -8257,15 +8586,15 @@ var LabeledField = memo30(function LabeledField2({
|
|
|
8257
8586
|
const labelWidth = labelWidthFromContext ?? minWidth;
|
|
8258
8587
|
const labelPositionFromContext = useLabelPosition();
|
|
8259
8588
|
const labelPosition = labelPositionProp ?? labelPositionFromContext ?? "start";
|
|
8260
|
-
const labeledFieldClasses =
|
|
8589
|
+
const labeledFieldClasses = useMemo30(
|
|
8261
8590
|
() => labeledFieldStyles(labelPosition),
|
|
8262
8591
|
[labelPosition]
|
|
8263
8592
|
);
|
|
8264
|
-
const labelContextValue =
|
|
8593
|
+
const labelContextValue = useMemo30(
|
|
8265
8594
|
() => ({ fieldId, label }),
|
|
8266
8595
|
[fieldId, label]
|
|
8267
8596
|
);
|
|
8268
|
-
const indentStyle =
|
|
8597
|
+
const indentStyle = useMemo30(
|
|
8269
8598
|
() => ({
|
|
8270
8599
|
width: indentLevel * 8,
|
|
8271
8600
|
flexBasis: indentLevel * 8,
|
|
@@ -8274,20 +8603,20 @@ var LabeledField = memo30(function LabeledField2({
|
|
|
8274
8603
|
}),
|
|
8275
8604
|
[indentLevel]
|
|
8276
8605
|
);
|
|
8277
|
-
const fieldStyle =
|
|
8606
|
+
const fieldStyle = useMemo30(
|
|
8278
8607
|
() => ({
|
|
8279
8608
|
minWidth: `calc(100% - ${labelWidth + indentLevel * 8 + 6}px)`
|
|
8280
8609
|
}),
|
|
8281
8610
|
[labelWidth, indentLevel]
|
|
8282
8611
|
);
|
|
8283
|
-
const labelStyle =
|
|
8612
|
+
const labelStyle = useMemo30(
|
|
8284
8613
|
() => ({
|
|
8285
8614
|
minWidth: `calc(${labelWidth}px - ${indentLevel * 8}px)`,
|
|
8286
8615
|
...labelStyleProp
|
|
8287
8616
|
}),
|
|
8288
8617
|
[labelWidth, indentLevel, labelStyleProp]
|
|
8289
8618
|
);
|
|
8290
|
-
return /* @__PURE__ */
|
|
8619
|
+
return /* @__PURE__ */ React72.createElement(LabelContext.Provider, { value: labelContextValue }, labelPosition === "inset" ? /* @__PURE__ */ React72.createElement(LabelPositionContext.Provider, { value: labelPositionInset }, children) : /* @__PURE__ */ React72.createElement("div", { className: cx("flex relative flex-1", className), style: style2 }, Boolean(indentLevel) && /* @__PURE__ */ React72.createElement("div", { style: indentStyle }), /* @__PURE__ */ React72.createElement("div", { className: labeledFieldClasses }, /* @__PURE__ */ React72.createElement(
|
|
8291
8620
|
Label,
|
|
8292
8621
|
{
|
|
8293
8622
|
htmlFor: fieldId,
|
|
@@ -8296,7 +8625,7 @@ var LabeledField = memo30(function LabeledField2({
|
|
|
8296
8625
|
...props
|
|
8297
8626
|
},
|
|
8298
8627
|
label
|
|
8299
|
-
), labelPosition === "start" ? /* @__PURE__ */
|
|
8628
|
+
), labelPosition === "start" ? /* @__PURE__ */ React72.createElement("div", { className: "flex-auto flex", style: fieldStyle }, children) : children)));
|
|
8300
8629
|
});
|
|
8301
8630
|
|
|
8302
8631
|
// src/components/MediaThumbnail.tsx
|
|
@@ -8306,7 +8635,7 @@ import {
|
|
|
8306
8635
|
SpeakerLoudIcon,
|
|
8307
8636
|
VideoIcon
|
|
8308
8637
|
} from "@noya-app/noya-icons";
|
|
8309
|
-
import
|
|
8638
|
+
import React73, { memo as memo30, useMemo as useMemo31 } from "react";
|
|
8310
8639
|
|
|
8311
8640
|
// src/components/catppuccin/fileIcons.ts
|
|
8312
8641
|
var fileIcons = {
|
|
@@ -10746,7 +11075,7 @@ var getThumbnailColors = (colorScheme, selected) => {
|
|
|
10746
11075
|
};
|
|
10747
11076
|
}
|
|
10748
11077
|
};
|
|
10749
|
-
var MediaThumbnail =
|
|
11078
|
+
var MediaThumbnail = memo30(function MediaThumbnail2({
|
|
10750
11079
|
contentType: contentTypeProp,
|
|
10751
11080
|
selected = false,
|
|
10752
11081
|
className,
|
|
@@ -10761,18 +11090,18 @@ var MediaThumbnail = memo31(function MediaThumbnail2({
|
|
|
10761
11090
|
selected
|
|
10762
11091
|
);
|
|
10763
11092
|
const contentType = getAssetType(contentTypeProp);
|
|
10764
|
-
const iconStyles =
|
|
11093
|
+
const iconStyles = useMemo31(
|
|
10765
11094
|
() => ({
|
|
10766
11095
|
width: iconSizeMap[size2],
|
|
10767
11096
|
height: iconSizeMap[size2]
|
|
10768
11097
|
}),
|
|
10769
11098
|
[size2]
|
|
10770
11099
|
);
|
|
10771
|
-
const content =
|
|
11100
|
+
const content = useMemo31(() => {
|
|
10772
11101
|
switch (contentType) {
|
|
10773
11102
|
case "image":
|
|
10774
|
-
if (!url) return /* @__PURE__ */
|
|
10775
|
-
return /* @__PURE__ */
|
|
11103
|
+
if (!url) return /* @__PURE__ */ React73.createElement(ImageIcon, { color: iconColor, style: iconStyles });
|
|
11104
|
+
return /* @__PURE__ */ React73.createElement(
|
|
10776
11105
|
"img",
|
|
10777
11106
|
{
|
|
10778
11107
|
src: url,
|
|
@@ -10782,18 +11111,18 @@ var MediaThumbnail = memo31(function MediaThumbnail2({
|
|
|
10782
11111
|
}
|
|
10783
11112
|
);
|
|
10784
11113
|
case "video":
|
|
10785
|
-
return /* @__PURE__ */
|
|
11114
|
+
return /* @__PURE__ */ React73.createElement(VideoIcon, { color: iconColor, style: iconStyles });
|
|
10786
11115
|
case "audio":
|
|
10787
|
-
return /* @__PURE__ */
|
|
11116
|
+
return /* @__PURE__ */ React73.createElement(SpeakerLoudIcon, { color: iconColor, style: iconStyles });
|
|
10788
11117
|
default:
|
|
10789
11118
|
if (iconName) {
|
|
10790
11119
|
const Icon = Icons[iconName];
|
|
10791
|
-
return /* @__PURE__ */
|
|
11120
|
+
return /* @__PURE__ */ React73.createElement(Icon, { color: iconColor, style: iconStyles });
|
|
10792
11121
|
}
|
|
10793
11122
|
if (fileName) {
|
|
10794
11123
|
const fileIcon = findFileIcon(fileName);
|
|
10795
11124
|
if (fileIcon) {
|
|
10796
|
-
return /* @__PURE__ */
|
|
11125
|
+
return /* @__PURE__ */ React73.createElement(
|
|
10797
11126
|
"img",
|
|
10798
11127
|
{
|
|
10799
11128
|
src: `https://api.iconify.design/catppuccin/${fileIcon}.svg?height=none&box=1`,
|
|
@@ -10803,10 +11132,10 @@ var MediaThumbnail = memo31(function MediaThumbnail2({
|
|
|
10803
11132
|
);
|
|
10804
11133
|
}
|
|
10805
11134
|
}
|
|
10806
|
-
return /* @__PURE__ */
|
|
11135
|
+
return /* @__PURE__ */ React73.createElement(FileIcon, { color: iconColor, style: iconStyles });
|
|
10807
11136
|
}
|
|
10808
11137
|
}, [contentType, url, iconColor, iconStyles, iconName, fileName]);
|
|
10809
|
-
return /* @__PURE__ */
|
|
11138
|
+
return /* @__PURE__ */ React73.createElement(
|
|
10810
11139
|
"div",
|
|
10811
11140
|
{
|
|
10812
11141
|
className: cx(
|
|
@@ -10837,18 +11166,18 @@ function findFileIcon(fileName) {
|
|
|
10837
11166
|
}
|
|
10838
11167
|
|
|
10839
11168
|
// src/components/Message.tsx
|
|
10840
|
-
import
|
|
10841
|
-
var Message =
|
|
11169
|
+
import React74, { forwardRef as forwardRef25, memo as memo31, useMemo as useMemo32 } from "react";
|
|
11170
|
+
var Message = memo31(
|
|
10842
11171
|
forwardRef25(function Message2({ role, children, user, avatarSize = INPUT_HEIGHT }, ref) {
|
|
10843
11172
|
const randomId = crypto.randomUUID();
|
|
10844
11173
|
const userMessageBackgroundColor = colorFromString(user?.id ?? randomId);
|
|
10845
|
-
const styles3 =
|
|
11174
|
+
const styles3 = useMemo32(
|
|
10846
11175
|
() => role === "user" ? {
|
|
10847
11176
|
backgroundColor: userMessageBackgroundColor
|
|
10848
11177
|
} : void 0,
|
|
10849
11178
|
[userMessageBackgroundColor, role]
|
|
10850
11179
|
);
|
|
10851
|
-
return /* @__PURE__ */
|
|
11180
|
+
return /* @__PURE__ */ React74.createElement(
|
|
10852
11181
|
"div",
|
|
10853
11182
|
{
|
|
10854
11183
|
className: cx(
|
|
@@ -10856,15 +11185,15 @@ var Message = memo32(
|
|
|
10856
11185
|
role === "user" ? "flex-row-reverse" : "flex-row"
|
|
10857
11186
|
)
|
|
10858
11187
|
},
|
|
10859
|
-
role === "assistant" ? /* @__PURE__ */
|
|
11188
|
+
role === "assistant" ? /* @__PURE__ */ React74.createElement(
|
|
10860
11189
|
Avatar,
|
|
10861
11190
|
{
|
|
10862
11191
|
name: "Assistant",
|
|
10863
11192
|
size: avatarSize,
|
|
10864
11193
|
backgroundColor: cssVars.colors.primaryPastel
|
|
10865
11194
|
},
|
|
10866
|
-
/* @__PURE__ */
|
|
10867
|
-
) : /* @__PURE__ */
|
|
11195
|
+
/* @__PURE__ */ React74.createElement(Logo, { style: { width: 15 }, fill: cssVars.colors.primary })
|
|
11196
|
+
) : /* @__PURE__ */ React74.createElement(
|
|
10868
11197
|
Avatar,
|
|
10869
11198
|
{
|
|
10870
11199
|
userId: !user ? randomId : user?.id,
|
|
@@ -10873,7 +11202,7 @@ var Message = memo32(
|
|
|
10873
11202
|
size: avatarSize
|
|
10874
11203
|
}
|
|
10875
11204
|
),
|
|
10876
|
-
/* @__PURE__ */
|
|
11205
|
+
/* @__PURE__ */ React74.createElement(
|
|
10877
11206
|
"div",
|
|
10878
11207
|
{
|
|
10879
11208
|
className: cx(
|
|
@@ -10883,7 +11212,7 @@ var Message = memo32(
|
|
|
10883
11212
|
style: styles3,
|
|
10884
11213
|
ref
|
|
10885
11214
|
},
|
|
10886
|
-
/* @__PURE__ */
|
|
11215
|
+
/* @__PURE__ */ React74.createElement(
|
|
10887
11216
|
Text,
|
|
10888
11217
|
{
|
|
10889
11218
|
variant: "small",
|
|
@@ -10898,9 +11227,9 @@ var Message = memo32(
|
|
|
10898
11227
|
|
|
10899
11228
|
// src/components/pipeline/PipelineResultLayout.tsx
|
|
10900
11229
|
import { Link1Icon } from "@noya-app/noya-icons";
|
|
10901
|
-
import
|
|
11230
|
+
import React75 from "react";
|
|
10902
11231
|
var PipelineResultLink = ({ url }) => {
|
|
10903
|
-
return /* @__PURE__ */
|
|
11232
|
+
return /* @__PURE__ */ React75.createElement("div", { className: "flex flex-col gap-0.5" }, /* @__PURE__ */ React75.createElement(
|
|
10904
11233
|
"a",
|
|
10905
11234
|
{
|
|
10906
11235
|
href: url,
|
|
@@ -10908,15 +11237,15 @@ var PipelineResultLink = ({ url }) => {
|
|
|
10908
11237
|
rel: "noopener noreferrer",
|
|
10909
11238
|
className: "flex text-primary hover:opacity-80 border border-divider rounded-md"
|
|
10910
11239
|
},
|
|
10911
|
-
/* @__PURE__ */
|
|
10912
|
-
/* @__PURE__ */
|
|
10913
|
-
/* @__PURE__ */
|
|
11240
|
+
/* @__PURE__ */ React75.createElement("div", { className: "flex gap-1 items-center p-2" }, /* @__PURE__ */ React75.createElement(Link1Icon, { className: "w-[15px] h-[15px] flex-shrink-0" })),
|
|
11241
|
+
/* @__PURE__ */ React75.createElement(DividerVertical, null),
|
|
11242
|
+
/* @__PURE__ */ React75.createElement(Small, { className: "truncate p-2 flex-1" }, url)
|
|
10914
11243
|
));
|
|
10915
11244
|
};
|
|
10916
11245
|
var PipelineResultLayout = ({
|
|
10917
11246
|
children
|
|
10918
11247
|
}) => {
|
|
10919
|
-
return /* @__PURE__ */
|
|
11248
|
+
return /* @__PURE__ */ React75.createElement("div", { className: "flex flex-col gap-2" }, children);
|
|
10920
11249
|
};
|
|
10921
11250
|
function getPipelineResultLink(value) {
|
|
10922
11251
|
if (typeof value !== "object" || value === null) return void 0;
|
|
@@ -10932,27 +11261,27 @@ function getPipelineResultLink(value) {
|
|
|
10932
11261
|
// src/components/Progress.tsx
|
|
10933
11262
|
import { clamp } from "@noya-app/noya-utils";
|
|
10934
11263
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
10935
|
-
import * as
|
|
11264
|
+
import * as React76 from "react";
|
|
10936
11265
|
function Progress({
|
|
10937
11266
|
value,
|
|
10938
11267
|
variant = "normal",
|
|
10939
11268
|
className
|
|
10940
11269
|
}) {
|
|
10941
11270
|
const clampedValue = clamp(value, 0, 100);
|
|
10942
|
-
const transformStyles =
|
|
11271
|
+
const transformStyles = React76.useMemo(
|
|
10943
11272
|
() => ({
|
|
10944
11273
|
transform: `translateX(-${100 - clampedValue}%)`
|
|
10945
11274
|
}),
|
|
10946
11275
|
[clampedValue]
|
|
10947
11276
|
);
|
|
10948
|
-
return /* @__PURE__ */
|
|
11277
|
+
return /* @__PURE__ */ React76.createElement(
|
|
10949
11278
|
ProgressPrimitive.Root,
|
|
10950
11279
|
{
|
|
10951
11280
|
className: cx(`relative hidden bg-input-background h-[5px] `, className),
|
|
10952
11281
|
style: { transform: "translateZ(0)" },
|
|
10953
11282
|
value: clampedValue
|
|
10954
11283
|
},
|
|
10955
|
-
/* @__PURE__ */
|
|
11284
|
+
/* @__PURE__ */ React76.createElement(
|
|
10956
11285
|
ProgressPrimitive.Indicator,
|
|
10957
11286
|
{
|
|
10958
11287
|
className: `${variant === "primary" ? "bg-primary" : variant === "secondary" ? "bg-secondary" : variant === "warning" ? "bg-warning" : "bg-text"} transition-[transform_660ms_cubic-bezier(0.65,0,0.35,1) w-full h-full`,
|
|
@@ -10963,7 +11292,7 @@ function Progress({
|
|
|
10963
11292
|
}
|
|
10964
11293
|
|
|
10965
11294
|
// src/components/Section.tsx
|
|
10966
|
-
import
|
|
11295
|
+
import React77, { memo as memo32, useMemo as useMemo34 } from "react";
|
|
10967
11296
|
var titleIconStyle = {
|
|
10968
11297
|
marginRight: "8px",
|
|
10969
11298
|
alignSelf: "flex-start",
|
|
@@ -10987,7 +11316,7 @@ var SectionInternal = ({
|
|
|
10987
11316
|
inlineBlockWrapper: true
|
|
10988
11317
|
}
|
|
10989
11318
|
}) => {
|
|
10990
|
-
const style2 =
|
|
11319
|
+
const style2 = useMemo34(
|
|
10991
11320
|
() => ({
|
|
10992
11321
|
display: "flex",
|
|
10993
11322
|
flexDirection: "column",
|
|
@@ -10998,15 +11327,15 @@ var SectionInternal = ({
|
|
|
10998
11327
|
}),
|
|
10999
11328
|
[titleTextStyle, title, extraPadding, styleProp]
|
|
11000
11329
|
);
|
|
11001
|
-
const hasChildren =
|
|
11002
|
-
const headerStyle =
|
|
11330
|
+
const hasChildren = React77.Children.toArray(children).some((child) => !!child);
|
|
11331
|
+
const headerStyle = useMemo34(
|
|
11003
11332
|
() => ({
|
|
11004
11333
|
marginBottom: hasChildren ? "4px" : void 0,
|
|
11005
11334
|
minHeight: INPUT_HEIGHT
|
|
11006
11335
|
}),
|
|
11007
11336
|
[hasChildren]
|
|
11008
11337
|
);
|
|
11009
|
-
return /* @__PURE__ */
|
|
11338
|
+
return /* @__PURE__ */ React77.createElement("div", { style: style2, className }, (title || titleIcon || right) && /* @__PURE__ */ React77.createElement(InspectorPrimitives_exports.SectionHeader, { style: headerStyle }, titleIcon && /* @__PURE__ */ React77.createElement("div", { style: titleIconStyle, className: textStyles[titleTextStyle] }, titleIconOptions.inlineBlockWrapper ? /* @__PURE__ */ React77.createElement("div", { style: titleIconWrapperStyle }, titleIcon) : titleIcon), title && /* @__PURE__ */ React77.createElement(React77.Fragment, null, onClickTitle ? /* @__PURE__ */ React77.createElement(Button, { variant: "none", onClick: onClickTitle }, /* @__PURE__ */ React77.createElement(InspectorPrimitives_exports.Title, { $textStyle: titleTextStyle }, title)) : /* @__PURE__ */ React77.createElement(InspectorPrimitives_exports.Title, { $textStyle: titleTextStyle }, title)), /* @__PURE__ */ React77.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ React77.createElement(IndentContext.Provider, { value: { indentLevel: 1 } }, children));
|
|
11010
11339
|
};
|
|
11011
11340
|
var ExpandableSection = ({
|
|
11012
11341
|
storageKey,
|
|
@@ -11019,12 +11348,12 @@ var ExpandableSection = ({
|
|
|
11019
11348
|
initialVisibility
|
|
11020
11349
|
);
|
|
11021
11350
|
const expanded = visibility === "show";
|
|
11022
|
-
return /* @__PURE__ */
|
|
11351
|
+
return /* @__PURE__ */ React77.createElement(
|
|
11023
11352
|
SectionInternal,
|
|
11024
11353
|
{
|
|
11025
11354
|
...props,
|
|
11026
11355
|
right: !props.hideRightWhenCollapsed || expanded ? props.right : null,
|
|
11027
|
-
title: /* @__PURE__ */
|
|
11356
|
+
title: /* @__PURE__ */ React77.createElement("div", { className: "flex gap-1 items-center" }, props.title, /* @__PURE__ */ React77.createElement(
|
|
11028
11357
|
IconButton,
|
|
11029
11358
|
{
|
|
11030
11359
|
iconName: expanded ? "ChevronDownIcon2" : "ChevronRightIcon2",
|
|
@@ -11035,23 +11364,23 @@ var ExpandableSection = ({
|
|
|
11035
11364
|
expanded && props.children
|
|
11036
11365
|
);
|
|
11037
11366
|
};
|
|
11038
|
-
var Section =
|
|
11367
|
+
var Section = memo32(function InspectorSection({
|
|
11039
11368
|
storageKey,
|
|
11040
11369
|
...props
|
|
11041
11370
|
}) {
|
|
11042
|
-
return storageKey ? /* @__PURE__ */
|
|
11371
|
+
return storageKey ? /* @__PURE__ */ React77.createElement(ExpandableSection, { ...props, storageKey }) : /* @__PURE__ */ React77.createElement(SectionInternal, { ...props });
|
|
11043
11372
|
});
|
|
11044
11373
|
|
|
11045
11374
|
// src/components/SegmentedControl.tsx
|
|
11046
11375
|
import * as ToggleGroupPrimitive2 from "@radix-ui/react-toggle-group";
|
|
11047
|
-
import
|
|
11048
|
-
createContext as
|
|
11376
|
+
import React78, {
|
|
11377
|
+
createContext as createContext13,
|
|
11049
11378
|
forwardRef as forwardRef26,
|
|
11050
|
-
useCallback as
|
|
11051
|
-
useContext as
|
|
11052
|
-
useMemo as
|
|
11379
|
+
useCallback as useCallback30,
|
|
11380
|
+
useContext as useContext14,
|
|
11381
|
+
useMemo as useMemo35
|
|
11053
11382
|
} from "react";
|
|
11054
|
-
var SegmentedControlContext =
|
|
11383
|
+
var SegmentedControlContext = createContext13({
|
|
11055
11384
|
colorScheme: "primary"
|
|
11056
11385
|
});
|
|
11057
11386
|
var SegmentedControlItem = forwardRef26(function SegmentedControlItem2({
|
|
@@ -11064,8 +11393,8 @@ var SegmentedControlItem = forwardRef26(function SegmentedControlItem2({
|
|
|
11064
11393
|
variant = "default",
|
|
11065
11394
|
...props
|
|
11066
11395
|
}, forwardedRef) {
|
|
11067
|
-
const { colorScheme } =
|
|
11068
|
-
const itemElement = /* @__PURE__ */
|
|
11396
|
+
const { colorScheme } = useContext14(SegmentedControlContext);
|
|
11397
|
+
const itemElement = /* @__PURE__ */ React78.createElement(
|
|
11069
11398
|
ToggleGroupPrimitive2.Item,
|
|
11070
11399
|
{
|
|
11071
11400
|
ref: forwardedRef,
|
|
@@ -11085,7 +11414,7 @@ var SegmentedControlItem = forwardRef26(function SegmentedControlItem2({
|
|
|
11085
11414
|
),
|
|
11086
11415
|
...props
|
|
11087
11416
|
},
|
|
11088
|
-
/* @__PURE__ */
|
|
11417
|
+
/* @__PURE__ */ React78.createElement(
|
|
11089
11418
|
"span",
|
|
11090
11419
|
{
|
|
11091
11420
|
className: cx(
|
|
@@ -11097,7 +11426,7 @@ var SegmentedControlItem = forwardRef26(function SegmentedControlItem2({
|
|
|
11097
11426
|
title
|
|
11098
11427
|
)
|
|
11099
11428
|
);
|
|
11100
|
-
return tooltip ? /* @__PURE__ */
|
|
11429
|
+
return tooltip ? /* @__PURE__ */ React78.createElement(Tooltip, { content: tooltip }, itemElement) : itemElement;
|
|
11101
11430
|
});
|
|
11102
11431
|
var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
11103
11432
|
id: idProp,
|
|
@@ -11110,16 +11439,16 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
11110
11439
|
className,
|
|
11111
11440
|
style: style2
|
|
11112
11441
|
}) {
|
|
11113
|
-
const contextValue =
|
|
11442
|
+
const contextValue = useMemo35(() => ({ colorScheme }), [colorScheme]);
|
|
11114
11443
|
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
11115
|
-
const handleValueChange =
|
|
11444
|
+
const handleValueChange = useCallback30(
|
|
11116
11445
|
(value2) => {
|
|
11117
11446
|
if (!allowEmpty && !value2) return;
|
|
11118
11447
|
onValueChange?.(value2);
|
|
11119
11448
|
},
|
|
11120
11449
|
[allowEmpty, onValueChange]
|
|
11121
11450
|
);
|
|
11122
|
-
return /* @__PURE__ */
|
|
11451
|
+
return /* @__PURE__ */ React78.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ React78.createElement(
|
|
11123
11452
|
ToggleGroupPrimitive2.Root,
|
|
11124
11453
|
{
|
|
11125
11454
|
id,
|
|
@@ -11137,13 +11466,13 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
11137
11466
|
gridTemplateColumns: `repeat(${items.length}, 1fr)`
|
|
11138
11467
|
}
|
|
11139
11468
|
},
|
|
11140
|
-
items.map((item, index) => /* @__PURE__ */
|
|
11469
|
+
items.map((item, index) => /* @__PURE__ */ React78.createElement(SegmentedControlItem, { key: index, ...item, variant }))
|
|
11141
11470
|
));
|
|
11142
11471
|
});
|
|
11143
11472
|
|
|
11144
11473
|
// src/components/SelectionToolbar.tsx
|
|
11145
11474
|
import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
11146
|
-
import
|
|
11475
|
+
import React79, { memo as memo33, useMemo as useMemo36 } from "react";
|
|
11147
11476
|
import { createPortal as createPortal3 } from "react-dom";
|
|
11148
11477
|
var createVirtualElement = (rect) => ({
|
|
11149
11478
|
getBoundingClientRect: () => ({
|
|
@@ -11158,22 +11487,22 @@ var createVirtualElement = (rect) => ({
|
|
|
11158
11487
|
toJSON: () => null
|
|
11159
11488
|
})
|
|
11160
11489
|
});
|
|
11161
|
-
var SelectionToolbarContainer =
|
|
11490
|
+
var SelectionToolbarContainer = memo33(
|
|
11162
11491
|
function SelectionToolbarContainer2({
|
|
11163
11492
|
rect,
|
|
11164
11493
|
children,
|
|
11165
11494
|
portalContainer
|
|
11166
11495
|
}) {
|
|
11167
11496
|
const portalScopeId = usePortalScopeId();
|
|
11168
|
-
const containerRef =
|
|
11497
|
+
const containerRef = React79.useRef(null);
|
|
11169
11498
|
const size2 = useSize(containerRef, "width");
|
|
11170
|
-
const virtualRef =
|
|
11499
|
+
const virtualRef = useMemo36(
|
|
11171
11500
|
() => ({
|
|
11172
11501
|
current: createVirtualElement(rect)
|
|
11173
11502
|
}),
|
|
11174
11503
|
[rect]
|
|
11175
11504
|
);
|
|
11176
|
-
const popperContent = /* @__PURE__ */
|
|
11505
|
+
const popperContent = /* @__PURE__ */ React79.createElement(
|
|
11177
11506
|
PopperPrimitive.Content,
|
|
11178
11507
|
{
|
|
11179
11508
|
...portalScopeProps(portalScopeId),
|
|
@@ -11190,7 +11519,7 @@ var SelectionToolbarContainer = memo34(
|
|
|
11190
11519
|
["--n-input-background"]: "transparent"
|
|
11191
11520
|
}
|
|
11192
11521
|
},
|
|
11193
|
-
/* @__PURE__ */
|
|
11522
|
+
/* @__PURE__ */ React79.createElement(
|
|
11194
11523
|
"div",
|
|
11195
11524
|
{
|
|
11196
11525
|
ref: containerRef,
|
|
@@ -11203,7 +11532,7 @@ var SelectionToolbarContainer = memo34(
|
|
|
11203
11532
|
children
|
|
11204
11533
|
)
|
|
11205
11534
|
);
|
|
11206
|
-
return /* @__PURE__ */
|
|
11535
|
+
return /* @__PURE__ */ React79.createElement(PopperPrimitive.Root, null, /* @__PURE__ */ React79.createElement(PopperPrimitive.Anchor, { virtualRef }), portalContainer ? createPortal3(popperContent, portalContainer) : popperContent);
|
|
11207
11536
|
}
|
|
11208
11537
|
);
|
|
11209
11538
|
|
|
@@ -11214,8 +11543,8 @@ import {
|
|
|
11214
11543
|
DropdownChevronIcon as DropdownChevronIcon3
|
|
11215
11544
|
} from "@noya-app/noya-icons";
|
|
11216
11545
|
import * as Select from "@radix-ui/react-select";
|
|
11217
|
-
import
|
|
11218
|
-
useMemo as
|
|
11546
|
+
import React80, {
|
|
11547
|
+
useMemo as useMemo37,
|
|
11219
11548
|
useState as useState28
|
|
11220
11549
|
} from "react";
|
|
11221
11550
|
var readOnlyStyle = {
|
|
@@ -11248,7 +11577,7 @@ var SelectMenuTrigger = memoGeneric(function SelectMenuTrigger2({
|
|
|
11248
11577
|
fieldId: props.id
|
|
11249
11578
|
});
|
|
11250
11579
|
const labelPosition = useLabelPosition();
|
|
11251
|
-
return /* @__PURE__ */
|
|
11580
|
+
return /* @__PURE__ */ React80.createElement(Select.SelectTrigger, { asChild: true, onFocus, onBlur }, /* @__PURE__ */ React80.createElement(
|
|
11252
11581
|
Button,
|
|
11253
11582
|
{
|
|
11254
11583
|
id,
|
|
@@ -11260,10 +11589,10 @@ var SelectMenuTrigger = memoGeneric(function SelectMenuTrigger2({
|
|
|
11260
11589
|
),
|
|
11261
11590
|
disabled
|
|
11262
11591
|
},
|
|
11263
|
-
icon && /* @__PURE__ */
|
|
11264
|
-
label && labelPosition === "inset" && /* @__PURE__ */
|
|
11265
|
-
/* @__PURE__ */
|
|
11266
|
-
/* @__PURE__ */
|
|
11592
|
+
icon && /* @__PURE__ */ React80.createElement("span", { className: "pr-1.5" }, renderIcon(icon)),
|
|
11593
|
+
label && labelPosition === "inset" && /* @__PURE__ */ React80.createElement("div", { className: insetEndStyles }, /* @__PURE__ */ React80.createElement(Label, { className: "pr-4 text-text-disabled", htmlFor: id }, label)),
|
|
11594
|
+
/* @__PURE__ */ React80.createElement("span", { className: "flex-1 flex" }, /* @__PURE__ */ React80.createElement(Select.Value, { placeholder })),
|
|
11595
|
+
/* @__PURE__ */ React80.createElement(
|
|
11267
11596
|
DropdownChevronIcon3,
|
|
11268
11597
|
{
|
|
11269
11598
|
className: cx(
|
|
@@ -11311,8 +11640,8 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11311
11640
|
}
|
|
11312
11641
|
setInternalOpen(open2);
|
|
11313
11642
|
};
|
|
11314
|
-
const readOnlyButton =
|
|
11315
|
-
() => /* @__PURE__ */
|
|
11643
|
+
const readOnlyButton = useMemo37(
|
|
11644
|
+
() => /* @__PURE__ */ React80.createElement(
|
|
11316
11645
|
Button,
|
|
11317
11646
|
{
|
|
11318
11647
|
id,
|
|
@@ -11322,11 +11651,11 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11322
11651
|
disabled
|
|
11323
11652
|
},
|
|
11324
11653
|
icon && renderIcon(icon),
|
|
11325
|
-
/* @__PURE__ */
|
|
11654
|
+
/* @__PURE__ */ React80.createElement("span", { className: "flex flex-1" }, selectedItem?.title ?? value)
|
|
11326
11655
|
),
|
|
11327
11656
|
[icon, id, style2, className, disabled, value, selectedItem]
|
|
11328
11657
|
);
|
|
11329
|
-
const contentStyle =
|
|
11658
|
+
const contentStyle = useMemo37(() => {
|
|
11330
11659
|
return {
|
|
11331
11660
|
width: "var(--radix-select-trigger-width)",
|
|
11332
11661
|
minWidth: "max-content",
|
|
@@ -11334,7 +11663,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11334
11663
|
...contentStyleProp
|
|
11335
11664
|
};
|
|
11336
11665
|
}, [contentStyleProp]);
|
|
11337
|
-
const content = /* @__PURE__ */
|
|
11666
|
+
const content = /* @__PURE__ */ React80.createElement(
|
|
11338
11667
|
Select.Root,
|
|
11339
11668
|
{
|
|
11340
11669
|
value,
|
|
@@ -11342,7 +11671,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11342
11671
|
open,
|
|
11343
11672
|
onOpenChange: handleOpenChange
|
|
11344
11673
|
},
|
|
11345
|
-
/* @__PURE__ */
|
|
11674
|
+
/* @__PURE__ */ React80.createElement(
|
|
11346
11675
|
SelectMenuTrigger,
|
|
11347
11676
|
{
|
|
11348
11677
|
id,
|
|
@@ -11357,7 +11686,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11357
11686
|
label
|
|
11358
11687
|
}
|
|
11359
11688
|
),
|
|
11360
|
-
/* @__PURE__ */
|
|
11689
|
+
/* @__PURE__ */ React80.createElement(Select.Portal, null, /* @__PURE__ */ React80.createElement(
|
|
11361
11690
|
Select.Content,
|
|
11362
11691
|
{
|
|
11363
11692
|
...portalScopeProps(portalScopeId),
|
|
@@ -11368,14 +11697,14 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11368
11697
|
align: "center",
|
|
11369
11698
|
style: contentStyle
|
|
11370
11699
|
},
|
|
11371
|
-
/* @__PURE__ */
|
|
11700
|
+
/* @__PURE__ */ React80.createElement(Select.ScrollUpButton, { className: scrollButtonStyles }, /* @__PURE__ */ React80.createElement(
|
|
11372
11701
|
ChevronUpIcon,
|
|
11373
11702
|
{
|
|
11374
11703
|
className: cx("transition-transform duration-100")
|
|
11375
11704
|
}
|
|
11376
11705
|
)),
|
|
11377
|
-
/* @__PURE__ */
|
|
11378
|
-
/* @__PURE__ */
|
|
11706
|
+
/* @__PURE__ */ React80.createElement(Select.Viewport, null, /* @__PURE__ */ React80.createElement(MenuViewport, { items, Components: Components3 })),
|
|
11707
|
+
/* @__PURE__ */ React80.createElement(Select.ScrollDownButton, { className: scrollButtonStyles }, /* @__PURE__ */ React80.createElement(ChevronDownIcon, null))
|
|
11379
11708
|
))
|
|
11380
11709
|
);
|
|
11381
11710
|
return readOnly ? readOnlyButton : content;
|
|
@@ -11383,13 +11712,13 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11383
11712
|
|
|
11384
11713
|
// src/components/Slider.tsx
|
|
11385
11714
|
import * as RadixSlider from "@radix-ui/react-slider";
|
|
11386
|
-
import
|
|
11715
|
+
import React81, { memo as memo34, useCallback as useCallback31, useMemo as useMemo38 } from "react";
|
|
11387
11716
|
var THUMB_WIDTH = 8;
|
|
11388
11717
|
var thumbStyle = {
|
|
11389
11718
|
width: THUMB_WIDTH
|
|
11390
11719
|
};
|
|
11391
11720
|
var insetEndStyles2 = getInsetEndStyles();
|
|
11392
|
-
var Slider =
|
|
11721
|
+
var Slider = memo34(function Slider2({
|
|
11393
11722
|
style: style2,
|
|
11394
11723
|
className,
|
|
11395
11724
|
value,
|
|
@@ -11403,7 +11732,7 @@ var Slider = memo35(function Slider2({
|
|
|
11403
11732
|
readOnly = false,
|
|
11404
11733
|
...props
|
|
11405
11734
|
}) {
|
|
11406
|
-
const arrayValue =
|
|
11735
|
+
const arrayValue = useMemo38(
|
|
11407
11736
|
() => [Math.min(Math.max(value, min), max)],
|
|
11408
11737
|
[value, min, max]
|
|
11409
11738
|
);
|
|
@@ -11412,13 +11741,13 @@ var Slider = memo35(function Slider2({
|
|
|
11412
11741
|
fieldId: props.id
|
|
11413
11742
|
});
|
|
11414
11743
|
const labelPosition = useLabelPosition();
|
|
11415
|
-
const handleValueChange =
|
|
11744
|
+
const handleValueChange = useCallback31(
|
|
11416
11745
|
(arrayValue2) => {
|
|
11417
11746
|
onValueChange(arrayValue2[0]);
|
|
11418
11747
|
},
|
|
11419
11748
|
[onValueChange]
|
|
11420
11749
|
);
|
|
11421
|
-
const percentage =
|
|
11750
|
+
const percentage = useMemo38(() => {
|
|
11422
11751
|
const rawPercent = (arrayValue[0] - min) / (max - min);
|
|
11423
11752
|
const adjustedPercent = rawPercent * (100 - THUMB_WIDTH * 100 / 300) + THUMB_WIDTH * 50 / 300;
|
|
11424
11753
|
return {
|
|
@@ -11426,19 +11755,19 @@ var Slider = memo35(function Slider2({
|
|
|
11426
11755
|
adjusted: adjustedPercent
|
|
11427
11756
|
};
|
|
11428
11757
|
}, [arrayValue, min, max]);
|
|
11429
|
-
const trackFillStyle =
|
|
11758
|
+
const trackFillStyle = useMemo38(
|
|
11430
11759
|
() => ({
|
|
11431
11760
|
clipPath: `inset(0 ${100 - percentage.adjusted}% 0 0)`
|
|
11432
11761
|
}),
|
|
11433
11762
|
[percentage.adjusted]
|
|
11434
11763
|
);
|
|
11435
|
-
const labelStyle =
|
|
11764
|
+
const labelStyle = useMemo38(
|
|
11436
11765
|
() => ({
|
|
11437
11766
|
clipPath: `inset(0 ${100 - percentage.raw}% 0 0)`
|
|
11438
11767
|
}),
|
|
11439
11768
|
[percentage.raw]
|
|
11440
11769
|
);
|
|
11441
|
-
return /* @__PURE__ */
|
|
11770
|
+
return /* @__PURE__ */ React81.createElement(
|
|
11442
11771
|
RadixSlider.Root,
|
|
11443
11772
|
{
|
|
11444
11773
|
min,
|
|
@@ -11456,7 +11785,7 @@ var Slider = memo35(function Slider2({
|
|
|
11456
11785
|
onBlur,
|
|
11457
11786
|
disabled: readOnly
|
|
11458
11787
|
},
|
|
11459
|
-
/* @__PURE__ */
|
|
11788
|
+
/* @__PURE__ */ React81.createElement(RadixSlider.Track, { className: "flex-grow h-full rounded overflow-hidden bg-input-background" }, label && labelPosition === "inset" && /* @__PURE__ */ React81.createElement("div", { className: insetEndStyles2 }, /* @__PURE__ */ React81.createElement(Label, { htmlFor: id, className: "text-text-disabled" }, label)), /* @__PURE__ */ React81.createElement(
|
|
11460
11789
|
"div",
|
|
11461
11790
|
{
|
|
11462
11791
|
style: trackFillStyle,
|
|
@@ -11467,8 +11796,8 @@ var Slider = memo35(function Slider2({
|
|
|
11467
11796
|
)
|
|
11468
11797
|
}
|
|
11469
11798
|
)),
|
|
11470
|
-
label && labelPosition === "inset" && colorScheme !== void 0 && /* @__PURE__ */
|
|
11471
|
-
/* @__PURE__ */
|
|
11799
|
+
label && labelPosition === "inset" && colorScheme !== void 0 && /* @__PURE__ */ React81.createElement("div", { className: insetEndStyles2 }, /* @__PURE__ */ React81.createElement(Label, { className: "text-white overflow-hidden", style: labelStyle }, label)),
|
|
11800
|
+
/* @__PURE__ */ React81.createElement(
|
|
11472
11801
|
RadixSlider.Thumb,
|
|
11473
11802
|
{
|
|
11474
11803
|
style: thumbStyle,
|
|
@@ -11483,9 +11812,28 @@ var Slider = memo35(function Slider2({
|
|
|
11483
11812
|
);
|
|
11484
11813
|
});
|
|
11485
11814
|
|
|
11815
|
+
// src/components/sorting/createSharedDrag.tsx
|
|
11816
|
+
import * as React82 from "react";
|
|
11817
|
+
function createSharedDrag() {
|
|
11818
|
+
const dragRegistrationContext = React82.createContext(null);
|
|
11819
|
+
const activeDragContext = React82.createContext(
|
|
11820
|
+
null
|
|
11821
|
+
);
|
|
11822
|
+
const sharedDragProps = {
|
|
11823
|
+
dragRegistrationContext,
|
|
11824
|
+
activeDragContext
|
|
11825
|
+
};
|
|
11826
|
+
const Provider3 = ({ children }) => /* @__PURE__ */ React82.createElement(SharedDragProvider, { sharedDragProps }, children);
|
|
11827
|
+
return {
|
|
11828
|
+
Provider: Provider3,
|
|
11829
|
+
Sortable: (props) => /* @__PURE__ */ React82.createElement(Sortable, { sharedDragProps, ...props }),
|
|
11830
|
+
props: sharedDragProps
|
|
11831
|
+
};
|
|
11832
|
+
}
|
|
11833
|
+
|
|
11486
11834
|
// src/components/Switch.tsx
|
|
11487
11835
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
11488
|
-
import * as
|
|
11836
|
+
import * as React83 from "react";
|
|
11489
11837
|
var Switch = function Switch2({
|
|
11490
11838
|
id,
|
|
11491
11839
|
value,
|
|
@@ -11497,7 +11845,7 @@ var Switch = function Switch2({
|
|
|
11497
11845
|
style: style2,
|
|
11498
11846
|
className
|
|
11499
11847
|
}) {
|
|
11500
|
-
return /* @__PURE__ */
|
|
11848
|
+
return /* @__PURE__ */ React83.createElement(
|
|
11501
11849
|
SwitchPrimitive.Root,
|
|
11502
11850
|
{
|
|
11503
11851
|
id,
|
|
@@ -11516,20 +11864,20 @@ var Switch = function Switch2({
|
|
|
11516
11864
|
onFocus,
|
|
11517
11865
|
onBlur
|
|
11518
11866
|
},
|
|
11519
|
-
/* @__PURE__ */
|
|
11867
|
+
/* @__PURE__ */ React83.createElement(SwitchPrimitive.Thumb, { className: "block w-[15px] h-[15px] bg-background rounded-full transition-transform translate-x-[2px] data-[state=checked]:translate-x-[15px]" })
|
|
11520
11868
|
);
|
|
11521
11869
|
};
|
|
11522
11870
|
|
|
11523
11871
|
// src/components/UserPointer.tsx
|
|
11524
|
-
import
|
|
11525
|
-
var UserPointerContainer =
|
|
11872
|
+
import React84, { memo as memo35, useMemo as useMemo39 } from "react";
|
|
11873
|
+
var UserPointerContainer = memo35(function UserPointerContainer2({
|
|
11526
11874
|
point,
|
|
11527
11875
|
visible,
|
|
11528
11876
|
children,
|
|
11529
11877
|
className,
|
|
11530
11878
|
style: style2
|
|
11531
11879
|
}) {
|
|
11532
|
-
return /* @__PURE__ */
|
|
11880
|
+
return /* @__PURE__ */ React84.createElement(
|
|
11533
11881
|
"div",
|
|
11534
11882
|
{
|
|
11535
11883
|
style: {
|
|
@@ -11546,13 +11894,13 @@ var UserPointerContainer = memo36(function UserPointerContainer2({
|
|
|
11546
11894
|
children
|
|
11547
11895
|
);
|
|
11548
11896
|
});
|
|
11549
|
-
var UserNameTag =
|
|
11897
|
+
var UserNameTag = memo35(function UserNameTag2({
|
|
11550
11898
|
backgroundColor,
|
|
11551
11899
|
className,
|
|
11552
11900
|
style: style2,
|
|
11553
11901
|
children
|
|
11554
11902
|
}) {
|
|
11555
|
-
return /* @__PURE__ */
|
|
11903
|
+
return /* @__PURE__ */ React84.createElement(
|
|
11556
11904
|
"span",
|
|
11557
11905
|
{
|
|
11558
11906
|
className: cx(
|
|
@@ -11568,14 +11916,14 @@ var UserNameTag = memo36(function UserNameTag2({
|
|
|
11568
11916
|
children
|
|
11569
11917
|
);
|
|
11570
11918
|
});
|
|
11571
|
-
var UserPointerIcon =
|
|
11919
|
+
var UserPointerIcon = memo35(function PointerIcon({
|
|
11572
11920
|
size: size2,
|
|
11573
11921
|
color = "black",
|
|
11574
11922
|
className,
|
|
11575
11923
|
style: style2
|
|
11576
11924
|
}) {
|
|
11577
11925
|
const points = "0,5 10,0 10,10";
|
|
11578
|
-
return /* @__PURE__ */
|
|
11926
|
+
return /* @__PURE__ */ React84.createElement(
|
|
11579
11927
|
"svg",
|
|
11580
11928
|
{
|
|
11581
11929
|
width: size2,
|
|
@@ -11590,7 +11938,7 @@ var UserPointerIcon = memo36(function PointerIcon({
|
|
|
11590
11938
|
...style2
|
|
11591
11939
|
}
|
|
11592
11940
|
},
|
|
11593
|
-
/* @__PURE__ */
|
|
11941
|
+
/* @__PURE__ */ React84.createElement(
|
|
11594
11942
|
"polygon",
|
|
11595
11943
|
{
|
|
11596
11944
|
points,
|
|
@@ -11603,7 +11951,7 @@ var UserPointerIcon = memo36(function PointerIcon({
|
|
|
11603
11951
|
});
|
|
11604
11952
|
var POINTER_SIZE = 12;
|
|
11605
11953
|
var POINTER_OVERLAP = 6;
|
|
11606
|
-
var UserPointer =
|
|
11954
|
+
var UserPointer = memo35(function UserPointer2({
|
|
11607
11955
|
userId,
|
|
11608
11956
|
name,
|
|
11609
11957
|
visible = true,
|
|
@@ -11612,22 +11960,22 @@ var UserPointer = memo36(function UserPointer2({
|
|
|
11612
11960
|
style: style2,
|
|
11613
11961
|
className
|
|
11614
11962
|
}) {
|
|
11615
|
-
const userBackgroundColor =
|
|
11963
|
+
const userBackgroundColor = useMemo39(
|
|
11616
11964
|
() => backgroundColor ?? colorFromString(userId ?? name ?? ""),
|
|
11617
11965
|
[backgroundColor, userId, name]
|
|
11618
11966
|
);
|
|
11619
|
-
const pointerOverlapStyle =
|
|
11967
|
+
const pointerOverlapStyle = useMemo39(
|
|
11620
11968
|
() => ({
|
|
11621
11969
|
marginRight: `-${POINTER_OVERLAP}px`,
|
|
11622
11970
|
marginBottom: `-${POINTER_OVERLAP}px`
|
|
11623
11971
|
}),
|
|
11624
11972
|
[]
|
|
11625
11973
|
);
|
|
11626
|
-
const nameTagOverlapStyle =
|
|
11974
|
+
const nameTagOverlapStyle = useMemo39(
|
|
11627
11975
|
() => ({ marginLeft: `${POINTER_SIZE - POINTER_OVERLAP + 1}px` }),
|
|
11628
11976
|
[]
|
|
11629
11977
|
);
|
|
11630
|
-
return /* @__PURE__ */
|
|
11978
|
+
return /* @__PURE__ */ React84.createElement(
|
|
11631
11979
|
UserPointerContainer,
|
|
11632
11980
|
{
|
|
11633
11981
|
point,
|
|
@@ -11635,14 +11983,14 @@ var UserPointer = memo36(function UserPointer2({
|
|
|
11635
11983
|
className,
|
|
11636
11984
|
style: style2
|
|
11637
11985
|
},
|
|
11638
|
-
name && /* @__PURE__ */
|
|
11986
|
+
name && /* @__PURE__ */ React84.createElement("div", { className: "relative" }, /* @__PURE__ */ React84.createElement(
|
|
11639
11987
|
UserPointerIcon,
|
|
11640
11988
|
{
|
|
11641
11989
|
size: POINTER_SIZE,
|
|
11642
11990
|
color: userBackgroundColor,
|
|
11643
11991
|
style: pointerOverlapStyle
|
|
11644
11992
|
}
|
|
11645
|
-
), /* @__PURE__ */
|
|
11993
|
+
), /* @__PURE__ */ React84.createElement(
|
|
11646
11994
|
UserNameTag,
|
|
11647
11995
|
{
|
|
11648
11996
|
backgroundColor: userBackgroundColor,
|
|
@@ -11655,17 +12003,17 @@ var UserPointer = memo36(function UserPointer2({
|
|
|
11655
12003
|
|
|
11656
12004
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
11657
12005
|
import { useKeyboardShortcuts as useKeyboardShortcuts3 } from "@noya-app/noya-keymap";
|
|
11658
|
-
import
|
|
12006
|
+
import React88, {
|
|
11659
12007
|
forwardRef as forwardRef27,
|
|
11660
|
-
memo as
|
|
11661
|
-
useCallback as
|
|
12008
|
+
memo as memo38,
|
|
12009
|
+
useCallback as useCallback32,
|
|
11662
12010
|
useImperativeHandle as useImperativeHandle9,
|
|
11663
12011
|
useRef as useRef28,
|
|
11664
12012
|
useState as useState31
|
|
11665
12013
|
} from "react";
|
|
11666
12014
|
|
|
11667
12015
|
// src/hooks/useWindowSize.tsx
|
|
11668
|
-
import { useEffect as
|
|
12016
|
+
import { useEffect as useEffect20, useState as useState29 } from "react";
|
|
11669
12017
|
function useWindowSize() {
|
|
11670
12018
|
const [size2, setSize] = useState29(
|
|
11671
12019
|
typeof window === "undefined" ? { width: 0, height: 0 } : {
|
|
@@ -11673,7 +12021,7 @@ function useWindowSize() {
|
|
|
11673
12021
|
height: window.innerHeight
|
|
11674
12022
|
}
|
|
11675
12023
|
);
|
|
11676
|
-
|
|
12024
|
+
useEffect20(() => {
|
|
11677
12025
|
const handleResize = () => setSize({
|
|
11678
12026
|
width: window.innerWidth,
|
|
11679
12027
|
height: window.innerHeight
|
|
@@ -11685,7 +12033,7 @@ function useWindowSize() {
|
|
|
11685
12033
|
}
|
|
11686
12034
|
|
|
11687
12035
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
11688
|
-
import
|
|
12036
|
+
import React86, { memo as memo36, useLayoutEffect as useLayoutEffect9, useRef as useRef26, useState as useState30 } from "react";
|
|
11689
12037
|
|
|
11690
12038
|
// src/hooks/usePreservePanelSize.tsx
|
|
11691
12039
|
import { useLayoutEffect as useLayoutEffect8, useRef as useRef25 } from "react";
|
|
@@ -11825,7 +12173,7 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
|
11825
12173
|
}
|
|
11826
12174
|
|
|
11827
12175
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
11828
|
-
var DrawerWorkspaceLayout =
|
|
12176
|
+
var DrawerWorkspaceLayout = memo36(function DrawerWorkspaceLayout2({
|
|
11829
12177
|
leftPanel,
|
|
11830
12178
|
leftSidebarRef,
|
|
11831
12179
|
rightPanel,
|
|
@@ -11846,14 +12194,14 @@ var DrawerWorkspaceLayout = memo37(function DrawerWorkspaceLayout2({
|
|
|
11846
12194
|
}, [handleChangeLayoutState, mounted]);
|
|
11847
12195
|
const leftSidebarCollapsed = internalLayoutState?.leftSidebarCollapsed ?? false;
|
|
11848
12196
|
const rightSidebarCollapsed = internalLayoutState?.rightSidebarCollapsed ?? false;
|
|
11849
|
-
return /* @__PURE__ */
|
|
12197
|
+
return /* @__PURE__ */ React86.createElement(
|
|
11850
12198
|
"div",
|
|
11851
12199
|
{
|
|
11852
12200
|
ref: portalContainer,
|
|
11853
12201
|
id: EDITOR_PANEL_GROUP_ID,
|
|
11854
12202
|
className: "flex flex-1 relative focus:outline-none"
|
|
11855
12203
|
},
|
|
11856
|
-
leftPanel && /* @__PURE__ */
|
|
12204
|
+
leftPanel && /* @__PURE__ */ React86.createElement(
|
|
11857
12205
|
Drawer,
|
|
11858
12206
|
{
|
|
11859
12207
|
id: LEFT_SIDEBAR_ID,
|
|
@@ -11874,7 +12222,7 @@ var DrawerWorkspaceLayout = memo37(function DrawerWorkspaceLayout2({
|
|
|
11874
12222
|
leftPanel
|
|
11875
12223
|
),
|
|
11876
12224
|
centerPanel,
|
|
11877
|
-
rightPanel && /* @__PURE__ */
|
|
12225
|
+
rightPanel && /* @__PURE__ */ React86.createElement(
|
|
11878
12226
|
Drawer,
|
|
11879
12227
|
{
|
|
11880
12228
|
id: RIGHT_SIDEBAR_ID,
|
|
@@ -11898,13 +12246,13 @@ var DrawerWorkspaceLayout = memo37(function DrawerWorkspaceLayout2({
|
|
|
11898
12246
|
});
|
|
11899
12247
|
|
|
11900
12248
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
11901
|
-
import
|
|
12249
|
+
import React87, { memo as memo37, useRef as useRef27 } from "react";
|
|
11902
12250
|
import {
|
|
11903
12251
|
Panel,
|
|
11904
12252
|
PanelGroup,
|
|
11905
12253
|
PanelResizeHandle
|
|
11906
12254
|
} from "react-resizable-panels";
|
|
11907
|
-
var PanelWorkspaceLayout =
|
|
12255
|
+
var PanelWorkspaceLayout = memo37(function PanelWorkspaceLayout2({
|
|
11908
12256
|
leftPanel,
|
|
11909
12257
|
rightPanel,
|
|
11910
12258
|
centerPanel,
|
|
@@ -11919,7 +12267,7 @@ var PanelWorkspaceLayout = memo38(function PanelWorkspaceLayout2({
|
|
|
11919
12267
|
}) {
|
|
11920
12268
|
const panelGroupRef = useRef27(null);
|
|
11921
12269
|
usePreservePanelSize(panelGroupRef, handleChangeLayoutState);
|
|
11922
|
-
return /* @__PURE__ */
|
|
12270
|
+
return /* @__PURE__ */ React87.createElement(
|
|
11923
12271
|
PanelGroup,
|
|
11924
12272
|
{
|
|
11925
12273
|
ref: panelGroupRef,
|
|
@@ -11928,7 +12276,7 @@ var PanelWorkspaceLayout = memo38(function PanelWorkspaceLayout2({
|
|
|
11928
12276
|
direction: "horizontal",
|
|
11929
12277
|
autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : void 0
|
|
11930
12278
|
},
|
|
11931
|
-
leftPanel && /* @__PURE__ */
|
|
12279
|
+
leftPanel && /* @__PURE__ */ React87.createElement(React87.Fragment, null, /* @__PURE__ */ React87.createElement(
|
|
11932
12280
|
Panel,
|
|
11933
12281
|
{
|
|
11934
12282
|
id: LEFT_SIDEBAR_ID,
|
|
@@ -11941,8 +12289,8 @@ var PanelWorkspaceLayout = memo38(function PanelWorkspaceLayout2({
|
|
|
11941
12289
|
collapsible: true
|
|
11942
12290
|
},
|
|
11943
12291
|
internalLayoutState?.leftSidebarCollapsed ? null : leftPanel
|
|
11944
|
-
), /* @__PURE__ */
|
|
11945
|
-
/* @__PURE__ */
|
|
12292
|
+
), /* @__PURE__ */ React87.createElement(PanelResizeHandle, { className: "cursor-col-resize w-px h-full bg-divider" })),
|
|
12293
|
+
/* @__PURE__ */ React87.createElement(
|
|
11946
12294
|
Panel,
|
|
11947
12295
|
{
|
|
11948
12296
|
id: CONTENT_AREA_ID,
|
|
@@ -11953,7 +12301,7 @@ var PanelWorkspaceLayout = memo38(function PanelWorkspaceLayout2({
|
|
|
11953
12301
|
},
|
|
11954
12302
|
centerPanel
|
|
11955
12303
|
),
|
|
11956
|
-
rightPanel && /* @__PURE__ */
|
|
12304
|
+
rightPanel && /* @__PURE__ */ React87.createElement(React87.Fragment, null, /* @__PURE__ */ React87.createElement(PanelResizeHandle, { className: "cursor-col-resize w-px h-full bg-divider" }), /* @__PURE__ */ React87.createElement(
|
|
11957
12305
|
Panel,
|
|
11958
12306
|
{
|
|
11959
12307
|
id: RIGHT_SIDEBAR_ID,
|
|
@@ -12002,7 +12350,7 @@ var WorkspaceLayout = forwardRef27(function WorkspaceLayout2({
|
|
|
12002
12350
|
} = {},
|
|
12003
12351
|
theme
|
|
12004
12352
|
}, forwardedRef) {
|
|
12005
|
-
const containerRef =
|
|
12353
|
+
const containerRef = React88.useRef(null);
|
|
12006
12354
|
const containerSize = useSize(containerRef);
|
|
12007
12355
|
const windowSize = useWindowSize();
|
|
12008
12356
|
const parentSize = detectSize === "window" ? windowSize : containerSize && containerSize.width > 0 ? containerSize : windowSize;
|
|
@@ -12036,7 +12384,7 @@ var WorkspaceLayout = forwardRef27(function WorkspaceLayout2({
|
|
|
12036
12384
|
const leftSidebarRef = useRef28(null);
|
|
12037
12385
|
const rightSidebarRef = useRef28(null);
|
|
12038
12386
|
const [internalLayoutState, setInternalLayoutState] = useState31(null);
|
|
12039
|
-
const handleChangeLayoutState =
|
|
12387
|
+
const handleChangeLayoutState = useCallback32(
|
|
12040
12388
|
(state) => {
|
|
12041
12389
|
setInternalLayoutState(state);
|
|
12042
12390
|
onChangeLayoutState?.(state);
|
|
@@ -12100,7 +12448,7 @@ var WorkspaceLayout = forwardRef27(function WorkspaceLayout2({
|
|
|
12100
12448
|
}
|
|
12101
12449
|
});
|
|
12102
12450
|
const centerPanelPercentage = 100 - (left ? leftSidebarPercentage : 0) - (right ? rightSidebarPercentage : 0);
|
|
12103
|
-
const leftPanel = left ? /* @__PURE__ */
|
|
12451
|
+
const leftPanel = left ? /* @__PURE__ */ React88.createElement(
|
|
12104
12452
|
PanelInner,
|
|
12105
12453
|
{
|
|
12106
12454
|
style: leftStyle,
|
|
@@ -12108,7 +12456,7 @@ var WorkspaceLayout = forwardRef27(function WorkspaceLayout2({
|
|
|
12108
12456
|
},
|
|
12109
12457
|
left
|
|
12110
12458
|
) : null;
|
|
12111
|
-
const rightPanel = right ? /* @__PURE__ */
|
|
12459
|
+
const rightPanel = right ? /* @__PURE__ */ React88.createElement(
|
|
12112
12460
|
PanelInner,
|
|
12113
12461
|
{
|
|
12114
12462
|
style: rightStyle,
|
|
@@ -12116,7 +12464,7 @@ var WorkspaceLayout = forwardRef27(function WorkspaceLayout2({
|
|
|
12116
12464
|
},
|
|
12117
12465
|
right
|
|
12118
12466
|
) : null;
|
|
12119
|
-
const centerPanel = /* @__PURE__ */
|
|
12467
|
+
const centerPanel = /* @__PURE__ */ React88.createElement(PanelInner, { className: "bg-canvas-background" }, children);
|
|
12120
12468
|
const leftSidebarOptions = {
|
|
12121
12469
|
minSize: leftSidebarMinPercentage,
|
|
12122
12470
|
maxSize: leftSidebarMaxPercentage,
|
|
@@ -12131,7 +12479,7 @@ var WorkspaceLayout = forwardRef27(function WorkspaceLayout2({
|
|
|
12131
12479
|
};
|
|
12132
12480
|
const LayoutComponent = sideType === "panel" ? PanelWorkspaceLayout : sideType === "drawer" ? DrawerWorkspaceLayout : parentSize.width > sideTypeBreakpoint ? PanelWorkspaceLayout : DrawerWorkspaceLayout;
|
|
12133
12481
|
const readyToRender = detectSize === "window" || containerSize && containerSize.width > 0;
|
|
12134
|
-
return /* @__PURE__ */
|
|
12482
|
+
return /* @__PURE__ */ React88.createElement(
|
|
12135
12483
|
"div",
|
|
12136
12484
|
{
|
|
12137
12485
|
ref: containerRef,
|
|
@@ -12141,7 +12489,7 @@ var WorkspaceLayout = forwardRef27(function WorkspaceLayout2({
|
|
|
12141
12489
|
"data-theme": theme
|
|
12142
12490
|
},
|
|
12143
12491
|
toolbar,
|
|
12144
|
-
/* @__PURE__ */
|
|
12492
|
+
/* @__PURE__ */ React88.createElement("div", { className: "flex flex-row flex-1 relative" }, readyToRender && /* @__PURE__ */ React88.createElement(
|
|
12145
12493
|
LayoutComponent,
|
|
12146
12494
|
{
|
|
12147
12495
|
leftPanel,
|
|
@@ -12159,12 +12507,12 @@ var WorkspaceLayout = forwardRef27(function WorkspaceLayout2({
|
|
|
12159
12507
|
))
|
|
12160
12508
|
);
|
|
12161
12509
|
});
|
|
12162
|
-
var PanelInner =
|
|
12510
|
+
var PanelInner = memo38(function PanelInner2({
|
|
12163
12511
|
children,
|
|
12164
12512
|
style: style2,
|
|
12165
12513
|
className
|
|
12166
12514
|
}) {
|
|
12167
|
-
return /* @__PURE__ */
|
|
12515
|
+
return /* @__PURE__ */ React88.createElement("div", { style: style2, className: cx("absolute inset-0 flex", className) }, children);
|
|
12168
12516
|
});
|
|
12169
12517
|
|
|
12170
12518
|
// src/hooks/usePlatform.ts
|
|
@@ -12177,7 +12525,7 @@ function usePlatformModKey() {
|
|
|
12177
12525
|
}
|
|
12178
12526
|
|
|
12179
12527
|
// src/hooks/useTheme.ts
|
|
12180
|
-
import { useState as useState32, useEffect as
|
|
12528
|
+
import { useState as useState32, useEffect as useEffect21 } from "react";
|
|
12181
12529
|
function useTheme() {
|
|
12182
12530
|
const [theme, setTheme] = useState32("light");
|
|
12183
12531
|
const checkTheme = () => {
|
|
@@ -12191,7 +12539,7 @@ function useTheme() {
|
|
|
12191
12539
|
break;
|
|
12192
12540
|
}
|
|
12193
12541
|
};
|
|
12194
|
-
|
|
12542
|
+
useEffect21(() => {
|
|
12195
12543
|
checkTheme();
|
|
12196
12544
|
const observer = new MutationObserver((mutations) => {
|
|
12197
12545
|
mutations.forEach((mutation) => {
|
|
@@ -12296,7 +12644,9 @@ function acceptsDrop({
|
|
|
12296
12644
|
return defaultAcceptsDrop(
|
|
12297
12645
|
sourceIndexPath.at(-1),
|
|
12298
12646
|
targetIndexPath.at(-1),
|
|
12299
|
-
position
|
|
12647
|
+
position,
|
|
12648
|
+
"",
|
|
12649
|
+
""
|
|
12300
12650
|
);
|
|
12301
12651
|
}
|
|
12302
12652
|
return true;
|
|
@@ -12317,11 +12667,11 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
12317
12667
|
|
|
12318
12668
|
// src/components/DimensionInput.tsx
|
|
12319
12669
|
import { round } from "@noya-app/noya-utils";
|
|
12320
|
-
import * as
|
|
12670
|
+
import * as React89 from "react";
|
|
12321
12671
|
function getNewValue(value, mode, delta) {
|
|
12322
12672
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
12323
12673
|
}
|
|
12324
|
-
var DimensionInput =
|
|
12674
|
+
var DimensionInput = React89.memo(function DimensionInput2({
|
|
12325
12675
|
id,
|
|
12326
12676
|
value,
|
|
12327
12677
|
onSetValue,
|
|
@@ -12331,15 +12681,15 @@ var DimensionInput = React85.memo(function DimensionInput2({
|
|
|
12331
12681
|
disabled,
|
|
12332
12682
|
trigger = "submit"
|
|
12333
12683
|
}) {
|
|
12334
|
-
const handleNudgeValue =
|
|
12684
|
+
const handleNudgeValue = React89.useCallback(
|
|
12335
12685
|
(value2) => onSetValue(value2, "adjust"),
|
|
12336
12686
|
[onSetValue]
|
|
12337
12687
|
);
|
|
12338
|
-
const handleSetValue =
|
|
12688
|
+
const handleSetValue = React89.useCallback(
|
|
12339
12689
|
(value2) => onSetValue(value2, "replace"),
|
|
12340
12690
|
[onSetValue]
|
|
12341
12691
|
);
|
|
12342
|
-
return /* @__PURE__ */
|
|
12692
|
+
return /* @__PURE__ */ React89.createElement(LabeledField, { label, labelPosition: "inset" }, /* @__PURE__ */ React89.createElement(InputField2.Root, { id, width: size2 }, /* @__PURE__ */ React89.createElement(
|
|
12343
12693
|
InputField2.NumberInput,
|
|
12344
12694
|
{
|
|
12345
12695
|
value: value === void 0 ? value : round(value, 2),
|
|
@@ -12366,11 +12716,11 @@ __export(InspectorPrimitives_exports, {
|
|
|
12366
12716
|
Title: () => Title4,
|
|
12367
12717
|
VerticalSeparator: () => VerticalSeparator
|
|
12368
12718
|
});
|
|
12369
|
-
import
|
|
12719
|
+
import React90, {
|
|
12370
12720
|
forwardRef as forwardRef28,
|
|
12371
|
-
memo as
|
|
12721
|
+
memo as memo40
|
|
12372
12722
|
} from "react";
|
|
12373
|
-
var Section2 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */
|
|
12723
|
+
var Section2 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ React90.createElement(
|
|
12374
12724
|
"div",
|
|
12375
12725
|
{
|
|
12376
12726
|
ref,
|
|
@@ -12378,8 +12728,8 @@ var Section2 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ Re
|
|
|
12378
12728
|
...props
|
|
12379
12729
|
}
|
|
12380
12730
|
));
|
|
12381
|
-
var SectionHeader3 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */
|
|
12382
|
-
var Title4 = forwardRef28(({ className, $textStyle, ...props }, ref) => /* @__PURE__ */
|
|
12731
|
+
var SectionHeader3 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ React90.createElement("div", { ref, className: cx(`flex items-center `, className), ...props }));
|
|
12732
|
+
var Title4 = forwardRef28(({ className, $textStyle, ...props }, ref) => /* @__PURE__ */ React90.createElement(
|
|
12383
12733
|
"div",
|
|
12384
12734
|
{
|
|
12385
12735
|
ref,
|
|
@@ -12390,7 +12740,7 @@ var Title4 = forwardRef28(({ className, $textStyle, ...props }, ref) => /* @__PU
|
|
|
12390
12740
|
...props
|
|
12391
12741
|
}
|
|
12392
12742
|
));
|
|
12393
|
-
var Row = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */
|
|
12743
|
+
var Row = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ React90.createElement(
|
|
12394
12744
|
"div",
|
|
12395
12745
|
{
|
|
12396
12746
|
ref,
|
|
@@ -12398,7 +12748,7 @@ var Row = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ React86
|
|
|
12398
12748
|
...props
|
|
12399
12749
|
}
|
|
12400
12750
|
));
|
|
12401
|
-
var Column = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */
|
|
12751
|
+
var Column = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ React90.createElement(
|
|
12402
12752
|
"div",
|
|
12403
12753
|
{
|
|
12404
12754
|
ref,
|
|
@@ -12406,7 +12756,7 @@ var Column = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ Reac
|
|
|
12406
12756
|
...props
|
|
12407
12757
|
}
|
|
12408
12758
|
));
|
|
12409
|
-
var Checkbox3 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */
|
|
12759
|
+
var Checkbox3 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ React90.createElement(
|
|
12410
12760
|
"input",
|
|
12411
12761
|
{
|
|
12412
12762
|
ref,
|
|
@@ -12415,7 +12765,7 @@ var Checkbox3 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ R
|
|
|
12415
12765
|
...props
|
|
12416
12766
|
}
|
|
12417
12767
|
));
|
|
12418
|
-
var Text3 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */
|
|
12768
|
+
var Text3 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ React90.createElement(
|
|
12419
12769
|
"span",
|
|
12420
12770
|
{
|
|
12421
12771
|
ref,
|
|
@@ -12423,14 +12773,14 @@ var Text3 = forwardRef28(({ className, ...props }, ref) => /* @__PURE__ */ React
|
|
|
12423
12773
|
...props
|
|
12424
12774
|
}
|
|
12425
12775
|
));
|
|
12426
|
-
var VerticalSeparator = () => /* @__PURE__ */
|
|
12427
|
-
var HorizontalSeparator = () => /* @__PURE__ */
|
|
12776
|
+
var VerticalSeparator = () => /* @__PURE__ */ React90.createElement(Spacer.Vertical, { size: "inspector-v-separator" });
|
|
12777
|
+
var HorizontalSeparator = () => /* @__PURE__ */ React90.createElement(Spacer.Horizontal, { size: "inspector-h-separator" });
|
|
12428
12778
|
var RowLabel = forwardRef28(function RowLabel2({
|
|
12429
12779
|
className,
|
|
12430
12780
|
$textStyle,
|
|
12431
12781
|
...props
|
|
12432
12782
|
}, ref) {
|
|
12433
|
-
return /* @__PURE__ */
|
|
12783
|
+
return /* @__PURE__ */ React90.createElement(
|
|
12434
12784
|
"label",
|
|
12435
12785
|
{
|
|
12436
12786
|
ref,
|
|
@@ -12442,7 +12792,7 @@ var RowLabel = forwardRef28(function RowLabel2({
|
|
|
12442
12792
|
}
|
|
12443
12793
|
);
|
|
12444
12794
|
});
|
|
12445
|
-
var LabeledRow =
|
|
12795
|
+
var LabeledRow = memo40(function LabeledRow2({
|
|
12446
12796
|
id,
|
|
12447
12797
|
children,
|
|
12448
12798
|
label,
|
|
@@ -12450,11 +12800,11 @@ var LabeledRow = memo41(function LabeledRow2({
|
|
|
12450
12800
|
right,
|
|
12451
12801
|
className
|
|
12452
12802
|
}) {
|
|
12453
|
-
return /* @__PURE__ */
|
|
12803
|
+
return /* @__PURE__ */ React90.createElement(Row, { id, className }, /* @__PURE__ */ React90.createElement(Column, null, /* @__PURE__ */ React90.createElement(RowLabel, { $textStyle: labelTextStyle }, label, right && /* @__PURE__ */ React90.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ React90.createElement(Row, null, children)));
|
|
12454
12804
|
});
|
|
12455
12805
|
|
|
12456
12806
|
// src/components/BaseToolbar.tsx
|
|
12457
|
-
import
|
|
12807
|
+
import React91 from "react";
|
|
12458
12808
|
var toolbarStyle = {
|
|
12459
12809
|
[cssVarNames.colors.inputBackground]: "transparent"
|
|
12460
12810
|
};
|
|
@@ -12465,7 +12815,7 @@ function BaseToolbar({
|
|
|
12465
12815
|
logo,
|
|
12466
12816
|
showDivider = true
|
|
12467
12817
|
}) {
|
|
12468
|
-
return /* @__PURE__ */
|
|
12818
|
+
return /* @__PURE__ */ React91.createElement("div", { className: "flex flex-col", style: toolbarStyle }, /* @__PURE__ */ React91.createElement(
|
|
12469
12819
|
"div",
|
|
12470
12820
|
{
|
|
12471
12821
|
className: "flex items-center pr-2.5 bg-sidebar-background flex-none relative @container/toolbar",
|
|
@@ -12473,10 +12823,10 @@ function BaseToolbar({
|
|
|
12473
12823
|
flex: `0 0 ${cssVars.spacing.toolbarHeight}`
|
|
12474
12824
|
}
|
|
12475
12825
|
},
|
|
12476
|
-
logo && /* @__PURE__ */
|
|
12477
|
-
/* @__PURE__ */
|
|
12478
|
-
left && /* @__PURE__ */
|
|
12479
|
-
/* @__PURE__ */
|
|
12826
|
+
logo && /* @__PURE__ */ React91.createElement(React91.Fragment, null, logo, /* @__PURE__ */ React91.createElement(DividerVertical, null)),
|
|
12827
|
+
/* @__PURE__ */ React91.createElement(Spacer.Horizontal, { size: 10 }),
|
|
12828
|
+
left && /* @__PURE__ */ React91.createElement(React91.Fragment, null, /* @__PURE__ */ React91.createElement("div", { className: "flex gap-toolbar-separator" }, left), /* @__PURE__ */ React91.createElement(Spacer.Horizontal, { size: 10 })),
|
|
12829
|
+
/* @__PURE__ */ React91.createElement("div", { className: "flex items-center justify-center text-text-muted pointer-events-none @2xl/toolbar:absolute inset-0" }, /* @__PURE__ */ React91.createElement(
|
|
12480
12830
|
"div",
|
|
12481
12831
|
{
|
|
12482
12832
|
style: {
|
|
@@ -12488,15 +12838,15 @@ function BaseToolbar({
|
|
|
12488
12838
|
},
|
|
12489
12839
|
children
|
|
12490
12840
|
)),
|
|
12491
|
-
/* @__PURE__ */
|
|
12492
|
-
/* @__PURE__ */
|
|
12493
|
-
/* @__PURE__ */
|
|
12494
|
-
), showDivider && /* @__PURE__ */
|
|
12841
|
+
/* @__PURE__ */ React91.createElement(Spacer.Horizontal, null),
|
|
12842
|
+
/* @__PURE__ */ React91.createElement(Spacer.Horizontal, { size: 10 }),
|
|
12843
|
+
/* @__PURE__ */ React91.createElement("div", { className: "flex gap-toolbar-separator" }, right)
|
|
12844
|
+
), showDivider && /* @__PURE__ */ React91.createElement(Divider, { variant: "strong" }));
|
|
12495
12845
|
}
|
|
12496
12846
|
|
|
12497
12847
|
// src/components/Toolbar.tsx
|
|
12498
12848
|
import { useKeyboardShortcuts as useKeyboardShortcuts4 } from "@noya-app/noya-keymap";
|
|
12499
|
-
import
|
|
12849
|
+
import React92 from "react";
|
|
12500
12850
|
var iconButtonStyle = {
|
|
12501
12851
|
height: 27,
|
|
12502
12852
|
width: 27,
|
|
@@ -12506,8 +12856,8 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12506
12856
|
item,
|
|
12507
12857
|
onSelectMenuItem
|
|
12508
12858
|
}) {
|
|
12509
|
-
const [open, setOpen] =
|
|
12510
|
-
return /* @__PURE__ */
|
|
12859
|
+
const [open, setOpen] = React92.useState(false);
|
|
12860
|
+
return /* @__PURE__ */ React92.createElement(
|
|
12511
12861
|
DropdownMenu,
|
|
12512
12862
|
{
|
|
12513
12863
|
open,
|
|
@@ -12519,7 +12869,7 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12519
12869
|
}
|
|
12520
12870
|
}
|
|
12521
12871
|
},
|
|
12522
|
-
/* @__PURE__ */
|
|
12872
|
+
/* @__PURE__ */ React92.createElement(
|
|
12523
12873
|
Button,
|
|
12524
12874
|
{
|
|
12525
12875
|
disabled: item.disabled,
|
|
@@ -12533,15 +12883,18 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12533
12883
|
});
|
|
12534
12884
|
var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
12535
12885
|
item,
|
|
12536
|
-
onSelectMenuItem
|
|
12886
|
+
onSelectMenuItem,
|
|
12887
|
+
as
|
|
12537
12888
|
}) {
|
|
12538
|
-
const content = /* @__PURE__ */
|
|
12889
|
+
const content = /* @__PURE__ */ React92.createElement(
|
|
12539
12890
|
Button,
|
|
12540
12891
|
{
|
|
12892
|
+
as,
|
|
12541
12893
|
disabled: item.disabled,
|
|
12542
12894
|
active: item.checked,
|
|
12543
12895
|
icon: item.icon,
|
|
12544
12896
|
style: item.icon && !item.title ? iconButtonStyle : void 0,
|
|
12897
|
+
...as === "a" && { href: item.value },
|
|
12545
12898
|
onClick: () => {
|
|
12546
12899
|
if (onSelectMenuItem && item.value) {
|
|
12547
12900
|
onSelectMenuItem(item.value);
|
|
@@ -12550,32 +12903,42 @@ var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
|
12550
12903
|
},
|
|
12551
12904
|
item.title
|
|
12552
12905
|
);
|
|
12553
|
-
return item.tooltip ? /* @__PURE__ */
|
|
12906
|
+
return item.tooltip ? /* @__PURE__ */ React92.createElement(Tooltip, { sideOffset: 10, content: item.tooltip }, content) : content;
|
|
12554
12907
|
});
|
|
12555
12908
|
var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
12556
12909
|
item,
|
|
12557
|
-
onSelectMenuItem
|
|
12910
|
+
onSelectMenuItem,
|
|
12911
|
+
buttonAs
|
|
12558
12912
|
}) {
|
|
12559
12913
|
if (item.type === "sectionHeader") return null;
|
|
12560
12914
|
if (item.type === "separator") {
|
|
12561
|
-
return /* @__PURE__ */
|
|
12915
|
+
return /* @__PURE__ */ React92.createElement(DividerVertical, { overflow: 4 });
|
|
12562
12916
|
}
|
|
12563
12917
|
if (isSelectableMenuItem(item)) {
|
|
12564
|
-
return /* @__PURE__ */
|
|
12918
|
+
return /* @__PURE__ */ React92.createElement(
|
|
12919
|
+
ToolbarMenuButton,
|
|
12920
|
+
{
|
|
12921
|
+
item,
|
|
12922
|
+
onSelectMenuItem,
|
|
12923
|
+
as: buttonAs
|
|
12924
|
+
}
|
|
12925
|
+
);
|
|
12565
12926
|
}
|
|
12566
|
-
return /* @__PURE__ */
|
|
12927
|
+
return /* @__PURE__ */ React92.createElement(ToolbarMenuDropdown, { item, onSelectMenuItem });
|
|
12567
12928
|
});
|
|
12568
12929
|
var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
12569
12930
|
items,
|
|
12570
|
-
onSelectMenuItem
|
|
12931
|
+
onSelectMenuItem,
|
|
12932
|
+
buttonAs
|
|
12571
12933
|
}) {
|
|
12572
|
-
return /* @__PURE__ */
|
|
12573
|
-
return /* @__PURE__ */
|
|
12934
|
+
return /* @__PURE__ */ React92.createElement(React92.Fragment, null, items.map((item, i) => {
|
|
12935
|
+
return /* @__PURE__ */ React92.createElement(
|
|
12574
12936
|
ToolbarMenuItem,
|
|
12575
12937
|
{
|
|
12576
12938
|
key: i,
|
|
12577
12939
|
item,
|
|
12578
|
-
onSelectMenuItem
|
|
12940
|
+
onSelectMenuItem,
|
|
12941
|
+
buttonAs
|
|
12579
12942
|
}
|
|
12580
12943
|
);
|
|
12581
12944
|
}));
|
|
@@ -12588,28 +12951,28 @@ function Toolbar({
|
|
|
12588
12951
|
onSelectMenuItem,
|
|
12589
12952
|
shouldBindKeyboardShortcuts = true
|
|
12590
12953
|
}) {
|
|
12591
|
-
const allMenuItems =
|
|
12954
|
+
const allMenuItems = React92.useMemo(
|
|
12592
12955
|
() => [...leftMenuItems, ...rightMenuItems],
|
|
12593
12956
|
[leftMenuItems, rightMenuItems]
|
|
12594
12957
|
);
|
|
12595
12958
|
useKeyboardShortcuts4(
|
|
12596
|
-
|
|
12959
|
+
React92.useMemo(
|
|
12597
12960
|
() => onSelectMenuItem && shouldBindKeyboardShortcuts ? getKeyboardShortcutsForMenuItems(allMenuItems, onSelectMenuItem) : {},
|
|
12598
12961
|
[allMenuItems, onSelectMenuItem, shouldBindKeyboardShortcuts]
|
|
12599
12962
|
)
|
|
12600
12963
|
);
|
|
12601
|
-
return /* @__PURE__ */
|
|
12964
|
+
return /* @__PURE__ */ React92.createElement(
|
|
12602
12965
|
BaseToolbar,
|
|
12603
12966
|
{
|
|
12604
12967
|
logo,
|
|
12605
|
-
left: leftMenuItems.length > 0 && /* @__PURE__ */
|
|
12968
|
+
left: leftMenuItems.length > 0 && /* @__PURE__ */ React92.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React92.createElement(
|
|
12606
12969
|
ToolbarMenu,
|
|
12607
12970
|
{
|
|
12608
12971
|
items: leftMenuItems,
|
|
12609
12972
|
onSelectMenuItem
|
|
12610
12973
|
}
|
|
12611
12974
|
)),
|
|
12612
|
-
right: rightMenuItems.length > 0 && /* @__PURE__ */
|
|
12975
|
+
right: rightMenuItems.length > 0 && /* @__PURE__ */ React92.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React92.createElement(
|
|
12613
12976
|
ToolbarMenu,
|
|
12614
12977
|
{
|
|
12615
12978
|
items: rightMenuItems,
|
|
@@ -12721,9 +13084,11 @@ export {
|
|
|
12721
13084
|
SegmentedControl,
|
|
12722
13085
|
SelectMenu,
|
|
12723
13086
|
SelectionToolbarContainer,
|
|
13087
|
+
SharedDragProvider,
|
|
12724
13088
|
Slider,
|
|
12725
13089
|
Small,
|
|
12726
|
-
|
|
13090
|
+
Sortable,
|
|
13091
|
+
SortableItemContext,
|
|
12727
13092
|
Spacer,
|
|
12728
13093
|
Switch,
|
|
12729
13094
|
Text,
|
|
@@ -12745,7 +13110,9 @@ export {
|
|
|
12745
13110
|
colorForStringValues,
|
|
12746
13111
|
colorFromString,
|
|
12747
13112
|
colorSwatchSizeMap,
|
|
13113
|
+
createDragItemKey,
|
|
12748
13114
|
createSectionedMenu,
|
|
13115
|
+
createSharedDrag,
|
|
12749
13116
|
cssVarNames,
|
|
12750
13117
|
cssVars,
|
|
12751
13118
|
cx,
|
|
@@ -12758,6 +13125,7 @@ export {
|
|
|
12758
13125
|
getFieldSpacing,
|
|
12759
13126
|
getGradientBackground,
|
|
12760
13127
|
getGridSize,
|
|
13128
|
+
getItemFirstCollisionDetection,
|
|
12761
13129
|
getKeyboardShortcutsForMenuItems,
|
|
12762
13130
|
getMenuItemKey,
|
|
12763
13131
|
getNewValue,
|
|
@@ -12773,6 +13141,7 @@ export {
|
|
|
12773
13141
|
mergeConflictingClassNames,
|
|
12774
13142
|
moveTreeItem,
|
|
12775
13143
|
normalizeListTargetIndex,
|
|
13144
|
+
parseDragItemKey,
|
|
12776
13145
|
popoverStyle,
|
|
12777
13146
|
portalScopeDataSetName,
|
|
12778
13147
|
portalScopePropName,
|
|
@@ -12815,6 +13184,7 @@ export {
|
|
|
12815
13184
|
usePreservePanelSize,
|
|
12816
13185
|
useTheme,
|
|
12817
13186
|
validateDropIndicator,
|
|
13187
|
+
withDragProvider,
|
|
12818
13188
|
withSeparatorElements
|
|
12819
13189
|
};
|
|
12820
13190
|
//# sourceMappingURL=index.mjs.map
|