@noya-app/noya-designsystem 0.1.55 → 0.1.56
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 +8 -0
- package/dist/index.d.mts +111 -40
- package/dist/index.d.ts +111 -40
- package/dist/index.js +981 -651
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +936 -611
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/validateDropIndicator.test.ts +35 -9
- package/src/components/ListView.tsx +5 -8
- package/src/components/Toolbar.tsx +15 -2
- package/src/components/sorting/DragRegistration.tsx +110 -0
- package/src/components/sorting/SharedDragProvider.tsx +307 -0
- package/src/components/sorting/Sortable.tsx +404 -0
- package/src/components/sorting/createSharedDrag.tsx +46 -0
- package/src/components/sorting/sorting.ts +180 -0
- package/src/index.tsx +4 -2
- package/src/utils/moveTreeItem.ts +4 -2
- package/src/components/Sortable.tsx +0 -468
package/dist/index.js
CHANGED
|
@@ -130,9 +130,11 @@ __export(src_exports, {
|
|
|
130
130
|
SegmentedControl: () => SegmentedControl,
|
|
131
131
|
SelectMenu: () => SelectMenu,
|
|
132
132
|
SelectionToolbarContainer: () => SelectionToolbarContainer,
|
|
133
|
+
SharedDragProvider: () => SharedDragProvider,
|
|
133
134
|
Slider: () => Slider,
|
|
134
135
|
Small: () => Small,
|
|
135
|
-
Sortable: () =>
|
|
136
|
+
Sortable: () => Sortable,
|
|
137
|
+
SortableItemContext: () => SortableItemContext,
|
|
136
138
|
Spacer: () => Spacer,
|
|
137
139
|
Switch: () => Switch,
|
|
138
140
|
Text: () => Text,
|
|
@@ -155,6 +157,7 @@ __export(src_exports, {
|
|
|
155
157
|
colorFromString: () => colorFromString,
|
|
156
158
|
colorSwatchSizeMap: () => colorSwatchSizeMap,
|
|
157
159
|
createSectionedMenu: () => createSectionedMenu,
|
|
160
|
+
createSharedDrag: () => createSharedDrag,
|
|
158
161
|
cssVarNames: () => cssVarNames,
|
|
159
162
|
cssVars: () => cssVars,
|
|
160
163
|
cx: () => cx,
|
|
@@ -167,6 +170,7 @@ __export(src_exports, {
|
|
|
167
170
|
getFieldSpacing: () => getFieldSpacing,
|
|
168
171
|
getGradientBackground: () => getGradientBackground,
|
|
169
172
|
getGridSize: () => getGridSize,
|
|
173
|
+
getItemFirstCollisionDetection: () => getItemFirstCollisionDetection,
|
|
170
174
|
getKeyboardShortcutsForMenuItems: () => getKeyboardShortcutsForMenuItems,
|
|
171
175
|
getMenuItemKey: () => getMenuItemKey,
|
|
172
176
|
getNewValue: () => getNewValue,
|
|
@@ -224,6 +228,7 @@ __export(src_exports, {
|
|
|
224
228
|
usePreservePanelSize: () => usePreservePanelSize,
|
|
225
229
|
useTheme: () => useTheme,
|
|
226
230
|
validateDropIndicator: () => validateDropIndicator,
|
|
231
|
+
withDragProvider: () => withDragProvider,
|
|
227
232
|
withSeparatorElements: () => withSeparatorElements
|
|
228
233
|
});
|
|
229
234
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -3835,7 +3840,7 @@ var Chip = (0, import_react45.memo)(
|
|
|
3835
3840
|
);
|
|
3836
3841
|
|
|
3837
3842
|
// src/components/Collection.tsx
|
|
3838
|
-
var
|
|
3843
|
+
var import_react55 = __toESM(require("react"));
|
|
3839
3844
|
|
|
3840
3845
|
// src/components/Grid.tsx
|
|
3841
3846
|
var import_react49 = __toESM(require("react"));
|
|
@@ -4562,12 +4567,12 @@ var Grid = memoGeneric(
|
|
|
4562
4567
|
);
|
|
4563
4568
|
|
|
4564
4569
|
// src/components/List.tsx
|
|
4565
|
-
var
|
|
4570
|
+
var import_react54 = __toESM(require("react"));
|
|
4566
4571
|
|
|
4567
4572
|
// src/components/ListView.tsx
|
|
4568
4573
|
var import_noya_utils8 = require("@noya-app/noya-utils");
|
|
4569
4574
|
var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
|
|
4570
|
-
var
|
|
4575
|
+
var import_react52 = __toESM(require("react"));
|
|
4571
4576
|
var import_react_virtualized = require("react-virtualized");
|
|
4572
4577
|
var import_react_window = require("react-window");
|
|
4573
4578
|
|
|
@@ -4594,12 +4599,253 @@ function mergeEventHandlers(...handlerMaps) {
|
|
|
4594
4599
|
);
|
|
4595
4600
|
}
|
|
4596
4601
|
|
|
4597
|
-
// src/components/Sortable.tsx
|
|
4598
|
-
var
|
|
4602
|
+
// src/components/sorting/Sortable.tsx
|
|
4603
|
+
var import_core2 = require("@dnd-kit/core");
|
|
4599
4604
|
var import_sortable = require("@dnd-kit/sortable");
|
|
4600
|
-
var
|
|
4601
|
-
|
|
4605
|
+
var React47 = __toESM(require("react"));
|
|
4606
|
+
|
|
4607
|
+
// src/components/sorting/DragRegistration.tsx
|
|
4608
|
+
var import_react50 = __toESM(require("react"));
|
|
4609
|
+
var DragRegistrationContext = import_react50.default.createContext(null);
|
|
4610
|
+
function useDragRegistration(context) {
|
|
4611
|
+
const value = import_react50.default.useContext(context);
|
|
4612
|
+
if (!value) {
|
|
4613
|
+
throw new Error(
|
|
4614
|
+
"useDragRegistration must be used within a DragRegistrationProvider"
|
|
4615
|
+
);
|
|
4616
|
+
}
|
|
4617
|
+
return value;
|
|
4618
|
+
}
|
|
4619
|
+
function useDragRegistrationManager() {
|
|
4620
|
+
const [registeredLists, setRegisteredLists] = import_react50.default.useState(/* @__PURE__ */ new Map());
|
|
4621
|
+
const registerList = import_react50.default.useCallback((list) => {
|
|
4622
|
+
setRegisteredLists((prev) => new Map(prev).set(list.id, list));
|
|
4623
|
+
}, []);
|
|
4624
|
+
const unregisterList = import_react50.default.useCallback((listId) => {
|
|
4625
|
+
setRegisteredLists((prev) => {
|
|
4626
|
+
const newMap = new Map(prev);
|
|
4627
|
+
newMap.delete(listId);
|
|
4628
|
+
return newMap;
|
|
4629
|
+
});
|
|
4630
|
+
}, []);
|
|
4631
|
+
return { registerList, unregisterList, registeredLists };
|
|
4632
|
+
}
|
|
4633
|
+
var ActiveDragContext = import_react50.default.createContext(null);
|
|
4634
|
+
function useActiveDrag(context) {
|
|
4635
|
+
const value = import_react50.default.useContext(context);
|
|
4636
|
+
if (!value) {
|
|
4637
|
+
throw new Error("useActiveDrag must be used within a ActiveDragProvider");
|
|
4638
|
+
}
|
|
4639
|
+
return value;
|
|
4640
|
+
}
|
|
4641
|
+
var AnyDragContext = import_react50.default.createContext(false);
|
|
4642
|
+
|
|
4643
|
+
// src/components/sorting/SharedDragProvider.tsx
|
|
4644
|
+
var import_core = require("@dnd-kit/core");
|
|
4645
|
+
var React45 = __toESM(require("react"));
|
|
4646
|
+
var import_react51 = require("react");
|
|
4602
4647
|
var import_react_dom2 = require("react-dom");
|
|
4648
|
+
function SharedDragProvider({
|
|
4649
|
+
children,
|
|
4650
|
+
contexts = {
|
|
4651
|
+
dragRegistrationContext: DragRegistrationContext,
|
|
4652
|
+
activeDragContext: ActiveDragContext
|
|
4653
|
+
}
|
|
4654
|
+
}) {
|
|
4655
|
+
const sensors = (0, import_core.useSensors)(
|
|
4656
|
+
(0, import_core.useSensor)(import_core.PointerSensor, {
|
|
4657
|
+
activationConstraint: {
|
|
4658
|
+
distance: 4
|
|
4659
|
+
}
|
|
4660
|
+
})
|
|
4661
|
+
);
|
|
4662
|
+
const mounted = useMounted();
|
|
4663
|
+
const [activeItem, setActiveItem] = React45.useState(null);
|
|
4664
|
+
const [delta, setDelta] = React45.useState({ x: 0, y: 0 });
|
|
4665
|
+
const { registerList, unregisterList, registeredLists } = useDragRegistrationManager();
|
|
4666
|
+
const activatorEventRef = React45.useRef(null);
|
|
4667
|
+
const acceptsListDrop = React45.useCallback(
|
|
4668
|
+
(sourceListId, targetListId) => {
|
|
4669
|
+
const sourceList = registeredLists.get(sourceListId);
|
|
4670
|
+
const targetList = registeredLists.get(targetListId);
|
|
4671
|
+
if (!sourceList || !targetList) return false;
|
|
4672
|
+
return targetList.acceptsFromList({
|
|
4673
|
+
sourceListId,
|
|
4674
|
+
targetListId
|
|
4675
|
+
});
|
|
4676
|
+
},
|
|
4677
|
+
[registeredLists]
|
|
4678
|
+
);
|
|
4679
|
+
const handleDragStart = React45.useCallback(
|
|
4680
|
+
(event) => {
|
|
4681
|
+
activatorEventRef.current = event.activatorEvent;
|
|
4682
|
+
for (const [listId, list] of registeredLists) {
|
|
4683
|
+
const itemIndex = list.keys.findIndex((key) => key === event.active.id);
|
|
4684
|
+
if (itemIndex >= 0) {
|
|
4685
|
+
const dragItem = {
|
|
4686
|
+
id: event.active.id,
|
|
4687
|
+
listId,
|
|
4688
|
+
index: itemIndex
|
|
4689
|
+
};
|
|
4690
|
+
setActiveItem(dragItem);
|
|
4691
|
+
break;
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
},
|
|
4695
|
+
[registeredLists]
|
|
4696
|
+
);
|
|
4697
|
+
const handleDragMove = React45.useCallback((event) => {
|
|
4698
|
+
setDelta({ x: event.delta.x, y: event.delta.y });
|
|
4699
|
+
}, []);
|
|
4700
|
+
const handleDragEnd = React45.useCallback(
|
|
4701
|
+
(event) => {
|
|
4702
|
+
const { active, over } = event;
|
|
4703
|
+
const activatorEventPoint = activatorEventRef.current ? {
|
|
4704
|
+
x: activatorEventRef.current.clientX,
|
|
4705
|
+
y: activatorEventRef.current.clientY
|
|
4706
|
+
} : null;
|
|
4707
|
+
setActiveItem(null);
|
|
4708
|
+
activatorEventRef.current = null;
|
|
4709
|
+
if (!activeItem || !over || active.id === over.id) {
|
|
4710
|
+
return;
|
|
4711
|
+
}
|
|
4712
|
+
let targetListId = null;
|
|
4713
|
+
let targetIndex = -1;
|
|
4714
|
+
for (const [listId, list] of registeredLists) {
|
|
4715
|
+
const itemIndex = list.keys.findIndex((key) => key === over.id);
|
|
4716
|
+
if (itemIndex >= 0) {
|
|
4717
|
+
targetListId = listId;
|
|
4718
|
+
targetIndex = itemIndex;
|
|
4719
|
+
break;
|
|
4720
|
+
}
|
|
4721
|
+
if (over.id === listId) {
|
|
4722
|
+
targetListId = listId;
|
|
4723
|
+
targetIndex = list.keys.length;
|
|
4724
|
+
break;
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
if (!targetListId || !acceptsListDrop(activeItem.listId, targetListId)) {
|
|
4728
|
+
setActiveItem(null);
|
|
4729
|
+
activatorEventRef.current = null;
|
|
4730
|
+
return;
|
|
4731
|
+
}
|
|
4732
|
+
const targetList = registeredLists.get(targetListId);
|
|
4733
|
+
const sourceList = registeredLists.get(activeItem.listId);
|
|
4734
|
+
if (!targetList || !sourceList) {
|
|
4735
|
+
return;
|
|
4736
|
+
}
|
|
4737
|
+
if (targetIndex < targetList.keys.length && activatorEventPoint) {
|
|
4738
|
+
const eventX = activatorEventPoint.x;
|
|
4739
|
+
const eventY = activatorEventPoint.y;
|
|
4740
|
+
const currentX = eventX + delta.x;
|
|
4741
|
+
const currentY = eventY + delta.y;
|
|
4742
|
+
const absolutePosition = { x: currentX, y: currentY };
|
|
4743
|
+
const indicator = targetList.getDropIndicator({
|
|
4744
|
+
absolutePosition,
|
|
4745
|
+
active,
|
|
4746
|
+
over,
|
|
4747
|
+
sourceListId: activeItem.listId,
|
|
4748
|
+
targetListId
|
|
4749
|
+
});
|
|
4750
|
+
if (!indicator) return;
|
|
4751
|
+
sourceList.onMoveItem(
|
|
4752
|
+
activeItem.index,
|
|
4753
|
+
targetIndex,
|
|
4754
|
+
indicator,
|
|
4755
|
+
activeItem.listId,
|
|
4756
|
+
targetListId
|
|
4757
|
+
);
|
|
4758
|
+
} else if (targetIndex >= targetList.keys.length) {
|
|
4759
|
+
const canDrop = targetList.acceptsDrop(
|
|
4760
|
+
activeItem.index,
|
|
4761
|
+
Math.max(0, targetList.keys.length - 1),
|
|
4762
|
+
// Use last valid index or 0 for empty lists
|
|
4763
|
+
"below",
|
|
4764
|
+
activeItem.listId,
|
|
4765
|
+
targetListId
|
|
4766
|
+
);
|
|
4767
|
+
if (canDrop) {
|
|
4768
|
+
sourceList.onMoveItem(
|
|
4769
|
+
activeItem.index,
|
|
4770
|
+
targetIndex,
|
|
4771
|
+
"below",
|
|
4772
|
+
activeItem.listId,
|
|
4773
|
+
targetListId
|
|
4774
|
+
);
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
},
|
|
4778
|
+
[activeItem, registeredLists, acceptsListDrop, delta]
|
|
4779
|
+
);
|
|
4780
|
+
const contextValue = React45.useMemo(
|
|
4781
|
+
() => ({
|
|
4782
|
+
activeItem,
|
|
4783
|
+
delta,
|
|
4784
|
+
registerList,
|
|
4785
|
+
unregisterList
|
|
4786
|
+
}),
|
|
4787
|
+
[activeItem, delta, registerList, unregisterList]
|
|
4788
|
+
);
|
|
4789
|
+
const activeList = activeItem ? registeredLists.get(activeItem.listId) : null;
|
|
4790
|
+
const activeDragContextValue = React45.useMemo(
|
|
4791
|
+
() => ({ activeItem, delta }),
|
|
4792
|
+
[activeItem, delta]
|
|
4793
|
+
);
|
|
4794
|
+
const collisionDetection = (0, import_react51.useMemo)(() => {
|
|
4795
|
+
return getItemFirstCollisionDetection(Array.from(registeredLists.keys()));
|
|
4796
|
+
}, [registeredLists]);
|
|
4797
|
+
return /* @__PURE__ */ React45.createElement(AnyDragContext.Provider, { value: true }, /* @__PURE__ */ React45.createElement(contexts.dragRegistrationContext.Provider, { value: contextValue }, /* @__PURE__ */ React45.createElement(contexts.activeDragContext.Provider, { value: activeDragContextValue }, /* @__PURE__ */ React45.createElement(
|
|
4798
|
+
import_core.DndContext,
|
|
4799
|
+
{
|
|
4800
|
+
sensors,
|
|
4801
|
+
collisionDetection,
|
|
4802
|
+
onDragStart: handleDragStart,
|
|
4803
|
+
onDragMove: handleDragMove,
|
|
4804
|
+
onDragEnd: handleDragEnd
|
|
4805
|
+
},
|
|
4806
|
+
children,
|
|
4807
|
+
mounted && activeList?.renderOverlay && activeItem && (0, import_react_dom2.createPortal)(
|
|
4808
|
+
/* @__PURE__ */ React45.createElement(import_core.DragOverlay, { dropAnimation: null }, activeList.renderOverlay(activeItem.id)),
|
|
4809
|
+
document.body
|
|
4810
|
+
)
|
|
4811
|
+
))));
|
|
4812
|
+
}
|
|
4813
|
+
function useMounted() {
|
|
4814
|
+
const [mounted, setMounted] = React45.useState(false);
|
|
4815
|
+
React45.useEffect(() => {
|
|
4816
|
+
setMounted(true);
|
|
4817
|
+
}, []);
|
|
4818
|
+
return mounted;
|
|
4819
|
+
}
|
|
4820
|
+
function withDragProvider(Component) {
|
|
4821
|
+
return function WithDragProvider(props) {
|
|
4822
|
+
const anyDragContext = React45.useContext(AnyDragContext);
|
|
4823
|
+
if (!anyDragContext) {
|
|
4824
|
+
return /* @__PURE__ */ React45.createElement(SharedDragProvider, null, /* @__PURE__ */ React45.createElement(Component, { ...props }));
|
|
4825
|
+
}
|
|
4826
|
+
return /* @__PURE__ */ React45.createElement(Component, { ...props });
|
|
4827
|
+
};
|
|
4828
|
+
}
|
|
4829
|
+
var getItemFirstCollisionDetection = (registeredListIds) => (parameters) => {
|
|
4830
|
+
const pointerCollisions = (0, import_core.pointerWithin)(parameters);
|
|
4831
|
+
if (pointerCollisions.length > 0) {
|
|
4832
|
+
const itemCollisions = pointerCollisions.filter((collision) => {
|
|
4833
|
+
for (const listId of registeredListIds) {
|
|
4834
|
+
if (collision.id === listId) {
|
|
4835
|
+
return false;
|
|
4836
|
+
}
|
|
4837
|
+
}
|
|
4838
|
+
return true;
|
|
4839
|
+
});
|
|
4840
|
+
if (itemCollisions.length > 0) {
|
|
4841
|
+
return itemCollisions;
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
return pointerCollisions.length > 0 ? pointerCollisions : (0, import_core.closestCenter)(parameters);
|
|
4845
|
+
};
|
|
4846
|
+
|
|
4847
|
+
// src/components/sorting/sorting.ts
|
|
4848
|
+
var React46 = __toESM(require("react"));
|
|
4603
4849
|
var normalizeListTargetIndex = (index, position) => {
|
|
4604
4850
|
return position === "above" ? index : index + 1;
|
|
4605
4851
|
};
|
|
@@ -4611,14 +4857,15 @@ var defaultAcceptsDrop = (sourceIndex, targetIndex, position) => {
|
|
|
4611
4857
|
}
|
|
4612
4858
|
return true;
|
|
4613
4859
|
};
|
|
4614
|
-
var SortableItemContext =
|
|
4860
|
+
var SortableItemContext = React46.createContext({
|
|
4615
4861
|
keys: [],
|
|
4616
4862
|
acceptsDrop: defaultAcceptsDrop,
|
|
4617
4863
|
axis: "y",
|
|
4618
4864
|
position: { x: 0, y: 0 },
|
|
4619
4865
|
setActivatorEvent: () => {
|
|
4620
4866
|
},
|
|
4621
|
-
getDropTargetParentIndex: void 0
|
|
4867
|
+
getDropTargetParentIndex: void 0,
|
|
4868
|
+
listId: ""
|
|
4622
4869
|
});
|
|
4623
4870
|
function validateDropIndicator({
|
|
4624
4871
|
acceptsDrop: acceptsDrop2,
|
|
@@ -4627,12 +4874,21 @@ function validateDropIndicator({
|
|
|
4627
4874
|
overId,
|
|
4628
4875
|
offsetStart,
|
|
4629
4876
|
elementStart,
|
|
4630
|
-
elementSize
|
|
4877
|
+
elementSize,
|
|
4878
|
+
sourceListId,
|
|
4879
|
+
targetListId
|
|
4631
4880
|
}) {
|
|
4632
4881
|
const activeIndex = keys.findIndex((id) => id === activeId);
|
|
4633
4882
|
const overIndex = keys.findIndex((id) => id === overId);
|
|
4634
|
-
if (
|
|
4635
|
-
|
|
4883
|
+
if (overIndex === -1) return void 0;
|
|
4884
|
+
if (activeIndex === -1 && sourceListId === targetListId) return void 0;
|
|
4885
|
+
const acceptsDropInside = acceptsDrop2(
|
|
4886
|
+
activeIndex,
|
|
4887
|
+
overIndex,
|
|
4888
|
+
"inside",
|
|
4889
|
+
sourceListId,
|
|
4890
|
+
targetListId
|
|
4891
|
+
);
|
|
4636
4892
|
if (isContainedInMiddleThird(elementStart, elementSize, offsetStart) && acceptsDropInside) {
|
|
4637
4893
|
return "inside";
|
|
4638
4894
|
}
|
|
@@ -4641,7 +4897,13 @@ function validateDropIndicator({
|
|
|
4641
4897
|
elementSize,
|
|
4642
4898
|
offsetStart
|
|
4643
4899
|
);
|
|
4644
|
-
const acceptedHalf = acceptsDrop2(
|
|
4900
|
+
const acceptedHalf = acceptsDrop2(
|
|
4901
|
+
activeIndex,
|
|
4902
|
+
overIndex,
|
|
4903
|
+
containingHalf,
|
|
4904
|
+
sourceListId,
|
|
4905
|
+
targetListId
|
|
4906
|
+
);
|
|
4645
4907
|
return acceptedHalf ? containingHalf : (
|
|
4646
4908
|
// Lastly, check if inside but not middle third
|
|
4647
4909
|
acceptsDropInside ? "inside" : void 0
|
|
@@ -4654,189 +4916,210 @@ function getContainingHalf(elementStart, elementSize, offsetStart) {
|
|
|
4654
4916
|
if (offsetStart < elementStart + elementSize / 2) return "above";
|
|
4655
4917
|
return "below";
|
|
4656
4918
|
}
|
|
4657
|
-
|
|
4919
|
+
|
|
4920
|
+
// src/components/sorting/Sortable.tsx
|
|
4921
|
+
var SortableItemContext2 = React47.createContext({
|
|
4922
|
+
keys: [],
|
|
4923
|
+
acceptsDrop: defaultAcceptsDrop,
|
|
4924
|
+
axis: "y",
|
|
4925
|
+
listId: "",
|
|
4926
|
+
getDropTargetParentIndex: void 0,
|
|
4927
|
+
activeDragContext: ActiveDragContext
|
|
4928
|
+
});
|
|
4929
|
+
function useSortableDropIndicator({
|
|
4658
4930
|
id,
|
|
4659
|
-
|
|
4660
|
-
|
|
4931
|
+
index,
|
|
4932
|
+
isDragging,
|
|
4933
|
+
overIndex,
|
|
4934
|
+
activeIndex,
|
|
4935
|
+
keys,
|
|
4936
|
+
acceptsDrop: acceptsDrop2,
|
|
4937
|
+
axis,
|
|
4938
|
+
listId,
|
|
4939
|
+
getDropTargetParentIndex
|
|
4661
4940
|
}) {
|
|
4662
|
-
const {
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
} = React44.useContext(SortableItemContext);
|
|
4670
|
-
const sortable = (0, import_sortable.useSortable)({ id, disabled });
|
|
4671
|
-
const { activatorEvent } = (0, import_core.useDndContext)();
|
|
4672
|
-
const {
|
|
4673
|
-
active,
|
|
4674
|
-
attributes,
|
|
4675
|
-
listeners,
|
|
4676
|
-
setNodeRef,
|
|
4677
|
-
isDragging,
|
|
4678
|
-
index,
|
|
4679
|
-
activeIndex,
|
|
4680
|
-
overIndex,
|
|
4681
|
-
over
|
|
4682
|
-
} = sortable;
|
|
4683
|
-
if (activatorEvent) {
|
|
4684
|
-
setActivatorEvent(activatorEvent);
|
|
4941
|
+
const { active, over, activatorEvent } = (0, import_core2.useDndContext)();
|
|
4942
|
+
const { activeDragContext } = React47.useContext(SortableItemContext2);
|
|
4943
|
+
const { activeItem, delta: position } = useActiveDrag(activeDragContext);
|
|
4944
|
+
if (index < 0 || isDragging || !active || !over || !activeItem || !// Same-list drop: check normal overIndex matching
|
|
4945
|
+
(activeItem.listId === listId && index === overIndex || // Cross-list drop: check if we're hovering over this specific item
|
|
4946
|
+
activeItem.listId !== listId && over.id === id)) {
|
|
4947
|
+
return void 0;
|
|
4685
4948
|
}
|
|
4949
|
+
const isCrossContainer = activeItem.listId !== listId;
|
|
4950
|
+
const validationKeys = isCrossContainer ? [active.id, ...keys] : keys;
|
|
4686
4951
|
const eventX = activatorEvent?.clientX ?? 0;
|
|
4687
4952
|
const eventY = activatorEvent?.clientY ?? 0;
|
|
4688
4953
|
const offsetLeft = eventX + position.x;
|
|
4689
4954
|
const offsetTop = eventY + position.y;
|
|
4690
|
-
const ref = React44.useCallback((node) => setNodeRef(node), [setNodeRef]);
|
|
4691
4955
|
const parentIndex = overIndex === -1 ? void 0 : getDropTargetParentIndex?.(overIndex);
|
|
4692
|
-
const isValidParent = parentIndex === void 0 || parentIndex === -1 ? false : acceptsDrop2(activeIndex, parentIndex, "inside");
|
|
4693
|
-
const overIdAcceptsDrop = overIndex === -1 ? void 0 : acceptsDrop2(activeIndex, overIndex, "inside");
|
|
4956
|
+
const isValidParent = parentIndex === void 0 || parentIndex === -1 ? false : acceptsDrop2(activeIndex, parentIndex, "inside", listId, listId);
|
|
4957
|
+
const overIdAcceptsDrop = overIndex === -1 ? void 0 : acceptsDrop2(activeIndex, overIndex, "inside", listId, listId);
|
|
4694
4958
|
const relativeDropPosition = index >= 0 && index === overIndex && !isDragging && active && over ? validateDropIndicator({
|
|
4695
4959
|
acceptsDrop: acceptsDrop2,
|
|
4696
|
-
keys,
|
|
4960
|
+
keys: validationKeys,
|
|
4697
4961
|
activeId: active.id,
|
|
4698
4962
|
overId: over.id,
|
|
4699
4963
|
offsetStart: axis === "x" ? offsetLeft : offsetTop,
|
|
4700
4964
|
elementStart: axis === "x" ? over.rect.left : over.rect.top,
|
|
4701
|
-
elementSize: axis === "x" ? over.rect.width : over.rect.height
|
|
4965
|
+
elementSize: axis === "x" ? over.rect.width : over.rect.height,
|
|
4966
|
+
sourceListId: listId,
|
|
4967
|
+
targetListId: listId
|
|
4702
4968
|
}) : void 0;
|
|
4703
4969
|
const showDragInsideIndicatorOnParent = !overIdAcceptsDrop && isValidParent && parentIndex === index;
|
|
4970
|
+
return relativeDropPosition ?? (showDragInsideIndicatorOnParent ? "inside" : void 0);
|
|
4971
|
+
}
|
|
4972
|
+
function SortableItem({
|
|
4973
|
+
id,
|
|
4974
|
+
disabled,
|
|
4975
|
+
children
|
|
4976
|
+
}) {
|
|
4977
|
+
const { keys, acceptsDrop: acceptsDrop2, axis, listId, getDropTargetParentIndex } = React47.useContext(SortableItemContext2);
|
|
4978
|
+
const { attributes, listeners, setNodeRef, isDragging, index, overIndex } = (0, import_sortable.useSortable)({ id, disabled });
|
|
4979
|
+
const ref = React47.useCallback(
|
|
4980
|
+
(node) => setNodeRef(node),
|
|
4981
|
+
[setNodeRef]
|
|
4982
|
+
);
|
|
4983
|
+
const relativeDropPosition = useSortableDropIndicator({
|
|
4984
|
+
id,
|
|
4985
|
+
index,
|
|
4986
|
+
isDragging,
|
|
4987
|
+
overIndex,
|
|
4988
|
+
keys,
|
|
4989
|
+
acceptsDrop: acceptsDrop2,
|
|
4990
|
+
axis,
|
|
4991
|
+
listId,
|
|
4992
|
+
activeIndex: index,
|
|
4993
|
+
getDropTargetParentIndex
|
|
4994
|
+
});
|
|
4704
4995
|
return children({
|
|
4705
4996
|
ref,
|
|
4706
4997
|
...attributes,
|
|
4707
4998
|
...listeners,
|
|
4708
|
-
relativeDropPosition
|
|
4999
|
+
relativeDropPosition,
|
|
5000
|
+
style: {
|
|
5001
|
+
opacity: isDragging ? 0.5 : 1
|
|
5002
|
+
}
|
|
4709
5003
|
});
|
|
4710
5004
|
}
|
|
4711
|
-
function
|
|
5005
|
+
function SortableRoot_({
|
|
5006
|
+
id: idProp,
|
|
4712
5007
|
keys,
|
|
4713
|
-
children,
|
|
4714
5008
|
onMoveItem,
|
|
4715
5009
|
renderOverlay,
|
|
5010
|
+
acceptsFromList,
|
|
4716
5011
|
acceptsDrop: acceptsDrop2 = defaultAcceptsDrop,
|
|
4717
5012
|
axis = "y",
|
|
4718
|
-
|
|
5013
|
+
children,
|
|
5014
|
+
getDropTargetParentIndex,
|
|
5015
|
+
sharedDragProviderContexts,
|
|
5016
|
+
containerRef
|
|
4719
5017
|
}) {
|
|
4720
|
-
const
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
}
|
|
4725
|
-
})
|
|
5018
|
+
const defaultId = React47.useId();
|
|
5019
|
+
const id = idProp ?? defaultId;
|
|
5020
|
+
const { registerList, unregisterList } = useDragRegistration(
|
|
5021
|
+
sharedDragProviderContexts?.dragRegistrationContext ?? DragRegistrationContext
|
|
4726
5022
|
);
|
|
4727
|
-
const
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
5023
|
+
const { setNodeRef: setDroppableRef } = (0, import_core2.useDroppable)({
|
|
5024
|
+
id,
|
|
5025
|
+
// Make the container droppable only when the list is empty
|
|
5026
|
+
// This avoids conflicts with individual sortable items.
|
|
5027
|
+
// This isn't strictly necessary since we also use a custom collision detection
|
|
5028
|
+
// that prioritizes items over containers, but it helps with dropping into
|
|
5029
|
+
// the best position (either above or below, rather than always below).
|
|
5030
|
+
disabled: keys.length > 0
|
|
4732
5031
|
});
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
const oldIndex = keys.findIndex((id) => id === active.id);
|
|
4752
|
-
const newIndex = keys.findIndex((id) => id === over.id);
|
|
4753
|
-
if (oldIndex === -1 || newIndex === -1) return;
|
|
4754
|
-
const eventX = activatorEvent.current?.clientX ?? 0;
|
|
4755
|
-
const eventY = activatorEvent.current?.clientY ?? 0;
|
|
4756
|
-
const offsetLeft = eventX + position.x;
|
|
4757
|
-
const offsetTop = eventY + position.y;
|
|
4758
|
-
const indicator = validateDropIndicator({
|
|
5032
|
+
React47.useEffect(() => {
|
|
5033
|
+
const listConfig = {
|
|
5034
|
+
id,
|
|
5035
|
+
keys,
|
|
5036
|
+
onMoveItem: onMoveItem ?? (() => {
|
|
5037
|
+
}),
|
|
5038
|
+
renderOverlay: (id2) => {
|
|
5039
|
+
const index = keys.findIndex((key) => key === id2);
|
|
5040
|
+
return renderOverlay?.(index) ?? null;
|
|
5041
|
+
},
|
|
5042
|
+
acceptsFromList: acceptsFromList ?? (({ sourceListId, targetListId }) => sourceListId === targetListId),
|
|
5043
|
+
acceptsDrop: acceptsDrop2,
|
|
5044
|
+
getDropIndicator: (parameters) => {
|
|
5045
|
+
const { absolutePosition, active, over, sourceListId, targetListId } = parameters;
|
|
5046
|
+
const offsetStart = axis === "x" ? absolutePosition.x : absolutePosition.y;
|
|
5047
|
+
const elementStart = axis === "x" ? over.rect.left : over.rect.top;
|
|
5048
|
+
const elementSize = axis === "x" ? over.rect.width : over.rect.height;
|
|
5049
|
+
const relativeDropPosition = validateDropIndicator({
|
|
4759
5050
|
acceptsDrop: acceptsDrop2,
|
|
4760
5051
|
keys,
|
|
4761
5052
|
activeId: active.id,
|
|
4762
5053
|
overId: over.id,
|
|
4763
|
-
offsetStart
|
|
4764
|
-
elementStart
|
|
4765
|
-
elementSize
|
|
5054
|
+
offsetStart,
|
|
5055
|
+
elementStart,
|
|
5056
|
+
elementSize,
|
|
5057
|
+
sourceListId,
|
|
5058
|
+
targetListId
|
|
4766
5059
|
});
|
|
4767
|
-
|
|
4768
|
-
onMoveItem?.(oldIndex, newIndex, indicator);
|
|
5060
|
+
return relativeDropPosition;
|
|
4769
5061
|
}
|
|
4770
|
-
}
|
|
4771
|
-
|
|
5062
|
+
};
|
|
5063
|
+
registerList(listConfig);
|
|
5064
|
+
return () => {
|
|
5065
|
+
unregisterList(id);
|
|
5066
|
+
};
|
|
5067
|
+
}, [
|
|
5068
|
+
id,
|
|
5069
|
+
onMoveItem,
|
|
5070
|
+
renderOverlay,
|
|
5071
|
+
acceptsFromList,
|
|
5072
|
+
acceptsDrop2,
|
|
5073
|
+
axis,
|
|
5074
|
+
registerList,
|
|
5075
|
+
unregisterList,
|
|
5076
|
+
keys
|
|
5077
|
+
]);
|
|
5078
|
+
const contextValue = React47.useMemo(
|
|
5079
|
+
() => ({
|
|
5080
|
+
keys,
|
|
5081
|
+
acceptsDrop: acceptsDrop2,
|
|
5082
|
+
axis,
|
|
5083
|
+
listId: id,
|
|
5084
|
+
getDropTargetParentIndex,
|
|
5085
|
+
activeDragContext: sharedDragProviderContexts?.activeDragContext ?? ActiveDragContext
|
|
5086
|
+
}),
|
|
5087
|
+
[
|
|
5088
|
+
keys,
|
|
5089
|
+
acceptsDrop2,
|
|
5090
|
+
axis,
|
|
5091
|
+
id,
|
|
5092
|
+
getDropTargetParentIndex,
|
|
5093
|
+
sharedDragProviderContexts
|
|
5094
|
+
]
|
|
4772
5095
|
);
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
5096
|
+
React47.useEffect(() => {
|
|
5097
|
+
if (containerRef) {
|
|
5098
|
+
setDroppableRef(containerRef.current);
|
|
5099
|
+
}
|
|
5100
|
+
});
|
|
5101
|
+
return /* @__PURE__ */ React47.createElement(SortableItemContext2.Provider, { value: contextValue }, /* @__PURE__ */ React47.createElement(
|
|
5102
|
+
import_sortable.SortableContext,
|
|
4779
5103
|
{
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
keys,
|
|
4783
|
-
acceptsDrop: acceptsDrop2,
|
|
4784
|
-
position,
|
|
4785
|
-
setActivatorEvent,
|
|
4786
|
-
axis,
|
|
4787
|
-
getDropTargetParentIndex
|
|
4788
|
-
}),
|
|
4789
|
-
[
|
|
4790
|
-
acceptsDrop2,
|
|
4791
|
-
axis,
|
|
4792
|
-
getDropTargetParentIndex,
|
|
4793
|
-
keys,
|
|
4794
|
-
position,
|
|
4795
|
-
setActivatorEvent
|
|
4796
|
-
]
|
|
4797
|
-
)
|
|
5104
|
+
items: keys,
|
|
5105
|
+
strategy: axis === "x" ? import_sortable.horizontalListSortingStrategy : import_sortable.verticalListSortingStrategy
|
|
4798
5106
|
},
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
{
|
|
4802
|
-
sensors,
|
|
4803
|
-
collisionDetection: import_core.closestCenter,
|
|
4804
|
-
onDragStart: handleDragStart,
|
|
4805
|
-
onDragMove: handleDragMove,
|
|
4806
|
-
onDragEnd: handleDragEnd
|
|
4807
|
-
},
|
|
4808
|
-
/* @__PURE__ */ React44.createElement(
|
|
4809
|
-
import_sortable.SortableContext,
|
|
4810
|
-
{
|
|
4811
|
-
items: keys,
|
|
4812
|
-
strategy: axis === "x" ? import_sortable.horizontalListSortingStrategy : import_sortable.verticalListSortingStrategy
|
|
4813
|
-
},
|
|
4814
|
-
children
|
|
4815
|
-
),
|
|
4816
|
-
mounted && renderOverlay && (0, import_react_dom2.createPortal)(
|
|
4817
|
-
/* @__PURE__ */ React44.createElement(import_core.DragOverlay, { dropAnimation: null }, activeIndex !== void 0 && activeIndex >= 0 && renderOverlay(activeIndex)),
|
|
4818
|
-
document.body
|
|
4819
|
-
)
|
|
4820
|
-
)
|
|
4821
|
-
);
|
|
5107
|
+
children
|
|
5108
|
+
));
|
|
4822
5109
|
}
|
|
4823
|
-
var
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
shouldRenderOverlay = true,
|
|
4833
|
-
...rest
|
|
4834
|
-
} = props;
|
|
4835
|
-
const keys = React44.useMemo(
|
|
5110
|
+
var SortableRoot = withDragProvider(SortableRoot_);
|
|
5111
|
+
var Sortable_ = function Sortable_2({
|
|
5112
|
+
items,
|
|
5113
|
+
keyExtractor,
|
|
5114
|
+
shouldRenderOverlay = true,
|
|
5115
|
+
renderItem,
|
|
5116
|
+
...rest
|
|
5117
|
+
}) {
|
|
5118
|
+
const keys = React47.useMemo(
|
|
4836
5119
|
() => items.map(keyExtractor),
|
|
4837
5120
|
[items, keyExtractor]
|
|
4838
5121
|
);
|
|
4839
|
-
const renderOverlay =
|
|
5122
|
+
const renderOverlay = React47.useCallback(
|
|
4840
5123
|
(index) => {
|
|
4841
5124
|
return renderItem(
|
|
4842
5125
|
items[index],
|
|
@@ -4856,32 +5139,31 @@ var SortableComponent = memoGeneric(function Sortable(props) {
|
|
|
4856
5139
|
},
|
|
4857
5140
|
[renderItem, items]
|
|
4858
5141
|
);
|
|
4859
|
-
return /* @__PURE__ */
|
|
4860
|
-
|
|
5142
|
+
return /* @__PURE__ */ React47.createElement(
|
|
5143
|
+
SortableRoot,
|
|
4861
5144
|
{
|
|
4862
5145
|
...rest,
|
|
4863
5146
|
keys,
|
|
4864
5147
|
renderOverlay: shouldRenderOverlay ? renderOverlay : void 0
|
|
4865
5148
|
},
|
|
4866
|
-
keys.map((key, index) => /* @__PURE__ */
|
|
4867
|
-
return renderItem(
|
|
4868
|
-
items[index],
|
|
4869
|
-
props2,
|
|
4870
|
-
{ isOverlay: false }
|
|
4871
|
-
);
|
|
5149
|
+
keys.map((key, index) => /* @__PURE__ */ React47.createElement(SortableItem, { key, id: key }, (props) => {
|
|
5150
|
+
return renderItem(items[index], props, { isOverlay: false });
|
|
4872
5151
|
}))
|
|
4873
5152
|
);
|
|
5153
|
+
};
|
|
5154
|
+
var Sortable = Object.assign(Sortable_, {
|
|
5155
|
+
Root: SortableRoot,
|
|
5156
|
+
Item: SortableItem
|
|
4874
5157
|
});
|
|
4875
|
-
var Sortable2 = Object.assign(SortableComponent, SortableSubcomponents);
|
|
4876
5158
|
|
|
4877
5159
|
// src/components/ListView.tsx
|
|
4878
5160
|
var ROW_HEIGHT = 31;
|
|
4879
5161
|
var SECTION_HEADER_LABEL_HEIGHT = INPUT_HEIGHT;
|
|
4880
|
-
var ListViewDraggingContext = (0,
|
|
5162
|
+
var ListViewDraggingContext = (0, import_react52.createContext)({
|
|
4881
5163
|
indentation: 12
|
|
4882
5164
|
});
|
|
4883
5165
|
ListViewDraggingContext.displayName = "ListViewDraggingContext";
|
|
4884
|
-
var ListRowContext = (0,
|
|
5166
|
+
var ListRowContext = (0, import_react52.createContext)({
|
|
4885
5167
|
marginType: "none",
|
|
4886
5168
|
selectedPosition: "only",
|
|
4887
5169
|
sortable: false,
|
|
@@ -4899,7 +5181,7 @@ var ListViewRowTitle = ({
|
|
|
4899
5181
|
className,
|
|
4900
5182
|
children,
|
|
4901
5183
|
...props
|
|
4902
|
-
}) => /* @__PURE__ */
|
|
5184
|
+
}) => /* @__PURE__ */ import_react52.default.createElement(
|
|
4903
5185
|
"span",
|
|
4904
5186
|
{
|
|
4905
5187
|
className: cx(
|
|
@@ -4918,8 +5200,8 @@ function ListViewEditableRowTitle({
|
|
|
4918
5200
|
className,
|
|
4919
5201
|
onKeyDown
|
|
4920
5202
|
}) {
|
|
4921
|
-
const inputRef = (0,
|
|
4922
|
-
(0,
|
|
5203
|
+
const inputRef = (0, import_react52.useRef)(null);
|
|
5204
|
+
(0, import_react52.useLayoutEffect)(() => {
|
|
4923
5205
|
const element = inputRef.current;
|
|
4924
5206
|
if (!element || !autoFocus) return;
|
|
4925
5207
|
element.focus();
|
|
@@ -4927,7 +5209,7 @@ function ListViewEditableRowTitle({
|
|
|
4927
5209
|
element.select();
|
|
4928
5210
|
}, 1);
|
|
4929
5211
|
}, [autoFocus]);
|
|
4930
|
-
return /* @__PURE__ */
|
|
5212
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
4931
5213
|
InputField2.Input,
|
|
4932
5214
|
{
|
|
4933
5215
|
ref: inputRef,
|
|
@@ -4940,7 +5222,7 @@ function ListViewEditableRowTitle({
|
|
|
4940
5222
|
}
|
|
4941
5223
|
);
|
|
4942
5224
|
}
|
|
4943
|
-
var RowContainer = (0,
|
|
5225
|
+
var RowContainer = (0, import_react52.forwardRef)(
|
|
4944
5226
|
({
|
|
4945
5227
|
className,
|
|
4946
5228
|
$marginType,
|
|
@@ -4966,7 +5248,7 @@ var RowContainer = (0, import_react51.forwardRef)(
|
|
|
4966
5248
|
"aria-selected": ariaSelected,
|
|
4967
5249
|
...props
|
|
4968
5250
|
}, ref) => {
|
|
4969
|
-
return /* @__PURE__ */
|
|
5251
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
4970
5252
|
"div",
|
|
4971
5253
|
{
|
|
4972
5254
|
ref,
|
|
@@ -5034,7 +5316,7 @@ var RowContainer = (0, import_react51.forwardRef)(
|
|
|
5034
5316
|
);
|
|
5035
5317
|
}
|
|
5036
5318
|
);
|
|
5037
|
-
var ListViewDragIndicatorElement = (0,
|
|
5319
|
+
var ListViewDragIndicatorElement = (0, import_react52.forwardRef)(
|
|
5038
5320
|
({
|
|
5039
5321
|
className,
|
|
5040
5322
|
$relativeDropPosition,
|
|
@@ -5044,7 +5326,7 @@ var ListViewDragIndicatorElement = (0, import_react51.forwardRef)(
|
|
|
5044
5326
|
style: style2,
|
|
5045
5327
|
...props
|
|
5046
5328
|
}, ref) => {
|
|
5047
|
-
return /* @__PURE__ */
|
|
5329
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
5048
5330
|
"div",
|
|
5049
5331
|
{
|
|
5050
5332
|
ref,
|
|
@@ -5111,12 +5393,12 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5111
5393
|
divider,
|
|
5112
5394
|
gap: listGap,
|
|
5113
5395
|
colorScheme
|
|
5114
|
-
} = (0,
|
|
5396
|
+
} = (0, import_react52.useContext)(ListRowContext);
|
|
5115
5397
|
const { hoverProps } = useHover({
|
|
5116
5398
|
onHoverChange
|
|
5117
5399
|
});
|
|
5118
|
-
const { indentation, isDragOverlay } = (0,
|
|
5119
|
-
const handlePress = (0,
|
|
5400
|
+
const { indentation, isDragOverlay } = (0, import_react52.useContext)(ListViewDraggingContext);
|
|
5401
|
+
const handlePress = (0, import_react52.useCallback)(
|
|
5120
5402
|
(event) => {
|
|
5121
5403
|
event.preventDefault();
|
|
5122
5404
|
if (event.button !== 0) return;
|
|
@@ -5124,14 +5406,14 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5124
5406
|
},
|
|
5125
5407
|
[onPress]
|
|
5126
5408
|
);
|
|
5127
|
-
const handleDoubleClick = (0,
|
|
5409
|
+
const handleDoubleClick = (0, import_react52.useCallback)(
|
|
5128
5410
|
(event) => {
|
|
5129
5411
|
event.stopPropagation();
|
|
5130
5412
|
onDoubleClick?.();
|
|
5131
5413
|
},
|
|
5132
5414
|
[onDoubleClick]
|
|
5133
5415
|
);
|
|
5134
|
-
const mergedStyle = (0,
|
|
5416
|
+
const mergedStyle = (0, import_react52.useMemo)(() => {
|
|
5135
5417
|
return isDragOverlay ? {
|
|
5136
5418
|
// TODO: Where do these offsets actually come from?
|
|
5137
5419
|
transform: `translate3d(-36px, -6px, 0)`,
|
|
@@ -5145,7 +5427,7 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5145
5427
|
}, ref) => {
|
|
5146
5428
|
const Component = RowContainer;
|
|
5147
5429
|
const relativeDropPosition = testRelativeDropPosition ?? relativeDropPositionProp;
|
|
5148
|
-
const element = /* @__PURE__ */
|
|
5430
|
+
const element = /* @__PURE__ */ import_react52.default.createElement(
|
|
5149
5431
|
Component,
|
|
5150
5432
|
{
|
|
5151
5433
|
ref,
|
|
@@ -5179,7 +5461,7 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5179
5461
|
className,
|
|
5180
5462
|
$clickable: !!onPress
|
|
5181
5463
|
},
|
|
5182
|
-
relativeDropPosition && /* @__PURE__ */
|
|
5464
|
+
relativeDropPosition && /* @__PURE__ */ import_react52.default.createElement(
|
|
5183
5465
|
ListViewDragIndicatorElement,
|
|
5184
5466
|
{
|
|
5185
5467
|
key: relativeDropPosition,
|
|
@@ -5194,11 +5476,11 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5194
5476
|
}) : dragIndicatorStyle
|
|
5195
5477
|
}
|
|
5196
5478
|
),
|
|
5197
|
-
depth > 0 && /* @__PURE__ */
|
|
5479
|
+
depth > 0 && /* @__PURE__ */ import_react52.default.createElement(Spacer.Horizontal, { size: depth * indentation }),
|
|
5198
5480
|
children
|
|
5199
5481
|
);
|
|
5200
5482
|
if (menuItems && onSelectMenuItem) {
|
|
5201
|
-
return /* @__PURE__ */
|
|
5483
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
5202
5484
|
ContextMenu,
|
|
5203
5485
|
{
|
|
5204
5486
|
items: menuItems,
|
|
@@ -5211,23 +5493,23 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5211
5493
|
return element;
|
|
5212
5494
|
};
|
|
5213
5495
|
if (sortable && id) {
|
|
5214
|
-
return /* @__PURE__ */
|
|
5496
|
+
return /* @__PURE__ */ import_react52.default.createElement(Sortable.Item, { id, disabled: overrideSortable === false }, ({ ref: sortableRef, ...sortableProps }) => renderContent(
|
|
5215
5497
|
sortableProps,
|
|
5216
5498
|
(0, import_react_compose_refs2.composeRefs)(sortableRef, forwardedRef)
|
|
5217
5499
|
));
|
|
5218
5500
|
}
|
|
5219
5501
|
return renderContent({}, forwardedRef);
|
|
5220
5502
|
});
|
|
5221
|
-
var RenderItemContext = (0,
|
|
5503
|
+
var RenderItemContext = (0, import_react52.createContext)(
|
|
5222
5504
|
() => null
|
|
5223
5505
|
);
|
|
5224
5506
|
RenderItemContext.displayName = "RenderItemContext";
|
|
5225
|
-
var VirtualizedListRow = (0,
|
|
5507
|
+
var VirtualizedListRow = (0, import_react52.memo)(function VirtualizedListRow2({
|
|
5226
5508
|
index,
|
|
5227
5509
|
style: style2
|
|
5228
5510
|
}) {
|
|
5229
|
-
const renderItem = (0,
|
|
5230
|
-
return /* @__PURE__ */
|
|
5511
|
+
const renderItem = (0, import_react52.useContext)(RenderItemContext);
|
|
5512
|
+
return /* @__PURE__ */ import_react52.default.createElement("div", { key: index, style: style2 }, renderItem(index));
|
|
5231
5513
|
});
|
|
5232
5514
|
var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
5233
5515
|
size: size2,
|
|
@@ -5237,20 +5519,20 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5237
5519
|
keyExtractor,
|
|
5238
5520
|
renderItem
|
|
5239
5521
|
}, ref) {
|
|
5240
|
-
const listRef = (0,
|
|
5241
|
-
(0,
|
|
5522
|
+
const listRef = (0, import_react52.useRef)(null);
|
|
5523
|
+
(0, import_react52.useImperativeHandle)(ref, () => ({
|
|
5242
5524
|
scrollToIndex(index) {
|
|
5243
5525
|
listRef.current?.scrollToItem(index);
|
|
5244
5526
|
}
|
|
5245
5527
|
}));
|
|
5246
|
-
(0,
|
|
5528
|
+
(0, import_react52.useLayoutEffect)(() => {
|
|
5247
5529
|
listRef.current?.resetAfterIndex(0);
|
|
5248
5530
|
}, [
|
|
5249
5531
|
// When items change, we need to re-render the virtualized list,
|
|
5250
5532
|
// since it doesn't currently support row height changes
|
|
5251
5533
|
items
|
|
5252
5534
|
]);
|
|
5253
|
-
const listStyle = (0,
|
|
5535
|
+
const listStyle = (0, import_react52.useMemo)(
|
|
5254
5536
|
() => ({
|
|
5255
5537
|
overflowX: "initial",
|
|
5256
5538
|
overflowY: "initial",
|
|
@@ -5258,18 +5540,18 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5258
5540
|
}),
|
|
5259
5541
|
[]
|
|
5260
5542
|
);
|
|
5261
|
-
return /* @__PURE__ */
|
|
5543
|
+
return /* @__PURE__ */ import_react52.default.createElement(RenderItemContext.Provider, { value: renderItem }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5262
5544
|
import_react_virtualized.WindowScroller,
|
|
5263
5545
|
{
|
|
5264
5546
|
scrollElement,
|
|
5265
|
-
style: (0,
|
|
5547
|
+
style: (0, import_react52.useMemo)(() => ({ flex: "1 1 auto" }), [])
|
|
5266
5548
|
},
|
|
5267
|
-
(0,
|
|
5549
|
+
(0, import_react52.useCallback)(
|
|
5268
5550
|
({
|
|
5269
5551
|
registerChild,
|
|
5270
5552
|
onChildScroll,
|
|
5271
5553
|
scrollTop
|
|
5272
|
-
}) => /* @__PURE__ */
|
|
5554
|
+
}) => /* @__PURE__ */ import_react52.default.createElement("div", { ref: registerChild }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5273
5555
|
import_react_window.VariableSizeList,
|
|
5274
5556
|
{
|
|
5275
5557
|
ref: listRef,
|
|
@@ -5299,7 +5581,7 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5299
5581
|
)
|
|
5300
5582
|
));
|
|
5301
5583
|
});
|
|
5302
|
-
var VirtualizedList = (0,
|
|
5584
|
+
var VirtualizedList = (0, import_react52.memo)(
|
|
5303
5585
|
VirtualizedListInner
|
|
5304
5586
|
);
|
|
5305
5587
|
var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
@@ -5335,7 +5617,7 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5335
5617
|
renderEmptyState,
|
|
5336
5618
|
getDropTargetParentIndex
|
|
5337
5619
|
}, forwardedRef) {
|
|
5338
|
-
const handleClick = (0,
|
|
5620
|
+
const handleClick = (0, import_react52.useCallback)(
|
|
5339
5621
|
(event) => {
|
|
5340
5622
|
if (event.target instanceof HTMLElement && event.target.classList.contains("scroll-component"))
|
|
5341
5623
|
return;
|
|
@@ -5345,11 +5627,11 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5345
5627
|
},
|
|
5346
5628
|
[onPress]
|
|
5347
5629
|
);
|
|
5348
|
-
const renderChild = (0,
|
|
5630
|
+
const renderChild = (0, import_react52.useCallback)(
|
|
5349
5631
|
(index) => renderItem(data[index], index, { isDragOverlay: false }),
|
|
5350
5632
|
[data, renderItem]
|
|
5351
5633
|
);
|
|
5352
|
-
const defaultContextValue = (0,
|
|
5634
|
+
const defaultContextValue = (0, import_react52.useMemo)(
|
|
5353
5635
|
() => ({
|
|
5354
5636
|
colorScheme,
|
|
5355
5637
|
marginType: "none",
|
|
@@ -5374,16 +5656,16 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5374
5656
|
sectionHeaderVariant
|
|
5375
5657
|
]
|
|
5376
5658
|
);
|
|
5377
|
-
const getItemContextValue = (0,
|
|
5659
|
+
const getItemContextValue = (0, import_react52.useCallback)(
|
|
5378
5660
|
(i) => {
|
|
5379
5661
|
if (variant === "bare" || variant === "normal")
|
|
5380
5662
|
return defaultContextValue;
|
|
5381
5663
|
const current = renderChild(i);
|
|
5382
|
-
if (!(0,
|
|
5664
|
+
if (!(0, import_react52.isValidElement)(current)) return;
|
|
5383
5665
|
const prevChild = i - 1 >= 0 && renderChild(i - 1);
|
|
5384
5666
|
const nextChild = i + 1 < data.length && renderChild(i + 1);
|
|
5385
|
-
const next = (0,
|
|
5386
|
-
const prev = (0,
|
|
5667
|
+
const next = (0, import_react52.isValidElement)(nextChild) ? nextChild : void 0;
|
|
5668
|
+
const prev = (0, import_react52.isValidElement)(prevChild) ? prevChild : void 0;
|
|
5387
5669
|
const hasMarginTop = !prev;
|
|
5388
5670
|
const hasMarginBottom = !next || current.props.isSectionHeader || next && next.props.isSectionHeader;
|
|
5389
5671
|
let marginType;
|
|
@@ -5436,26 +5718,26 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5436
5718
|
gap
|
|
5437
5719
|
]
|
|
5438
5720
|
);
|
|
5439
|
-
const draggingContextOverlayValue = (0,
|
|
5721
|
+
const draggingContextOverlayValue = (0, import_react52.useMemo)(
|
|
5440
5722
|
() => ({ indentation, isDragOverlay: true }),
|
|
5441
5723
|
[indentation]
|
|
5442
5724
|
);
|
|
5443
|
-
const renderOverlay = (0,
|
|
5444
|
-
(index) => /* @__PURE__ */
|
|
5725
|
+
const renderOverlay = (0, import_react52.useCallback)(
|
|
5726
|
+
(index) => /* @__PURE__ */ import_react52.default.createElement("div", { style: { opacity: 0.25 } }, /* @__PURE__ */ import_react52.default.createElement(ListViewDraggingContext.Provider, { value: draggingContextOverlayValue }, renderItem(data[index], index, { isDragOverlay: true }))),
|
|
5445
5727
|
[draggingContextOverlayValue, renderItem, data]
|
|
5446
5728
|
);
|
|
5447
|
-
const renderWrappedChild = (0,
|
|
5729
|
+
const renderWrappedChild = (0, import_react52.useCallback)(
|
|
5448
5730
|
(index) => {
|
|
5449
5731
|
const contextValue = getItemContextValue(index);
|
|
5450
5732
|
const current = renderChild(index);
|
|
5451
|
-
if (!contextValue || !(0,
|
|
5452
|
-
return /* @__PURE__ */
|
|
5733
|
+
if (!contextValue || !(0, import_react52.isValidElement)(current)) return null;
|
|
5734
|
+
return /* @__PURE__ */ import_react52.default.createElement(ListRowContext.Provider, { key: current.key, value: contextValue }, current);
|
|
5453
5735
|
},
|
|
5454
5736
|
[getItemContextValue, renderChild]
|
|
5455
5737
|
);
|
|
5456
|
-
const ids = (0,
|
|
5457
|
-
const withSortable = (children) => sortable ? /* @__PURE__ */
|
|
5458
|
-
|
|
5738
|
+
const ids = (0, import_react52.useMemo)(() => data.map(keyExtractor), [keyExtractor, data]);
|
|
5739
|
+
const withSortable = (children) => sortable ? /* @__PURE__ */ import_react52.default.createElement(
|
|
5740
|
+
Sortable.Root,
|
|
5459
5741
|
{
|
|
5460
5742
|
onMoveItem,
|
|
5461
5743
|
keys: ids,
|
|
@@ -5465,8 +5747,8 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5465
5747
|
},
|
|
5466
5748
|
children
|
|
5467
5749
|
) : children;
|
|
5468
|
-
const withScrollable = (children) => scrollable ? /* @__PURE__ */
|
|
5469
|
-
const getItemHeight = (0,
|
|
5750
|
+
const withScrollable = (children) => scrollable ? /* @__PURE__ */ import_react52.default.createElement(ScrollArea, null, children) : children(null);
|
|
5751
|
+
const getItemHeight = (0, import_react52.useCallback)(
|
|
5470
5752
|
(index) => {
|
|
5471
5753
|
const child = getItemContextValue(index);
|
|
5472
5754
|
const height = child?.isSectionHeader && child.sectionHeaderVariant === "label" ? SECTION_HEADER_LABEL_HEIGHT : ROW_HEIGHT;
|
|
@@ -5474,13 +5756,13 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5474
5756
|
},
|
|
5475
5757
|
[getItemContextValue]
|
|
5476
5758
|
);
|
|
5477
|
-
const getKey = (0,
|
|
5759
|
+
const getKey = (0, import_react52.useCallback)(
|
|
5478
5760
|
(index) => keyExtractor(data[index], index),
|
|
5479
5761
|
[data, keyExtractor]
|
|
5480
5762
|
);
|
|
5481
|
-
const draggingContextValue = (0,
|
|
5482
|
-
const gapStyle = (0,
|
|
5483
|
-
return /* @__PURE__ */
|
|
5763
|
+
const draggingContextValue = (0, import_react52.useMemo)(() => ({ indentation }), [indentation]);
|
|
5764
|
+
const gapStyle = (0, import_react52.useMemo)(() => ({ gap: `${gap}px` }), [gap]);
|
|
5765
|
+
return /* @__PURE__ */ import_react52.default.createElement(ListViewDraggingContext.Provider, { value: draggingContextValue }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5484
5766
|
"div",
|
|
5485
5767
|
{
|
|
5486
5768
|
id,
|
|
@@ -5509,7 +5791,7 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5509
5791
|
},
|
|
5510
5792
|
data.length === 0 && renderEmptyState ? renderEmptyState() : withScrollable(
|
|
5511
5793
|
(scrollElementRef) => withSortable(
|
|
5512
|
-
virtualized ? /* @__PURE__ */
|
|
5794
|
+
virtualized ? /* @__PURE__ */ import_react52.default.createElement(
|
|
5513
5795
|
VirtualizedList,
|
|
5514
5796
|
{
|
|
5515
5797
|
ref: forwardedRef,
|
|
@@ -5526,40 +5808,40 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5526
5808
|
));
|
|
5527
5809
|
});
|
|
5528
5810
|
var ListViewRoot = memoGeneric(ListViewRootInner);
|
|
5529
|
-
var ChildrenListViewInner = (0,
|
|
5530
|
-
const items = (0,
|
|
5531
|
-
() =>
|
|
5532
|
-
(child) => (0,
|
|
5811
|
+
var ChildrenListViewInner = (0, import_react52.forwardRef)(function ChildrenListViewInner2({ children, ...rest }, forwardedRef) {
|
|
5812
|
+
const items = (0, import_react52.useMemo)(
|
|
5813
|
+
() => import_react52.Children.toArray(children).flatMap(
|
|
5814
|
+
(child) => (0, import_react52.isValidElement)(child) ? [child] : []
|
|
5533
5815
|
),
|
|
5534
5816
|
[children]
|
|
5535
5817
|
);
|
|
5536
|
-
return /* @__PURE__ */
|
|
5818
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
5537
5819
|
ListViewRoot,
|
|
5538
5820
|
{
|
|
5539
5821
|
ref: forwardedRef,
|
|
5540
5822
|
...rest,
|
|
5541
5823
|
data: items,
|
|
5542
|
-
keyExtractor: (0,
|
|
5824
|
+
keyExtractor: (0, import_react52.useCallback)(
|
|
5543
5825
|
({ key }, index) => typeof key === "string" ? key : (key ?? index).toString(),
|
|
5544
5826
|
[]
|
|
5545
5827
|
),
|
|
5546
|
-
renderItem: (0,
|
|
5828
|
+
renderItem: (0, import_react52.useCallback)((item) => item, [])
|
|
5547
5829
|
}
|
|
5548
5830
|
);
|
|
5549
5831
|
});
|
|
5550
|
-
var ChildrenListView = (0,
|
|
5832
|
+
var ChildrenListView = (0, import_react52.memo)(ChildrenListViewInner);
|
|
5551
5833
|
var SimpleListViewInner = forwardRefGeneric(function SimpleListViewInner2(props, forwardedRef) {
|
|
5552
5834
|
if ("children" in props) {
|
|
5553
|
-
return /* @__PURE__ */
|
|
5835
|
+
return /* @__PURE__ */ import_react52.default.createElement(ChildrenListView, { ref: forwardedRef, ...props });
|
|
5554
5836
|
} else {
|
|
5555
|
-
return /* @__PURE__ */
|
|
5837
|
+
return /* @__PURE__ */ import_react52.default.createElement(ListViewRoot, { ref: forwardedRef, ...props });
|
|
5556
5838
|
}
|
|
5557
5839
|
});
|
|
5558
5840
|
var SimpleListView = memoGeneric(SimpleListViewInner);
|
|
5559
5841
|
var ListView;
|
|
5560
5842
|
((ListView2) => {
|
|
5561
|
-
ListView2.RowTitle = (0,
|
|
5562
|
-
ListView2.EditableRowTitle = (0,
|
|
5843
|
+
ListView2.RowTitle = (0, import_react52.memo)(ListViewRowTitle);
|
|
5844
|
+
ListView2.EditableRowTitle = (0, import_react52.memo)(ListViewEditableRowTitle);
|
|
5563
5845
|
ListView2.Row = memoGeneric(ListViewRow);
|
|
5564
5846
|
ListView2.Root = SimpleListView;
|
|
5565
5847
|
ListView2.RowContext = ListRowContext;
|
|
@@ -5576,7 +5858,7 @@ var ListView;
|
|
|
5576
5858
|
})(ListView || (ListView = {}));
|
|
5577
5859
|
|
|
5578
5860
|
// src/components/TreeView.tsx
|
|
5579
|
-
var
|
|
5861
|
+
var import_react53 = __toESM(require("react"));
|
|
5580
5862
|
var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
5581
5863
|
icon,
|
|
5582
5864
|
expanded,
|
|
@@ -5585,15 +5867,15 @@ var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
|
5585
5867
|
children,
|
|
5586
5868
|
...rest
|
|
5587
5869
|
}, forwardedRef) {
|
|
5588
|
-
const { expandable } = (0,
|
|
5589
|
-
const handleClickChevron = (0,
|
|
5870
|
+
const { expandable } = (0, import_react53.useContext)(ListView.RowContext);
|
|
5871
|
+
const handleClickChevron = (0, import_react53.useCallback)(
|
|
5590
5872
|
(event) => {
|
|
5591
5873
|
event.stopPropagation();
|
|
5592
5874
|
onClickChevron?.({ altKey: event.altKey });
|
|
5593
5875
|
},
|
|
5594
5876
|
[onClickChevron]
|
|
5595
5877
|
);
|
|
5596
|
-
return /* @__PURE__ */
|
|
5878
|
+
return /* @__PURE__ */ import_react53.default.createElement(ListView.Row, { ref: forwardedRef, ...rest }, expandable && /* @__PURE__ */ import_react53.default.createElement(import_react53.default.Fragment, null, expanded === void 0 ? /* @__PURE__ */ import_react53.default.createElement(Spacer.Horizontal, { size: 19 }) : /* @__PURE__ */ import_react53.default.createElement(
|
|
5597
5879
|
IconButton,
|
|
5598
5880
|
{
|
|
5599
5881
|
className: chevronClassName,
|
|
@@ -5601,7 +5883,7 @@ var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
|
5601
5883
|
onClick: handleClickChevron,
|
|
5602
5884
|
selected: rest.selected
|
|
5603
5885
|
}
|
|
5604
|
-
), /* @__PURE__ */
|
|
5886
|
+
), /* @__PURE__ */ import_react53.default.createElement(Spacer.Horizontal, { size: 6 })), icon && /* @__PURE__ */ import_react53.default.createElement(import_react53.default.Fragment, null, renderIcon(icon), /* @__PURE__ */ import_react53.default.createElement(Spacer.Horizontal, { size: 10 })), children);
|
|
5605
5887
|
});
|
|
5606
5888
|
var TreeView;
|
|
5607
5889
|
((TreeView2) => {
|
|
@@ -5656,9 +5938,9 @@ var List = memoGeneric(
|
|
|
5656
5938
|
onClickItem,
|
|
5657
5939
|
dragIndicatorStyle
|
|
5658
5940
|
} = props;
|
|
5659
|
-
const [internalHoveredId, setHoveredId] = (0,
|
|
5660
|
-
const [internalRenamingId, setRenamingId] = (0,
|
|
5661
|
-
const [dropdownOpenId, setDropdownOpenId] = (0,
|
|
5941
|
+
const [internalHoveredId, setHoveredId] = (0, import_react54.useState)();
|
|
5942
|
+
const [internalRenamingId, setRenamingId] = (0, import_react54.useState)();
|
|
5943
|
+
const [dropdownOpenId, setDropdownOpenId] = (0, import_react54.useState)();
|
|
5662
5944
|
const hoveredId = internalHoveredId ?? testHoveredId;
|
|
5663
5945
|
const renamingId = testRenamingId ?? internalRenamingId;
|
|
5664
5946
|
const handleSelect = (itemId, event) => {
|
|
@@ -5683,17 +5965,17 @@ var List = memoGeneric(
|
|
|
5683
5965
|
);
|
|
5684
5966
|
};
|
|
5685
5967
|
const ViewComponent = expandable ? TreeView : ListView;
|
|
5686
|
-
const fileDropTargetRef = (0,
|
|
5968
|
+
const fileDropTargetRef = (0, import_react54.useRef)(null);
|
|
5687
5969
|
const { isDropTargetActive, dropTargetProps } = useFileDropTarget(
|
|
5688
5970
|
fileDropTargetRef,
|
|
5689
5971
|
onFilesDrop
|
|
5690
5972
|
);
|
|
5691
|
-
(0,
|
|
5973
|
+
(0, import_react54.useImperativeHandle)(ref, () => ({
|
|
5692
5974
|
editName: (id) => {
|
|
5693
5975
|
setRenamingId(id);
|
|
5694
5976
|
}
|
|
5695
5977
|
}));
|
|
5696
|
-
return /* @__PURE__ */
|
|
5978
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5697
5979
|
ViewComponent.Root,
|
|
5698
5980
|
{
|
|
5699
5981
|
variant: "bare",
|
|
@@ -5736,7 +6018,7 @@ var List = memoGeneric(
|
|
|
5736
6018
|
handleSelect(id);
|
|
5737
6019
|
}
|
|
5738
6020
|
};
|
|
5739
|
-
const action = (isHovered || isSelected) && !isRenaming && (typeof renderAction === "function" ? renderAction({ item, selected: isSelected, onOpenChange }) : renderAction === "menu" && menuItems && /* @__PURE__ */
|
|
6021
|
+
const action = (isHovered || isSelected) && !isRenaming && (typeof renderAction === "function" ? renderAction({ item, selected: isSelected, onOpenChange }) : renderAction === "menu" && menuItems && /* @__PURE__ */ import_react54.default.createElement(
|
|
5740
6022
|
ActionMenu,
|
|
5741
6023
|
{
|
|
5742
6024
|
menuItems,
|
|
@@ -5752,7 +6034,7 @@ var List = memoGeneric(
|
|
|
5752
6034
|
));
|
|
5753
6035
|
const end = action || detailPosition === "end" && renderDetail?.(item, isSelected);
|
|
5754
6036
|
const below = detailPosition === "below" && renderDetail?.(item, isSelected);
|
|
5755
|
-
return /* @__PURE__ */
|
|
6037
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5756
6038
|
ViewComponent.Row,
|
|
5757
6039
|
{
|
|
5758
6040
|
id,
|
|
@@ -5800,12 +6082,12 @@ var List = memoGeneric(
|
|
|
5800
6082
|
},
|
|
5801
6083
|
dragIndicatorStyle
|
|
5802
6084
|
},
|
|
5803
|
-
/* @__PURE__ */
|
|
6085
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5804
6086
|
"div",
|
|
5805
6087
|
{
|
|
5806
6088
|
className: cx("flex flex-1 items-center px-2", rowGapMap[size2])
|
|
5807
6089
|
},
|
|
5808
|
-
thumbnail && /* @__PURE__ */
|
|
6090
|
+
thumbnail && /* @__PURE__ */ import_react54.default.createElement(
|
|
5809
6091
|
"div",
|
|
5810
6092
|
{
|
|
5811
6093
|
className: cx(
|
|
@@ -5818,7 +6100,7 @@ var List = memoGeneric(
|
|
|
5818
6100
|
},
|
|
5819
6101
|
thumbnail
|
|
5820
6102
|
),
|
|
5821
|
-
/* @__PURE__ */
|
|
6103
|
+
/* @__PURE__ */ import_react54.default.createElement("div", { className: "flex flex-col flex-1 w-0" }, /* @__PURE__ */ import_react54.default.createElement("div", { className: "flex items-center min-h-input-height flex-1 gap-2" }, /* @__PURE__ */ import_react54.default.createElement("div", { className: "flex-1 w-0 flex items-center", tabIndex: -1 }, isRenaming ? /* @__PURE__ */ import_react54.default.createElement(
|
|
5822
6104
|
ViewComponent.EditableRowTitle,
|
|
5823
6105
|
{
|
|
5824
6106
|
value: getName(item),
|
|
@@ -5833,7 +6115,7 @@ var List = memoGeneric(
|
|
|
5833
6115
|
e.stopPropagation();
|
|
5834
6116
|
}
|
|
5835
6117
|
}
|
|
5836
|
-
) : /* @__PURE__ */
|
|
6118
|
+
) : /* @__PURE__ */ import_react54.default.createElement(
|
|
5837
6119
|
ViewComponent.RowTitle,
|
|
5838
6120
|
{
|
|
5839
6121
|
className: cx(
|
|
@@ -5842,8 +6124,8 @@ var List = memoGeneric(
|
|
|
5842
6124
|
)
|
|
5843
6125
|
},
|
|
5844
6126
|
getName(item)
|
|
5845
|
-
)), end && detailPosition === "end" && /* @__PURE__ */
|
|
5846
|
-
end && detailPosition === "below" && /* @__PURE__ */
|
|
6127
|
+
)), end && detailPosition === "end" && /* @__PURE__ */ import_react54.default.createElement(DetailContainer, { selected: isSelected }, end)), below && /* @__PURE__ */ import_react54.default.createElement(DetailContainer, { selected: isSelected }, below)),
|
|
6128
|
+
end && detailPosition === "below" && /* @__PURE__ */ import_react54.default.createElement(DetailContainer, { selected: isSelected }, end)
|
|
5847
6129
|
)
|
|
5848
6130
|
);
|
|
5849
6131
|
}
|
|
@@ -5851,11 +6133,11 @@ var List = memoGeneric(
|
|
|
5851
6133
|
);
|
|
5852
6134
|
})
|
|
5853
6135
|
);
|
|
5854
|
-
var DetailContainer = (0,
|
|
6136
|
+
var DetailContainer = (0, import_react54.memo)(function DetailContainer2({
|
|
5855
6137
|
children,
|
|
5856
6138
|
selected
|
|
5857
6139
|
}) {
|
|
5858
|
-
return /* @__PURE__ */
|
|
6140
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5859
6141
|
"div",
|
|
5860
6142
|
{
|
|
5861
6143
|
className: cx("flex items-center gap-2", selected && "text-primary"),
|
|
@@ -5900,20 +6182,20 @@ var fontStyleMap = {
|
|
|
5900
6182
|
// src/components/Collection.tsx
|
|
5901
6183
|
var Collection = forwardRefGeneric(function Collection2(props, ref) {
|
|
5902
6184
|
const { viewType, ...rest } = props;
|
|
5903
|
-
return viewType === "grid" ? /* @__PURE__ */
|
|
6185
|
+
return viewType === "grid" ? /* @__PURE__ */ import_react55.default.createElement(Grid, { ref, ...rest }) : /* @__PURE__ */ import_react55.default.createElement(List, { ref, ...rest });
|
|
5904
6186
|
});
|
|
5905
6187
|
|
|
5906
6188
|
// src/components/ColorSwatch.tsx
|
|
5907
|
-
var
|
|
6189
|
+
var import_react56 = __toESM(require("react"));
|
|
5908
6190
|
var colorSwatchSizeMap = {
|
|
5909
6191
|
xsmall: 21,
|
|
5910
6192
|
small: 27,
|
|
5911
6193
|
medium: 36,
|
|
5912
6194
|
large: 48
|
|
5913
6195
|
};
|
|
5914
|
-
var ColorSwatch = (0,
|
|
6196
|
+
var ColorSwatch = (0, import_react56.forwardRef)(function ColorSwatch2({ color, size: size2 = "small", checked, style: style2, ...props }, ref) {
|
|
5915
6197
|
const sizePx = colorSwatchSizeMap[size2];
|
|
5916
|
-
return /* @__PURE__ */
|
|
6198
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5917
6199
|
"button",
|
|
5918
6200
|
{
|
|
5919
6201
|
...props,
|
|
@@ -5934,7 +6216,7 @@ var ColorSwatch = (0, import_react55.forwardRef)(function ColorSwatch2({ color,
|
|
|
5934
6216
|
|
|
5935
6217
|
// src/components/ColorSwatchControl.tsx
|
|
5936
6218
|
var ToggleGroupPrimitive = __toESM(require("@radix-ui/react-toggle-group"));
|
|
5937
|
-
var
|
|
6219
|
+
var import_react57 = __toESM(require("react"));
|
|
5938
6220
|
function ColorSwatchControl(props) {
|
|
5939
6221
|
const {
|
|
5940
6222
|
options,
|
|
@@ -5949,7 +6231,7 @@ function ColorSwatchControl(props) {
|
|
|
5949
6231
|
id,
|
|
5950
6232
|
style: style2
|
|
5951
6233
|
} = props;
|
|
5952
|
-
const styles3 = (0,
|
|
6234
|
+
const styles3 = (0, import_react57.useMemo)(() => {
|
|
5953
6235
|
return {
|
|
5954
6236
|
display: "grid",
|
|
5955
6237
|
gridTemplateColumns: `repeat(auto-fill, minmax(${colorSwatchSizeMap[size2]}px, 1fr))`,
|
|
@@ -5957,8 +6239,8 @@ function ColorSwatchControl(props) {
|
|
|
5957
6239
|
...style2
|
|
5958
6240
|
};
|
|
5959
6241
|
}, [size2, style2]);
|
|
5960
|
-
const content = /* @__PURE__ */
|
|
5961
|
-
const item = /* @__PURE__ */
|
|
6242
|
+
const content = /* @__PURE__ */ import_react57.default.createElement("div", { className, id, style: styles3 }, options.map((option) => {
|
|
6243
|
+
const item = /* @__PURE__ */ import_react57.default.createElement(
|
|
5962
6244
|
ColorSwatch,
|
|
5963
6245
|
{
|
|
5964
6246
|
key: option,
|
|
@@ -5971,7 +6253,7 @@ function ColorSwatchControl(props) {
|
|
|
5971
6253
|
checked: value === option
|
|
5972
6254
|
}
|
|
5973
6255
|
);
|
|
5974
|
-
return /* @__PURE__ */
|
|
6256
|
+
return /* @__PURE__ */ import_react57.default.createElement(
|
|
5975
6257
|
ToggleGroupPrimitive.Item,
|
|
5976
6258
|
{
|
|
5977
6259
|
asChild: true,
|
|
@@ -5982,7 +6264,7 @@ function ColorSwatchControl(props) {
|
|
|
5982
6264
|
item
|
|
5983
6265
|
);
|
|
5984
6266
|
}));
|
|
5985
|
-
return /* @__PURE__ */
|
|
6267
|
+
return /* @__PURE__ */ import_react57.default.createElement(
|
|
5986
6268
|
ToggleGroupPrimitive.Root,
|
|
5987
6269
|
{
|
|
5988
6270
|
type: "single",
|
|
@@ -5997,11 +6279,11 @@ function ColorSwatchControl(props) {
|
|
|
5997
6279
|
|
|
5998
6280
|
// src/components/Combobox.tsx
|
|
5999
6281
|
var import_noya_icons5 = require("@noya-app/noya-icons");
|
|
6000
|
-
var
|
|
6282
|
+
var import_react60 = __toESM(require("react"));
|
|
6001
6283
|
|
|
6002
6284
|
// src/utils/combobox.ts
|
|
6003
6285
|
var import_noya_utils9 = require("@noya-app/noya-utils");
|
|
6004
|
-
var
|
|
6286
|
+
var import_react58 = require("react");
|
|
6005
6287
|
|
|
6006
6288
|
// src/utils/fuzzyScorer.ts
|
|
6007
6289
|
var import_vscode_fuzzy_scorer = require("vscode-fuzzy-scorer");
|
|
@@ -6323,7 +6605,7 @@ function getNextIndex({
|
|
|
6323
6605
|
return nextIndex;
|
|
6324
6606
|
}
|
|
6325
6607
|
function useComboboxState(state) {
|
|
6326
|
-
return (0,
|
|
6608
|
+
return (0, import_react58.useSyncExternalStore)(
|
|
6327
6609
|
state.subscribe,
|
|
6328
6610
|
state.getSnapshot,
|
|
6329
6611
|
state.getSnapshot
|
|
@@ -6332,7 +6614,7 @@ function useComboboxState(state) {
|
|
|
6332
6614
|
|
|
6333
6615
|
// src/components/ComboboxMenu.tsx
|
|
6334
6616
|
var import_noya_icons4 = require("@noya-app/noya-icons");
|
|
6335
|
-
var
|
|
6617
|
+
var import_react59 = __toESM(require("react"));
|
|
6336
6618
|
var ComboboxMenu = memoGeneric(
|
|
6337
6619
|
forwardRefGeneric(function ComboboxMenu2({
|
|
6338
6620
|
items,
|
|
@@ -6344,7 +6626,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6344
6626
|
indented,
|
|
6345
6627
|
iconPosition = "right"
|
|
6346
6628
|
}, forwardedRef) {
|
|
6347
|
-
return /* @__PURE__ */
|
|
6629
|
+
return /* @__PURE__ */ import_react59.default.createElement(
|
|
6348
6630
|
ListView.Root,
|
|
6349
6631
|
{
|
|
6350
6632
|
ref: forwardedRef,
|
|
@@ -6360,7 +6642,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6360
6642
|
style: style2,
|
|
6361
6643
|
renderItem: (item, i) => {
|
|
6362
6644
|
if (item.type === "sectionHeader") {
|
|
6363
|
-
return /* @__PURE__ */
|
|
6645
|
+
return /* @__PURE__ */ import_react59.default.createElement(ListView.Row, { key: item.id, isSectionHeader: true }, indented && /* @__PURE__ */ import_react59.default.createElement(
|
|
6364
6646
|
Spacer.Horizontal,
|
|
6365
6647
|
{
|
|
6366
6648
|
size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET + CHECKBOX_INDENT_WIDTH
|
|
@@ -6371,7 +6653,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6371
6653
|
item: typeof item.title === "string" ? item.title : item.value,
|
|
6372
6654
|
itemScore: item
|
|
6373
6655
|
});
|
|
6374
|
-
return /* @__PURE__ */
|
|
6656
|
+
return /* @__PURE__ */ import_react59.default.createElement(
|
|
6375
6657
|
ListView.Row,
|
|
6376
6658
|
{
|
|
6377
6659
|
key: item.value,
|
|
@@ -6384,12 +6666,12 @@ var ComboboxMenu = memoGeneric(
|
|
|
6384
6666
|
}
|
|
6385
6667
|
}
|
|
6386
6668
|
},
|
|
6387
|
-
/* @__PURE__ */
|
|
6669
|
+
/* @__PURE__ */ import_react59.default.createElement("div", { className: "flex flex-1 min-w-0 items-center" }, indented && /* @__PURE__ */ import_react59.default.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }), item.checked ? /* @__PURE__ */ import_react59.default.createElement("div", { ...styles.itemIndicator }, /* @__PURE__ */ import_react59.default.createElement(import_noya_icons4.CheckIcon, null)) : indented ? /* @__PURE__ */ import_react59.default.createElement(
|
|
6388
6670
|
Spacer.Horizontal,
|
|
6389
6671
|
{
|
|
6390
6672
|
size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET
|
|
6391
6673
|
}
|
|
6392
|
-
) : null, iconPosition === "left" && item.icon && /* @__PURE__ */
|
|
6674
|
+
) : null, iconPosition === "left" && item.icon && /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, renderIcon(item.icon), /* @__PURE__ */ import_react59.default.createElement(Spacer.Horizontal, { size: 8 })), tokens.map((token, j) => /* @__PURE__ */ import_react59.default.createElement(
|
|
6393
6675
|
"span",
|
|
6394
6676
|
{
|
|
6395
6677
|
key: `${item.value}-token-${j}`,
|
|
@@ -6400,7 +6682,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6400
6682
|
},
|
|
6401
6683
|
token.text
|
|
6402
6684
|
))),
|
|
6403
|
-
(item.shortcut || item.icon && iconPosition === "right") && /* @__PURE__ */
|
|
6685
|
+
(item.shortcut || item.icon && iconPosition === "right") && /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, item.shortcut ? /* @__PURE__ */ import_react59.default.createElement(KeyboardShortcut, { shortcut: item.shortcut }) : item.icon && renderIcon(item.icon))
|
|
6404
6686
|
);
|
|
6405
6687
|
}
|
|
6406
6688
|
}
|
|
@@ -6427,7 +6709,7 @@ var Combobox = memoGeneric(
|
|
|
6427
6709
|
onDeleteWhenEmpty,
|
|
6428
6710
|
...rest
|
|
6429
6711
|
}, forwardedRef) {
|
|
6430
|
-
const props = (0,
|
|
6712
|
+
const props = (0, import_react60.useMemo)(() => {
|
|
6431
6713
|
if (rest.mode === "string") {
|
|
6432
6714
|
return {
|
|
6433
6715
|
mode: rest.mode,
|
|
@@ -6457,7 +6739,7 @@ var Combobox = memoGeneric(
|
|
|
6457
6739
|
rest.onBlur,
|
|
6458
6740
|
rest.allowArbitraryValues
|
|
6459
6741
|
]);
|
|
6460
|
-
const ref = (0,
|
|
6742
|
+
const ref = (0, import_react60.useRef)(null);
|
|
6461
6743
|
function getInitialValueString() {
|
|
6462
6744
|
if (props.mode === "string") {
|
|
6463
6745
|
return props.value ?? "";
|
|
@@ -6466,7 +6748,7 @@ var Combobox = memoGeneric(
|
|
|
6466
6748
|
}
|
|
6467
6749
|
}
|
|
6468
6750
|
const initialValueString = getInitialValueString();
|
|
6469
|
-
const [comboboxState] = (0,
|
|
6751
|
+
const [comboboxState] = (0, import_react60.useState)(
|
|
6470
6752
|
() => new ComboboxState(
|
|
6471
6753
|
items,
|
|
6472
6754
|
initialValueString,
|
|
@@ -6474,26 +6756,26 @@ var Combobox = memoGeneric(
|
|
|
6474
6756
|
)
|
|
6475
6757
|
);
|
|
6476
6758
|
const state = useComboboxState(comboboxState);
|
|
6477
|
-
const [isFocused, setIsFocused] = (0,
|
|
6478
|
-
const listRef = (0,
|
|
6479
|
-
const [shouldBlur, setShouldBlur] = (0,
|
|
6759
|
+
const [isFocused, setIsFocused] = (0, import_react60.useState)(false);
|
|
6760
|
+
const listRef = (0, import_react60.useRef)(null);
|
|
6761
|
+
const [shouldBlur, setShouldBlur] = (0, import_react60.useState)(false);
|
|
6480
6762
|
const { fieldId: id } = useLabel({
|
|
6481
6763
|
fieldId: rest.id
|
|
6482
6764
|
});
|
|
6483
|
-
(0,
|
|
6765
|
+
(0, import_react60.useEffect)(() => {
|
|
6484
6766
|
comboboxState.setItems(items);
|
|
6485
6767
|
}, [items, comboboxState]);
|
|
6486
|
-
(0,
|
|
6768
|
+
(0, import_react60.useEffect)(() => {
|
|
6487
6769
|
comboboxState.setFilter(initialValueString);
|
|
6488
6770
|
}, [comboboxState, initialValueString]);
|
|
6489
6771
|
const { filter, selectedIndex, filteredItems } = state;
|
|
6490
6772
|
const shouldShowMenu = isFocused && !(hideMenuWhenEmptyValue && filter === "");
|
|
6491
|
-
(0,
|
|
6773
|
+
(0, import_react60.useEffect)(() => {
|
|
6492
6774
|
if (listRef.current) {
|
|
6493
6775
|
listRef.current.scrollToIndex(selectedIndex);
|
|
6494
6776
|
}
|
|
6495
6777
|
}, [selectedIndex]);
|
|
6496
|
-
const handleBlur = (0,
|
|
6778
|
+
const handleBlur = (0, import_react60.useCallback)(() => {
|
|
6497
6779
|
ref.current?.blur();
|
|
6498
6780
|
comboboxState.reset(initialValueString);
|
|
6499
6781
|
if (props.mode === "string") {
|
|
@@ -6512,7 +6794,7 @@ var Combobox = memoGeneric(
|
|
|
6512
6794
|
}
|
|
6513
6795
|
setIsFocused(false);
|
|
6514
6796
|
}, [filter, initialValueString, props, state, comboboxState]);
|
|
6515
|
-
const handleFocus = (0,
|
|
6797
|
+
const handleFocus = (0, import_react60.useCallback)(
|
|
6516
6798
|
(event) => {
|
|
6517
6799
|
setIsFocused(true);
|
|
6518
6800
|
comboboxState.reset(
|
|
@@ -6526,7 +6808,7 @@ var Combobox = memoGeneric(
|
|
|
6526
6808
|
},
|
|
6527
6809
|
[initialValueString, onFocus, openMenuBehavior, comboboxState]
|
|
6528
6810
|
);
|
|
6529
|
-
const handleUpdateSelection = (0,
|
|
6811
|
+
const handleUpdateSelection = (0, import_react60.useCallback)(
|
|
6530
6812
|
(item) => {
|
|
6531
6813
|
if (item.type !== void 0) return;
|
|
6532
6814
|
const selectedItem = comboboxState.selectCurrentItem(item);
|
|
@@ -6542,7 +6824,7 @@ var Combobox = memoGeneric(
|
|
|
6542
6824
|
},
|
|
6543
6825
|
[props, comboboxState]
|
|
6544
6826
|
);
|
|
6545
|
-
const handleIndexChange = (0,
|
|
6827
|
+
const handleIndexChange = (0, import_react60.useCallback)(
|
|
6546
6828
|
(index) => {
|
|
6547
6829
|
comboboxState.setSelectedIndex(index);
|
|
6548
6830
|
const item = comboboxState.getSelectedItem();
|
|
@@ -6558,7 +6840,7 @@ var Combobox = memoGeneric(
|
|
|
6558
6840
|
},
|
|
6559
6841
|
[props, comboboxState]
|
|
6560
6842
|
);
|
|
6561
|
-
const handleChange = (0,
|
|
6843
|
+
const handleChange = (0, import_react60.useCallback)(
|
|
6562
6844
|
(value) => {
|
|
6563
6845
|
if (readOnly) return;
|
|
6564
6846
|
comboboxState.setFilter(value);
|
|
@@ -6573,7 +6855,7 @@ var Combobox = memoGeneric(
|
|
|
6573
6855
|
},
|
|
6574
6856
|
[readOnly, props, comboboxState]
|
|
6575
6857
|
);
|
|
6576
|
-
const handleKeyDown = (0,
|
|
6858
|
+
const handleKeyDown = (0, import_react60.useCallback)(
|
|
6577
6859
|
(event) => {
|
|
6578
6860
|
let handled = false;
|
|
6579
6861
|
const item = comboboxState.getSelectedItem();
|
|
@@ -6662,7 +6944,7 @@ var Combobox = memoGeneric(
|
|
|
6662
6944
|
]
|
|
6663
6945
|
);
|
|
6664
6946
|
const typeaheadValue = comboboxState.getTypeaheadValue();
|
|
6665
|
-
(0,
|
|
6947
|
+
(0, import_react60.useImperativeHandle)(forwardedRef, () => ({
|
|
6666
6948
|
focus: () => {
|
|
6667
6949
|
ref.current?.focus();
|
|
6668
6950
|
if (ref.current) {
|
|
@@ -6681,7 +6963,7 @@ var Combobox = memoGeneric(
|
|
|
6681
6963
|
ref.current?.setSelectionRange(0, ref.current.value.length);
|
|
6682
6964
|
}
|
|
6683
6965
|
}));
|
|
6684
|
-
const handleChevronClick = (0,
|
|
6966
|
+
const handleChevronClick = (0, import_react60.useCallback)(
|
|
6685
6967
|
(event) => {
|
|
6686
6968
|
event.stopPropagation();
|
|
6687
6969
|
if (shouldShowMenu) {
|
|
@@ -6701,14 +6983,14 @@ var Combobox = memoGeneric(
|
|
|
6701
6983
|
comboboxState
|
|
6702
6984
|
]
|
|
6703
6985
|
);
|
|
6704
|
-
(0,
|
|
6986
|
+
(0, import_react60.useEffect)(() => {
|
|
6705
6987
|
if (!shouldBlur) return;
|
|
6706
6988
|
if (document.activeElement !== ref.current) return;
|
|
6707
6989
|
setShouldBlur(false);
|
|
6708
6990
|
ref.current?.focus();
|
|
6709
6991
|
handleBlur();
|
|
6710
6992
|
}, [shouldBlur, handleBlur]);
|
|
6711
|
-
const { sectionHeaderCount, menuItemsCount } = (0,
|
|
6993
|
+
const { sectionHeaderCount, menuItemsCount } = (0, import_react60.useMemo)(
|
|
6712
6994
|
() => ({
|
|
6713
6995
|
sectionHeaderCount: filteredItems.filter(
|
|
6714
6996
|
(item) => isMenuItemSectionHeader(item)
|
|
@@ -6722,19 +7004,19 @@ var Combobox = memoGeneric(
|
|
|
6722
7004
|
const hasCheckedItems = items.some(
|
|
6723
7005
|
(item) => isSelectableMenuItem(item) && item.checked
|
|
6724
7006
|
);
|
|
6725
|
-
return /* @__PURE__ */
|
|
7007
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
6726
7008
|
InputField2.Root,
|
|
6727
7009
|
{
|
|
6728
7010
|
id,
|
|
6729
7011
|
size: size2,
|
|
6730
7012
|
sideOffset: 6,
|
|
6731
|
-
end: /* @__PURE__ */
|
|
7013
|
+
end: /* @__PURE__ */ import_react60.default.createElement(import_react60.default.Fragment, null, loading && /* @__PURE__ */ import_react60.default.createElement("div", { className: "pr-1.5" }, /* @__PURE__ */ import_react60.default.createElement(ActivityIndicator, null)), !readOnly && /* @__PURE__ */ import_react60.default.createElement(
|
|
6732
7014
|
InputField2.Button,
|
|
6733
7015
|
{
|
|
6734
7016
|
variant: "floating",
|
|
6735
7017
|
onClick: handleChevronClick
|
|
6736
7018
|
},
|
|
6737
|
-
/* @__PURE__ */
|
|
7019
|
+
/* @__PURE__ */ import_react60.default.createElement(
|
|
6738
7020
|
import_noya_icons5.DropdownChevronIcon,
|
|
6739
7021
|
{
|
|
6740
7022
|
className: cx(
|
|
@@ -6753,7 +7035,7 @@ var Combobox = memoGeneric(
|
|
|
6753
7035
|
ListView.rowHeight * 10.5
|
|
6754
7036
|
);
|
|
6755
7037
|
const listSize = { width, height };
|
|
6756
|
-
return /* @__PURE__ */
|
|
7038
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
6757
7039
|
"div",
|
|
6758
7040
|
{
|
|
6759
7041
|
className: cx(
|
|
@@ -6761,7 +7043,7 @@ var Combobox = memoGeneric(
|
|
|
6761
7043
|
shouldShowMenu && !readOnly ? "flex" : "hidden"
|
|
6762
7044
|
)
|
|
6763
7045
|
},
|
|
6764
|
-
filteredItems.length > 0 && !loading ? /* @__PURE__ */
|
|
7046
|
+
filteredItems.length > 0 && !loading ? /* @__PURE__ */ import_react60.default.createElement(
|
|
6765
7047
|
ComboboxMenu,
|
|
6766
7048
|
{
|
|
6767
7049
|
ref: listRef,
|
|
@@ -6775,11 +7057,11 @@ var Combobox = memoGeneric(
|
|
|
6775
7057
|
},
|
|
6776
7058
|
indented: hasCheckedItems
|
|
6777
7059
|
}
|
|
6778
|
-
) : /* @__PURE__ */
|
|
7060
|
+
) : /* @__PURE__ */ import_react60.default.createElement("div", { className: "flex flex-col h-[50px] p-5 items-center justify-center" }, /* @__PURE__ */ import_react60.default.createElement(Small, { className: "text-text-disabled" }, loading ? "Loading..." : "No results"))
|
|
6779
7061
|
);
|
|
6780
7062
|
}
|
|
6781
7063
|
},
|
|
6782
|
-
/* @__PURE__ */
|
|
7064
|
+
/* @__PURE__ */ import_react60.default.createElement(
|
|
6783
7065
|
InputField2.Input,
|
|
6784
7066
|
{
|
|
6785
7067
|
ref,
|
|
@@ -6804,7 +7086,7 @@ var Combobox = memoGeneric(
|
|
|
6804
7086
|
...readOnly ? { readOnly: true } : {}
|
|
6805
7087
|
}
|
|
6806
7088
|
),
|
|
6807
|
-
filter && typeaheadValue && typeaheadValue.toLowerCase().startsWith(filter.toLowerCase()) && /* @__PURE__ */
|
|
7089
|
+
filter && typeaheadValue && typeaheadValue.toLowerCase().startsWith(filter.toLowerCase()) && /* @__PURE__ */ import_react60.default.createElement(
|
|
6808
7090
|
InputField2.Typeahead,
|
|
6809
7091
|
{
|
|
6810
7092
|
value: typeaheadValue,
|
|
@@ -6818,22 +7100,22 @@ var Combobox = memoGeneric(
|
|
|
6818
7100
|
);
|
|
6819
7101
|
|
|
6820
7102
|
// src/components/CommandPalette.tsx
|
|
6821
|
-
var
|
|
7103
|
+
var import_react63 = __toESM(require("react"));
|
|
6822
7104
|
|
|
6823
7105
|
// src/components/SearchCompletionMenu.tsx
|
|
6824
7106
|
var import_noya_keymap5 = require("@noya-app/noya-keymap");
|
|
6825
|
-
var
|
|
7107
|
+
var import_react62 = __toESM(require("react"));
|
|
6826
7108
|
|
|
6827
7109
|
// src/components/Divider.tsx
|
|
6828
|
-
var
|
|
6829
|
-
var Divider = (0,
|
|
7110
|
+
var import_react61 = __toESM(require("react"));
|
|
7111
|
+
var Divider = (0, import_react61.memo)(function Divider2({
|
|
6830
7112
|
variant = "normal",
|
|
6831
7113
|
overflow = 0,
|
|
6832
7114
|
className,
|
|
6833
7115
|
style: style2,
|
|
6834
7116
|
...props
|
|
6835
7117
|
}) {
|
|
6836
|
-
return /* @__PURE__ */
|
|
7118
|
+
return /* @__PURE__ */ import_react61.default.createElement(
|
|
6837
7119
|
"div",
|
|
6838
7120
|
{
|
|
6839
7121
|
className: cx(
|
|
@@ -6853,14 +7135,14 @@ var Divider = (0, import_react60.memo)(function Divider2({
|
|
|
6853
7135
|
}
|
|
6854
7136
|
);
|
|
6855
7137
|
});
|
|
6856
|
-
var DividerVertical = (0,
|
|
7138
|
+
var DividerVertical = (0, import_react61.memo)(function DividerVertical2({
|
|
6857
7139
|
variant = "normal",
|
|
6858
7140
|
overflow = 0,
|
|
6859
7141
|
className,
|
|
6860
7142
|
style: style2,
|
|
6861
7143
|
...props
|
|
6862
7144
|
}) {
|
|
6863
|
-
return /* @__PURE__ */
|
|
7145
|
+
return /* @__PURE__ */ import_react61.default.createElement(
|
|
6864
7146
|
"div",
|
|
6865
7147
|
{
|
|
6866
7148
|
className: cx(`
|
|
@@ -6880,7 +7162,7 @@ var DividerVertical = (0, import_react60.memo)(function DividerVertical2({
|
|
|
6880
7162
|
});
|
|
6881
7163
|
|
|
6882
7164
|
// src/components/SearchCompletionMenu.tsx
|
|
6883
|
-
var SearchCompletionMenu = (0,
|
|
7165
|
+
var SearchCompletionMenu = (0, import_react62.forwardRef)(function SearchCompletionMenu2({
|
|
6884
7166
|
onSelect,
|
|
6885
7167
|
onHover,
|
|
6886
7168
|
onClose,
|
|
@@ -6889,17 +7171,17 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6889
7171
|
testSelectedIndex,
|
|
6890
7172
|
testSearch
|
|
6891
7173
|
}, forwardedRef) {
|
|
6892
|
-
const [state, setState] = (0,
|
|
7174
|
+
const [state, setState] = (0, import_react62.useState)({
|
|
6893
7175
|
search: testSearch ?? "",
|
|
6894
7176
|
index: 0
|
|
6895
7177
|
});
|
|
6896
7178
|
const { index, search } = state;
|
|
6897
|
-
const listRef =
|
|
7179
|
+
const listRef = import_react62.default.useRef(null);
|
|
6898
7180
|
const hasCheckedItems = items.some((item) => item.checked);
|
|
6899
|
-
(0,
|
|
7181
|
+
(0, import_react62.useEffect)(() => {
|
|
6900
7182
|
listRef.current?.scrollToIndex(index);
|
|
6901
7183
|
}, [index]);
|
|
6902
|
-
const results = (0,
|
|
7184
|
+
const results = (0, import_react62.useMemo)(
|
|
6903
7185
|
() => fuzzyFilter({
|
|
6904
7186
|
items: items.map(
|
|
6905
7187
|
(item) => typeof item.title === "string" ? item.title : item.value
|
|
@@ -6911,13 +7193,13 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6911
7193
|
})),
|
|
6912
7194
|
[items, search]
|
|
6913
7195
|
);
|
|
6914
|
-
const setSearch = (0,
|
|
7196
|
+
const setSearch = (0, import_react62.useCallback)((search2) => {
|
|
6915
7197
|
setState((state2) => ({ ...state2, search: search2, index: 0 }));
|
|
6916
7198
|
}, []);
|
|
6917
|
-
const setIndex = (0,
|
|
7199
|
+
const setIndex = (0, import_react62.useCallback)((index2) => {
|
|
6918
7200
|
setState((state2) => ({ ...state2, index: index2 }));
|
|
6919
7201
|
}, []);
|
|
6920
|
-
(0,
|
|
7202
|
+
(0, import_react62.useEffect)(() => {
|
|
6921
7203
|
onHover?.(results[index]);
|
|
6922
7204
|
}, [index, onHover, results]);
|
|
6923
7205
|
const searchHeight = 31;
|
|
@@ -6932,14 +7214,14 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6932
7214
|
width: listSize.width,
|
|
6933
7215
|
height: searchHeight + listSize.height
|
|
6934
7216
|
};
|
|
6935
|
-
const selectAndClose = (0,
|
|
7217
|
+
const selectAndClose = (0, import_react62.useCallback)(
|
|
6936
7218
|
(item) => {
|
|
6937
7219
|
onSelect(item);
|
|
6938
7220
|
onClose();
|
|
6939
7221
|
},
|
|
6940
7222
|
[onSelect, onClose]
|
|
6941
7223
|
);
|
|
6942
|
-
const handleKeyDown = (0,
|
|
7224
|
+
const handleKeyDown = (0, import_react62.useCallback)(
|
|
6943
7225
|
(event) => {
|
|
6944
7226
|
(0, import_noya_keymap5.handleKeyboardEvent)(event.nativeEvent, (0, import_noya_keymap5.getCurrentPlatform)(navigator), {
|
|
6945
7227
|
ArrowUp: () => {
|
|
@@ -6967,13 +7249,13 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6967
7249
|
},
|
|
6968
7250
|
[index, onClose, selectAndClose, results, setIndex]
|
|
6969
7251
|
);
|
|
6970
|
-
const inputRef = (0,
|
|
6971
|
-
(0,
|
|
7252
|
+
const inputRef = (0, import_react62.useRef)(null);
|
|
7253
|
+
(0, import_react62.useImperativeHandle)(forwardedRef, () => ({
|
|
6972
7254
|
focus: () => {
|
|
6973
7255
|
inputRef.current?.focus();
|
|
6974
7256
|
}
|
|
6975
7257
|
}));
|
|
6976
|
-
return /* @__PURE__ */
|
|
7258
|
+
return /* @__PURE__ */ import_react62.default.createElement("div", { ...elementSize, className: "flex flex-col overflow-hidden" }, /* @__PURE__ */ import_react62.default.createElement(InputField2.Root, { className: "flex flex-0" }, /* @__PURE__ */ import_react62.default.createElement(
|
|
6977
7259
|
InputField2.Input,
|
|
6978
7260
|
{
|
|
6979
7261
|
ref: inputRef,
|
|
@@ -6993,7 +7275,7 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6993
7275
|
onChange: setSearch,
|
|
6994
7276
|
onKeyDown: handleKeyDown
|
|
6995
7277
|
}
|
|
6996
|
-
)), /* @__PURE__ */
|
|
7278
|
+
)), /* @__PURE__ */ import_react62.default.createElement(Divider, null), results.length > 0 ? /* @__PURE__ */ import_react62.default.createElement(
|
|
6997
7279
|
ComboboxMenu,
|
|
6998
7280
|
{
|
|
6999
7281
|
ref: listRef,
|
|
@@ -7008,29 +7290,29 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
7008
7290
|
onHoverIndex: setIndex,
|
|
7009
7291
|
indented: hasCheckedItems
|
|
7010
7292
|
}
|
|
7011
|
-
) : /* @__PURE__ */
|
|
7293
|
+
) : /* @__PURE__ */ import_react62.default.createElement(
|
|
7012
7294
|
"div",
|
|
7013
7295
|
{
|
|
7014
7296
|
...listSize,
|
|
7015
7297
|
className: "flex flex-col p-20 items-center justify-center"
|
|
7016
7298
|
},
|
|
7017
|
-
/* @__PURE__ */
|
|
7299
|
+
/* @__PURE__ */ import_react62.default.createElement(Small, { color: "textDisabled" }, "No results")
|
|
7018
7300
|
));
|
|
7019
7301
|
});
|
|
7020
7302
|
|
|
7021
7303
|
// src/components/CommandPalette.tsx
|
|
7022
|
-
var CommandPalette = (0,
|
|
7304
|
+
var CommandPalette = (0, import_react63.memo)(function CommandPalette2({
|
|
7023
7305
|
showCommandPalette,
|
|
7024
7306
|
setShowCommandPalette,
|
|
7025
7307
|
items,
|
|
7026
7308
|
onSelect,
|
|
7027
7309
|
onHover
|
|
7028
7310
|
}) {
|
|
7029
|
-
const menuRef =
|
|
7030
|
-
const handleClose =
|
|
7311
|
+
const menuRef = import_react63.default.useRef(null);
|
|
7312
|
+
const handleClose = import_react63.default.useCallback(() => {
|
|
7031
7313
|
setShowCommandPalette(false);
|
|
7032
7314
|
}, [setShowCommandPalette]);
|
|
7033
|
-
return /* @__PURE__ */
|
|
7315
|
+
return /* @__PURE__ */ import_react63.default.createElement(
|
|
7034
7316
|
Dialog,
|
|
7035
7317
|
{
|
|
7036
7318
|
style: {
|
|
@@ -7056,7 +7338,7 @@ var CommandPalette = (0, import_react62.memo)(function CommandPalette2({
|
|
|
7056
7338
|
}, 0);
|
|
7057
7339
|
}
|
|
7058
7340
|
},
|
|
7059
|
-
/* @__PURE__ */
|
|
7341
|
+
/* @__PURE__ */ import_react63.default.createElement("div", { className: "flex flex-col flex-1" }, /* @__PURE__ */ import_react63.default.createElement(AutoSizer, null, (size2) => /* @__PURE__ */ import_react63.default.createElement(
|
|
7060
7342
|
SearchCompletionMenu,
|
|
7061
7343
|
{
|
|
7062
7344
|
ref: menuRef,
|
|
@@ -7071,21 +7353,21 @@ var CommandPalette = (0, import_react62.memo)(function CommandPalette2({
|
|
|
7071
7353
|
});
|
|
7072
7354
|
|
|
7073
7355
|
// src/components/connected-users-menu/ConnectedUsersMenuLayout.tsx
|
|
7074
|
-
var
|
|
7075
|
-
var UserAvatar = ({ userId, name, image }) => /* @__PURE__ */
|
|
7356
|
+
var import_react64 = __toESM(require("react"));
|
|
7357
|
+
var UserAvatar = ({ userId, name, image }) => /* @__PURE__ */ import_react64.default.createElement(
|
|
7076
7358
|
Tooltip,
|
|
7077
7359
|
{
|
|
7078
7360
|
key: userId,
|
|
7079
|
-
content: /* @__PURE__ */
|
|
7361
|
+
content: /* @__PURE__ */ import_react64.default.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ import_react64.default.createElement(Small, null, name))
|
|
7080
7362
|
},
|
|
7081
|
-
/* @__PURE__ */
|
|
7363
|
+
/* @__PURE__ */ import_react64.default.createElement(Avatar, { size: INPUT_HEIGHT, userId, name, image })
|
|
7082
7364
|
);
|
|
7083
7365
|
var ConnectedUsersMenuLayout = ({
|
|
7084
7366
|
renderUsers,
|
|
7085
7367
|
launchAIAssistant,
|
|
7086
7368
|
isAssistantOpen
|
|
7087
7369
|
}) => {
|
|
7088
|
-
return /* @__PURE__ */
|
|
7370
|
+
return /* @__PURE__ */ import_react64.default.createElement("div", { className: "flex gap-1.5" }, /* @__PURE__ */ import_react64.default.createElement(AvatarStack, { size: INPUT_HEIGHT, className: "mr-1" }, renderUsers()), launchAIAssistant && /* @__PURE__ */ import_react64.default.createElement(Tooltip, { content: "AI Assistant" }, /* @__PURE__ */ import_react64.default.createElement(
|
|
7089
7371
|
Button_default,
|
|
7090
7372
|
{
|
|
7091
7373
|
active: isAssistantOpen,
|
|
@@ -7098,7 +7380,7 @@ var ConnectedUsersMenuLayout = ({
|
|
|
7098
7380
|
|
|
7099
7381
|
// src/components/DraggableMenuButton.tsx
|
|
7100
7382
|
var import_noya_icons6 = require("@noya-app/noya-icons");
|
|
7101
|
-
var
|
|
7383
|
+
var import_react65 = __toESM(require("react"));
|
|
7102
7384
|
var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
7103
7385
|
items,
|
|
7104
7386
|
onSelect,
|
|
@@ -7107,9 +7389,9 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7107
7389
|
className,
|
|
7108
7390
|
style: style2
|
|
7109
7391
|
}) {
|
|
7110
|
-
const [open, setOpen] = (0,
|
|
7111
|
-
const [downPosition, setDownPosition] = (0,
|
|
7112
|
-
const handlePointerDownCapture = (0,
|
|
7392
|
+
const [open, setOpen] = (0, import_react65.useState)(false);
|
|
7393
|
+
const [downPosition, setDownPosition] = (0, import_react65.useState)(null);
|
|
7394
|
+
const handlePointerDownCapture = (0, import_react65.useCallback)(
|
|
7113
7395
|
(event) => {
|
|
7114
7396
|
if (open) {
|
|
7115
7397
|
setDownPosition(null);
|
|
@@ -7122,7 +7404,7 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7122
7404
|
},
|
|
7123
7405
|
[open]
|
|
7124
7406
|
);
|
|
7125
|
-
const handlePointerUp = (0,
|
|
7407
|
+
const handlePointerUp = (0, import_react65.useCallback)(
|
|
7126
7408
|
(event) => {
|
|
7127
7409
|
if (open || !downPosition) {
|
|
7128
7410
|
setDownPosition(null);
|
|
@@ -7138,13 +7420,13 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7138
7420
|
},
|
|
7139
7421
|
[downPosition, open]
|
|
7140
7422
|
);
|
|
7141
|
-
const handleOpenChange = (0,
|
|
7423
|
+
const handleOpenChange = (0, import_react65.useCallback)(
|
|
7142
7424
|
(isOpen) => {
|
|
7143
7425
|
if (!isOpen) setOpen(false);
|
|
7144
7426
|
},
|
|
7145
7427
|
[setOpen]
|
|
7146
7428
|
);
|
|
7147
|
-
return /* @__PURE__ */
|
|
7429
|
+
return /* @__PURE__ */ import_react65.default.createElement(
|
|
7148
7430
|
"div",
|
|
7149
7431
|
{
|
|
7150
7432
|
className: cx(
|
|
@@ -7160,7 +7442,7 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7160
7442
|
onClick?.();
|
|
7161
7443
|
}
|
|
7162
7444
|
},
|
|
7163
|
-
items && onSelect ? /* @__PURE__ */
|
|
7445
|
+
items && onSelect ? /* @__PURE__ */ import_react65.default.createElement(
|
|
7164
7446
|
DropdownMenu,
|
|
7165
7447
|
{
|
|
7166
7448
|
open,
|
|
@@ -7169,13 +7451,13 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7169
7451
|
onSelect,
|
|
7170
7452
|
shouldBindKeyboardShortcuts: false
|
|
7171
7453
|
},
|
|
7172
|
-
/* @__PURE__ */
|
|
7454
|
+
/* @__PURE__ */ import_react65.default.createElement("div", { className: "pointer-events-none h-[15px]" }, /* @__PURE__ */ import_react65.default.createElement(
|
|
7173
7455
|
import_noya_icons6.DragHandleDots2Icon,
|
|
7174
7456
|
{
|
|
7175
7457
|
color: isVisible || open ? cssVars.colors.icon : "transparent"
|
|
7176
7458
|
}
|
|
7177
7459
|
))
|
|
7178
|
-
) : /* @__PURE__ */
|
|
7460
|
+
) : /* @__PURE__ */ import_react65.default.createElement(
|
|
7179
7461
|
import_noya_icons6.DragHandleDots2Icon,
|
|
7180
7462
|
{
|
|
7181
7463
|
color: isVisible || open ? cssVars.colors.icon : "transparent"
|
|
@@ -7186,10 +7468,10 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7186
7468
|
|
|
7187
7469
|
// src/components/Drawer.tsx
|
|
7188
7470
|
var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
|
|
7189
|
-
var
|
|
7190
|
-
var
|
|
7191
|
-
var Drawer =
|
|
7192
|
-
|
|
7471
|
+
var React61 = __toESM(require("react"));
|
|
7472
|
+
var import_react66 = require("react");
|
|
7473
|
+
var Drawer = React61.memo(
|
|
7474
|
+
React61.forwardRef(function Drawer2({
|
|
7193
7475
|
open,
|
|
7194
7476
|
onOpenChange,
|
|
7195
7477
|
trigger,
|
|
@@ -7208,7 +7490,7 @@ var Drawer = React58.memo(
|
|
|
7208
7490
|
value: open,
|
|
7209
7491
|
onChange: onOpenChange
|
|
7210
7492
|
});
|
|
7211
|
-
(0,
|
|
7493
|
+
(0, import_react66.useImperativeHandle)(forwardedRef, () => ({
|
|
7212
7494
|
expand: () => {
|
|
7213
7495
|
setInternalOpen(true);
|
|
7214
7496
|
},
|
|
@@ -7219,7 +7501,7 @@ var Drawer = React58.memo(
|
|
|
7219
7501
|
return internalOpen;
|
|
7220
7502
|
}
|
|
7221
7503
|
}));
|
|
7222
|
-
const inner = /* @__PURE__ */
|
|
7504
|
+
const inner = /* @__PURE__ */ React61.createElement(React61.Fragment, null, /* @__PURE__ */ React61.createElement(
|
|
7223
7505
|
Dialog3.Overlay,
|
|
7224
7506
|
{
|
|
7225
7507
|
className: cx(
|
|
@@ -7227,7 +7509,7 @@ var Drawer = React58.memo(
|
|
|
7227
7509
|
positioning === "absolute" ? "absolute" : "fixed"
|
|
7228
7510
|
)
|
|
7229
7511
|
}
|
|
7230
|
-
), /* @__PURE__ */
|
|
7512
|
+
), /* @__PURE__ */ React61.createElement(
|
|
7231
7513
|
Dialog3.Content,
|
|
7232
7514
|
{
|
|
7233
7515
|
id,
|
|
@@ -7239,24 +7521,24 @@ var Drawer = React58.memo(
|
|
|
7239
7521
|
className
|
|
7240
7522
|
)
|
|
7241
7523
|
},
|
|
7242
|
-
title && /* @__PURE__ */
|
|
7524
|
+
title && /* @__PURE__ */ React61.createElement(Dialog3.Title, null, title),
|
|
7243
7525
|
children
|
|
7244
7526
|
));
|
|
7245
|
-
return /* @__PURE__ */
|
|
7527
|
+
return /* @__PURE__ */ React61.createElement(
|
|
7246
7528
|
Dialog3.Root,
|
|
7247
7529
|
{
|
|
7248
7530
|
key: "dialog",
|
|
7249
7531
|
open: internalOpen,
|
|
7250
7532
|
onOpenChange: setInternalOpen
|
|
7251
7533
|
},
|
|
7252
|
-
/* @__PURE__ */
|
|
7253
|
-
portalled ? /* @__PURE__ */
|
|
7534
|
+
/* @__PURE__ */ React61.createElement(Dialog3.Trigger, { key: "trigger" }, trigger),
|
|
7535
|
+
portalled ? /* @__PURE__ */ React61.createElement(Dialog3.Portal, { container: portalContainer }, inner) : inner
|
|
7254
7536
|
);
|
|
7255
7537
|
})
|
|
7256
7538
|
);
|
|
7257
7539
|
|
|
7258
7540
|
// src/components/Fade.tsx
|
|
7259
|
-
var
|
|
7541
|
+
var import_react67 = __toESM(require("react"));
|
|
7260
7542
|
var Fade = ({
|
|
7261
7543
|
children,
|
|
7262
7544
|
direction = "right",
|
|
@@ -7278,7 +7560,7 @@ var Fade = ({
|
|
|
7278
7560
|
top: "left-0 right-0 top-0",
|
|
7279
7561
|
bottom: "left-0 right-0 bottom-0"
|
|
7280
7562
|
}[direction];
|
|
7281
|
-
return /* @__PURE__ */
|
|
7563
|
+
return /* @__PURE__ */ import_react67.default.createElement("div", { className: cx("relative", className), style: { height } }, position === "front" ? children : null, /* @__PURE__ */ import_react67.default.createElement(
|
|
7282
7564
|
"div",
|
|
7283
7565
|
{
|
|
7284
7566
|
className: cx(
|
|
@@ -7297,17 +7579,17 @@ var Fade = ({
|
|
|
7297
7579
|
};
|
|
7298
7580
|
|
|
7299
7581
|
// src/components/file-explorer/FileExplorerLayout.tsx
|
|
7300
|
-
var
|
|
7582
|
+
var import_react68 = __toESM(require("react"));
|
|
7301
7583
|
var FileExplorerLayout = ({
|
|
7302
7584
|
children,
|
|
7303
7585
|
className,
|
|
7304
7586
|
...props
|
|
7305
|
-
}) => /* @__PURE__ */
|
|
7587
|
+
}) => /* @__PURE__ */ import_react68.default.createElement(Section, { className: cx(className, "px-3 flex-1"), ...props }, children);
|
|
7306
7588
|
var FileExplorerUploadButton = ({
|
|
7307
7589
|
showUploadButton,
|
|
7308
7590
|
onUpload,
|
|
7309
7591
|
children
|
|
7310
|
-
}) => /* @__PURE__ */
|
|
7592
|
+
}) => /* @__PURE__ */ import_react68.default.createElement("div", { className: "flex items-center gap-2" }, showUploadButton && /* @__PURE__ */ import_react68.default.createElement(
|
|
7311
7593
|
IconButton,
|
|
7312
7594
|
{
|
|
7313
7595
|
iconName: "UploadIcon",
|
|
@@ -7318,14 +7600,14 @@ var FileExplorerUploadButton = ({
|
|
|
7318
7600
|
), children);
|
|
7319
7601
|
var FileExplorerCollection = forwardRefGeneric(
|
|
7320
7602
|
function FileExplorerCollection2({ ...props }, ref) {
|
|
7321
|
-
return /* @__PURE__ */
|
|
7603
|
+
return /* @__PURE__ */ import_react68.default.createElement(Collection, { ref, className: "-mx-3 flex-1", ...props });
|
|
7322
7604
|
}
|
|
7323
7605
|
);
|
|
7324
7606
|
var FileExplorerDetail = ({
|
|
7325
7607
|
selected,
|
|
7326
7608
|
size: size2,
|
|
7327
7609
|
children
|
|
7328
|
-
}) => /* @__PURE__ */
|
|
7610
|
+
}) => /* @__PURE__ */ import_react68.default.createElement(
|
|
7329
7611
|
"span",
|
|
7330
7612
|
{
|
|
7331
7613
|
className: cx(
|
|
@@ -7338,10 +7620,10 @@ var FileExplorerDetail = ({
|
|
|
7338
7620
|
var FileExplorerEmptyState = ({
|
|
7339
7621
|
label = "No files",
|
|
7340
7622
|
...props
|
|
7341
|
-
}) => /* @__PURE__ */
|
|
7623
|
+
}) => /* @__PURE__ */ import_react68.default.createElement(Banner, { label, className: "mx-3", ...props });
|
|
7342
7624
|
|
|
7343
7625
|
// src/components/FillInputField.tsx
|
|
7344
|
-
var
|
|
7626
|
+
var import_react70 = __toESM(require("react"));
|
|
7345
7627
|
|
|
7346
7628
|
// ../noya-file-format/src/types.ts
|
|
7347
7629
|
var types_exports = {};
|
|
@@ -7666,25 +7948,25 @@ var ClassValue = /* @__PURE__ */ ((ClassValue2) => {
|
|
|
7666
7948
|
})(ClassValue || {});
|
|
7667
7949
|
|
|
7668
7950
|
// src/components/FillPreviewBackground.tsx
|
|
7669
|
-
var
|
|
7951
|
+
var React65 = __toESM(require("react"));
|
|
7670
7952
|
|
|
7671
7953
|
// src/contexts/ImageDataContext.tsx
|
|
7672
|
-
var
|
|
7673
|
-
var ImageDataContext =
|
|
7954
|
+
var React64 = __toESM(require("react"));
|
|
7955
|
+
var ImageDataContext = React64.createContext(
|
|
7674
7956
|
void 0
|
|
7675
7957
|
);
|
|
7676
|
-
var ImageDataProvider =
|
|
7958
|
+
var ImageDataProvider = React64.memo(function ImageDataProvider2({
|
|
7677
7959
|
children,
|
|
7678
7960
|
getImageData
|
|
7679
7961
|
}) {
|
|
7680
|
-
const contextValue =
|
|
7962
|
+
const contextValue = React64.useMemo(
|
|
7681
7963
|
() => ({ getImageData: getImageData ?? (() => void 0) }),
|
|
7682
7964
|
[getImageData]
|
|
7683
7965
|
);
|
|
7684
|
-
return /* @__PURE__ */
|
|
7966
|
+
return /* @__PURE__ */ React64.createElement(ImageDataContext.Provider, { value: contextValue }, children);
|
|
7685
7967
|
});
|
|
7686
7968
|
function useImageData(ref) {
|
|
7687
|
-
const value =
|
|
7969
|
+
const value = React64.useContext(ImageDataContext);
|
|
7688
7970
|
if (!value) {
|
|
7689
7971
|
throw new Error("Missing ImageDataProvider");
|
|
7690
7972
|
}
|
|
@@ -7692,14 +7974,14 @@ function useImageData(ref) {
|
|
|
7692
7974
|
}
|
|
7693
7975
|
|
|
7694
7976
|
// src/hooks/useObjectURL.ts
|
|
7695
|
-
var
|
|
7977
|
+
var import_react69 = require("react");
|
|
7696
7978
|
function useObjectURL(object) {
|
|
7697
|
-
const objectURL = (0,
|
|
7979
|
+
const objectURL = (0, import_react69.useMemo)(() => {
|
|
7698
7980
|
if (object instanceof Blob) return URL.createObjectURL(object);
|
|
7699
7981
|
const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
|
|
7700
7982
|
return URL.createObjectURL(new Blob([bytes]));
|
|
7701
7983
|
}, [object]);
|
|
7702
|
-
(0,
|
|
7984
|
+
(0, import_react69.useLayoutEffect)(() => {
|
|
7703
7985
|
return () => URL.revokeObjectURL(objectURL);
|
|
7704
7986
|
}, [objectURL]);
|
|
7705
7987
|
return objectURL;
|
|
@@ -7750,10 +8032,10 @@ var dotsHorizontalSvg = (fillColor) => `
|
|
|
7750
8032
|
<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>
|
|
7751
8033
|
</svg>
|
|
7752
8034
|
`;
|
|
7753
|
-
var Background =
|
|
8035
|
+
var Background = React65.memo(function Background2({
|
|
7754
8036
|
background: background2
|
|
7755
8037
|
}) {
|
|
7756
|
-
return /* @__PURE__ */
|
|
8038
|
+
return /* @__PURE__ */ React65.createElement(
|
|
7757
8039
|
"span",
|
|
7758
8040
|
{
|
|
7759
8041
|
className: `${background2 ? `bg-[${background2}]` : "bg-input-background"} absolute inset-0`
|
|
@@ -7772,7 +8054,7 @@ function getPatternSizeAndPosition(fillType, tileScale) {
|
|
|
7772
8054
|
return "center / 100% 100%";
|
|
7773
8055
|
}
|
|
7774
8056
|
}
|
|
7775
|
-
var PatternPreviewBackground =
|
|
8057
|
+
var PatternPreviewBackground = React65.memo(
|
|
7776
8058
|
function PatternPreviewBackground2({
|
|
7777
8059
|
fillType,
|
|
7778
8060
|
tileScale,
|
|
@@ -7781,7 +8063,7 @@ var PatternPreviewBackground = React62.memo(
|
|
|
7781
8063
|
const image = useImageData(imageRef);
|
|
7782
8064
|
const url = useObjectURL(image);
|
|
7783
8065
|
const size2 = getPatternSizeAndPosition(fillType, tileScale);
|
|
7784
|
-
const background2 =
|
|
8066
|
+
const background2 = React65.useMemo(
|
|
7785
8067
|
() => [
|
|
7786
8068
|
size2,
|
|
7787
8069
|
`url(${url})`,
|
|
@@ -7789,44 +8071,44 @@ var PatternPreviewBackground = React62.memo(
|
|
|
7789
8071
|
].join(" "),
|
|
7790
8072
|
[fillType, size2, url]
|
|
7791
8073
|
);
|
|
7792
|
-
return /* @__PURE__ */
|
|
8074
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7793
8075
|
}
|
|
7794
8076
|
);
|
|
7795
|
-
var ColorPreviewBackground =
|
|
8077
|
+
var ColorPreviewBackground = React65.memo(function ColorPreviewBackground2({
|
|
7796
8078
|
color
|
|
7797
8079
|
}) {
|
|
7798
|
-
const background2 =
|
|
8080
|
+
const background2 = React65.useMemo(
|
|
7799
8081
|
() => sketchColorToRgbaString(color),
|
|
7800
8082
|
[color]
|
|
7801
8083
|
);
|
|
7802
|
-
return /* @__PURE__ */
|
|
8084
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7803
8085
|
});
|
|
7804
|
-
var GradientPreviewBackground =
|
|
8086
|
+
var GradientPreviewBackground = React65.memo(
|
|
7805
8087
|
function GradientPreviewBackground2({
|
|
7806
8088
|
gradient
|
|
7807
8089
|
}) {
|
|
7808
|
-
const background2 =
|
|
8090
|
+
const background2 = React65.useMemo(
|
|
7809
8091
|
() => getGradientBackground(gradient.stops, gradient.gradientType, 180),
|
|
7810
8092
|
[gradient.gradientType, gradient.stops]
|
|
7811
8093
|
);
|
|
7812
|
-
return /* @__PURE__ */
|
|
8094
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7813
8095
|
}
|
|
7814
8096
|
);
|
|
7815
8097
|
var background = `center url("data:image/svg+xml;utf8,${dotsHorizontalSvg(
|
|
7816
8098
|
cssVars.colors.placeholderDots
|
|
7817
8099
|
)}") no-repeat`;
|
|
7818
|
-
var FillPreviewBackground =
|
|
8100
|
+
var FillPreviewBackground = React65.memo(function FillPreviewBackground2({
|
|
7819
8101
|
value
|
|
7820
8102
|
}) {
|
|
7821
|
-
if (!value) return /* @__PURE__ */
|
|
8103
|
+
if (!value) return /* @__PURE__ */ React65.createElement(Background, { background });
|
|
7822
8104
|
switch (value._class) {
|
|
7823
8105
|
case "color":
|
|
7824
|
-
return /* @__PURE__ */
|
|
8106
|
+
return /* @__PURE__ */ React65.createElement(ColorPreviewBackground, { color: value });
|
|
7825
8107
|
case "gradient":
|
|
7826
|
-
return /* @__PURE__ */
|
|
8108
|
+
return /* @__PURE__ */ React65.createElement(GradientPreviewBackground, { gradient: value });
|
|
7827
8109
|
case "pattern":
|
|
7828
8110
|
if (!value.image) return null;
|
|
7829
|
-
return /* @__PURE__ */
|
|
8111
|
+
return /* @__PURE__ */ React65.createElement(
|
|
7830
8112
|
PatternPreviewBackground,
|
|
7831
8113
|
{
|
|
7832
8114
|
fillType: value.patternFillType,
|
|
@@ -7838,7 +8120,7 @@ var FillPreviewBackground = React62.memo(function FillPreviewBackground2({
|
|
|
7838
8120
|
});
|
|
7839
8121
|
|
|
7840
8122
|
// src/components/FillInputField.tsx
|
|
7841
|
-
var FillButton = (0,
|
|
8123
|
+
var FillButton = (0, import_react70.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react70.default.createElement(
|
|
7842
8124
|
"button",
|
|
7843
8125
|
{
|
|
7844
8126
|
ref,
|
|
@@ -7849,14 +8131,14 @@ var FillButton = (0, import_react69.forwardRef)(({ className, ...props }, ref) =
|
|
|
7849
8131
|
...props
|
|
7850
8132
|
}
|
|
7851
8133
|
));
|
|
7852
|
-
var FillInputField = (0,
|
|
7853
|
-
(0,
|
|
7854
|
-
return /* @__PURE__ */
|
|
8134
|
+
var FillInputField = (0, import_react70.memo)(
|
|
8135
|
+
(0, import_react70.forwardRef)(function FillInputField2({ id, value, ...rest }, ref) {
|
|
8136
|
+
return /* @__PURE__ */ import_react70.default.createElement(FillButton, { ref, id, ...rest }, /* @__PURE__ */ import_react70.default.createElement(FillPreviewBackground, { value }));
|
|
7855
8137
|
})
|
|
7856
8138
|
);
|
|
7857
8139
|
|
|
7858
8140
|
// src/components/FloatingWindow.tsx
|
|
7859
|
-
var
|
|
8141
|
+
var import_react71 = __toESM(require("react"));
|
|
7860
8142
|
var styles2 = {
|
|
7861
8143
|
noSelect: {
|
|
7862
8144
|
userSelect: "none",
|
|
@@ -7949,7 +8231,7 @@ function defaultRenderToolbar({
|
|
|
7949
8231
|
toolbarContent,
|
|
7950
8232
|
onClose
|
|
7951
8233
|
}) {
|
|
7952
|
-
return /* @__PURE__ */
|
|
8234
|
+
return /* @__PURE__ */ import_react71.default.createElement(import_react71.default.Fragment, null, /* @__PURE__ */ import_react71.default.createElement(Small, { className: "flex-1 font-medium text-text" }, title), toolbarContent, /* @__PURE__ */ import_react71.default.createElement(
|
|
7953
8235
|
IconButton,
|
|
7954
8236
|
{
|
|
7955
8237
|
iconName: "Cross3Icon",
|
|
@@ -7976,16 +8258,16 @@ var FloatingWindow = ({
|
|
|
7976
8258
|
toolbarContent,
|
|
7977
8259
|
renderToolbar = defaultRenderToolbar
|
|
7978
8260
|
}) => {
|
|
7979
|
-
const [position, setPosition] = (0,
|
|
7980
|
-
const [size2, setSize] = (0,
|
|
8261
|
+
const [position, setPosition] = (0, import_react71.useState)({ x: initialX, y: initialY });
|
|
8262
|
+
const [size2, setSize] = (0, import_react71.useState)({
|
|
7981
8263
|
width: initialWidth,
|
|
7982
8264
|
height: initialHeight
|
|
7983
8265
|
});
|
|
7984
|
-
const [isDragging, setIsDragging] = (0,
|
|
7985
|
-
const [isResizing, setIsResizing] = (0,
|
|
7986
|
-
const [dragOffset, setDragOffset] = (0,
|
|
7987
|
-
const [resizeDirection, setResizeDirection] = (0,
|
|
7988
|
-
const wrapperRef = (0,
|
|
8266
|
+
const [isDragging, setIsDragging] = (0, import_react71.useState)(false);
|
|
8267
|
+
const [isResizing, setIsResizing] = (0, import_react71.useState)(false);
|
|
8268
|
+
const [dragOffset, setDragOffset] = (0, import_react71.useState)({ x: 0, y: 0 });
|
|
8269
|
+
const [resizeDirection, setResizeDirection] = (0, import_react71.useState)(null);
|
|
8270
|
+
const wrapperRef = (0, import_react71.useRef)(null);
|
|
7989
8271
|
const toggleGlobalTextSelection = (disable) => {
|
|
7990
8272
|
if (disable) {
|
|
7991
8273
|
document.body.style.userSelect = "none";
|
|
@@ -7993,7 +8275,7 @@ var FloatingWindow = ({
|
|
|
7993
8275
|
document.body.style.userSelect = "";
|
|
7994
8276
|
}
|
|
7995
8277
|
};
|
|
7996
|
-
const handleMouseDown = (0,
|
|
8278
|
+
const handleMouseDown = (0, import_react71.useCallback)((e) => {
|
|
7997
8279
|
if (!wrapperRef.current) return;
|
|
7998
8280
|
const rect = wrapperRef.current.getBoundingClientRect();
|
|
7999
8281
|
setDragOffset({
|
|
@@ -8002,7 +8284,7 @@ var FloatingWindow = ({
|
|
|
8002
8284
|
});
|
|
8003
8285
|
setIsDragging(true);
|
|
8004
8286
|
}, []);
|
|
8005
|
-
const handleResizeStart = (0,
|
|
8287
|
+
const handleResizeStart = (0, import_react71.useCallback)(
|
|
8006
8288
|
(direction) => (e) => {
|
|
8007
8289
|
e.stopPropagation();
|
|
8008
8290
|
setIsResizing(true);
|
|
@@ -8011,7 +8293,7 @@ var FloatingWindow = ({
|
|
|
8011
8293
|
},
|
|
8012
8294
|
[]
|
|
8013
8295
|
);
|
|
8014
|
-
const handleMouseMove = (0,
|
|
8296
|
+
const handleMouseMove = (0, import_react71.useCallback)(
|
|
8015
8297
|
(e) => {
|
|
8016
8298
|
if (isDragging) {
|
|
8017
8299
|
setPosition({
|
|
@@ -8065,13 +8347,13 @@ var FloatingWindow = ({
|
|
|
8065
8347
|
minHeight
|
|
8066
8348
|
]
|
|
8067
8349
|
);
|
|
8068
|
-
const handleMouseUp = (0,
|
|
8350
|
+
const handleMouseUp = (0, import_react71.useCallback)((_e) => {
|
|
8069
8351
|
setIsDragging(false);
|
|
8070
8352
|
setIsResizing(false);
|
|
8071
8353
|
setResizeDirection(null);
|
|
8072
8354
|
toggleGlobalTextSelection(false);
|
|
8073
8355
|
}, []);
|
|
8074
|
-
|
|
8356
|
+
import_react71.default.useEffect(() => {
|
|
8075
8357
|
document.addEventListener("mousemove", handleMouseMove);
|
|
8076
8358
|
document.addEventListener("mouseup", handleMouseUp);
|
|
8077
8359
|
return () => {
|
|
@@ -8081,11 +8363,11 @@ var FloatingWindow = ({
|
|
|
8081
8363
|
}, [handleMouseMove, handleMouseUp]);
|
|
8082
8364
|
const floatingWindowManager = useFloatingWindowManager();
|
|
8083
8365
|
const currentFloatingWindow = useCurrentFloatingWindowInternal();
|
|
8084
|
-
const handleClose = (0,
|
|
8366
|
+
const handleClose = (0, import_react71.useCallback)(() => {
|
|
8085
8367
|
if (onClose) onClose();
|
|
8086
8368
|
floatingWindowManager.closeWindow(currentFloatingWindow.id);
|
|
8087
8369
|
}, [currentFloatingWindow.id, floatingWindowManager, onClose]);
|
|
8088
|
-
return /* @__PURE__ */
|
|
8370
|
+
return /* @__PURE__ */ import_react71.default.createElement(
|
|
8089
8371
|
"div",
|
|
8090
8372
|
{
|
|
8091
8373
|
ref: wrapperRef,
|
|
@@ -8100,7 +8382,7 @@ var FloatingWindow = ({
|
|
|
8100
8382
|
zIndex: cssVars.zIndex.menu
|
|
8101
8383
|
}
|
|
8102
8384
|
},
|
|
8103
|
-
/* @__PURE__ */
|
|
8385
|
+
/* @__PURE__ */ import_react71.default.createElement(
|
|
8104
8386
|
"div",
|
|
8105
8387
|
{
|
|
8106
8388
|
style: {
|
|
@@ -8111,9 +8393,9 @@ var FloatingWindow = ({
|
|
|
8111
8393
|
},
|
|
8112
8394
|
renderToolbar({ title, toolbarContent, onClose: handleClose })
|
|
8113
8395
|
),
|
|
8114
|
-
/* @__PURE__ */
|
|
8115
|
-
/* @__PURE__ */
|
|
8116
|
-
Object.entries(resizeHandlePositions).map(([direction, style2]) => /* @__PURE__ */
|
|
8396
|
+
/* @__PURE__ */ import_react71.default.createElement(Divider, null),
|
|
8397
|
+
/* @__PURE__ */ import_react71.default.createElement("div", { style: styles2.content }, children),
|
|
8398
|
+
Object.entries(resizeHandlePositions).map(([direction, style2]) => /* @__PURE__ */ import_react71.default.createElement(
|
|
8117
8399
|
"div",
|
|
8118
8400
|
{
|
|
8119
8401
|
key: direction,
|
|
@@ -8126,8 +8408,8 @@ var FloatingWindow = ({
|
|
|
8126
8408
|
|
|
8127
8409
|
// src/components/GradientPicker.tsx
|
|
8128
8410
|
var import_noya_colorpicker2 = require("@noya-app/noya-colorpicker");
|
|
8129
|
-
var
|
|
8130
|
-
var GradientPicker =
|
|
8411
|
+
var React68 = __toESM(require("react"));
|
|
8412
|
+
var GradientPicker = React68.memo(function GradientPicker2({
|
|
8131
8413
|
value,
|
|
8132
8414
|
selectedStop,
|
|
8133
8415
|
onChangeColor,
|
|
@@ -8136,7 +8418,7 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8136
8418
|
onDelete,
|
|
8137
8419
|
onSelectStop
|
|
8138
8420
|
}) {
|
|
8139
|
-
const colorModel =
|
|
8421
|
+
const colorModel = React68.useMemo(
|
|
8140
8422
|
() => ({
|
|
8141
8423
|
defaultColor: { r: 0, g: 0, b: 0, a: 1 },
|
|
8142
8424
|
toHsva: import_noya_colorpicker2.rgbaToHsva,
|
|
@@ -8145,30 +8427,30 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8145
8427
|
}),
|
|
8146
8428
|
[]
|
|
8147
8429
|
);
|
|
8148
|
-
const rgbaColor =
|
|
8430
|
+
const rgbaColor = React68.useMemo(
|
|
8149
8431
|
() => sketchColorToRgba(value[selectedStop].color),
|
|
8150
8432
|
[value, selectedStop]
|
|
8151
8433
|
);
|
|
8152
|
-
const handleChangeColor =
|
|
8434
|
+
const handleChangeColor = React68.useCallback(
|
|
8153
8435
|
(value2) => {
|
|
8154
8436
|
onChangeColor(rgbaToSketchColor(value2));
|
|
8155
8437
|
},
|
|
8156
8438
|
[onChangeColor]
|
|
8157
8439
|
);
|
|
8158
|
-
const handleAddGradientStop =
|
|
8440
|
+
const handleAddGradientStop = React68.useCallback(
|
|
8159
8441
|
(value2, position) => {
|
|
8160
8442
|
onAdd(rgbaToSketchColor(value2), position);
|
|
8161
8443
|
},
|
|
8162
8444
|
[onAdd]
|
|
8163
8445
|
);
|
|
8164
|
-
return /* @__PURE__ */
|
|
8446
|
+
return /* @__PURE__ */ React68.createElement(
|
|
8165
8447
|
import_noya_colorpicker2.ColorPicker,
|
|
8166
8448
|
{
|
|
8167
8449
|
onChange: handleChangeColor,
|
|
8168
8450
|
colorModel,
|
|
8169
8451
|
color: rgbaColor
|
|
8170
8452
|
},
|
|
8171
|
-
/* @__PURE__ */
|
|
8453
|
+
/* @__PURE__ */ React68.createElement(
|
|
8172
8454
|
import_noya_colorpicker2.Gradient,
|
|
8173
8455
|
{
|
|
8174
8456
|
gradients: value,
|
|
@@ -8179,19 +8461,19 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8179
8461
|
onDelete
|
|
8180
8462
|
}
|
|
8181
8463
|
),
|
|
8182
|
-
/* @__PURE__ */
|
|
8183
|
-
/* @__PURE__ */
|
|
8184
|
-
/* @__PURE__ */
|
|
8185
|
-
/* @__PURE__ */
|
|
8186
|
-
/* @__PURE__ */
|
|
8187
|
-
/* @__PURE__ */
|
|
8464
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 10 }),
|
|
8465
|
+
/* @__PURE__ */ React68.createElement(import_noya_colorpicker2.Saturation, null),
|
|
8466
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 12 }),
|
|
8467
|
+
/* @__PURE__ */ React68.createElement(import_noya_colorpicker2.Hue, null),
|
|
8468
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 5 }),
|
|
8469
|
+
/* @__PURE__ */ React68.createElement(import_noya_colorpicker2.Alpha, null)
|
|
8188
8470
|
);
|
|
8189
8471
|
});
|
|
8190
8472
|
|
|
8191
8473
|
// src/components/InspectorContainer.tsx
|
|
8192
|
-
var
|
|
8193
|
-
var InspectorContainer = (0,
|
|
8194
|
-
(0,
|
|
8474
|
+
var import_react72 = __toESM(require("react"));
|
|
8475
|
+
var InspectorContainer = (0, import_react72.memo)(
|
|
8476
|
+
(0, import_react72.forwardRef)(function InspectorContainer2({
|
|
8195
8477
|
header,
|
|
8196
8478
|
children,
|
|
8197
8479
|
fallback,
|
|
@@ -8200,7 +8482,7 @@ var InspectorContainer = (0, import_react71.memo)(
|
|
|
8200
8482
|
className,
|
|
8201
8483
|
style: style2
|
|
8202
8484
|
}, forwardedRef) {
|
|
8203
|
-
return /* @__PURE__ */
|
|
8485
|
+
return /* @__PURE__ */ import_react72.default.createElement(
|
|
8204
8486
|
"div",
|
|
8205
8487
|
{
|
|
8206
8488
|
ref: forwardedRef,
|
|
@@ -8215,32 +8497,32 @@ var InspectorContainer = (0, import_react71.memo)(
|
|
|
8215
8497
|
}
|
|
8216
8498
|
},
|
|
8217
8499
|
header,
|
|
8218
|
-
children ? /* @__PURE__ */
|
|
8500
|
+
children ? /* @__PURE__ */ import_react72.default.createElement(ScrollArea, null, /* @__PURE__ */ import_react72.default.createElement("div", { className: "flex flex-col relative" }, showDividers ? withSeparatorElements(children, /* @__PURE__ */ import_react72.default.createElement(Divider, null)) : children)) : fallback ? /* @__PURE__ */ import_react72.default.createElement("div", { className: "flex flex-col relative h-full" }, fallback) : null
|
|
8219
8501
|
);
|
|
8220
8502
|
})
|
|
8221
8503
|
);
|
|
8222
8504
|
|
|
8223
8505
|
// src/components/LabeledElementView.tsx
|
|
8224
8506
|
var kiwi = __toESM(require("kiwi.js"));
|
|
8225
|
-
var
|
|
8226
|
-
var LabeledElementView =
|
|
8507
|
+
var React70 = __toESM(require("react"));
|
|
8508
|
+
var LabeledElementView = React70.memo(function LabeledElementView2({
|
|
8227
8509
|
children,
|
|
8228
8510
|
renderLabel
|
|
8229
8511
|
}) {
|
|
8230
|
-
const elementIds =
|
|
8231
|
-
(child) =>
|
|
8512
|
+
const elementIds = React70.Children.toArray(children).flatMap(
|
|
8513
|
+
(child) => React70.isValidElement(child) && child.type === React70.Fragment ? child.props.children : [child]
|
|
8232
8514
|
).map(
|
|
8233
|
-
(child) =>
|
|
8515
|
+
(child) => React70.isValidElement(child) && "id" in child.props ? child.props.id : null
|
|
8234
8516
|
).filter((id) => !!id);
|
|
8235
8517
|
const serializedIds = elementIds.join(",");
|
|
8236
|
-
const containerRef =
|
|
8237
|
-
const refs =
|
|
8518
|
+
const containerRef = React70.useRef(null);
|
|
8519
|
+
const refs = React70.useMemo(() => {
|
|
8238
8520
|
return Object.fromEntries(
|
|
8239
|
-
serializedIds.split(",").map((id) => [id,
|
|
8521
|
+
serializedIds.split(",").map((id) => [id, React70.createRef()])
|
|
8240
8522
|
);
|
|
8241
8523
|
}, [serializedIds]);
|
|
8242
|
-
const labelElements =
|
|
8243
|
-
return serializedIds.split(",").map((id, index) => /* @__PURE__ */
|
|
8524
|
+
const labelElements = React70.useMemo(() => {
|
|
8525
|
+
return serializedIds.split(",").map((id, index) => /* @__PURE__ */ React70.createElement(
|
|
8244
8526
|
"span",
|
|
8245
8527
|
{
|
|
8246
8528
|
key: id,
|
|
@@ -8253,7 +8535,7 @@ var LabeledElementView = React67.memo(function LabeledElementView2({
|
|
|
8253
8535
|
})
|
|
8254
8536
|
));
|
|
8255
8537
|
}, [refs, serializedIds, renderLabel]);
|
|
8256
|
-
|
|
8538
|
+
React70.useLayoutEffect(() => {
|
|
8257
8539
|
if (!containerRef.current) return;
|
|
8258
8540
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
8259
8541
|
const solver = new kiwi.Solver();
|
|
@@ -8315,19 +8597,19 @@ var LabeledElementView = React67.memo(function LabeledElementView2({
|
|
|
8315
8597
|
`${Math.max(...heights)}px`
|
|
8316
8598
|
);
|
|
8317
8599
|
}, [refs, labelElements]);
|
|
8318
|
-
return /* @__PURE__ */
|
|
8600
|
+
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));
|
|
8319
8601
|
});
|
|
8320
8602
|
|
|
8321
8603
|
// src/components/LabeledField.tsx
|
|
8322
|
-
var
|
|
8604
|
+
var import_react74 = __toESM(require("react"));
|
|
8323
8605
|
|
|
8324
8606
|
// src/hooks/useIndent.ts
|
|
8325
|
-
var
|
|
8326
|
-
var IndentContext =
|
|
8607
|
+
var import_react73 = __toESM(require("react"));
|
|
8608
|
+
var IndentContext = import_react73.default.createContext({
|
|
8327
8609
|
indentLevel: 0
|
|
8328
8610
|
});
|
|
8329
8611
|
var useIndent = () => {
|
|
8330
|
-
const { indentLevel } =
|
|
8612
|
+
const { indentLevel } = import_react73.default.useContext(IndentContext);
|
|
8331
8613
|
return indentLevel;
|
|
8332
8614
|
};
|
|
8333
8615
|
|
|
@@ -8340,7 +8622,7 @@ var labeledFieldStyles = (labelPosition) => cx(
|
|
|
8340
8622
|
var labelPositionInset = {
|
|
8341
8623
|
position: "inset"
|
|
8342
8624
|
};
|
|
8343
|
-
var LabeledField = (0,
|
|
8625
|
+
var LabeledField = (0, import_react74.memo)(function LabeledField2({
|
|
8344
8626
|
children,
|
|
8345
8627
|
label,
|
|
8346
8628
|
labelPosition: labelPositionProp,
|
|
@@ -8356,15 +8638,15 @@ var LabeledField = (0, import_react73.memo)(function LabeledField2({
|
|
|
8356
8638
|
const labelWidth = labelWidthFromContext ?? minWidth;
|
|
8357
8639
|
const labelPositionFromContext = useLabelPosition();
|
|
8358
8640
|
const labelPosition = labelPositionProp ?? labelPositionFromContext ?? "start";
|
|
8359
|
-
const labeledFieldClasses = (0,
|
|
8641
|
+
const labeledFieldClasses = (0, import_react74.useMemo)(
|
|
8360
8642
|
() => labeledFieldStyles(labelPosition),
|
|
8361
8643
|
[labelPosition]
|
|
8362
8644
|
);
|
|
8363
|
-
const labelContextValue = (0,
|
|
8645
|
+
const labelContextValue = (0, import_react74.useMemo)(
|
|
8364
8646
|
() => ({ fieldId, label }),
|
|
8365
8647
|
[fieldId, label]
|
|
8366
8648
|
);
|
|
8367
|
-
const indentStyle = (0,
|
|
8649
|
+
const indentStyle = (0, import_react74.useMemo)(
|
|
8368
8650
|
() => ({
|
|
8369
8651
|
width: indentLevel * 8,
|
|
8370
8652
|
flexBasis: indentLevel * 8,
|
|
@@ -8373,20 +8655,20 @@ var LabeledField = (0, import_react73.memo)(function LabeledField2({
|
|
|
8373
8655
|
}),
|
|
8374
8656
|
[indentLevel]
|
|
8375
8657
|
);
|
|
8376
|
-
const fieldStyle = (0,
|
|
8658
|
+
const fieldStyle = (0, import_react74.useMemo)(
|
|
8377
8659
|
() => ({
|
|
8378
8660
|
minWidth: `calc(100% - ${labelWidth + indentLevel * 8 + 6}px)`
|
|
8379
8661
|
}),
|
|
8380
8662
|
[labelWidth, indentLevel]
|
|
8381
8663
|
);
|
|
8382
|
-
const labelStyle = (0,
|
|
8664
|
+
const labelStyle = (0, import_react74.useMemo)(
|
|
8383
8665
|
() => ({
|
|
8384
8666
|
minWidth: `calc(${labelWidth}px - ${indentLevel * 8}px)`,
|
|
8385
8667
|
...labelStyleProp
|
|
8386
8668
|
}),
|
|
8387
8669
|
[labelWidth, indentLevel, labelStyleProp]
|
|
8388
8670
|
);
|
|
8389
|
-
return /* @__PURE__ */
|
|
8671
|
+
return /* @__PURE__ */ import_react74.default.createElement(LabelContext.Provider, { value: labelContextValue }, labelPosition === "inset" ? /* @__PURE__ */ import_react74.default.createElement(LabelPositionContext.Provider, { value: labelPositionInset }, children) : /* @__PURE__ */ import_react74.default.createElement("div", { className: cx("flex relative flex-1", className), style: style2 }, Boolean(indentLevel) && /* @__PURE__ */ import_react74.default.createElement("div", { style: indentStyle }), /* @__PURE__ */ import_react74.default.createElement("div", { className: labeledFieldClasses }, /* @__PURE__ */ import_react74.default.createElement(
|
|
8390
8672
|
Label,
|
|
8391
8673
|
{
|
|
8392
8674
|
htmlFor: fieldId,
|
|
@@ -8395,12 +8677,12 @@ var LabeledField = (0, import_react73.memo)(function LabeledField2({
|
|
|
8395
8677
|
...props
|
|
8396
8678
|
},
|
|
8397
8679
|
label
|
|
8398
|
-
), labelPosition === "start" ? /* @__PURE__ */
|
|
8680
|
+
), labelPosition === "start" ? /* @__PURE__ */ import_react74.default.createElement("div", { className: "flex-auto flex", style: fieldStyle }, children) : children)));
|
|
8399
8681
|
});
|
|
8400
8682
|
|
|
8401
8683
|
// src/components/MediaThumbnail.tsx
|
|
8402
8684
|
var import_noya_icons7 = require("@noya-app/noya-icons");
|
|
8403
|
-
var
|
|
8685
|
+
var import_react75 = __toESM(require("react"));
|
|
8404
8686
|
|
|
8405
8687
|
// src/components/catppuccin/fileIcons.ts
|
|
8406
8688
|
var fileIcons = {
|
|
@@ -10840,7 +11122,7 @@ var getThumbnailColors = (colorScheme, selected) => {
|
|
|
10840
11122
|
};
|
|
10841
11123
|
}
|
|
10842
11124
|
};
|
|
10843
|
-
var MediaThumbnail = (0,
|
|
11125
|
+
var MediaThumbnail = (0, import_react75.memo)(function MediaThumbnail2({
|
|
10844
11126
|
contentType: contentTypeProp,
|
|
10845
11127
|
selected = false,
|
|
10846
11128
|
className,
|
|
@@ -10855,18 +11137,18 @@ var MediaThumbnail = (0, import_react74.memo)(function MediaThumbnail2({
|
|
|
10855
11137
|
selected
|
|
10856
11138
|
);
|
|
10857
11139
|
const contentType = getAssetType(contentTypeProp);
|
|
10858
|
-
const iconStyles = (0,
|
|
11140
|
+
const iconStyles = (0, import_react75.useMemo)(
|
|
10859
11141
|
() => ({
|
|
10860
11142
|
width: iconSizeMap[size2],
|
|
10861
11143
|
height: iconSizeMap[size2]
|
|
10862
11144
|
}),
|
|
10863
11145
|
[size2]
|
|
10864
11146
|
);
|
|
10865
|
-
const content = (0,
|
|
11147
|
+
const content = (0, import_react75.useMemo)(() => {
|
|
10866
11148
|
switch (contentType) {
|
|
10867
11149
|
case "image":
|
|
10868
|
-
if (!url) return /* @__PURE__ */
|
|
10869
|
-
return /* @__PURE__ */
|
|
11150
|
+
if (!url) return /* @__PURE__ */ import_react75.default.createElement(import_noya_icons7.ImageIcon, { color: iconColor, style: iconStyles });
|
|
11151
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
10870
11152
|
"img",
|
|
10871
11153
|
{
|
|
10872
11154
|
src: url,
|
|
@@ -10876,18 +11158,18 @@ var MediaThumbnail = (0, import_react74.memo)(function MediaThumbnail2({
|
|
|
10876
11158
|
}
|
|
10877
11159
|
);
|
|
10878
11160
|
case "video":
|
|
10879
|
-
return /* @__PURE__ */
|
|
11161
|
+
return /* @__PURE__ */ import_react75.default.createElement(import_noya_icons7.VideoIcon, { color: iconColor, style: iconStyles });
|
|
10880
11162
|
case "audio":
|
|
10881
|
-
return /* @__PURE__ */
|
|
11163
|
+
return /* @__PURE__ */ import_react75.default.createElement(import_noya_icons7.SpeakerLoudIcon, { color: iconColor, style: iconStyles });
|
|
10882
11164
|
default:
|
|
10883
11165
|
if (iconName) {
|
|
10884
11166
|
const Icon = Icons[iconName];
|
|
10885
|
-
return /* @__PURE__ */
|
|
11167
|
+
return /* @__PURE__ */ import_react75.default.createElement(Icon, { color: iconColor, style: iconStyles });
|
|
10886
11168
|
}
|
|
10887
11169
|
if (fileName) {
|
|
10888
11170
|
const fileIcon = findFileIcon(fileName);
|
|
10889
11171
|
if (fileIcon) {
|
|
10890
|
-
return /* @__PURE__ */
|
|
11172
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
10891
11173
|
"img",
|
|
10892
11174
|
{
|
|
10893
11175
|
src: `https://api.iconify.design/catppuccin/${fileIcon}.svg?height=none&box=1`,
|
|
@@ -10897,10 +11179,10 @@ var MediaThumbnail = (0, import_react74.memo)(function MediaThumbnail2({
|
|
|
10897
11179
|
);
|
|
10898
11180
|
}
|
|
10899
11181
|
}
|
|
10900
|
-
return /* @__PURE__ */
|
|
11182
|
+
return /* @__PURE__ */ import_react75.default.createElement(import_noya_icons7.FileIcon, { color: iconColor, style: iconStyles });
|
|
10901
11183
|
}
|
|
10902
11184
|
}, [contentType, url, iconColor, iconStyles, iconName, fileName]);
|
|
10903
|
-
return /* @__PURE__ */
|
|
11185
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
10904
11186
|
"div",
|
|
10905
11187
|
{
|
|
10906
11188
|
className: cx(
|
|
@@ -10931,18 +11213,18 @@ function findFileIcon(fileName) {
|
|
|
10931
11213
|
}
|
|
10932
11214
|
|
|
10933
11215
|
// src/components/Message.tsx
|
|
10934
|
-
var
|
|
10935
|
-
var Message = (0,
|
|
10936
|
-
(0,
|
|
11216
|
+
var import_react76 = __toESM(require("react"));
|
|
11217
|
+
var Message = (0, import_react76.memo)(
|
|
11218
|
+
(0, import_react76.forwardRef)(function Message2({ role, children, user, avatarSize = INPUT_HEIGHT }, ref) {
|
|
10937
11219
|
const randomId = crypto.randomUUID();
|
|
10938
11220
|
const userMessageBackgroundColor = colorFromString(user?.id ?? randomId);
|
|
10939
|
-
const styles3 = (0,
|
|
11221
|
+
const styles3 = (0, import_react76.useMemo)(
|
|
10940
11222
|
() => role === "user" ? {
|
|
10941
11223
|
backgroundColor: userMessageBackgroundColor
|
|
10942
11224
|
} : void 0,
|
|
10943
11225
|
[userMessageBackgroundColor, role]
|
|
10944
11226
|
);
|
|
10945
|
-
return /* @__PURE__ */
|
|
11227
|
+
return /* @__PURE__ */ import_react76.default.createElement(
|
|
10946
11228
|
"div",
|
|
10947
11229
|
{
|
|
10948
11230
|
className: cx(
|
|
@@ -10950,15 +11232,15 @@ var Message = (0, import_react75.memo)(
|
|
|
10950
11232
|
role === "user" ? "flex-row-reverse" : "flex-row"
|
|
10951
11233
|
)
|
|
10952
11234
|
},
|
|
10953
|
-
role === "assistant" ? /* @__PURE__ */
|
|
11235
|
+
role === "assistant" ? /* @__PURE__ */ import_react76.default.createElement(
|
|
10954
11236
|
Avatar,
|
|
10955
11237
|
{
|
|
10956
11238
|
name: "Assistant",
|
|
10957
11239
|
size: avatarSize,
|
|
10958
11240
|
backgroundColor: cssVars.colors.primaryPastel
|
|
10959
11241
|
},
|
|
10960
|
-
/* @__PURE__ */
|
|
10961
|
-
) : /* @__PURE__ */
|
|
11242
|
+
/* @__PURE__ */ import_react76.default.createElement(Logo, { style: { width: 15 }, fill: cssVars.colors.primary })
|
|
11243
|
+
) : /* @__PURE__ */ import_react76.default.createElement(
|
|
10962
11244
|
Avatar,
|
|
10963
11245
|
{
|
|
10964
11246
|
userId: !user ? randomId : user?.id,
|
|
@@ -10967,7 +11249,7 @@ var Message = (0, import_react75.memo)(
|
|
|
10967
11249
|
size: avatarSize
|
|
10968
11250
|
}
|
|
10969
11251
|
),
|
|
10970
|
-
/* @__PURE__ */
|
|
11252
|
+
/* @__PURE__ */ import_react76.default.createElement(
|
|
10971
11253
|
"div",
|
|
10972
11254
|
{
|
|
10973
11255
|
className: cx(
|
|
@@ -10977,7 +11259,7 @@ var Message = (0, import_react75.memo)(
|
|
|
10977
11259
|
style: styles3,
|
|
10978
11260
|
ref
|
|
10979
11261
|
},
|
|
10980
|
-
/* @__PURE__ */
|
|
11262
|
+
/* @__PURE__ */ import_react76.default.createElement(
|
|
10981
11263
|
Text,
|
|
10982
11264
|
{
|
|
10983
11265
|
variant: "small",
|
|
@@ -10992,9 +11274,9 @@ var Message = (0, import_react75.memo)(
|
|
|
10992
11274
|
|
|
10993
11275
|
// src/components/pipeline/PipelineResultLayout.tsx
|
|
10994
11276
|
var import_noya_icons8 = require("@noya-app/noya-icons");
|
|
10995
|
-
var
|
|
11277
|
+
var import_react77 = __toESM(require("react"));
|
|
10996
11278
|
var PipelineResultLink = ({ url }) => {
|
|
10997
|
-
return /* @__PURE__ */
|
|
11279
|
+
return /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex flex-col gap-0.5" }, /* @__PURE__ */ import_react77.default.createElement(
|
|
10998
11280
|
"a",
|
|
10999
11281
|
{
|
|
11000
11282
|
href: url,
|
|
@@ -11002,15 +11284,15 @@ var PipelineResultLink = ({ url }) => {
|
|
|
11002
11284
|
rel: "noopener noreferrer",
|
|
11003
11285
|
className: "flex text-primary hover:opacity-80 border border-divider rounded-md"
|
|
11004
11286
|
},
|
|
11005
|
-
/* @__PURE__ */
|
|
11006
|
-
/* @__PURE__ */
|
|
11007
|
-
/* @__PURE__ */
|
|
11287
|
+
/* @__PURE__ */ import_react77.default.createElement("div", { className: "flex gap-1 items-center p-2" }, /* @__PURE__ */ import_react77.default.createElement(import_noya_icons8.Link1Icon, { className: "w-[15px] h-[15px] flex-shrink-0" })),
|
|
11288
|
+
/* @__PURE__ */ import_react77.default.createElement(DividerVertical, null),
|
|
11289
|
+
/* @__PURE__ */ import_react77.default.createElement(Small, { className: "truncate p-2 flex-1" }, url)
|
|
11008
11290
|
));
|
|
11009
11291
|
};
|
|
11010
11292
|
var PipelineResultLayout = ({
|
|
11011
11293
|
children
|
|
11012
11294
|
}) => {
|
|
11013
|
-
return /* @__PURE__ */
|
|
11295
|
+
return /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex flex-col gap-2" }, children);
|
|
11014
11296
|
};
|
|
11015
11297
|
function getPipelineResultLink(value) {
|
|
11016
11298
|
if (typeof value !== "object" || value === null) return void 0;
|
|
@@ -11026,27 +11308,27 @@ function getPipelineResultLink(value) {
|
|
|
11026
11308
|
// src/components/Progress.tsx
|
|
11027
11309
|
var import_noya_utils10 = require("@noya-app/noya-utils");
|
|
11028
11310
|
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"));
|
|
11029
|
-
var
|
|
11311
|
+
var React76 = __toESM(require("react"));
|
|
11030
11312
|
function Progress({
|
|
11031
11313
|
value,
|
|
11032
11314
|
variant = "normal",
|
|
11033
11315
|
className
|
|
11034
11316
|
}) {
|
|
11035
11317
|
const clampedValue = (0, import_noya_utils10.clamp)(value, 0, 100);
|
|
11036
|
-
const transformStyles =
|
|
11318
|
+
const transformStyles = React76.useMemo(
|
|
11037
11319
|
() => ({
|
|
11038
11320
|
transform: `translateX(-${100 - clampedValue}%)`
|
|
11039
11321
|
}),
|
|
11040
11322
|
[clampedValue]
|
|
11041
11323
|
);
|
|
11042
|
-
return /* @__PURE__ */
|
|
11324
|
+
return /* @__PURE__ */ React76.createElement(
|
|
11043
11325
|
ProgressPrimitive.Root,
|
|
11044
11326
|
{
|
|
11045
11327
|
className: cx(`relative hidden bg-input-background h-[5px] `, className),
|
|
11046
11328
|
style: { transform: "translateZ(0)" },
|
|
11047
11329
|
value: clampedValue
|
|
11048
11330
|
},
|
|
11049
|
-
/* @__PURE__ */
|
|
11331
|
+
/* @__PURE__ */ React76.createElement(
|
|
11050
11332
|
ProgressPrimitive.Indicator,
|
|
11051
11333
|
{
|
|
11052
11334
|
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`,
|
|
@@ -11057,7 +11339,7 @@ function Progress({
|
|
|
11057
11339
|
}
|
|
11058
11340
|
|
|
11059
11341
|
// src/components/Section.tsx
|
|
11060
|
-
var
|
|
11342
|
+
var import_react78 = __toESM(require("react"));
|
|
11061
11343
|
var titleIconStyle = {
|
|
11062
11344
|
marginRight: "8px",
|
|
11063
11345
|
alignSelf: "flex-start",
|
|
@@ -11081,7 +11363,7 @@ var SectionInternal = ({
|
|
|
11081
11363
|
inlineBlockWrapper: true
|
|
11082
11364
|
}
|
|
11083
11365
|
}) => {
|
|
11084
|
-
const style2 = (0,
|
|
11366
|
+
const style2 = (0, import_react78.useMemo)(
|
|
11085
11367
|
() => ({
|
|
11086
11368
|
display: "flex",
|
|
11087
11369
|
flexDirection: "column",
|
|
@@ -11092,15 +11374,15 @@ var SectionInternal = ({
|
|
|
11092
11374
|
}),
|
|
11093
11375
|
[titleTextStyle, title, extraPadding, styleProp]
|
|
11094
11376
|
);
|
|
11095
|
-
const hasChildren =
|
|
11096
|
-
const headerStyle = (0,
|
|
11377
|
+
const hasChildren = import_react78.default.Children.toArray(children).some((child) => !!child);
|
|
11378
|
+
const headerStyle = (0, import_react78.useMemo)(
|
|
11097
11379
|
() => ({
|
|
11098
11380
|
marginBottom: hasChildren ? "4px" : void 0,
|
|
11099
11381
|
minHeight: INPUT_HEIGHT
|
|
11100
11382
|
}),
|
|
11101
11383
|
[hasChildren]
|
|
11102
11384
|
);
|
|
11103
|
-
return /* @__PURE__ */
|
|
11385
|
+
return /* @__PURE__ */ import_react78.default.createElement("div", { style: style2, className }, (title || titleIcon || right) && /* @__PURE__ */ import_react78.default.createElement(InspectorPrimitives_exports.SectionHeader, { style: headerStyle }, titleIcon && /* @__PURE__ */ import_react78.default.createElement("div", { style: titleIconStyle, className: textStyles[titleTextStyle] }, titleIconOptions.inlineBlockWrapper ? /* @__PURE__ */ import_react78.default.createElement("div", { style: titleIconWrapperStyle }, titleIcon) : titleIcon), title && /* @__PURE__ */ import_react78.default.createElement(import_react78.default.Fragment, null, onClickTitle ? /* @__PURE__ */ import_react78.default.createElement(Button, { variant: "none", onClick: onClickTitle }, /* @__PURE__ */ import_react78.default.createElement(InspectorPrimitives_exports.Title, { $textStyle: titleTextStyle }, title)) : /* @__PURE__ */ import_react78.default.createElement(InspectorPrimitives_exports.Title, { $textStyle: titleTextStyle }, title)), /* @__PURE__ */ import_react78.default.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ import_react78.default.createElement(IndentContext.Provider, { value: { indentLevel: 1 } }, children));
|
|
11104
11386
|
};
|
|
11105
11387
|
var ExpandableSection = ({
|
|
11106
11388
|
storageKey,
|
|
@@ -11113,12 +11395,12 @@ var ExpandableSection = ({
|
|
|
11113
11395
|
initialVisibility
|
|
11114
11396
|
);
|
|
11115
11397
|
const expanded = visibility === "show";
|
|
11116
|
-
return /* @__PURE__ */
|
|
11398
|
+
return /* @__PURE__ */ import_react78.default.createElement(
|
|
11117
11399
|
SectionInternal,
|
|
11118
11400
|
{
|
|
11119
11401
|
...props,
|
|
11120
11402
|
right: !props.hideRightWhenCollapsed || expanded ? props.right : null,
|
|
11121
|
-
title: /* @__PURE__ */
|
|
11403
|
+
title: /* @__PURE__ */ import_react78.default.createElement("div", { className: "flex gap-1 items-center" }, props.title, /* @__PURE__ */ import_react78.default.createElement(
|
|
11122
11404
|
IconButton,
|
|
11123
11405
|
{
|
|
11124
11406
|
iconName: expanded ? "ChevronDownIcon2" : "ChevronRightIcon2",
|
|
@@ -11129,20 +11411,20 @@ var ExpandableSection = ({
|
|
|
11129
11411
|
expanded && props.children
|
|
11130
11412
|
);
|
|
11131
11413
|
};
|
|
11132
|
-
var Section = (0,
|
|
11414
|
+
var Section = (0, import_react78.memo)(function InspectorSection({
|
|
11133
11415
|
storageKey,
|
|
11134
11416
|
...props
|
|
11135
11417
|
}) {
|
|
11136
|
-
return storageKey ? /* @__PURE__ */
|
|
11418
|
+
return storageKey ? /* @__PURE__ */ import_react78.default.createElement(ExpandableSection, { ...props, storageKey }) : /* @__PURE__ */ import_react78.default.createElement(SectionInternal, { ...props });
|
|
11137
11419
|
});
|
|
11138
11420
|
|
|
11139
11421
|
// src/components/SegmentedControl.tsx
|
|
11140
11422
|
var ToggleGroupPrimitive2 = __toESM(require("@radix-ui/react-toggle-group"));
|
|
11141
|
-
var
|
|
11142
|
-
var SegmentedControlContext = (0,
|
|
11423
|
+
var import_react79 = __toESM(require("react"));
|
|
11424
|
+
var SegmentedControlContext = (0, import_react79.createContext)({
|
|
11143
11425
|
colorScheme: "primary"
|
|
11144
11426
|
});
|
|
11145
|
-
var SegmentedControlItem = (0,
|
|
11427
|
+
var SegmentedControlItem = (0, import_react79.forwardRef)(function SegmentedControlItem2({
|
|
11146
11428
|
value,
|
|
11147
11429
|
tooltip,
|
|
11148
11430
|
title,
|
|
@@ -11152,8 +11434,8 @@ var SegmentedControlItem = (0, import_react78.forwardRef)(function SegmentedCont
|
|
|
11152
11434
|
variant = "default",
|
|
11153
11435
|
...props
|
|
11154
11436
|
}, forwardedRef) {
|
|
11155
|
-
const { colorScheme } = (0,
|
|
11156
|
-
const itemElement = /* @__PURE__ */
|
|
11437
|
+
const { colorScheme } = (0, import_react79.useContext)(SegmentedControlContext);
|
|
11438
|
+
const itemElement = /* @__PURE__ */ import_react79.default.createElement(
|
|
11157
11439
|
ToggleGroupPrimitive2.Item,
|
|
11158
11440
|
{
|
|
11159
11441
|
ref: forwardedRef,
|
|
@@ -11173,7 +11455,7 @@ var SegmentedControlItem = (0, import_react78.forwardRef)(function SegmentedCont
|
|
|
11173
11455
|
),
|
|
11174
11456
|
...props
|
|
11175
11457
|
},
|
|
11176
|
-
/* @__PURE__ */
|
|
11458
|
+
/* @__PURE__ */ import_react79.default.createElement(
|
|
11177
11459
|
"span",
|
|
11178
11460
|
{
|
|
11179
11461
|
className: cx(
|
|
@@ -11185,7 +11467,7 @@ var SegmentedControlItem = (0, import_react78.forwardRef)(function SegmentedCont
|
|
|
11185
11467
|
title
|
|
11186
11468
|
)
|
|
11187
11469
|
);
|
|
11188
|
-
return tooltip ? /* @__PURE__ */
|
|
11470
|
+
return tooltip ? /* @__PURE__ */ import_react79.default.createElement(Tooltip, { content: tooltip }, itemElement) : itemElement;
|
|
11189
11471
|
});
|
|
11190
11472
|
var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
11191
11473
|
id: idProp,
|
|
@@ -11198,16 +11480,16 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
11198
11480
|
className,
|
|
11199
11481
|
style: style2
|
|
11200
11482
|
}) {
|
|
11201
|
-
const contextValue = (0,
|
|
11483
|
+
const contextValue = (0, import_react79.useMemo)(() => ({ colorScheme }), [colorScheme]);
|
|
11202
11484
|
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
11203
|
-
const handleValueChange = (0,
|
|
11485
|
+
const handleValueChange = (0, import_react79.useCallback)(
|
|
11204
11486
|
(value2) => {
|
|
11205
11487
|
if (!allowEmpty && !value2) return;
|
|
11206
11488
|
onValueChange?.(value2);
|
|
11207
11489
|
},
|
|
11208
11490
|
[allowEmpty, onValueChange]
|
|
11209
11491
|
);
|
|
11210
|
-
return /* @__PURE__ */
|
|
11492
|
+
return /* @__PURE__ */ import_react79.default.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react79.default.createElement(
|
|
11211
11493
|
ToggleGroupPrimitive2.Root,
|
|
11212
11494
|
{
|
|
11213
11495
|
id,
|
|
@@ -11225,13 +11507,13 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
11225
11507
|
gridTemplateColumns: `repeat(${items.length}, 1fr)`
|
|
11226
11508
|
}
|
|
11227
11509
|
},
|
|
11228
|
-
items.map((item, index) => /* @__PURE__ */
|
|
11510
|
+
items.map((item, index) => /* @__PURE__ */ import_react79.default.createElement(SegmentedControlItem, { key: index, ...item, variant }))
|
|
11229
11511
|
));
|
|
11230
11512
|
});
|
|
11231
11513
|
|
|
11232
11514
|
// src/components/SelectionToolbar.tsx
|
|
11233
11515
|
var PopperPrimitive = __toESM(require("@radix-ui/react-popper"));
|
|
11234
|
-
var
|
|
11516
|
+
var import_react80 = __toESM(require("react"));
|
|
11235
11517
|
var import_react_dom3 = require("react-dom");
|
|
11236
11518
|
var createVirtualElement = (rect) => ({
|
|
11237
11519
|
getBoundingClientRect: () => ({
|
|
@@ -11246,22 +11528,22 @@ var createVirtualElement = (rect) => ({
|
|
|
11246
11528
|
toJSON: () => null
|
|
11247
11529
|
})
|
|
11248
11530
|
});
|
|
11249
|
-
var SelectionToolbarContainer = (0,
|
|
11531
|
+
var SelectionToolbarContainer = (0, import_react80.memo)(
|
|
11250
11532
|
function SelectionToolbarContainer2({
|
|
11251
11533
|
rect,
|
|
11252
11534
|
children,
|
|
11253
11535
|
portalContainer
|
|
11254
11536
|
}) {
|
|
11255
11537
|
const portalScopeId = usePortalScopeId();
|
|
11256
|
-
const containerRef =
|
|
11538
|
+
const containerRef = import_react80.default.useRef(null);
|
|
11257
11539
|
const size2 = useSize(containerRef, "width");
|
|
11258
|
-
const virtualRef = (0,
|
|
11540
|
+
const virtualRef = (0, import_react80.useMemo)(
|
|
11259
11541
|
() => ({
|
|
11260
11542
|
current: createVirtualElement(rect)
|
|
11261
11543
|
}),
|
|
11262
11544
|
[rect]
|
|
11263
11545
|
);
|
|
11264
|
-
const popperContent = /* @__PURE__ */
|
|
11546
|
+
const popperContent = /* @__PURE__ */ import_react80.default.createElement(
|
|
11265
11547
|
PopperPrimitive.Content,
|
|
11266
11548
|
{
|
|
11267
11549
|
...portalScopeProps(portalScopeId),
|
|
@@ -11278,7 +11560,7 @@ var SelectionToolbarContainer = (0, import_react79.memo)(
|
|
|
11278
11560
|
["--n-input-background"]: "transparent"
|
|
11279
11561
|
}
|
|
11280
11562
|
},
|
|
11281
|
-
/* @__PURE__ */
|
|
11563
|
+
/* @__PURE__ */ import_react80.default.createElement(
|
|
11282
11564
|
"div",
|
|
11283
11565
|
{
|
|
11284
11566
|
ref: containerRef,
|
|
@@ -11291,14 +11573,14 @@ var SelectionToolbarContainer = (0, import_react79.memo)(
|
|
|
11291
11573
|
children
|
|
11292
11574
|
)
|
|
11293
11575
|
);
|
|
11294
|
-
return /* @__PURE__ */
|
|
11576
|
+
return /* @__PURE__ */ import_react80.default.createElement(PopperPrimitive.Root, null, /* @__PURE__ */ import_react80.default.createElement(PopperPrimitive.Anchor, { virtualRef }), portalContainer ? (0, import_react_dom3.createPortal)(popperContent, portalContainer) : popperContent);
|
|
11295
11577
|
}
|
|
11296
11578
|
);
|
|
11297
11579
|
|
|
11298
11580
|
// src/components/SelectMenu.tsx
|
|
11299
11581
|
var import_noya_icons9 = require("@noya-app/noya-icons");
|
|
11300
11582
|
var Select = __toESM(require("@radix-ui/react-select"));
|
|
11301
|
-
var
|
|
11583
|
+
var import_react81 = __toESM(require("react"));
|
|
11302
11584
|
var readOnlyStyle = {
|
|
11303
11585
|
justifyContent: "flex-start",
|
|
11304
11586
|
textAlign: "left"
|
|
@@ -11329,7 +11611,7 @@ var SelectMenuTrigger = memoGeneric(function SelectMenuTrigger2({
|
|
|
11329
11611
|
fieldId: props.id
|
|
11330
11612
|
});
|
|
11331
11613
|
const labelPosition = useLabelPosition();
|
|
11332
|
-
return /* @__PURE__ */
|
|
11614
|
+
return /* @__PURE__ */ import_react81.default.createElement(Select.SelectTrigger, { asChild: true, onFocus, onBlur }, /* @__PURE__ */ import_react81.default.createElement(
|
|
11333
11615
|
Button,
|
|
11334
11616
|
{
|
|
11335
11617
|
id,
|
|
@@ -11341,10 +11623,10 @@ var SelectMenuTrigger = memoGeneric(function SelectMenuTrigger2({
|
|
|
11341
11623
|
),
|
|
11342
11624
|
disabled
|
|
11343
11625
|
},
|
|
11344
|
-
icon && /* @__PURE__ */
|
|
11345
|
-
label && labelPosition === "inset" && /* @__PURE__ */
|
|
11346
|
-
/* @__PURE__ */
|
|
11347
|
-
/* @__PURE__ */
|
|
11626
|
+
icon && /* @__PURE__ */ import_react81.default.createElement("span", { className: "pr-1.5" }, renderIcon(icon)),
|
|
11627
|
+
label && labelPosition === "inset" && /* @__PURE__ */ import_react81.default.createElement("div", { className: insetEndStyles }, /* @__PURE__ */ import_react81.default.createElement(Label, { className: "pr-4 text-text-disabled", htmlFor: id }, label)),
|
|
11628
|
+
/* @__PURE__ */ import_react81.default.createElement("span", { className: "flex-1 flex" }, /* @__PURE__ */ import_react81.default.createElement(Select.Value, { placeholder })),
|
|
11629
|
+
/* @__PURE__ */ import_react81.default.createElement(
|
|
11348
11630
|
import_noya_icons9.DropdownChevronIcon,
|
|
11349
11631
|
{
|
|
11350
11632
|
className: cx(
|
|
@@ -11381,7 +11663,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11381
11663
|
(item) => isSelectableMenuItem(item) && item.value === value
|
|
11382
11664
|
);
|
|
11383
11665
|
const icon = selectedItem?.icon;
|
|
11384
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
11666
|
+
const [internalOpen, setInternalOpen] = (0, import_react81.useState)(open);
|
|
11385
11667
|
const { label, fieldId: id } = useLabel({
|
|
11386
11668
|
label: props.label,
|
|
11387
11669
|
fieldId: props.id
|
|
@@ -11392,8 +11674,8 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11392
11674
|
}
|
|
11393
11675
|
setInternalOpen(open2);
|
|
11394
11676
|
};
|
|
11395
|
-
const readOnlyButton = (0,
|
|
11396
|
-
() => /* @__PURE__ */
|
|
11677
|
+
const readOnlyButton = (0, import_react81.useMemo)(
|
|
11678
|
+
() => /* @__PURE__ */ import_react81.default.createElement(
|
|
11397
11679
|
Button,
|
|
11398
11680
|
{
|
|
11399
11681
|
id,
|
|
@@ -11403,11 +11685,11 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11403
11685
|
disabled
|
|
11404
11686
|
},
|
|
11405
11687
|
icon && renderIcon(icon),
|
|
11406
|
-
/* @__PURE__ */
|
|
11688
|
+
/* @__PURE__ */ import_react81.default.createElement("span", { className: "flex flex-1" }, selectedItem?.title ?? value)
|
|
11407
11689
|
),
|
|
11408
11690
|
[icon, id, style2, className, disabled, value, selectedItem]
|
|
11409
11691
|
);
|
|
11410
|
-
const contentStyle = (0,
|
|
11692
|
+
const contentStyle = (0, import_react81.useMemo)(() => {
|
|
11411
11693
|
return {
|
|
11412
11694
|
width: "var(--radix-select-trigger-width)",
|
|
11413
11695
|
minWidth: "max-content",
|
|
@@ -11415,7 +11697,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11415
11697
|
...contentStyleProp
|
|
11416
11698
|
};
|
|
11417
11699
|
}, [contentStyleProp]);
|
|
11418
|
-
const content = /* @__PURE__ */
|
|
11700
|
+
const content = /* @__PURE__ */ import_react81.default.createElement(
|
|
11419
11701
|
Select.Root,
|
|
11420
11702
|
{
|
|
11421
11703
|
value,
|
|
@@ -11423,7 +11705,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11423
11705
|
open,
|
|
11424
11706
|
onOpenChange: handleOpenChange
|
|
11425
11707
|
},
|
|
11426
|
-
/* @__PURE__ */
|
|
11708
|
+
/* @__PURE__ */ import_react81.default.createElement(
|
|
11427
11709
|
SelectMenuTrigger,
|
|
11428
11710
|
{
|
|
11429
11711
|
id,
|
|
@@ -11438,7 +11720,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11438
11720
|
label
|
|
11439
11721
|
}
|
|
11440
11722
|
),
|
|
11441
|
-
/* @__PURE__ */
|
|
11723
|
+
/* @__PURE__ */ import_react81.default.createElement(Select.Portal, null, /* @__PURE__ */ import_react81.default.createElement(
|
|
11442
11724
|
Select.Content,
|
|
11443
11725
|
{
|
|
11444
11726
|
...portalScopeProps(portalScopeId),
|
|
@@ -11449,14 +11731,14 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11449
11731
|
align: "center",
|
|
11450
11732
|
style: contentStyle
|
|
11451
11733
|
},
|
|
11452
|
-
/* @__PURE__ */
|
|
11734
|
+
/* @__PURE__ */ import_react81.default.createElement(Select.ScrollUpButton, { className: scrollButtonStyles }, /* @__PURE__ */ import_react81.default.createElement(
|
|
11453
11735
|
import_noya_icons9.ChevronUpIcon,
|
|
11454
11736
|
{
|
|
11455
11737
|
className: cx("transition-transform duration-100")
|
|
11456
11738
|
}
|
|
11457
11739
|
)),
|
|
11458
|
-
/* @__PURE__ */
|
|
11459
|
-
/* @__PURE__ */
|
|
11740
|
+
/* @__PURE__ */ import_react81.default.createElement(Select.Viewport, null, /* @__PURE__ */ import_react81.default.createElement(MenuViewport, { items, Components: Components3 })),
|
|
11741
|
+
/* @__PURE__ */ import_react81.default.createElement(Select.ScrollDownButton, { className: scrollButtonStyles }, /* @__PURE__ */ import_react81.default.createElement(import_noya_icons9.ChevronDownIcon, null))
|
|
11460
11742
|
))
|
|
11461
11743
|
);
|
|
11462
11744
|
return readOnly ? readOnlyButton : content;
|
|
@@ -11464,13 +11746,13 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11464
11746
|
|
|
11465
11747
|
// src/components/Slider.tsx
|
|
11466
11748
|
var RadixSlider = __toESM(require("@radix-ui/react-slider"));
|
|
11467
|
-
var
|
|
11749
|
+
var import_react82 = __toESM(require("react"));
|
|
11468
11750
|
var THUMB_WIDTH = 8;
|
|
11469
11751
|
var thumbStyle = {
|
|
11470
11752
|
width: THUMB_WIDTH
|
|
11471
11753
|
};
|
|
11472
11754
|
var insetEndStyles2 = getInsetEndStyles();
|
|
11473
|
-
var Slider = (0,
|
|
11755
|
+
var Slider = (0, import_react82.memo)(function Slider2({
|
|
11474
11756
|
style: style2,
|
|
11475
11757
|
className,
|
|
11476
11758
|
value,
|
|
@@ -11484,7 +11766,7 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11484
11766
|
readOnly = false,
|
|
11485
11767
|
...props
|
|
11486
11768
|
}) {
|
|
11487
|
-
const arrayValue = (0,
|
|
11769
|
+
const arrayValue = (0, import_react82.useMemo)(
|
|
11488
11770
|
() => [Math.min(Math.max(value, min), max)],
|
|
11489
11771
|
[value, min, max]
|
|
11490
11772
|
);
|
|
@@ -11493,13 +11775,13 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11493
11775
|
fieldId: props.id
|
|
11494
11776
|
});
|
|
11495
11777
|
const labelPosition = useLabelPosition();
|
|
11496
|
-
const handleValueChange = (0,
|
|
11778
|
+
const handleValueChange = (0, import_react82.useCallback)(
|
|
11497
11779
|
(arrayValue2) => {
|
|
11498
11780
|
onValueChange(arrayValue2[0]);
|
|
11499
11781
|
},
|
|
11500
11782
|
[onValueChange]
|
|
11501
11783
|
);
|
|
11502
|
-
const percentage = (0,
|
|
11784
|
+
const percentage = (0, import_react82.useMemo)(() => {
|
|
11503
11785
|
const rawPercent = (arrayValue[0] - min) / (max - min);
|
|
11504
11786
|
const adjustedPercent = rawPercent * (100 - THUMB_WIDTH * 100 / 300) + THUMB_WIDTH * 50 / 300;
|
|
11505
11787
|
return {
|
|
@@ -11507,19 +11789,19 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11507
11789
|
adjusted: adjustedPercent
|
|
11508
11790
|
};
|
|
11509
11791
|
}, [arrayValue, min, max]);
|
|
11510
|
-
const trackFillStyle = (0,
|
|
11792
|
+
const trackFillStyle = (0, import_react82.useMemo)(
|
|
11511
11793
|
() => ({
|
|
11512
11794
|
clipPath: `inset(0 ${100 - percentage.adjusted}% 0 0)`
|
|
11513
11795
|
}),
|
|
11514
11796
|
[percentage.adjusted]
|
|
11515
11797
|
);
|
|
11516
|
-
const labelStyle = (0,
|
|
11798
|
+
const labelStyle = (0, import_react82.useMemo)(
|
|
11517
11799
|
() => ({
|
|
11518
11800
|
clipPath: `inset(0 ${100 - percentage.raw}% 0 0)`
|
|
11519
11801
|
}),
|
|
11520
11802
|
[percentage.raw]
|
|
11521
11803
|
);
|
|
11522
|
-
return /* @__PURE__ */
|
|
11804
|
+
return /* @__PURE__ */ import_react82.default.createElement(
|
|
11523
11805
|
RadixSlider.Root,
|
|
11524
11806
|
{
|
|
11525
11807
|
min,
|
|
@@ -11537,7 +11819,7 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11537
11819
|
onBlur,
|
|
11538
11820
|
disabled: readOnly
|
|
11539
11821
|
},
|
|
11540
|
-
/* @__PURE__ */
|
|
11822
|
+
/* @__PURE__ */ import_react82.default.createElement(RadixSlider.Track, { className: "flex-grow h-full rounded overflow-hidden bg-input-background" }, label && labelPosition === "inset" && /* @__PURE__ */ import_react82.default.createElement("div", { className: insetEndStyles2 }, /* @__PURE__ */ import_react82.default.createElement(Label, { htmlFor: id, className: "text-text-disabled" }, label)), /* @__PURE__ */ import_react82.default.createElement(
|
|
11541
11823
|
"div",
|
|
11542
11824
|
{
|
|
11543
11825
|
style: trackFillStyle,
|
|
@@ -11548,8 +11830,8 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11548
11830
|
)
|
|
11549
11831
|
}
|
|
11550
11832
|
)),
|
|
11551
|
-
label && labelPosition === "inset" && colorScheme !== void 0 && /* @__PURE__ */
|
|
11552
|
-
/* @__PURE__ */
|
|
11833
|
+
label && labelPosition === "inset" && colorScheme !== void 0 && /* @__PURE__ */ import_react82.default.createElement("div", { className: insetEndStyles2 }, /* @__PURE__ */ import_react82.default.createElement(Label, { className: "text-white overflow-hidden", style: labelStyle }, label)),
|
|
11834
|
+
/* @__PURE__ */ import_react82.default.createElement(
|
|
11553
11835
|
RadixSlider.Thumb,
|
|
11554
11836
|
{
|
|
11555
11837
|
style: thumbStyle,
|
|
@@ -11564,9 +11846,37 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11564
11846
|
);
|
|
11565
11847
|
});
|
|
11566
11848
|
|
|
11849
|
+
// src/components/sorting/createSharedDrag.tsx
|
|
11850
|
+
var React82 = __toESM(require("react"));
|
|
11851
|
+
function createSharedDrag() {
|
|
11852
|
+
const dragRegistrationContext = React82.createContext(null);
|
|
11853
|
+
const activeDragContext = React82.createContext(
|
|
11854
|
+
null
|
|
11855
|
+
);
|
|
11856
|
+
const Provider3 = ({ children }) => /* @__PURE__ */ React82.createElement(
|
|
11857
|
+
SharedDragProvider,
|
|
11858
|
+
{
|
|
11859
|
+
contexts: {
|
|
11860
|
+
dragRegistrationContext,
|
|
11861
|
+
activeDragContext
|
|
11862
|
+
}
|
|
11863
|
+
},
|
|
11864
|
+
children
|
|
11865
|
+
);
|
|
11866
|
+
const dragProps = {
|
|
11867
|
+
dragRegistrationContext,
|
|
11868
|
+
activeDragContext
|
|
11869
|
+
};
|
|
11870
|
+
return {
|
|
11871
|
+
Provider: Provider3,
|
|
11872
|
+
Sortable: (props) => /* @__PURE__ */ React82.createElement(Sortable, { sharedDragProviderContexts: dragProps, ...props }),
|
|
11873
|
+
props: dragProps
|
|
11874
|
+
};
|
|
11875
|
+
}
|
|
11876
|
+
|
|
11567
11877
|
// src/components/Switch.tsx
|
|
11568
11878
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
11569
|
-
var
|
|
11879
|
+
var React83 = __toESM(require("react"));
|
|
11570
11880
|
var Switch = function Switch2({
|
|
11571
11881
|
id,
|
|
11572
11882
|
value,
|
|
@@ -11578,7 +11888,7 @@ var Switch = function Switch2({
|
|
|
11578
11888
|
style: style2,
|
|
11579
11889
|
className
|
|
11580
11890
|
}) {
|
|
11581
|
-
return /* @__PURE__ */
|
|
11891
|
+
return /* @__PURE__ */ React83.createElement(
|
|
11582
11892
|
SwitchPrimitive.Root,
|
|
11583
11893
|
{
|
|
11584
11894
|
id,
|
|
@@ -11597,20 +11907,20 @@ var Switch = function Switch2({
|
|
|
11597
11907
|
onFocus,
|
|
11598
11908
|
onBlur
|
|
11599
11909
|
},
|
|
11600
|
-
/* @__PURE__ */
|
|
11910
|
+
/* @__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]" })
|
|
11601
11911
|
);
|
|
11602
11912
|
};
|
|
11603
11913
|
|
|
11604
11914
|
// src/components/UserPointer.tsx
|
|
11605
|
-
var
|
|
11606
|
-
var UserPointerContainer = (0,
|
|
11915
|
+
var import_react83 = __toESM(require("react"));
|
|
11916
|
+
var UserPointerContainer = (0, import_react83.memo)(function UserPointerContainer2({
|
|
11607
11917
|
point,
|
|
11608
11918
|
visible,
|
|
11609
11919
|
children,
|
|
11610
11920
|
className,
|
|
11611
11921
|
style: style2
|
|
11612
11922
|
}) {
|
|
11613
|
-
return /* @__PURE__ */
|
|
11923
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
11614
11924
|
"div",
|
|
11615
11925
|
{
|
|
11616
11926
|
style: {
|
|
@@ -11627,13 +11937,13 @@ var UserPointerContainer = (0, import_react82.memo)(function UserPointerContaine
|
|
|
11627
11937
|
children
|
|
11628
11938
|
);
|
|
11629
11939
|
});
|
|
11630
|
-
var UserNameTag = (0,
|
|
11940
|
+
var UserNameTag = (0, import_react83.memo)(function UserNameTag2({
|
|
11631
11941
|
backgroundColor,
|
|
11632
11942
|
className,
|
|
11633
11943
|
style: style2,
|
|
11634
11944
|
children
|
|
11635
11945
|
}) {
|
|
11636
|
-
return /* @__PURE__ */
|
|
11946
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
11637
11947
|
"span",
|
|
11638
11948
|
{
|
|
11639
11949
|
className: cx(
|
|
@@ -11649,14 +11959,14 @@ var UserNameTag = (0, import_react82.memo)(function UserNameTag2({
|
|
|
11649
11959
|
children
|
|
11650
11960
|
);
|
|
11651
11961
|
});
|
|
11652
|
-
var UserPointerIcon = (0,
|
|
11962
|
+
var UserPointerIcon = (0, import_react83.memo)(function PointerIcon({
|
|
11653
11963
|
size: size2,
|
|
11654
11964
|
color = "black",
|
|
11655
11965
|
className,
|
|
11656
11966
|
style: style2
|
|
11657
11967
|
}) {
|
|
11658
11968
|
const points = "0,5 10,0 10,10";
|
|
11659
|
-
return /* @__PURE__ */
|
|
11969
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
11660
11970
|
"svg",
|
|
11661
11971
|
{
|
|
11662
11972
|
width: size2,
|
|
@@ -11671,7 +11981,7 @@ var UserPointerIcon = (0, import_react82.memo)(function PointerIcon({
|
|
|
11671
11981
|
...style2
|
|
11672
11982
|
}
|
|
11673
11983
|
},
|
|
11674
|
-
/* @__PURE__ */
|
|
11984
|
+
/* @__PURE__ */ import_react83.default.createElement(
|
|
11675
11985
|
"polygon",
|
|
11676
11986
|
{
|
|
11677
11987
|
points,
|
|
@@ -11684,7 +11994,7 @@ var UserPointerIcon = (0, import_react82.memo)(function PointerIcon({
|
|
|
11684
11994
|
});
|
|
11685
11995
|
var POINTER_SIZE = 12;
|
|
11686
11996
|
var POINTER_OVERLAP = 6;
|
|
11687
|
-
var UserPointer = (0,
|
|
11997
|
+
var UserPointer = (0, import_react83.memo)(function UserPointer2({
|
|
11688
11998
|
userId,
|
|
11689
11999
|
name,
|
|
11690
12000
|
visible = true,
|
|
@@ -11693,22 +12003,22 @@ var UserPointer = (0, import_react82.memo)(function UserPointer2({
|
|
|
11693
12003
|
style: style2,
|
|
11694
12004
|
className
|
|
11695
12005
|
}) {
|
|
11696
|
-
const userBackgroundColor = (0,
|
|
12006
|
+
const userBackgroundColor = (0, import_react83.useMemo)(
|
|
11697
12007
|
() => backgroundColor ?? colorFromString(userId ?? name ?? ""),
|
|
11698
12008
|
[backgroundColor, userId, name]
|
|
11699
12009
|
);
|
|
11700
|
-
const pointerOverlapStyle = (0,
|
|
12010
|
+
const pointerOverlapStyle = (0, import_react83.useMemo)(
|
|
11701
12011
|
() => ({
|
|
11702
12012
|
marginRight: `-${POINTER_OVERLAP}px`,
|
|
11703
12013
|
marginBottom: `-${POINTER_OVERLAP}px`
|
|
11704
12014
|
}),
|
|
11705
12015
|
[]
|
|
11706
12016
|
);
|
|
11707
|
-
const nameTagOverlapStyle = (0,
|
|
12017
|
+
const nameTagOverlapStyle = (0, import_react83.useMemo)(
|
|
11708
12018
|
() => ({ marginLeft: `${POINTER_SIZE - POINTER_OVERLAP + 1}px` }),
|
|
11709
12019
|
[]
|
|
11710
12020
|
);
|
|
11711
|
-
return /* @__PURE__ */
|
|
12021
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
11712
12022
|
UserPointerContainer,
|
|
11713
12023
|
{
|
|
11714
12024
|
point,
|
|
@@ -11716,14 +12026,14 @@ var UserPointer = (0, import_react82.memo)(function UserPointer2({
|
|
|
11716
12026
|
className,
|
|
11717
12027
|
style: style2
|
|
11718
12028
|
},
|
|
11719
|
-
name && /* @__PURE__ */
|
|
12029
|
+
name && /* @__PURE__ */ import_react83.default.createElement("div", { className: "relative" }, /* @__PURE__ */ import_react83.default.createElement(
|
|
11720
12030
|
UserPointerIcon,
|
|
11721
12031
|
{
|
|
11722
12032
|
size: POINTER_SIZE,
|
|
11723
12033
|
color: userBackgroundColor,
|
|
11724
12034
|
style: pointerOverlapStyle
|
|
11725
12035
|
}
|
|
11726
|
-
), /* @__PURE__ */
|
|
12036
|
+
), /* @__PURE__ */ import_react83.default.createElement(
|
|
11727
12037
|
UserNameTag,
|
|
11728
12038
|
{
|
|
11729
12039
|
backgroundColor: userBackgroundColor,
|
|
@@ -11736,18 +12046,18 @@ var UserPointer = (0, import_react82.memo)(function UserPointer2({
|
|
|
11736
12046
|
|
|
11737
12047
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
11738
12048
|
var import_noya_keymap6 = require("@noya-app/noya-keymap");
|
|
11739
|
-
var
|
|
12049
|
+
var import_react88 = __toESM(require("react"));
|
|
11740
12050
|
|
|
11741
12051
|
// src/hooks/useWindowSize.tsx
|
|
11742
|
-
var
|
|
12052
|
+
var import_react84 = require("react");
|
|
11743
12053
|
function useWindowSize() {
|
|
11744
|
-
const [size2, setSize] = (0,
|
|
12054
|
+
const [size2, setSize] = (0, import_react84.useState)(
|
|
11745
12055
|
typeof window === "undefined" ? { width: 0, height: 0 } : {
|
|
11746
12056
|
width: window.innerWidth,
|
|
11747
12057
|
height: window.innerHeight
|
|
11748
12058
|
}
|
|
11749
12059
|
);
|
|
11750
|
-
(0,
|
|
12060
|
+
(0, import_react84.useEffect)(() => {
|
|
11751
12061
|
const handleResize = () => setSize({
|
|
11752
12062
|
width: window.innerWidth,
|
|
11753
12063
|
height: window.innerHeight
|
|
@@ -11759,18 +12069,18 @@ function useWindowSize() {
|
|
|
11759
12069
|
}
|
|
11760
12070
|
|
|
11761
12071
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
11762
|
-
var
|
|
12072
|
+
var import_react86 = __toESM(require("react"));
|
|
11763
12073
|
|
|
11764
12074
|
// src/hooks/usePreservePanelSize.tsx
|
|
11765
|
-
var
|
|
12075
|
+
var import_react85 = require("react");
|
|
11766
12076
|
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
11767
12077
|
var LEFT_SIDEBAR_ID = "editor-left-sidebar";
|
|
11768
12078
|
var RIGHT_SIDEBAR_ID = "editor-right-sidebar";
|
|
11769
12079
|
var CONTENT_AREA_ID = "editor-content-area";
|
|
11770
12080
|
function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
11771
12081
|
const windowSize = useWindowSize();
|
|
11772
|
-
const layoutRef = (0,
|
|
11773
|
-
(0,
|
|
12082
|
+
const layoutRef = (0, import_react85.useRef)();
|
|
12083
|
+
(0, import_react85.useLayoutEffect)(() => {
|
|
11774
12084
|
const panelGroup = document.querySelector(
|
|
11775
12085
|
`[data-panel-group-id="${EDITOR_PANEL_GROUP_ID}"]`
|
|
11776
12086
|
);
|
|
@@ -11813,7 +12123,7 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
|
11813
12123
|
panelGroupObserver.disconnect();
|
|
11814
12124
|
};
|
|
11815
12125
|
}, [panelGroupRef, setPanelLayoutState]);
|
|
11816
|
-
(0,
|
|
12126
|
+
(0, import_react85.useLayoutEffect)(() => {
|
|
11817
12127
|
if (!layoutRef.current) return;
|
|
11818
12128
|
const {
|
|
11819
12129
|
windowWidth: oldWindowWidth,
|
|
@@ -11899,7 +12209,7 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
|
11899
12209
|
}
|
|
11900
12210
|
|
|
11901
12211
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
11902
|
-
var DrawerWorkspaceLayout = (0,
|
|
12212
|
+
var DrawerWorkspaceLayout = (0, import_react86.memo)(function DrawerWorkspaceLayout2({
|
|
11903
12213
|
leftPanel,
|
|
11904
12214
|
leftSidebarRef,
|
|
11905
12215
|
rightPanel,
|
|
@@ -11908,9 +12218,9 @@ var DrawerWorkspaceLayout = (0, import_react85.memo)(function DrawerWorkspaceLay
|
|
|
11908
12218
|
internalLayoutState,
|
|
11909
12219
|
handleChangeLayoutState
|
|
11910
12220
|
}) {
|
|
11911
|
-
const portalContainer = (0,
|
|
11912
|
-
const [mounted, setMounted] = (0,
|
|
11913
|
-
(0,
|
|
12221
|
+
const portalContainer = (0, import_react86.useRef)(null);
|
|
12222
|
+
const [mounted, setMounted] = (0, import_react86.useState)(false);
|
|
12223
|
+
(0, import_react86.useLayoutEffect)(() => {
|
|
11914
12224
|
if (mounted) return;
|
|
11915
12225
|
setMounted(true);
|
|
11916
12226
|
handleChangeLayoutState({
|
|
@@ -11920,14 +12230,14 @@ var DrawerWorkspaceLayout = (0, import_react85.memo)(function DrawerWorkspaceLay
|
|
|
11920
12230
|
}, [handleChangeLayoutState, mounted]);
|
|
11921
12231
|
const leftSidebarCollapsed = internalLayoutState?.leftSidebarCollapsed ?? false;
|
|
11922
12232
|
const rightSidebarCollapsed = internalLayoutState?.rightSidebarCollapsed ?? false;
|
|
11923
|
-
return /* @__PURE__ */
|
|
12233
|
+
return /* @__PURE__ */ import_react86.default.createElement(
|
|
11924
12234
|
"div",
|
|
11925
12235
|
{
|
|
11926
12236
|
ref: portalContainer,
|
|
11927
12237
|
id: EDITOR_PANEL_GROUP_ID,
|
|
11928
12238
|
className: "flex flex-1 relative focus:outline-none"
|
|
11929
12239
|
},
|
|
11930
|
-
leftPanel && /* @__PURE__ */
|
|
12240
|
+
leftPanel && /* @__PURE__ */ import_react86.default.createElement(
|
|
11931
12241
|
Drawer,
|
|
11932
12242
|
{
|
|
11933
12243
|
id: LEFT_SIDEBAR_ID,
|
|
@@ -11948,7 +12258,7 @@ var DrawerWorkspaceLayout = (0, import_react85.memo)(function DrawerWorkspaceLay
|
|
|
11948
12258
|
leftPanel
|
|
11949
12259
|
),
|
|
11950
12260
|
centerPanel,
|
|
11951
|
-
rightPanel && /* @__PURE__ */
|
|
12261
|
+
rightPanel && /* @__PURE__ */ import_react86.default.createElement(
|
|
11952
12262
|
Drawer,
|
|
11953
12263
|
{
|
|
11954
12264
|
id: RIGHT_SIDEBAR_ID,
|
|
@@ -11972,9 +12282,9 @@ var DrawerWorkspaceLayout = (0, import_react85.memo)(function DrawerWorkspaceLay
|
|
|
11972
12282
|
});
|
|
11973
12283
|
|
|
11974
12284
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
11975
|
-
var
|
|
12285
|
+
var import_react87 = __toESM(require("react"));
|
|
11976
12286
|
var import_react_resizable_panels = require("react-resizable-panels");
|
|
11977
|
-
var PanelWorkspaceLayout = (0,
|
|
12287
|
+
var PanelWorkspaceLayout = (0, import_react87.memo)(function PanelWorkspaceLayout2({
|
|
11978
12288
|
leftPanel,
|
|
11979
12289
|
rightPanel,
|
|
11980
12290
|
centerPanel,
|
|
@@ -11987,9 +12297,9 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
11987
12297
|
rightSidebarRef,
|
|
11988
12298
|
handleChangeLayoutState
|
|
11989
12299
|
}) {
|
|
11990
|
-
const panelGroupRef = (0,
|
|
12300
|
+
const panelGroupRef = (0, import_react87.useRef)(null);
|
|
11991
12301
|
usePreservePanelSize(panelGroupRef, handleChangeLayoutState);
|
|
11992
|
-
return /* @__PURE__ */
|
|
12302
|
+
return /* @__PURE__ */ import_react87.default.createElement(
|
|
11993
12303
|
import_react_resizable_panels.PanelGroup,
|
|
11994
12304
|
{
|
|
11995
12305
|
ref: panelGroupRef,
|
|
@@ -11998,7 +12308,7 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
11998
12308
|
direction: "horizontal",
|
|
11999
12309
|
autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : void 0
|
|
12000
12310
|
},
|
|
12001
|
-
leftPanel && /* @__PURE__ */
|
|
12311
|
+
leftPanel && /* @__PURE__ */ import_react87.default.createElement(import_react87.default.Fragment, null, /* @__PURE__ */ import_react87.default.createElement(
|
|
12002
12312
|
import_react_resizable_panels.Panel,
|
|
12003
12313
|
{
|
|
12004
12314
|
id: LEFT_SIDEBAR_ID,
|
|
@@ -12011,8 +12321,8 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
12011
12321
|
collapsible: true
|
|
12012
12322
|
},
|
|
12013
12323
|
internalLayoutState?.leftSidebarCollapsed ? null : leftPanel
|
|
12014
|
-
), /* @__PURE__ */
|
|
12015
|
-
/* @__PURE__ */
|
|
12324
|
+
), /* @__PURE__ */ import_react87.default.createElement(import_react_resizable_panels.PanelResizeHandle, { className: "cursor-col-resize w-px h-full bg-divider" })),
|
|
12325
|
+
/* @__PURE__ */ import_react87.default.createElement(
|
|
12016
12326
|
import_react_resizable_panels.Panel,
|
|
12017
12327
|
{
|
|
12018
12328
|
id: CONTENT_AREA_ID,
|
|
@@ -12023,7 +12333,7 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
12023
12333
|
},
|
|
12024
12334
|
centerPanel
|
|
12025
12335
|
),
|
|
12026
|
-
rightPanel && /* @__PURE__ */
|
|
12336
|
+
rightPanel && /* @__PURE__ */ import_react87.default.createElement(import_react87.default.Fragment, null, /* @__PURE__ */ import_react87.default.createElement(import_react_resizable_panels.PanelResizeHandle, { className: "cursor-col-resize w-px h-full bg-divider" }), /* @__PURE__ */ import_react87.default.createElement(
|
|
12027
12337
|
import_react_resizable_panels.Panel,
|
|
12028
12338
|
{
|
|
12029
12339
|
id: RIGHT_SIDEBAR_ID,
|
|
@@ -12041,7 +12351,7 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
12041
12351
|
});
|
|
12042
12352
|
|
|
12043
12353
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
12044
|
-
var WorkspaceLayout = (0,
|
|
12354
|
+
var WorkspaceLayout = (0, import_react88.forwardRef)(function WorkspaceLayout2({
|
|
12045
12355
|
autoSavePrefix,
|
|
12046
12356
|
left,
|
|
12047
12357
|
right,
|
|
@@ -12072,7 +12382,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12072
12382
|
} = {},
|
|
12073
12383
|
theme
|
|
12074
12384
|
}, forwardedRef) {
|
|
12075
|
-
const containerRef =
|
|
12385
|
+
const containerRef = import_react88.default.useRef(null);
|
|
12076
12386
|
const containerSize = useSize(containerRef);
|
|
12077
12387
|
const windowSize = useWindowSize();
|
|
12078
12388
|
const parentSize = detectSize === "window" ? windowSize : containerSize && containerSize.width > 0 ? containerSize : windowSize;
|
|
@@ -12103,17 +12413,17 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12103
12413
|
rightSidebarMinPercentage,
|
|
12104
12414
|
rightSidebarMaxPercentage
|
|
12105
12415
|
);
|
|
12106
|
-
const leftSidebarRef = (0,
|
|
12107
|
-
const rightSidebarRef = (0,
|
|
12108
|
-
const [internalLayoutState, setInternalLayoutState] = (0,
|
|
12109
|
-
const handleChangeLayoutState = (0,
|
|
12416
|
+
const leftSidebarRef = (0, import_react88.useRef)(null);
|
|
12417
|
+
const rightSidebarRef = (0, import_react88.useRef)(null);
|
|
12418
|
+
const [internalLayoutState, setInternalLayoutState] = (0, import_react88.useState)(null);
|
|
12419
|
+
const handleChangeLayoutState = (0, import_react88.useCallback)(
|
|
12110
12420
|
(state) => {
|
|
12111
12421
|
setInternalLayoutState(state);
|
|
12112
12422
|
onChangeLayoutState?.(state);
|
|
12113
12423
|
},
|
|
12114
12424
|
[onChangeLayoutState]
|
|
12115
12425
|
);
|
|
12116
|
-
(0,
|
|
12426
|
+
(0, import_react88.useImperativeHandle)(forwardedRef, () => ({
|
|
12117
12427
|
setLeftExpanded: (expanded) => {
|
|
12118
12428
|
if (expanded) {
|
|
12119
12429
|
leftSidebarRef.current?.expand();
|
|
@@ -12170,7 +12480,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12170
12480
|
}
|
|
12171
12481
|
});
|
|
12172
12482
|
const centerPanelPercentage = 100 - (left ? leftSidebarPercentage : 0) - (right ? rightSidebarPercentage : 0);
|
|
12173
|
-
const leftPanel = left ? /* @__PURE__ */
|
|
12483
|
+
const leftPanel = left ? /* @__PURE__ */ import_react88.default.createElement(
|
|
12174
12484
|
PanelInner,
|
|
12175
12485
|
{
|
|
12176
12486
|
style: leftStyle,
|
|
@@ -12178,7 +12488,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12178
12488
|
},
|
|
12179
12489
|
left
|
|
12180
12490
|
) : null;
|
|
12181
|
-
const rightPanel = right ? /* @__PURE__ */
|
|
12491
|
+
const rightPanel = right ? /* @__PURE__ */ import_react88.default.createElement(
|
|
12182
12492
|
PanelInner,
|
|
12183
12493
|
{
|
|
12184
12494
|
style: rightStyle,
|
|
@@ -12186,7 +12496,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12186
12496
|
},
|
|
12187
12497
|
right
|
|
12188
12498
|
) : null;
|
|
12189
|
-
const centerPanel = /* @__PURE__ */
|
|
12499
|
+
const centerPanel = /* @__PURE__ */ import_react88.default.createElement(PanelInner, { className: "bg-canvas-background" }, children);
|
|
12190
12500
|
const leftSidebarOptions = {
|
|
12191
12501
|
minSize: leftSidebarMinPercentage,
|
|
12192
12502
|
maxSize: leftSidebarMaxPercentage,
|
|
@@ -12201,7 +12511,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12201
12511
|
};
|
|
12202
12512
|
const LayoutComponent = sideType === "panel" ? PanelWorkspaceLayout : sideType === "drawer" ? DrawerWorkspaceLayout : parentSize.width > sideTypeBreakpoint ? PanelWorkspaceLayout : DrawerWorkspaceLayout;
|
|
12203
12513
|
const readyToRender = detectSize === "window" || containerSize && containerSize.width > 0;
|
|
12204
|
-
return /* @__PURE__ */
|
|
12514
|
+
return /* @__PURE__ */ import_react88.default.createElement(
|
|
12205
12515
|
"div",
|
|
12206
12516
|
{
|
|
12207
12517
|
ref: containerRef,
|
|
@@ -12211,7 +12521,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12211
12521
|
"data-theme": theme
|
|
12212
12522
|
},
|
|
12213
12523
|
toolbar,
|
|
12214
|
-
/* @__PURE__ */
|
|
12524
|
+
/* @__PURE__ */ import_react88.default.createElement("div", { className: "flex flex-row flex-1 relative" }, readyToRender && /* @__PURE__ */ import_react88.default.createElement(
|
|
12215
12525
|
LayoutComponent,
|
|
12216
12526
|
{
|
|
12217
12527
|
leftPanel,
|
|
@@ -12229,12 +12539,12 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12229
12539
|
))
|
|
12230
12540
|
);
|
|
12231
12541
|
});
|
|
12232
|
-
var PanelInner = (0,
|
|
12542
|
+
var PanelInner = (0, import_react88.memo)(function PanelInner2({
|
|
12233
12543
|
children,
|
|
12234
12544
|
style: style2,
|
|
12235
12545
|
className
|
|
12236
12546
|
}) {
|
|
12237
|
-
return /* @__PURE__ */
|
|
12547
|
+
return /* @__PURE__ */ import_react88.default.createElement("div", { style: style2, className: cx("absolute inset-0 flex", className) }, children);
|
|
12238
12548
|
});
|
|
12239
12549
|
|
|
12240
12550
|
// src/hooks/usePlatform.ts
|
|
@@ -12247,9 +12557,9 @@ function usePlatformModKey() {
|
|
|
12247
12557
|
}
|
|
12248
12558
|
|
|
12249
12559
|
// src/hooks/useTheme.ts
|
|
12250
|
-
var
|
|
12560
|
+
var import_react89 = require("react");
|
|
12251
12561
|
function useTheme() {
|
|
12252
|
-
const [theme, setTheme] = (0,
|
|
12562
|
+
const [theme, setTheme] = (0, import_react89.useState)("light");
|
|
12253
12563
|
const checkTheme = () => {
|
|
12254
12564
|
const currentTheme = document.body.getAttribute("data-theme");
|
|
12255
12565
|
switch (currentTheme) {
|
|
@@ -12261,7 +12571,7 @@ function useTheme() {
|
|
|
12261
12571
|
break;
|
|
12262
12572
|
}
|
|
12263
12573
|
};
|
|
12264
|
-
(0,
|
|
12574
|
+
(0, import_react89.useEffect)(() => {
|
|
12265
12575
|
checkTheme();
|
|
12266
12576
|
const observer = new MutationObserver((mutations) => {
|
|
12267
12577
|
mutations.forEach((mutation) => {
|
|
@@ -12366,7 +12676,9 @@ function acceptsDrop({
|
|
|
12366
12676
|
return defaultAcceptsDrop(
|
|
12367
12677
|
sourceIndexPath.at(-1),
|
|
12368
12678
|
targetIndexPath.at(-1),
|
|
12369
|
-
position
|
|
12679
|
+
position,
|
|
12680
|
+
"",
|
|
12681
|
+
""
|
|
12370
12682
|
);
|
|
12371
12683
|
}
|
|
12372
12684
|
return true;
|
|
@@ -12387,11 +12699,11 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
12387
12699
|
|
|
12388
12700
|
// src/components/DimensionInput.tsx
|
|
12389
12701
|
var import_noya_utils12 = require("@noya-app/noya-utils");
|
|
12390
|
-
var
|
|
12702
|
+
var React89 = __toESM(require("react"));
|
|
12391
12703
|
function getNewValue(value, mode, delta) {
|
|
12392
12704
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
12393
12705
|
}
|
|
12394
|
-
var DimensionInput =
|
|
12706
|
+
var DimensionInput = React89.memo(function DimensionInput2({
|
|
12395
12707
|
id,
|
|
12396
12708
|
value,
|
|
12397
12709
|
onSetValue,
|
|
@@ -12401,15 +12713,15 @@ var DimensionInput = React85.memo(function DimensionInput2({
|
|
|
12401
12713
|
disabled,
|
|
12402
12714
|
trigger = "submit"
|
|
12403
12715
|
}) {
|
|
12404
|
-
const handleNudgeValue =
|
|
12716
|
+
const handleNudgeValue = React89.useCallback(
|
|
12405
12717
|
(value2) => onSetValue(value2, "adjust"),
|
|
12406
12718
|
[onSetValue]
|
|
12407
12719
|
);
|
|
12408
|
-
const handleSetValue =
|
|
12720
|
+
const handleSetValue = React89.useCallback(
|
|
12409
12721
|
(value2) => onSetValue(value2, "replace"),
|
|
12410
12722
|
[onSetValue]
|
|
12411
12723
|
);
|
|
12412
|
-
return /* @__PURE__ */
|
|
12724
|
+
return /* @__PURE__ */ React89.createElement(LabeledField, { label, labelPosition: "inset" }, /* @__PURE__ */ React89.createElement(InputField2.Root, { id, width: size2 }, /* @__PURE__ */ React89.createElement(
|
|
12413
12725
|
InputField2.NumberInput,
|
|
12414
12726
|
{
|
|
12415
12727
|
value: value === void 0 ? value : (0, import_noya_utils12.round)(value, 2),
|
|
@@ -12436,8 +12748,8 @@ __export(InspectorPrimitives_exports, {
|
|
|
12436
12748
|
Title: () => Title4,
|
|
12437
12749
|
VerticalSeparator: () => VerticalSeparator
|
|
12438
12750
|
});
|
|
12439
|
-
var
|
|
12440
|
-
var Section2 = (0,
|
|
12751
|
+
var import_react90 = __toESM(require("react"));
|
|
12752
|
+
var Section2 = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12441
12753
|
"div",
|
|
12442
12754
|
{
|
|
12443
12755
|
ref,
|
|
@@ -12445,8 +12757,8 @@ var Section2 = (0, import_react89.forwardRef)(({ className, ...props }, ref) =>
|
|
|
12445
12757
|
...props
|
|
12446
12758
|
}
|
|
12447
12759
|
));
|
|
12448
|
-
var SectionHeader3 = (0,
|
|
12449
|
-
var Title4 = (0,
|
|
12760
|
+
var SectionHeader3 = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement("div", { ref, className: cx(`flex items-center `, className), ...props }));
|
|
12761
|
+
var Title4 = (0, import_react90.forwardRef)(({ className, $textStyle, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12450
12762
|
"div",
|
|
12451
12763
|
{
|
|
12452
12764
|
ref,
|
|
@@ -12457,7 +12769,7 @@ var Title4 = (0, import_react89.forwardRef)(({ className, $textStyle, ...props }
|
|
|
12457
12769
|
...props
|
|
12458
12770
|
}
|
|
12459
12771
|
));
|
|
12460
|
-
var Row = (0,
|
|
12772
|
+
var Row = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12461
12773
|
"div",
|
|
12462
12774
|
{
|
|
12463
12775
|
ref,
|
|
@@ -12465,7 +12777,7 @@ var Row = (0, import_react89.forwardRef)(({ className, ...props }, ref) => /* @_
|
|
|
12465
12777
|
...props
|
|
12466
12778
|
}
|
|
12467
12779
|
));
|
|
12468
|
-
var Column = (0,
|
|
12780
|
+
var Column = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12469
12781
|
"div",
|
|
12470
12782
|
{
|
|
12471
12783
|
ref,
|
|
@@ -12473,7 +12785,7 @@ var Column = (0, import_react89.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
12473
12785
|
...props
|
|
12474
12786
|
}
|
|
12475
12787
|
));
|
|
12476
|
-
var Checkbox3 = (0,
|
|
12788
|
+
var Checkbox3 = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12477
12789
|
"input",
|
|
12478
12790
|
{
|
|
12479
12791
|
ref,
|
|
@@ -12482,7 +12794,7 @@ var Checkbox3 = (0, import_react89.forwardRef)(({ className, ...props }, ref) =>
|
|
|
12482
12794
|
...props
|
|
12483
12795
|
}
|
|
12484
12796
|
));
|
|
12485
|
-
var Text3 = (0,
|
|
12797
|
+
var Text3 = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12486
12798
|
"span",
|
|
12487
12799
|
{
|
|
12488
12800
|
ref,
|
|
@@ -12490,14 +12802,14 @@ var Text3 = (0, import_react89.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
12490
12802
|
...props
|
|
12491
12803
|
}
|
|
12492
12804
|
));
|
|
12493
|
-
var VerticalSeparator = () => /* @__PURE__ */
|
|
12494
|
-
var HorizontalSeparator = () => /* @__PURE__ */
|
|
12495
|
-
var RowLabel = (0,
|
|
12805
|
+
var VerticalSeparator = () => /* @__PURE__ */ import_react90.default.createElement(Spacer.Vertical, { size: "inspector-v-separator" });
|
|
12806
|
+
var HorizontalSeparator = () => /* @__PURE__ */ import_react90.default.createElement(Spacer.Horizontal, { size: "inspector-h-separator" });
|
|
12807
|
+
var RowLabel = (0, import_react90.forwardRef)(function RowLabel2({
|
|
12496
12808
|
className,
|
|
12497
12809
|
$textStyle,
|
|
12498
12810
|
...props
|
|
12499
12811
|
}, ref) {
|
|
12500
|
-
return /* @__PURE__ */
|
|
12812
|
+
return /* @__PURE__ */ import_react90.default.createElement(
|
|
12501
12813
|
"label",
|
|
12502
12814
|
{
|
|
12503
12815
|
ref,
|
|
@@ -12509,7 +12821,7 @@ var RowLabel = (0, import_react89.forwardRef)(function RowLabel2({
|
|
|
12509
12821
|
}
|
|
12510
12822
|
);
|
|
12511
12823
|
});
|
|
12512
|
-
var LabeledRow = (0,
|
|
12824
|
+
var LabeledRow = (0, import_react90.memo)(function LabeledRow2({
|
|
12513
12825
|
id,
|
|
12514
12826
|
children,
|
|
12515
12827
|
label,
|
|
@@ -12517,11 +12829,11 @@ var LabeledRow = (0, import_react89.memo)(function LabeledRow2({
|
|
|
12517
12829
|
right,
|
|
12518
12830
|
className
|
|
12519
12831
|
}) {
|
|
12520
|
-
return /* @__PURE__ */
|
|
12832
|
+
return /* @__PURE__ */ import_react90.default.createElement(Row, { id, className }, /* @__PURE__ */ import_react90.default.createElement(Column, null, /* @__PURE__ */ import_react90.default.createElement(RowLabel, { $textStyle: labelTextStyle }, label, right && /* @__PURE__ */ import_react90.default.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ import_react90.default.createElement(Row, null, children)));
|
|
12521
12833
|
});
|
|
12522
12834
|
|
|
12523
12835
|
// src/components/BaseToolbar.tsx
|
|
12524
|
-
var
|
|
12836
|
+
var import_react91 = __toESM(require("react"));
|
|
12525
12837
|
var toolbarStyle = {
|
|
12526
12838
|
[cssVarNames.colors.inputBackground]: "transparent"
|
|
12527
12839
|
};
|
|
@@ -12532,7 +12844,7 @@ function BaseToolbar({
|
|
|
12532
12844
|
logo,
|
|
12533
12845
|
showDivider = true
|
|
12534
12846
|
}) {
|
|
12535
|
-
return /* @__PURE__ */
|
|
12847
|
+
return /* @__PURE__ */ import_react91.default.createElement("div", { className: "flex flex-col", style: toolbarStyle }, /* @__PURE__ */ import_react91.default.createElement(
|
|
12536
12848
|
"div",
|
|
12537
12849
|
{
|
|
12538
12850
|
className: "flex items-center pr-2.5 bg-sidebar-background flex-none relative @container/toolbar",
|
|
@@ -12540,10 +12852,10 @@ function BaseToolbar({
|
|
|
12540
12852
|
flex: `0 0 ${cssVars.spacing.toolbarHeight}`
|
|
12541
12853
|
}
|
|
12542
12854
|
},
|
|
12543
|
-
logo && /* @__PURE__ */
|
|
12544
|
-
/* @__PURE__ */
|
|
12545
|
-
left && /* @__PURE__ */
|
|
12546
|
-
/* @__PURE__ */
|
|
12855
|
+
logo && /* @__PURE__ */ import_react91.default.createElement(import_react91.default.Fragment, null, logo, /* @__PURE__ */ import_react91.default.createElement(DividerVertical, null)),
|
|
12856
|
+
/* @__PURE__ */ import_react91.default.createElement(Spacer.Horizontal, { size: 10 }),
|
|
12857
|
+
left && /* @__PURE__ */ import_react91.default.createElement(import_react91.default.Fragment, null, /* @__PURE__ */ import_react91.default.createElement("div", { className: "flex gap-toolbar-separator" }, left), /* @__PURE__ */ import_react91.default.createElement(Spacer.Horizontal, { size: 10 })),
|
|
12858
|
+
/* @__PURE__ */ import_react91.default.createElement("div", { className: "flex items-center justify-center text-text-muted pointer-events-none @2xl/toolbar:absolute inset-0" }, /* @__PURE__ */ import_react91.default.createElement(
|
|
12547
12859
|
"div",
|
|
12548
12860
|
{
|
|
12549
12861
|
style: {
|
|
@@ -12555,15 +12867,15 @@ function BaseToolbar({
|
|
|
12555
12867
|
},
|
|
12556
12868
|
children
|
|
12557
12869
|
)),
|
|
12558
|
-
/* @__PURE__ */
|
|
12559
|
-
/* @__PURE__ */
|
|
12560
|
-
/* @__PURE__ */
|
|
12561
|
-
), showDivider && /* @__PURE__ */
|
|
12870
|
+
/* @__PURE__ */ import_react91.default.createElement(Spacer.Horizontal, null),
|
|
12871
|
+
/* @__PURE__ */ import_react91.default.createElement(Spacer.Horizontal, { size: 10 }),
|
|
12872
|
+
/* @__PURE__ */ import_react91.default.createElement("div", { className: "flex gap-toolbar-separator" }, right)
|
|
12873
|
+
), showDivider && /* @__PURE__ */ import_react91.default.createElement(Divider, { variant: "strong" }));
|
|
12562
12874
|
}
|
|
12563
12875
|
|
|
12564
12876
|
// src/components/Toolbar.tsx
|
|
12565
12877
|
var import_noya_keymap7 = require("@noya-app/noya-keymap");
|
|
12566
|
-
var
|
|
12878
|
+
var import_react92 = __toESM(require("react"));
|
|
12567
12879
|
var iconButtonStyle = {
|
|
12568
12880
|
height: 27,
|
|
12569
12881
|
width: 27,
|
|
@@ -12573,8 +12885,8 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12573
12885
|
item,
|
|
12574
12886
|
onSelectMenuItem
|
|
12575
12887
|
}) {
|
|
12576
|
-
const [open, setOpen] =
|
|
12577
|
-
return /* @__PURE__ */
|
|
12888
|
+
const [open, setOpen] = import_react92.default.useState(false);
|
|
12889
|
+
return /* @__PURE__ */ import_react92.default.createElement(
|
|
12578
12890
|
DropdownMenu,
|
|
12579
12891
|
{
|
|
12580
12892
|
open,
|
|
@@ -12586,7 +12898,7 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12586
12898
|
}
|
|
12587
12899
|
}
|
|
12588
12900
|
},
|
|
12589
|
-
/* @__PURE__ */
|
|
12901
|
+
/* @__PURE__ */ import_react92.default.createElement(
|
|
12590
12902
|
Button,
|
|
12591
12903
|
{
|
|
12592
12904
|
disabled: item.disabled,
|
|
@@ -12600,15 +12912,18 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12600
12912
|
});
|
|
12601
12913
|
var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
12602
12914
|
item,
|
|
12603
|
-
onSelectMenuItem
|
|
12915
|
+
onSelectMenuItem,
|
|
12916
|
+
as
|
|
12604
12917
|
}) {
|
|
12605
|
-
const content = /* @__PURE__ */
|
|
12918
|
+
const content = /* @__PURE__ */ import_react92.default.createElement(
|
|
12606
12919
|
Button,
|
|
12607
12920
|
{
|
|
12921
|
+
as,
|
|
12608
12922
|
disabled: item.disabled,
|
|
12609
12923
|
active: item.checked,
|
|
12610
12924
|
icon: item.icon,
|
|
12611
12925
|
style: item.icon && !item.title ? iconButtonStyle : void 0,
|
|
12926
|
+
...as === "a" && { href: item.value },
|
|
12612
12927
|
onClick: () => {
|
|
12613
12928
|
if (onSelectMenuItem && item.value) {
|
|
12614
12929
|
onSelectMenuItem(item.value);
|
|
@@ -12617,32 +12932,42 @@ var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
|
12617
12932
|
},
|
|
12618
12933
|
item.title
|
|
12619
12934
|
);
|
|
12620
|
-
return item.tooltip ? /* @__PURE__ */
|
|
12935
|
+
return item.tooltip ? /* @__PURE__ */ import_react92.default.createElement(Tooltip, { sideOffset: 10, content: item.tooltip }, content) : content;
|
|
12621
12936
|
});
|
|
12622
12937
|
var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
12623
12938
|
item,
|
|
12624
|
-
onSelectMenuItem
|
|
12939
|
+
onSelectMenuItem,
|
|
12940
|
+
buttonAs
|
|
12625
12941
|
}) {
|
|
12626
12942
|
if (item.type === "sectionHeader") return null;
|
|
12627
12943
|
if (item.type === "separator") {
|
|
12628
|
-
return /* @__PURE__ */
|
|
12944
|
+
return /* @__PURE__ */ import_react92.default.createElement(DividerVertical, { overflow: 4 });
|
|
12629
12945
|
}
|
|
12630
12946
|
if (isSelectableMenuItem(item)) {
|
|
12631
|
-
return /* @__PURE__ */
|
|
12947
|
+
return /* @__PURE__ */ import_react92.default.createElement(
|
|
12948
|
+
ToolbarMenuButton,
|
|
12949
|
+
{
|
|
12950
|
+
item,
|
|
12951
|
+
onSelectMenuItem,
|
|
12952
|
+
as: buttonAs
|
|
12953
|
+
}
|
|
12954
|
+
);
|
|
12632
12955
|
}
|
|
12633
|
-
return /* @__PURE__ */
|
|
12956
|
+
return /* @__PURE__ */ import_react92.default.createElement(ToolbarMenuDropdown, { item, onSelectMenuItem });
|
|
12634
12957
|
});
|
|
12635
12958
|
var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
12636
12959
|
items,
|
|
12637
|
-
onSelectMenuItem
|
|
12960
|
+
onSelectMenuItem,
|
|
12961
|
+
buttonAs
|
|
12638
12962
|
}) {
|
|
12639
|
-
return /* @__PURE__ */
|
|
12640
|
-
return /* @__PURE__ */
|
|
12963
|
+
return /* @__PURE__ */ import_react92.default.createElement(import_react92.default.Fragment, null, items.map((item, i) => {
|
|
12964
|
+
return /* @__PURE__ */ import_react92.default.createElement(
|
|
12641
12965
|
ToolbarMenuItem,
|
|
12642
12966
|
{
|
|
12643
12967
|
key: i,
|
|
12644
12968
|
item,
|
|
12645
|
-
onSelectMenuItem
|
|
12969
|
+
onSelectMenuItem,
|
|
12970
|
+
buttonAs
|
|
12646
12971
|
}
|
|
12647
12972
|
);
|
|
12648
12973
|
}));
|
|
@@ -12655,28 +12980,28 @@ function Toolbar({
|
|
|
12655
12980
|
onSelectMenuItem,
|
|
12656
12981
|
shouldBindKeyboardShortcuts = true
|
|
12657
12982
|
}) {
|
|
12658
|
-
const allMenuItems =
|
|
12983
|
+
const allMenuItems = import_react92.default.useMemo(
|
|
12659
12984
|
() => [...leftMenuItems, ...rightMenuItems],
|
|
12660
12985
|
[leftMenuItems, rightMenuItems]
|
|
12661
12986
|
);
|
|
12662
12987
|
(0, import_noya_keymap7.useKeyboardShortcuts)(
|
|
12663
|
-
|
|
12988
|
+
import_react92.default.useMemo(
|
|
12664
12989
|
() => onSelectMenuItem && shouldBindKeyboardShortcuts ? getKeyboardShortcutsForMenuItems(allMenuItems, onSelectMenuItem) : {},
|
|
12665
12990
|
[allMenuItems, onSelectMenuItem, shouldBindKeyboardShortcuts]
|
|
12666
12991
|
)
|
|
12667
12992
|
);
|
|
12668
|
-
return /* @__PURE__ */
|
|
12993
|
+
return /* @__PURE__ */ import_react92.default.createElement(
|
|
12669
12994
|
BaseToolbar,
|
|
12670
12995
|
{
|
|
12671
12996
|
logo,
|
|
12672
|
-
left: leftMenuItems.length > 0 && /* @__PURE__ */
|
|
12997
|
+
left: leftMenuItems.length > 0 && /* @__PURE__ */ import_react92.default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ import_react92.default.createElement(
|
|
12673
12998
|
ToolbarMenu,
|
|
12674
12999
|
{
|
|
12675
13000
|
items: leftMenuItems,
|
|
12676
13001
|
onSelectMenuItem
|
|
12677
13002
|
}
|
|
12678
13003
|
)),
|
|
12679
|
-
right: rightMenuItems.length > 0 && /* @__PURE__ */
|
|
13004
|
+
right: rightMenuItems.length > 0 && /* @__PURE__ */ import_react92.default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ import_react92.default.createElement(
|
|
12680
13005
|
ToolbarMenu,
|
|
12681
13006
|
{
|
|
12682
13007
|
items: rightMenuItems,
|
|
@@ -12789,9 +13114,11 @@ function Toolbar({
|
|
|
12789
13114
|
SegmentedControl,
|
|
12790
13115
|
SelectMenu,
|
|
12791
13116
|
SelectionToolbarContainer,
|
|
13117
|
+
SharedDragProvider,
|
|
12792
13118
|
Slider,
|
|
12793
13119
|
Small,
|
|
12794
13120
|
Sortable,
|
|
13121
|
+
SortableItemContext,
|
|
12795
13122
|
Spacer,
|
|
12796
13123
|
Switch,
|
|
12797
13124
|
Text,
|
|
@@ -12814,6 +13141,7 @@ function Toolbar({
|
|
|
12814
13141
|
colorFromString,
|
|
12815
13142
|
colorSwatchSizeMap,
|
|
12816
13143
|
createSectionedMenu,
|
|
13144
|
+
createSharedDrag,
|
|
12817
13145
|
cssVarNames,
|
|
12818
13146
|
cssVars,
|
|
12819
13147
|
cx,
|
|
@@ -12826,6 +13154,7 @@ function Toolbar({
|
|
|
12826
13154
|
getFieldSpacing,
|
|
12827
13155
|
getGradientBackground,
|
|
12828
13156
|
getGridSize,
|
|
13157
|
+
getItemFirstCollisionDetection,
|
|
12829
13158
|
getKeyboardShortcutsForMenuItems,
|
|
12830
13159
|
getMenuItemKey,
|
|
12831
13160
|
getNewValue,
|
|
@@ -12883,6 +13212,7 @@ function Toolbar({
|
|
|
12883
13212
|
usePreservePanelSize,
|
|
12884
13213
|
useTheme,
|
|
12885
13214
|
validateDropIndicator,
|
|
13215
|
+
withDragProvider,
|
|
12886
13216
|
withSeparatorElements
|
|
12887
13217
|
});
|
|
12888
13218
|
//# sourceMappingURL=index.js.map
|