@noya-app/noya-designsystem 0.1.55 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +113 -36
- package/dist/index.d.ts +113 -36
- package/dist/index.js +1042 -665
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +995 -625
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/validateDropIndicator.test.ts +35 -9
- package/src/components/Collection.tsx +3 -0
- package/src/components/List.tsx +4 -0
- package/src/components/ListView.tsx +12 -8
- package/src/components/Toolbar.tsx +15 -2
- package/src/components/sorting/DragRegistration.tsx +107 -0
- package/src/components/sorting/SharedDragProvider.tsx +376 -0
- package/src/components/sorting/Sortable.tsx +357 -0
- package/src/components/sorting/createSharedDrag.tsx +41 -0
- package/src/components/sorting/sorting.ts +215 -0
- package/src/index.tsx +4 -2
- package/src/utils/moveTreeItem.ts +4 -2
- package/src/components/Sortable.tsx +0 -468
package/dist/index.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,
|
|
@@ -154,7 +156,9 @@ __export(src_exports, {
|
|
|
154
156
|
colorForStringValues: () => colorForStringValues,
|
|
155
157
|
colorFromString: () => colorFromString,
|
|
156
158
|
colorSwatchSizeMap: () => colorSwatchSizeMap,
|
|
159
|
+
createDragItemKey: () => createDragItemKey,
|
|
157
160
|
createSectionedMenu: () => createSectionedMenu,
|
|
161
|
+
createSharedDrag: () => createSharedDrag,
|
|
158
162
|
cssVarNames: () => cssVarNames,
|
|
159
163
|
cssVars: () => cssVars,
|
|
160
164
|
cx: () => cx,
|
|
@@ -167,6 +171,7 @@ __export(src_exports, {
|
|
|
167
171
|
getFieldSpacing: () => getFieldSpacing,
|
|
168
172
|
getGradientBackground: () => getGradientBackground,
|
|
169
173
|
getGridSize: () => getGridSize,
|
|
174
|
+
getItemFirstCollisionDetection: () => getItemFirstCollisionDetection,
|
|
170
175
|
getKeyboardShortcutsForMenuItems: () => getKeyboardShortcutsForMenuItems,
|
|
171
176
|
getMenuItemKey: () => getMenuItemKey,
|
|
172
177
|
getNewValue: () => getNewValue,
|
|
@@ -182,6 +187,7 @@ __export(src_exports, {
|
|
|
182
187
|
mergeConflictingClassNames: () => mergeConflictingClassNames,
|
|
183
188
|
moveTreeItem: () => moveTreeItem,
|
|
184
189
|
normalizeListTargetIndex: () => normalizeListTargetIndex,
|
|
190
|
+
parseDragItemKey: () => parseDragItemKey,
|
|
185
191
|
popoverStyle: () => popoverStyle,
|
|
186
192
|
portalScopeDataSetName: () => portalScopeDataSetName,
|
|
187
193
|
portalScopePropName: () => portalScopePropName,
|
|
@@ -224,6 +230,7 @@ __export(src_exports, {
|
|
|
224
230
|
usePreservePanelSize: () => usePreservePanelSize,
|
|
225
231
|
useTheme: () => useTheme,
|
|
226
232
|
validateDropIndicator: () => validateDropIndicator,
|
|
233
|
+
withDragProvider: () => withDragProvider,
|
|
227
234
|
withSeparatorElements: () => withSeparatorElements
|
|
228
235
|
});
|
|
229
236
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -3835,7 +3842,7 @@ var Chip = (0, import_react45.memo)(
|
|
|
3835
3842
|
);
|
|
3836
3843
|
|
|
3837
3844
|
// src/components/Collection.tsx
|
|
3838
|
-
var
|
|
3845
|
+
var import_react55 = __toESM(require("react"));
|
|
3839
3846
|
|
|
3840
3847
|
// src/components/Grid.tsx
|
|
3841
3848
|
var import_react49 = __toESM(require("react"));
|
|
@@ -4562,12 +4569,12 @@ var Grid = memoGeneric(
|
|
|
4562
4569
|
);
|
|
4563
4570
|
|
|
4564
4571
|
// src/components/List.tsx
|
|
4565
|
-
var
|
|
4572
|
+
var import_react54 = __toESM(require("react"));
|
|
4566
4573
|
|
|
4567
4574
|
// src/components/ListView.tsx
|
|
4568
4575
|
var import_noya_utils8 = require("@noya-app/noya-utils");
|
|
4569
4576
|
var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
|
|
4570
|
-
var
|
|
4577
|
+
var import_react52 = __toESM(require("react"));
|
|
4571
4578
|
var import_react_virtualized = require("react-virtualized");
|
|
4572
4579
|
var import_react_window = require("react-window");
|
|
4573
4580
|
|
|
@@ -4594,12 +4601,304 @@ function mergeEventHandlers(...handlerMaps) {
|
|
|
4594
4601
|
);
|
|
4595
4602
|
}
|
|
4596
4603
|
|
|
4597
|
-
// src/components/Sortable.tsx
|
|
4598
|
-
var
|
|
4604
|
+
// src/components/sorting/Sortable.tsx
|
|
4605
|
+
var import_core2 = require("@dnd-kit/core");
|
|
4599
4606
|
var import_sortable = require("@dnd-kit/sortable");
|
|
4600
|
-
var
|
|
4601
|
-
|
|
4607
|
+
var React47 = __toESM(require("react"));
|
|
4608
|
+
|
|
4609
|
+
// src/components/sorting/DragRegistration.tsx
|
|
4610
|
+
var import_react50 = __toESM(require("react"));
|
|
4611
|
+
var DragRegistrationContext = import_react50.default.createContext(null);
|
|
4612
|
+
function useDragRegistration(context) {
|
|
4613
|
+
const value = import_react50.default.useContext(context);
|
|
4614
|
+
if (!value) {
|
|
4615
|
+
throw new Error(
|
|
4616
|
+
"useDragRegistration must be used within a DragRegistrationProvider"
|
|
4617
|
+
);
|
|
4618
|
+
}
|
|
4619
|
+
return value;
|
|
4620
|
+
}
|
|
4621
|
+
function useDragRegistrationManager() {
|
|
4622
|
+
const [registeredLists, setRegisteredLists] = import_react50.default.useState(/* @__PURE__ */ new Map());
|
|
4623
|
+
const registerList = import_react50.default.useCallback((list) => {
|
|
4624
|
+
setRegisteredLists((prev) => new Map(prev).set(list.id, list));
|
|
4625
|
+
}, []);
|
|
4626
|
+
const unregisterList = import_react50.default.useCallback((listId) => {
|
|
4627
|
+
setRegisteredLists((prev) => {
|
|
4628
|
+
const newMap = new Map(prev);
|
|
4629
|
+
newMap.delete(listId);
|
|
4630
|
+
return newMap;
|
|
4631
|
+
});
|
|
4632
|
+
}, []);
|
|
4633
|
+
return { registerList, unregisterList, registeredLists };
|
|
4634
|
+
}
|
|
4635
|
+
var ActiveDragContext = import_react50.default.createContext(null);
|
|
4636
|
+
function useActiveDrag(context) {
|
|
4637
|
+
const value = import_react50.default.useContext(context);
|
|
4638
|
+
if (!value) {
|
|
4639
|
+
throw new Error("useActiveDrag must be used within a ActiveDragProvider");
|
|
4640
|
+
}
|
|
4641
|
+
return value;
|
|
4642
|
+
}
|
|
4643
|
+
var AnyDragContext = import_react50.default.createContext(false);
|
|
4644
|
+
|
|
4645
|
+
// src/components/sorting/SharedDragProvider.tsx
|
|
4646
|
+
var import_core = require("@dnd-kit/core");
|
|
4647
|
+
var React45 = __toESM(require("react"));
|
|
4648
|
+
var import_react51 = require("react");
|
|
4602
4649
|
var import_react_dom2 = require("react-dom");
|
|
4650
|
+
function SharedDragProvider({
|
|
4651
|
+
children,
|
|
4652
|
+
sharedDragProps = {
|
|
4653
|
+
dragRegistrationContext: DragRegistrationContext,
|
|
4654
|
+
activeDragContext: ActiveDragContext
|
|
4655
|
+
}
|
|
4656
|
+
}) {
|
|
4657
|
+
const sensors = (0, import_core.useSensors)(
|
|
4658
|
+
(0, import_core.useSensor)(import_core.PointerSensor, {
|
|
4659
|
+
activationConstraint: {
|
|
4660
|
+
distance: 4
|
|
4661
|
+
}
|
|
4662
|
+
})
|
|
4663
|
+
);
|
|
4664
|
+
const mounted = useMounted();
|
|
4665
|
+
const [dragState, setDragState] = React45.useState({
|
|
4666
|
+
source: null,
|
|
4667
|
+
target: null,
|
|
4668
|
+
indicator: null
|
|
4669
|
+
});
|
|
4670
|
+
const { registerList, unregisterList, registeredLists } = useDragRegistrationManager();
|
|
4671
|
+
const activatorEventRef = React45.useRef(null);
|
|
4672
|
+
const handleDragStart = React45.useCallback(
|
|
4673
|
+
(event) => {
|
|
4674
|
+
activatorEventRef.current = event.activatorEvent;
|
|
4675
|
+
for (const [listId, list] of registeredLists) {
|
|
4676
|
+
const itemIndex = list.keys.findIndex((key) => key === event.active.id);
|
|
4677
|
+
if (itemIndex >= 0) {
|
|
4678
|
+
const dragItem = {
|
|
4679
|
+
itemId: event.active.id,
|
|
4680
|
+
listId,
|
|
4681
|
+
index: itemIndex
|
|
4682
|
+
};
|
|
4683
|
+
setDragState({
|
|
4684
|
+
source: dragItem,
|
|
4685
|
+
target: null,
|
|
4686
|
+
indicator: null
|
|
4687
|
+
});
|
|
4688
|
+
break;
|
|
4689
|
+
}
|
|
4690
|
+
}
|
|
4691
|
+
},
|
|
4692
|
+
[registeredLists]
|
|
4693
|
+
);
|
|
4694
|
+
const handleDragMove = React45.useCallback(
|
|
4695
|
+
(event) => {
|
|
4696
|
+
const { active, over } = event;
|
|
4697
|
+
if (!activatorEventRef.current || !dragState.source) return;
|
|
4698
|
+
const dropTarget = findDropTarget({
|
|
4699
|
+
activationPoint: {
|
|
4700
|
+
x: activatorEventRef.current.clientX,
|
|
4701
|
+
y: activatorEventRef.current.clientY
|
|
4702
|
+
},
|
|
4703
|
+
delta: { x: event.delta.x, y: event.delta.y },
|
|
4704
|
+
over,
|
|
4705
|
+
active,
|
|
4706
|
+
source: dragState.source,
|
|
4707
|
+
registeredLists
|
|
4708
|
+
});
|
|
4709
|
+
setDragState({
|
|
4710
|
+
source: dragState.source,
|
|
4711
|
+
target: dropTarget?.target ?? null,
|
|
4712
|
+
indicator: dropTarget?.indicator ?? null
|
|
4713
|
+
});
|
|
4714
|
+
},
|
|
4715
|
+
[registeredLists, dragState.source]
|
|
4716
|
+
);
|
|
4717
|
+
const handleDragEnd = React45.useCallback(
|
|
4718
|
+
(event) => {
|
|
4719
|
+
const { active, over } = event;
|
|
4720
|
+
if (!activatorEventRef.current || !dragState.source) return;
|
|
4721
|
+
const dropTarget = findDropTarget({
|
|
4722
|
+
activationPoint: {
|
|
4723
|
+
x: activatorEventRef.current.clientX,
|
|
4724
|
+
y: activatorEventRef.current.clientY
|
|
4725
|
+
},
|
|
4726
|
+
delta: { x: event.delta.x, y: event.delta.y },
|
|
4727
|
+
over,
|
|
4728
|
+
active,
|
|
4729
|
+
source: dragState.source,
|
|
4730
|
+
registeredLists
|
|
4731
|
+
});
|
|
4732
|
+
setDragState({
|
|
4733
|
+
source: null,
|
|
4734
|
+
target: null,
|
|
4735
|
+
indicator: null
|
|
4736
|
+
});
|
|
4737
|
+
activatorEventRef.current = null;
|
|
4738
|
+
if (!dropTarget) return;
|
|
4739
|
+
const sourceList = registeredLists.get(dropTarget.source.listId);
|
|
4740
|
+
const targetList = registeredLists.get(dropTarget.target.listId);
|
|
4741
|
+
if (!sourceList || !targetList) return;
|
|
4742
|
+
sourceList.onMoveItem(
|
|
4743
|
+
dropTarget.source.index,
|
|
4744
|
+
dropTarget.target.index,
|
|
4745
|
+
dropTarget.indicator,
|
|
4746
|
+
dropTarget.source.listId,
|
|
4747
|
+
dropTarget.target.listId
|
|
4748
|
+
);
|
|
4749
|
+
},
|
|
4750
|
+
[registeredLists, dragState.source]
|
|
4751
|
+
);
|
|
4752
|
+
const contextValue = React45.useMemo(
|
|
4753
|
+
() => ({
|
|
4754
|
+
registerList,
|
|
4755
|
+
unregisterList
|
|
4756
|
+
}),
|
|
4757
|
+
[registerList, unregisterList]
|
|
4758
|
+
);
|
|
4759
|
+
const activeList = dragState.source ? registeredLists.get(dragState.source.listId) : null;
|
|
4760
|
+
const activeDragContextValue = React45.useMemo(
|
|
4761
|
+
() => dragState,
|
|
4762
|
+
[dragState]
|
|
4763
|
+
);
|
|
4764
|
+
const collisionDetection = (0, import_react51.useMemo)(() => {
|
|
4765
|
+
return getItemFirstCollisionDetection(Array.from(registeredLists.keys()));
|
|
4766
|
+
}, [registeredLists]);
|
|
4767
|
+
return /* @__PURE__ */ React45.createElement(AnyDragContext.Provider, { value: true }, /* @__PURE__ */ React45.createElement(sharedDragProps.dragRegistrationContext.Provider, { value: contextValue }, /* @__PURE__ */ React45.createElement(
|
|
4768
|
+
sharedDragProps.activeDragContext.Provider,
|
|
4769
|
+
{
|
|
4770
|
+
value: activeDragContextValue
|
|
4771
|
+
},
|
|
4772
|
+
/* @__PURE__ */ React45.createElement(
|
|
4773
|
+
import_core.DndContext,
|
|
4774
|
+
{
|
|
4775
|
+
sensors,
|
|
4776
|
+
collisionDetection,
|
|
4777
|
+
onDragStart: handleDragStart,
|
|
4778
|
+
onDragMove: handleDragMove,
|
|
4779
|
+
onDragEnd: handleDragEnd
|
|
4780
|
+
},
|
|
4781
|
+
children,
|
|
4782
|
+
mounted && activeList?.renderOverlay && dragState.source && (0, import_react_dom2.createPortal)(
|
|
4783
|
+
/* @__PURE__ */ React45.createElement(import_core.DragOverlay, { dropAnimation: null }, activeList.renderOverlay(dragState.source.itemId)),
|
|
4784
|
+
document.body
|
|
4785
|
+
)
|
|
4786
|
+
)
|
|
4787
|
+
)));
|
|
4788
|
+
}
|
|
4789
|
+
function useMounted() {
|
|
4790
|
+
const [mounted, setMounted] = React45.useState(false);
|
|
4791
|
+
React45.useEffect(() => {
|
|
4792
|
+
setMounted(true);
|
|
4793
|
+
}, []);
|
|
4794
|
+
return mounted;
|
|
4795
|
+
}
|
|
4796
|
+
function withDragProvider(Component) {
|
|
4797
|
+
return function WithDragProvider(props) {
|
|
4798
|
+
const anyDragContext = React45.useContext(AnyDragContext);
|
|
4799
|
+
if (!anyDragContext) {
|
|
4800
|
+
return /* @__PURE__ */ React45.createElement(SharedDragProvider, null, /* @__PURE__ */ React45.createElement(Component, { ...props }));
|
|
4801
|
+
}
|
|
4802
|
+
return /* @__PURE__ */ React45.createElement(Component, { ...props });
|
|
4803
|
+
};
|
|
4804
|
+
}
|
|
4805
|
+
var getItemFirstCollisionDetection = (registeredListIds) => (parameters) => {
|
|
4806
|
+
const pointerCollisions = (0, import_core.pointerWithin)(parameters);
|
|
4807
|
+
if (pointerCollisions.length > 0) {
|
|
4808
|
+
const itemCollisions = pointerCollisions.filter((collision) => {
|
|
4809
|
+
for (const listId of registeredListIds) {
|
|
4810
|
+
if (collision.id === listId) {
|
|
4811
|
+
return false;
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
return true;
|
|
4815
|
+
});
|
|
4816
|
+
if (itemCollisions.length > 0) {
|
|
4817
|
+
return itemCollisions;
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
return pointerCollisions.length > 0 ? pointerCollisions : (0, import_core.closestCenter)(parameters);
|
|
4821
|
+
};
|
|
4822
|
+
function findDropTarget({
|
|
4823
|
+
activationPoint,
|
|
4824
|
+
delta,
|
|
4825
|
+
over,
|
|
4826
|
+
active,
|
|
4827
|
+
source,
|
|
4828
|
+
registeredLists
|
|
4829
|
+
}) {
|
|
4830
|
+
if (!over || active.id === over.id) return;
|
|
4831
|
+
let targetListId = null;
|
|
4832
|
+
let targetIndex = -1;
|
|
4833
|
+
for (const [listId, list] of registeredLists) {
|
|
4834
|
+
const itemIndex = list.keys.findIndex((key) => key === over.id);
|
|
4835
|
+
if (itemIndex >= 0) {
|
|
4836
|
+
targetListId = listId;
|
|
4837
|
+
targetIndex = itemIndex;
|
|
4838
|
+
break;
|
|
4839
|
+
}
|
|
4840
|
+
if (over.id === listId) {
|
|
4841
|
+
targetListId = listId;
|
|
4842
|
+
targetIndex = list.keys.length;
|
|
4843
|
+
break;
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
const targetList = targetListId !== null ? registeredLists.get(targetListId) : null;
|
|
4847
|
+
const sourceList = registeredLists.get(source.listId);
|
|
4848
|
+
if (!targetList || !sourceList || !targetList.acceptsFromList({
|
|
4849
|
+
sourceListId: sourceList.id,
|
|
4850
|
+
targetListId: targetList.id
|
|
4851
|
+
})) {
|
|
4852
|
+
return;
|
|
4853
|
+
}
|
|
4854
|
+
if (over.id === targetList.id) {
|
|
4855
|
+
const canDrop = targetList.acceptsDrop(
|
|
4856
|
+
source.index,
|
|
4857
|
+
Math.max(0, targetList.keys.length - 1),
|
|
4858
|
+
// Use last valid index or 0 for empty lists
|
|
4859
|
+
"below",
|
|
4860
|
+
sourceList.id,
|
|
4861
|
+
targetList.id
|
|
4862
|
+
);
|
|
4863
|
+
if (canDrop) {
|
|
4864
|
+
return {
|
|
4865
|
+
source,
|
|
4866
|
+
target: {
|
|
4867
|
+
itemId: over.id,
|
|
4868
|
+
listId: targetList.id,
|
|
4869
|
+
index: targetIndex
|
|
4870
|
+
},
|
|
4871
|
+
indicator: "below"
|
|
4872
|
+
};
|
|
4873
|
+
}
|
|
4874
|
+
}
|
|
4875
|
+
const eventX = activationPoint.x;
|
|
4876
|
+
const eventY = activationPoint.y;
|
|
4877
|
+
const currentX = eventX + delta.x;
|
|
4878
|
+
const currentY = eventY + delta.y;
|
|
4879
|
+
const absolutePosition = { x: currentX, y: currentY };
|
|
4880
|
+
const indicator = targetList.getDropIndicator({
|
|
4881
|
+
absolutePosition,
|
|
4882
|
+
active,
|
|
4883
|
+
over,
|
|
4884
|
+
sourceListId: sourceList.id,
|
|
4885
|
+
targetListId: targetList.id
|
|
4886
|
+
});
|
|
4887
|
+
if (indicator) {
|
|
4888
|
+
return {
|
|
4889
|
+
source,
|
|
4890
|
+
target: {
|
|
4891
|
+
itemId: over.id,
|
|
4892
|
+
listId: targetList.id,
|
|
4893
|
+
index: targetIndex
|
|
4894
|
+
},
|
|
4895
|
+
indicator
|
|
4896
|
+
};
|
|
4897
|
+
}
|
|
4898
|
+
}
|
|
4899
|
+
|
|
4900
|
+
// src/components/sorting/sorting.ts
|
|
4901
|
+
var React46 = __toESM(require("react"));
|
|
4603
4902
|
var normalizeListTargetIndex = (index, position) => {
|
|
4604
4903
|
return position === "above" ? index : index + 1;
|
|
4605
4904
|
};
|
|
@@ -4611,14 +4910,15 @@ var defaultAcceptsDrop = (sourceIndex, targetIndex, position) => {
|
|
|
4611
4910
|
}
|
|
4612
4911
|
return true;
|
|
4613
4912
|
};
|
|
4614
|
-
var SortableItemContext =
|
|
4913
|
+
var SortableItemContext = React46.createContext({
|
|
4615
4914
|
keys: [],
|
|
4616
4915
|
acceptsDrop: defaultAcceptsDrop,
|
|
4617
4916
|
axis: "y",
|
|
4618
4917
|
position: { x: 0, y: 0 },
|
|
4619
4918
|
setActivatorEvent: () => {
|
|
4620
4919
|
},
|
|
4621
|
-
getDropTargetParentIndex: void 0
|
|
4920
|
+
getDropTargetParentIndex: void 0,
|
|
4921
|
+
listId: ""
|
|
4622
4922
|
});
|
|
4623
4923
|
function validateDropIndicator({
|
|
4624
4924
|
acceptsDrop: acceptsDrop2,
|
|
@@ -4627,12 +4927,21 @@ function validateDropIndicator({
|
|
|
4627
4927
|
overId,
|
|
4628
4928
|
offsetStart,
|
|
4629
4929
|
elementStart,
|
|
4630
|
-
elementSize
|
|
4930
|
+
elementSize,
|
|
4931
|
+
sourceListId,
|
|
4932
|
+
targetListId
|
|
4631
4933
|
}) {
|
|
4632
4934
|
const activeIndex = keys.findIndex((id) => id === activeId);
|
|
4633
4935
|
const overIndex = keys.findIndex((id) => id === overId);
|
|
4634
|
-
if (
|
|
4635
|
-
|
|
4936
|
+
if (overIndex === -1) return void 0;
|
|
4937
|
+
if (activeIndex === -1 && sourceListId === targetListId) return void 0;
|
|
4938
|
+
const acceptsDropInside = acceptsDrop2(
|
|
4939
|
+
activeIndex,
|
|
4940
|
+
overIndex,
|
|
4941
|
+
"inside",
|
|
4942
|
+
sourceListId,
|
|
4943
|
+
targetListId
|
|
4944
|
+
);
|
|
4636
4945
|
if (isContainedInMiddleThird(elementStart, elementSize, offsetStart) && acceptsDropInside) {
|
|
4637
4946
|
return "inside";
|
|
4638
4947
|
}
|
|
@@ -4641,7 +4950,16 @@ function validateDropIndicator({
|
|
|
4641
4950
|
elementSize,
|
|
4642
4951
|
offsetStart
|
|
4643
4952
|
);
|
|
4644
|
-
|
|
4953
|
+
if (!isContained(elementStart, elementSize, offsetStart) && sourceListId === targetListId) {
|
|
4954
|
+
return void 0;
|
|
4955
|
+
}
|
|
4956
|
+
const acceptedHalf = acceptsDrop2(
|
|
4957
|
+
activeIndex,
|
|
4958
|
+
overIndex,
|
|
4959
|
+
containingHalf,
|
|
4960
|
+
sourceListId,
|
|
4961
|
+
targetListId
|
|
4962
|
+
);
|
|
4645
4963
|
return acceptedHalf ? containingHalf : (
|
|
4646
4964
|
// Lastly, check if inside but not middle third
|
|
4647
4965
|
acceptsDropInside ? "inside" : void 0
|
|
@@ -4650,193 +4968,204 @@ function validateDropIndicator({
|
|
|
4650
4968
|
function isContainedInMiddleThird(elementStart, elementSize, offsetStart) {
|
|
4651
4969
|
return offsetStart >= elementStart + elementSize / 3 && offsetStart <= elementStart + elementSize * 2 / 3;
|
|
4652
4970
|
}
|
|
4971
|
+
function isContained(elementStart, elementSize, offsetStart) {
|
|
4972
|
+
return offsetStart >= elementStart && offsetStart <= elementStart + elementSize;
|
|
4973
|
+
}
|
|
4653
4974
|
function getContainingHalf(elementStart, elementSize, offsetStart) {
|
|
4654
4975
|
if (offsetStart < elementStart + elementSize / 2) return "above";
|
|
4655
4976
|
return "below";
|
|
4656
4977
|
}
|
|
4978
|
+
function createDragItemKey(listId, itemId) {
|
|
4979
|
+
return `${listId}-~-${itemId}`;
|
|
4980
|
+
}
|
|
4981
|
+
function parseDragItemKey(key) {
|
|
4982
|
+
const [listId, itemId] = key.split("-~-");
|
|
4983
|
+
return { listId, itemId };
|
|
4984
|
+
}
|
|
4985
|
+
|
|
4986
|
+
// src/components/sorting/Sortable.tsx
|
|
4987
|
+
var SortableItemContext2 = React47.createContext({
|
|
4988
|
+
acceptsDrop: defaultAcceptsDrop,
|
|
4989
|
+
listId: "",
|
|
4990
|
+
getDropTargetParentIndex: void 0,
|
|
4991
|
+
activeDragContext: ActiveDragContext
|
|
4992
|
+
});
|
|
4993
|
+
function useSortableDropIndicator({
|
|
4994
|
+
index,
|
|
4995
|
+
itemId,
|
|
4996
|
+
listId,
|
|
4997
|
+
acceptsDrop: acceptsDrop2,
|
|
4998
|
+
getDropTargetParentIndex
|
|
4999
|
+
}) {
|
|
5000
|
+
const { activeDragContext } = React47.useContext(SortableItemContext2);
|
|
5001
|
+
const activeDrag = useActiveDrag(activeDragContext);
|
|
5002
|
+
const { source, target } = activeDrag;
|
|
5003
|
+
if (!source || !target) return;
|
|
5004
|
+
const indicator = target.listId === listId && target.itemId === itemId ? activeDrag.indicator : void 0;
|
|
5005
|
+
const targetParentIndex = target.index === -1 ? void 0 : getDropTargetParentIndex?.(target.index);
|
|
5006
|
+
const isValidParent = targetParentIndex === void 0 || targetParentIndex === -1 ? false : acceptsDrop2(
|
|
5007
|
+
source.index,
|
|
5008
|
+
targetParentIndex,
|
|
5009
|
+
"inside",
|
|
5010
|
+
source.listId,
|
|
5011
|
+
target.listId
|
|
5012
|
+
);
|
|
5013
|
+
const overIdAcceptsDrop = target.index === -1 ? void 0 : acceptsDrop2(
|
|
5014
|
+
source.index,
|
|
5015
|
+
target.index,
|
|
5016
|
+
"inside",
|
|
5017
|
+
source.listId,
|
|
5018
|
+
target.listId
|
|
5019
|
+
);
|
|
5020
|
+
const thisItemIsTargetParent = targetParentIndex === index;
|
|
5021
|
+
const showDragInsideIndicatorOnParent = !overIdAcceptsDrop && isValidParent && thisItemIsTargetParent;
|
|
5022
|
+
return indicator ?? (showDragInsideIndicatorOnParent ? "inside" : void 0);
|
|
5023
|
+
}
|
|
4657
5024
|
function SortableItem({
|
|
4658
5025
|
id,
|
|
4659
5026
|
disabled,
|
|
4660
5027
|
children
|
|
4661
5028
|
}) {
|
|
4662
|
-
const {
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
const {
|
|
4673
|
-
active,
|
|
4674
|
-
attributes,
|
|
4675
|
-
listeners,
|
|
4676
|
-
setNodeRef,
|
|
4677
|
-
isDragging,
|
|
5029
|
+
const { acceptsDrop: acceptsDrop2, listId, getDropTargetParentIndex } = React47.useContext(SortableItemContext2);
|
|
5030
|
+
const dragItemKey = createDragItemKey(listId, id);
|
|
5031
|
+
const { attributes, listeners, setNodeRef, isDragging, index } = (0, import_sortable.useSortable)({
|
|
5032
|
+
id: dragItemKey,
|
|
5033
|
+
disabled
|
|
5034
|
+
});
|
|
5035
|
+
const ref = React47.useCallback(
|
|
5036
|
+
(node) => setNodeRef(node),
|
|
5037
|
+
[setNodeRef]
|
|
5038
|
+
);
|
|
5039
|
+
const relativeDropPosition = useSortableDropIndicator({
|
|
4678
5040
|
index,
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
over
|
|
4682
|
-
} = sortable;
|
|
4683
|
-
if (activatorEvent) {
|
|
4684
|
-
setActivatorEvent(activatorEvent);
|
|
4685
|
-
}
|
|
4686
|
-
const eventX = activatorEvent?.clientX ?? 0;
|
|
4687
|
-
const eventY = activatorEvent?.clientY ?? 0;
|
|
4688
|
-
const offsetLeft = eventX + position.x;
|
|
4689
|
-
const offsetTop = eventY + position.y;
|
|
4690
|
-
const ref = React44.useCallback((node) => setNodeRef(node), [setNodeRef]);
|
|
4691
|
-
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");
|
|
4694
|
-
const relativeDropPosition = index >= 0 && index === overIndex && !isDragging && active && over ? validateDropIndicator({
|
|
5041
|
+
itemId: dragItemKey,
|
|
5042
|
+
listId,
|
|
4695
5043
|
acceptsDrop: acceptsDrop2,
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
overId: over.id,
|
|
4699
|
-
offsetStart: axis === "x" ? offsetLeft : offsetTop,
|
|
4700
|
-
elementStart: axis === "x" ? over.rect.left : over.rect.top,
|
|
4701
|
-
elementSize: axis === "x" ? over.rect.width : over.rect.height
|
|
4702
|
-
}) : void 0;
|
|
4703
|
-
const showDragInsideIndicatorOnParent = !overIdAcceptsDrop && isValidParent && parentIndex === index;
|
|
5044
|
+
getDropTargetParentIndex
|
|
5045
|
+
});
|
|
4704
5046
|
return children({
|
|
4705
5047
|
ref,
|
|
4706
5048
|
...attributes,
|
|
4707
5049
|
...listeners,
|
|
4708
|
-
relativeDropPosition
|
|
5050
|
+
relativeDropPosition,
|
|
5051
|
+
style: {
|
|
5052
|
+
opacity: isDragging ? 0.5 : 1
|
|
5053
|
+
}
|
|
4709
5054
|
});
|
|
4710
5055
|
}
|
|
4711
|
-
function
|
|
4712
|
-
|
|
4713
|
-
|
|
5056
|
+
function SortableRoot_({
|
|
5057
|
+
id: idProp,
|
|
5058
|
+
keys: keysProp,
|
|
4714
5059
|
onMoveItem,
|
|
4715
5060
|
renderOverlay,
|
|
5061
|
+
acceptsFromList,
|
|
4716
5062
|
acceptsDrop: acceptsDrop2 = defaultAcceptsDrop,
|
|
4717
5063
|
axis = "y",
|
|
4718
|
-
|
|
5064
|
+
children,
|
|
5065
|
+
getDropTargetParentIndex,
|
|
5066
|
+
sharedDragProps,
|
|
5067
|
+
containerRef
|
|
4719
5068
|
}) {
|
|
4720
|
-
const
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
const
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
5069
|
+
const defaultId = React47.useId();
|
|
5070
|
+
const id = idProp ?? defaultId;
|
|
5071
|
+
const keys = React47.useMemo(() => {
|
|
5072
|
+
return keysProp.map((key) => createDragItemKey(id, key));
|
|
5073
|
+
}, [keysProp, id]);
|
|
5074
|
+
const { registerList, unregisterList } = useDragRegistration(
|
|
5075
|
+
sharedDragProps?.dragRegistrationContext ?? DragRegistrationContext
|
|
5076
|
+
);
|
|
5077
|
+
const { setNodeRef: setDroppableRef } = (0, import_core2.useDroppable)({
|
|
5078
|
+
id,
|
|
5079
|
+
// Make the container droppable only when the list is empty
|
|
5080
|
+
// This avoids conflicts with individual sortable items.
|
|
5081
|
+
// This isn't strictly necessary since we also use a custom collision detection
|
|
5082
|
+
// that prioritizes items over containers, but it helps with dropping into
|
|
5083
|
+
// the best position (either above or below, rather than always below).
|
|
5084
|
+
disabled: keys.length > 0
|
|
4732
5085
|
});
|
|
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({
|
|
5086
|
+
React47.useEffect(() => {
|
|
5087
|
+
const listConfig = {
|
|
5088
|
+
id,
|
|
5089
|
+
keys,
|
|
5090
|
+
onMoveItem: onMoveItem ?? (() => {
|
|
5091
|
+
}),
|
|
5092
|
+
renderOverlay: (id2) => {
|
|
5093
|
+
const index = keys.findIndex((key) => key === id2);
|
|
5094
|
+
return renderOverlay?.(index) ?? null;
|
|
5095
|
+
},
|
|
5096
|
+
acceptsFromList: acceptsFromList ?? (() => true),
|
|
5097
|
+
acceptsDrop: acceptsDrop2,
|
|
5098
|
+
getDropIndicator: (parameters) => {
|
|
5099
|
+
const { absolutePosition, active, over, sourceListId, targetListId } = parameters;
|
|
5100
|
+
const offsetStart = axis === "x" ? absolutePosition.x : absolutePosition.y;
|
|
5101
|
+
const elementStart = axis === "x" ? over.rect.left : over.rect.top;
|
|
5102
|
+
const elementSize = axis === "x" ? over.rect.width : over.rect.height;
|
|
5103
|
+
const relativeDropPosition = validateDropIndicator({
|
|
4759
5104
|
acceptsDrop: acceptsDrop2,
|
|
4760
5105
|
keys,
|
|
4761
5106
|
activeId: active.id,
|
|
4762
5107
|
overId: over.id,
|
|
4763
|
-
offsetStart
|
|
4764
|
-
elementStart
|
|
4765
|
-
elementSize
|
|
5108
|
+
offsetStart,
|
|
5109
|
+
elementStart,
|
|
5110
|
+
elementSize,
|
|
5111
|
+
sourceListId,
|
|
5112
|
+
targetListId
|
|
4766
5113
|
});
|
|
4767
|
-
|
|
4768
|
-
onMoveItem?.(oldIndex, newIndex, indicator);
|
|
5114
|
+
return relativeDropPosition;
|
|
4769
5115
|
}
|
|
4770
|
-
}
|
|
4771
|
-
|
|
5116
|
+
};
|
|
5117
|
+
registerList(listConfig);
|
|
5118
|
+
return () => {
|
|
5119
|
+
unregisterList(id);
|
|
5120
|
+
};
|
|
5121
|
+
}, [
|
|
5122
|
+
id,
|
|
5123
|
+
onMoveItem,
|
|
5124
|
+
renderOverlay,
|
|
5125
|
+
acceptsFromList,
|
|
5126
|
+
acceptsDrop2,
|
|
5127
|
+
axis,
|
|
5128
|
+
registerList,
|
|
5129
|
+
unregisterList,
|
|
5130
|
+
keys
|
|
5131
|
+
]);
|
|
5132
|
+
const contextValue = React47.useMemo(
|
|
5133
|
+
() => ({
|
|
5134
|
+
keys,
|
|
5135
|
+
acceptsDrop: acceptsDrop2,
|
|
5136
|
+
listId: id,
|
|
5137
|
+
getDropTargetParentIndex,
|
|
5138
|
+
activeDragContext: sharedDragProps?.activeDragContext ?? ActiveDragContext
|
|
5139
|
+
}),
|
|
5140
|
+
[keys, acceptsDrop2, id, getDropTargetParentIndex, sharedDragProps]
|
|
4772
5141
|
);
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
5142
|
+
React47.useEffect(() => {
|
|
5143
|
+
if (containerRef) {
|
|
5144
|
+
setDroppableRef(containerRef.current);
|
|
5145
|
+
}
|
|
5146
|
+
});
|
|
5147
|
+
return /* @__PURE__ */ React47.createElement(SortableItemContext2.Provider, { value: contextValue }, /* @__PURE__ */ React47.createElement(
|
|
5148
|
+
import_sortable.SortableContext,
|
|
4779
5149
|
{
|
|
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
|
-
)
|
|
5150
|
+
items: keys,
|
|
5151
|
+
strategy: axis === "x" ? import_sortable.horizontalListSortingStrategy : import_sortable.verticalListSortingStrategy
|
|
4798
5152
|
},
|
|
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
|
-
);
|
|
5153
|
+
children
|
|
5154
|
+
));
|
|
4822
5155
|
}
|
|
4823
|
-
var
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
shouldRenderOverlay = true,
|
|
4833
|
-
...rest
|
|
4834
|
-
} = props;
|
|
4835
|
-
const keys = React44.useMemo(
|
|
5156
|
+
var SortableRoot = withDragProvider(SortableRoot_);
|
|
5157
|
+
var Sortable_ = function Sortable_2({
|
|
5158
|
+
items,
|
|
5159
|
+
keyExtractor,
|
|
5160
|
+
shouldRenderOverlay = true,
|
|
5161
|
+
renderItem,
|
|
5162
|
+
...rest
|
|
5163
|
+
}) {
|
|
5164
|
+
const keys = React47.useMemo(
|
|
4836
5165
|
() => items.map(keyExtractor),
|
|
4837
5166
|
[items, keyExtractor]
|
|
4838
5167
|
);
|
|
4839
|
-
const renderOverlay =
|
|
5168
|
+
const renderOverlay = React47.useCallback(
|
|
4840
5169
|
(index) => {
|
|
4841
5170
|
return renderItem(
|
|
4842
5171
|
items[index],
|
|
@@ -4856,32 +5185,31 @@ var SortableComponent = memoGeneric(function Sortable(props) {
|
|
|
4856
5185
|
},
|
|
4857
5186
|
[renderItem, items]
|
|
4858
5187
|
);
|
|
4859
|
-
return /* @__PURE__ */
|
|
4860
|
-
|
|
5188
|
+
return /* @__PURE__ */ React47.createElement(
|
|
5189
|
+
SortableRoot,
|
|
4861
5190
|
{
|
|
4862
5191
|
...rest,
|
|
4863
5192
|
keys,
|
|
4864
5193
|
renderOverlay: shouldRenderOverlay ? renderOverlay : void 0
|
|
4865
5194
|
},
|
|
4866
|
-
keys.map((key, index) => /* @__PURE__ */
|
|
4867
|
-
return renderItem(
|
|
4868
|
-
items[index],
|
|
4869
|
-
props2,
|
|
4870
|
-
{ isOverlay: false }
|
|
4871
|
-
);
|
|
5195
|
+
keys.map((key, index) => /* @__PURE__ */ React47.createElement(SortableItem, { key, id: key }, (props) => {
|
|
5196
|
+
return renderItem(items[index], props, { isOverlay: false });
|
|
4872
5197
|
}))
|
|
4873
5198
|
);
|
|
5199
|
+
};
|
|
5200
|
+
var Sortable = Object.assign(Sortable_, {
|
|
5201
|
+
Root: SortableRoot,
|
|
5202
|
+
Item: SortableItem
|
|
4874
5203
|
});
|
|
4875
|
-
var Sortable2 = Object.assign(SortableComponent, SortableSubcomponents);
|
|
4876
5204
|
|
|
4877
5205
|
// src/components/ListView.tsx
|
|
4878
5206
|
var ROW_HEIGHT = 31;
|
|
4879
5207
|
var SECTION_HEADER_LABEL_HEIGHT = INPUT_HEIGHT;
|
|
4880
|
-
var ListViewDraggingContext = (0,
|
|
5208
|
+
var ListViewDraggingContext = (0, import_react52.createContext)({
|
|
4881
5209
|
indentation: 12
|
|
4882
5210
|
});
|
|
4883
5211
|
ListViewDraggingContext.displayName = "ListViewDraggingContext";
|
|
4884
|
-
var ListRowContext = (0,
|
|
5212
|
+
var ListRowContext = (0, import_react52.createContext)({
|
|
4885
5213
|
marginType: "none",
|
|
4886
5214
|
selectedPosition: "only",
|
|
4887
5215
|
sortable: false,
|
|
@@ -4899,7 +5227,7 @@ var ListViewRowTitle = ({
|
|
|
4899
5227
|
className,
|
|
4900
5228
|
children,
|
|
4901
5229
|
...props
|
|
4902
|
-
}) => /* @__PURE__ */
|
|
5230
|
+
}) => /* @__PURE__ */ import_react52.default.createElement(
|
|
4903
5231
|
"span",
|
|
4904
5232
|
{
|
|
4905
5233
|
className: cx(
|
|
@@ -4918,8 +5246,8 @@ function ListViewEditableRowTitle({
|
|
|
4918
5246
|
className,
|
|
4919
5247
|
onKeyDown
|
|
4920
5248
|
}) {
|
|
4921
|
-
const inputRef = (0,
|
|
4922
|
-
(0,
|
|
5249
|
+
const inputRef = (0, import_react52.useRef)(null);
|
|
5250
|
+
(0, import_react52.useLayoutEffect)(() => {
|
|
4923
5251
|
const element = inputRef.current;
|
|
4924
5252
|
if (!element || !autoFocus) return;
|
|
4925
5253
|
element.focus();
|
|
@@ -4927,7 +5255,7 @@ function ListViewEditableRowTitle({
|
|
|
4927
5255
|
element.select();
|
|
4928
5256
|
}, 1);
|
|
4929
5257
|
}, [autoFocus]);
|
|
4930
|
-
return /* @__PURE__ */
|
|
5258
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
4931
5259
|
InputField2.Input,
|
|
4932
5260
|
{
|
|
4933
5261
|
ref: inputRef,
|
|
@@ -4940,7 +5268,7 @@ function ListViewEditableRowTitle({
|
|
|
4940
5268
|
}
|
|
4941
5269
|
);
|
|
4942
5270
|
}
|
|
4943
|
-
var RowContainer = (0,
|
|
5271
|
+
var RowContainer = (0, import_react52.forwardRef)(
|
|
4944
5272
|
({
|
|
4945
5273
|
className,
|
|
4946
5274
|
$marginType,
|
|
@@ -4966,7 +5294,7 @@ var RowContainer = (0, import_react51.forwardRef)(
|
|
|
4966
5294
|
"aria-selected": ariaSelected,
|
|
4967
5295
|
...props
|
|
4968
5296
|
}, ref) => {
|
|
4969
|
-
return /* @__PURE__ */
|
|
5297
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
4970
5298
|
"div",
|
|
4971
5299
|
{
|
|
4972
5300
|
ref,
|
|
@@ -5034,7 +5362,7 @@ var RowContainer = (0, import_react51.forwardRef)(
|
|
|
5034
5362
|
);
|
|
5035
5363
|
}
|
|
5036
5364
|
);
|
|
5037
|
-
var ListViewDragIndicatorElement = (0,
|
|
5365
|
+
var ListViewDragIndicatorElement = (0, import_react52.forwardRef)(
|
|
5038
5366
|
({
|
|
5039
5367
|
className,
|
|
5040
5368
|
$relativeDropPosition,
|
|
@@ -5044,7 +5372,7 @@ var ListViewDragIndicatorElement = (0, import_react51.forwardRef)(
|
|
|
5044
5372
|
style: style2,
|
|
5045
5373
|
...props
|
|
5046
5374
|
}, ref) => {
|
|
5047
|
-
return /* @__PURE__ */
|
|
5375
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
5048
5376
|
"div",
|
|
5049
5377
|
{
|
|
5050
5378
|
ref,
|
|
@@ -5111,12 +5439,12 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5111
5439
|
divider,
|
|
5112
5440
|
gap: listGap,
|
|
5113
5441
|
colorScheme
|
|
5114
|
-
} = (0,
|
|
5442
|
+
} = (0, import_react52.useContext)(ListRowContext);
|
|
5115
5443
|
const { hoverProps } = useHover({
|
|
5116
5444
|
onHoverChange
|
|
5117
5445
|
});
|
|
5118
|
-
const { indentation, isDragOverlay } = (0,
|
|
5119
|
-
const handlePress = (0,
|
|
5446
|
+
const { indentation, isDragOverlay } = (0, import_react52.useContext)(ListViewDraggingContext);
|
|
5447
|
+
const handlePress = (0, import_react52.useCallback)(
|
|
5120
5448
|
(event) => {
|
|
5121
5449
|
event.preventDefault();
|
|
5122
5450
|
if (event.button !== 0) return;
|
|
@@ -5124,14 +5452,14 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5124
5452
|
},
|
|
5125
5453
|
[onPress]
|
|
5126
5454
|
);
|
|
5127
|
-
const handleDoubleClick = (0,
|
|
5455
|
+
const handleDoubleClick = (0, import_react52.useCallback)(
|
|
5128
5456
|
(event) => {
|
|
5129
5457
|
event.stopPropagation();
|
|
5130
5458
|
onDoubleClick?.();
|
|
5131
5459
|
},
|
|
5132
5460
|
[onDoubleClick]
|
|
5133
5461
|
);
|
|
5134
|
-
const mergedStyle = (0,
|
|
5462
|
+
const mergedStyle = (0, import_react52.useMemo)(() => {
|
|
5135
5463
|
return isDragOverlay ? {
|
|
5136
5464
|
// TODO: Where do these offsets actually come from?
|
|
5137
5465
|
transform: `translate3d(-36px, -6px, 0)`,
|
|
@@ -5145,7 +5473,7 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5145
5473
|
}, ref) => {
|
|
5146
5474
|
const Component = RowContainer;
|
|
5147
5475
|
const relativeDropPosition = testRelativeDropPosition ?? relativeDropPositionProp;
|
|
5148
|
-
const element = /* @__PURE__ */
|
|
5476
|
+
const element = /* @__PURE__ */ import_react52.default.createElement(
|
|
5149
5477
|
Component,
|
|
5150
5478
|
{
|
|
5151
5479
|
ref,
|
|
@@ -5179,7 +5507,7 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5179
5507
|
className,
|
|
5180
5508
|
$clickable: !!onPress
|
|
5181
5509
|
},
|
|
5182
|
-
relativeDropPosition && /* @__PURE__ */
|
|
5510
|
+
relativeDropPosition && /* @__PURE__ */ import_react52.default.createElement(
|
|
5183
5511
|
ListViewDragIndicatorElement,
|
|
5184
5512
|
{
|
|
5185
5513
|
key: relativeDropPosition,
|
|
@@ -5194,11 +5522,11 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5194
5522
|
}) : dragIndicatorStyle
|
|
5195
5523
|
}
|
|
5196
5524
|
),
|
|
5197
|
-
depth > 0 && /* @__PURE__ */
|
|
5525
|
+
depth > 0 && /* @__PURE__ */ import_react52.default.createElement(Spacer.Horizontal, { size: depth * indentation }),
|
|
5198
5526
|
children
|
|
5199
5527
|
);
|
|
5200
5528
|
if (menuItems && onSelectMenuItem) {
|
|
5201
|
-
return /* @__PURE__ */
|
|
5529
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
5202
5530
|
ContextMenu,
|
|
5203
5531
|
{
|
|
5204
5532
|
items: menuItems,
|
|
@@ -5211,23 +5539,23 @@ var ListViewRow = forwardRefGeneric(function ListViewRow2({
|
|
|
5211
5539
|
return element;
|
|
5212
5540
|
};
|
|
5213
5541
|
if (sortable && id) {
|
|
5214
|
-
return /* @__PURE__ */
|
|
5542
|
+
return /* @__PURE__ */ import_react52.default.createElement(Sortable.Item, { id, disabled: overrideSortable === false }, ({ ref: sortableRef, ...sortableProps }) => renderContent(
|
|
5215
5543
|
sortableProps,
|
|
5216
5544
|
(0, import_react_compose_refs2.composeRefs)(sortableRef, forwardedRef)
|
|
5217
5545
|
));
|
|
5218
5546
|
}
|
|
5219
5547
|
return renderContent({}, forwardedRef);
|
|
5220
5548
|
});
|
|
5221
|
-
var RenderItemContext = (0,
|
|
5549
|
+
var RenderItemContext = (0, import_react52.createContext)(
|
|
5222
5550
|
() => null
|
|
5223
5551
|
);
|
|
5224
5552
|
RenderItemContext.displayName = "RenderItemContext";
|
|
5225
|
-
var VirtualizedListRow = (0,
|
|
5553
|
+
var VirtualizedListRow = (0, import_react52.memo)(function VirtualizedListRow2({
|
|
5226
5554
|
index,
|
|
5227
5555
|
style: style2
|
|
5228
5556
|
}) {
|
|
5229
|
-
const renderItem = (0,
|
|
5230
|
-
return /* @__PURE__ */
|
|
5557
|
+
const renderItem = (0, import_react52.useContext)(RenderItemContext);
|
|
5558
|
+
return /* @__PURE__ */ import_react52.default.createElement("div", { key: index, style: style2 }, renderItem(index));
|
|
5231
5559
|
});
|
|
5232
5560
|
var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
5233
5561
|
size: size2,
|
|
@@ -5237,20 +5565,20 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5237
5565
|
keyExtractor,
|
|
5238
5566
|
renderItem
|
|
5239
5567
|
}, ref) {
|
|
5240
|
-
const listRef = (0,
|
|
5241
|
-
(0,
|
|
5568
|
+
const listRef = (0, import_react52.useRef)(null);
|
|
5569
|
+
(0, import_react52.useImperativeHandle)(ref, () => ({
|
|
5242
5570
|
scrollToIndex(index) {
|
|
5243
5571
|
listRef.current?.scrollToItem(index);
|
|
5244
5572
|
}
|
|
5245
5573
|
}));
|
|
5246
|
-
(0,
|
|
5574
|
+
(0, import_react52.useLayoutEffect)(() => {
|
|
5247
5575
|
listRef.current?.resetAfterIndex(0);
|
|
5248
5576
|
}, [
|
|
5249
5577
|
// When items change, we need to re-render the virtualized list,
|
|
5250
5578
|
// since it doesn't currently support row height changes
|
|
5251
5579
|
items
|
|
5252
5580
|
]);
|
|
5253
|
-
const listStyle = (0,
|
|
5581
|
+
const listStyle = (0, import_react52.useMemo)(
|
|
5254
5582
|
() => ({
|
|
5255
5583
|
overflowX: "initial",
|
|
5256
5584
|
overflowY: "initial",
|
|
@@ -5258,18 +5586,18 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5258
5586
|
}),
|
|
5259
5587
|
[]
|
|
5260
5588
|
);
|
|
5261
|
-
return /* @__PURE__ */
|
|
5589
|
+
return /* @__PURE__ */ import_react52.default.createElement(RenderItemContext.Provider, { value: renderItem }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5262
5590
|
import_react_virtualized.WindowScroller,
|
|
5263
5591
|
{
|
|
5264
5592
|
scrollElement,
|
|
5265
|
-
style: (0,
|
|
5593
|
+
style: (0, import_react52.useMemo)(() => ({ flex: "1 1 auto" }), [])
|
|
5266
5594
|
},
|
|
5267
|
-
(0,
|
|
5595
|
+
(0, import_react52.useCallback)(
|
|
5268
5596
|
({
|
|
5269
5597
|
registerChild,
|
|
5270
5598
|
onChildScroll,
|
|
5271
5599
|
scrollTop
|
|
5272
|
-
}) => /* @__PURE__ */
|
|
5600
|
+
}) => /* @__PURE__ */ import_react52.default.createElement("div", { ref: registerChild }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5273
5601
|
import_react_window.VariableSizeList,
|
|
5274
5602
|
{
|
|
5275
5603
|
ref: listRef,
|
|
@@ -5299,7 +5627,7 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
|
|
|
5299
5627
|
)
|
|
5300
5628
|
));
|
|
5301
5629
|
});
|
|
5302
|
-
var VirtualizedList = (0,
|
|
5630
|
+
var VirtualizedList = (0, import_react52.memo)(
|
|
5303
5631
|
VirtualizedListInner
|
|
5304
5632
|
);
|
|
5305
5633
|
var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
@@ -5333,9 +5661,11 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5333
5661
|
onDragLeave,
|
|
5334
5662
|
onDrop,
|
|
5335
5663
|
renderEmptyState,
|
|
5336
|
-
getDropTargetParentIndex
|
|
5664
|
+
getDropTargetParentIndex,
|
|
5665
|
+
sharedDragProps,
|
|
5666
|
+
sortableId
|
|
5337
5667
|
}, forwardedRef) {
|
|
5338
|
-
const handleClick = (0,
|
|
5668
|
+
const handleClick = (0, import_react52.useCallback)(
|
|
5339
5669
|
(event) => {
|
|
5340
5670
|
if (event.target instanceof HTMLElement && event.target.classList.contains("scroll-component"))
|
|
5341
5671
|
return;
|
|
@@ -5345,11 +5675,11 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5345
5675
|
},
|
|
5346
5676
|
[onPress]
|
|
5347
5677
|
);
|
|
5348
|
-
const renderChild = (0,
|
|
5678
|
+
const renderChild = (0, import_react52.useCallback)(
|
|
5349
5679
|
(index) => renderItem(data[index], index, { isDragOverlay: false }),
|
|
5350
5680
|
[data, renderItem]
|
|
5351
5681
|
);
|
|
5352
|
-
const defaultContextValue = (0,
|
|
5682
|
+
const defaultContextValue = (0, import_react52.useMemo)(
|
|
5353
5683
|
() => ({
|
|
5354
5684
|
colorScheme,
|
|
5355
5685
|
marginType: "none",
|
|
@@ -5374,16 +5704,16 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5374
5704
|
sectionHeaderVariant
|
|
5375
5705
|
]
|
|
5376
5706
|
);
|
|
5377
|
-
const getItemContextValue = (0,
|
|
5707
|
+
const getItemContextValue = (0, import_react52.useCallback)(
|
|
5378
5708
|
(i) => {
|
|
5379
5709
|
if (variant === "bare" || variant === "normal")
|
|
5380
5710
|
return defaultContextValue;
|
|
5381
5711
|
const current = renderChild(i);
|
|
5382
|
-
if (!(0,
|
|
5712
|
+
if (!(0, import_react52.isValidElement)(current)) return;
|
|
5383
5713
|
const prevChild = i - 1 >= 0 && renderChild(i - 1);
|
|
5384
5714
|
const nextChild = i + 1 < data.length && renderChild(i + 1);
|
|
5385
|
-
const next = (0,
|
|
5386
|
-
const prev = (0,
|
|
5715
|
+
const next = (0, import_react52.isValidElement)(nextChild) ? nextChild : void 0;
|
|
5716
|
+
const prev = (0, import_react52.isValidElement)(prevChild) ? prevChild : void 0;
|
|
5387
5717
|
const hasMarginTop = !prev;
|
|
5388
5718
|
const hasMarginBottom = !next || current.props.isSectionHeader || next && next.props.isSectionHeader;
|
|
5389
5719
|
let marginType;
|
|
@@ -5436,37 +5766,39 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5436
5766
|
gap
|
|
5437
5767
|
]
|
|
5438
5768
|
);
|
|
5439
|
-
const draggingContextOverlayValue = (0,
|
|
5769
|
+
const draggingContextOverlayValue = (0, import_react52.useMemo)(
|
|
5440
5770
|
() => ({ indentation, isDragOverlay: true }),
|
|
5441
5771
|
[indentation]
|
|
5442
5772
|
);
|
|
5443
|
-
const renderOverlay = (0,
|
|
5444
|
-
(index) => /* @__PURE__ */
|
|
5773
|
+
const renderOverlay = (0, import_react52.useCallback)(
|
|
5774
|
+
(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
5775
|
[draggingContextOverlayValue, renderItem, data]
|
|
5446
5776
|
);
|
|
5447
|
-
const renderWrappedChild = (0,
|
|
5777
|
+
const renderWrappedChild = (0, import_react52.useCallback)(
|
|
5448
5778
|
(index) => {
|
|
5449
5779
|
const contextValue = getItemContextValue(index);
|
|
5450
5780
|
const current = renderChild(index);
|
|
5451
|
-
if (!contextValue || !(0,
|
|
5452
|
-
return /* @__PURE__ */
|
|
5781
|
+
if (!contextValue || !(0, import_react52.isValidElement)(current)) return null;
|
|
5782
|
+
return /* @__PURE__ */ import_react52.default.createElement(ListRowContext.Provider, { key: current.key, value: contextValue }, current);
|
|
5453
5783
|
},
|
|
5454
5784
|
[getItemContextValue, renderChild]
|
|
5455
5785
|
);
|
|
5456
|
-
const ids = (0,
|
|
5457
|
-
const withSortable = (children) => sortable ? /* @__PURE__ */
|
|
5458
|
-
|
|
5786
|
+
const ids = (0, import_react52.useMemo)(() => data.map(keyExtractor), [keyExtractor, data]);
|
|
5787
|
+
const withSortable = (children) => sortable ? /* @__PURE__ */ import_react52.default.createElement(
|
|
5788
|
+
Sortable.Root,
|
|
5459
5789
|
{
|
|
5790
|
+
id: sortableId,
|
|
5460
5791
|
onMoveItem,
|
|
5461
5792
|
keys: ids,
|
|
5462
5793
|
renderOverlay,
|
|
5463
5794
|
acceptsDrop: acceptsDrop2,
|
|
5464
|
-
getDropTargetParentIndex
|
|
5795
|
+
getDropTargetParentIndex,
|
|
5796
|
+
sharedDragProps
|
|
5465
5797
|
},
|
|
5466
5798
|
children
|
|
5467
5799
|
) : children;
|
|
5468
|
-
const withScrollable = (children) => scrollable ? /* @__PURE__ */
|
|
5469
|
-
const getItemHeight = (0,
|
|
5800
|
+
const withScrollable = (children) => scrollable ? /* @__PURE__ */ import_react52.default.createElement(ScrollArea, null, children) : children(null);
|
|
5801
|
+
const getItemHeight = (0, import_react52.useCallback)(
|
|
5470
5802
|
(index) => {
|
|
5471
5803
|
const child = getItemContextValue(index);
|
|
5472
5804
|
const height = child?.isSectionHeader && child.sectionHeaderVariant === "label" ? SECTION_HEADER_LABEL_HEIGHT : ROW_HEIGHT;
|
|
@@ -5474,13 +5806,13 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5474
5806
|
},
|
|
5475
5807
|
[getItemContextValue]
|
|
5476
5808
|
);
|
|
5477
|
-
const getKey = (0,
|
|
5809
|
+
const getKey = (0, import_react52.useCallback)(
|
|
5478
5810
|
(index) => keyExtractor(data[index], index),
|
|
5479
5811
|
[data, keyExtractor]
|
|
5480
5812
|
);
|
|
5481
|
-
const draggingContextValue = (0,
|
|
5482
|
-
const gapStyle = (0,
|
|
5483
|
-
return /* @__PURE__ */
|
|
5813
|
+
const draggingContextValue = (0, import_react52.useMemo)(() => ({ indentation }), [indentation]);
|
|
5814
|
+
const gapStyle = (0, import_react52.useMemo)(() => ({ gap: `${gap}px` }), [gap]);
|
|
5815
|
+
return /* @__PURE__ */ import_react52.default.createElement(ListViewDraggingContext.Provider, { value: draggingContextValue }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5484
5816
|
"div",
|
|
5485
5817
|
{
|
|
5486
5818
|
id,
|
|
@@ -5509,7 +5841,7 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5509
5841
|
},
|
|
5510
5842
|
data.length === 0 && renderEmptyState ? renderEmptyState() : withScrollable(
|
|
5511
5843
|
(scrollElementRef) => withSortable(
|
|
5512
|
-
virtualized ? /* @__PURE__ */
|
|
5844
|
+
virtualized ? /* @__PURE__ */ import_react52.default.createElement(
|
|
5513
5845
|
VirtualizedList,
|
|
5514
5846
|
{
|
|
5515
5847
|
ref: forwardedRef,
|
|
@@ -5526,40 +5858,40 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5526
5858
|
));
|
|
5527
5859
|
});
|
|
5528
5860
|
var ListViewRoot = memoGeneric(ListViewRootInner);
|
|
5529
|
-
var ChildrenListViewInner = (0,
|
|
5530
|
-
const items = (0,
|
|
5531
|
-
() =>
|
|
5532
|
-
(child) => (0,
|
|
5861
|
+
var ChildrenListViewInner = (0, import_react52.forwardRef)(function ChildrenListViewInner2({ children, ...rest }, forwardedRef) {
|
|
5862
|
+
const items = (0, import_react52.useMemo)(
|
|
5863
|
+
() => import_react52.Children.toArray(children).flatMap(
|
|
5864
|
+
(child) => (0, import_react52.isValidElement)(child) ? [child] : []
|
|
5533
5865
|
),
|
|
5534
5866
|
[children]
|
|
5535
5867
|
);
|
|
5536
|
-
return /* @__PURE__ */
|
|
5868
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
5537
5869
|
ListViewRoot,
|
|
5538
5870
|
{
|
|
5539
5871
|
ref: forwardedRef,
|
|
5540
5872
|
...rest,
|
|
5541
5873
|
data: items,
|
|
5542
|
-
keyExtractor: (0,
|
|
5874
|
+
keyExtractor: (0, import_react52.useCallback)(
|
|
5543
5875
|
({ key }, index) => typeof key === "string" ? key : (key ?? index).toString(),
|
|
5544
5876
|
[]
|
|
5545
5877
|
),
|
|
5546
|
-
renderItem: (0,
|
|
5878
|
+
renderItem: (0, import_react52.useCallback)((item) => item, [])
|
|
5547
5879
|
}
|
|
5548
5880
|
);
|
|
5549
5881
|
});
|
|
5550
|
-
var ChildrenListView = (0,
|
|
5882
|
+
var ChildrenListView = (0, import_react52.memo)(ChildrenListViewInner);
|
|
5551
5883
|
var SimpleListViewInner = forwardRefGeneric(function SimpleListViewInner2(props, forwardedRef) {
|
|
5552
5884
|
if ("children" in props) {
|
|
5553
|
-
return /* @__PURE__ */
|
|
5885
|
+
return /* @__PURE__ */ import_react52.default.createElement(ChildrenListView, { ref: forwardedRef, ...props });
|
|
5554
5886
|
} else {
|
|
5555
|
-
return /* @__PURE__ */
|
|
5887
|
+
return /* @__PURE__ */ import_react52.default.createElement(ListViewRoot, { ref: forwardedRef, ...props });
|
|
5556
5888
|
}
|
|
5557
5889
|
});
|
|
5558
5890
|
var SimpleListView = memoGeneric(SimpleListViewInner);
|
|
5559
5891
|
var ListView;
|
|
5560
5892
|
((ListView2) => {
|
|
5561
|
-
ListView2.RowTitle = (0,
|
|
5562
|
-
ListView2.EditableRowTitle = (0,
|
|
5893
|
+
ListView2.RowTitle = (0, import_react52.memo)(ListViewRowTitle);
|
|
5894
|
+
ListView2.EditableRowTitle = (0, import_react52.memo)(ListViewEditableRowTitle);
|
|
5563
5895
|
ListView2.Row = memoGeneric(ListViewRow);
|
|
5564
5896
|
ListView2.Root = SimpleListView;
|
|
5565
5897
|
ListView2.RowContext = ListRowContext;
|
|
@@ -5576,7 +5908,7 @@ var ListView;
|
|
|
5576
5908
|
})(ListView || (ListView = {}));
|
|
5577
5909
|
|
|
5578
5910
|
// src/components/TreeView.tsx
|
|
5579
|
-
var
|
|
5911
|
+
var import_react53 = __toESM(require("react"));
|
|
5580
5912
|
var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
5581
5913
|
icon,
|
|
5582
5914
|
expanded,
|
|
@@ -5585,15 +5917,15 @@ var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
|
5585
5917
|
children,
|
|
5586
5918
|
...rest
|
|
5587
5919
|
}, forwardedRef) {
|
|
5588
|
-
const { expandable } = (0,
|
|
5589
|
-
const handleClickChevron = (0,
|
|
5920
|
+
const { expandable } = (0, import_react53.useContext)(ListView.RowContext);
|
|
5921
|
+
const handleClickChevron = (0, import_react53.useCallback)(
|
|
5590
5922
|
(event) => {
|
|
5591
5923
|
event.stopPropagation();
|
|
5592
5924
|
onClickChevron?.({ altKey: event.altKey });
|
|
5593
5925
|
},
|
|
5594
5926
|
[onClickChevron]
|
|
5595
5927
|
);
|
|
5596
|
-
return /* @__PURE__ */
|
|
5928
|
+
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
5929
|
IconButton,
|
|
5598
5930
|
{
|
|
5599
5931
|
className: chevronClassName,
|
|
@@ -5601,7 +5933,7 @@ var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
|
5601
5933
|
onClick: handleClickChevron,
|
|
5602
5934
|
selected: rest.selected
|
|
5603
5935
|
}
|
|
5604
|
-
), /* @__PURE__ */
|
|
5936
|
+
), /* @__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
5937
|
});
|
|
5606
5938
|
var TreeView;
|
|
5607
5939
|
((TreeView2) => {
|
|
@@ -5654,11 +5986,13 @@ var List = memoGeneric(
|
|
|
5654
5986
|
getDropTargetParentIndex,
|
|
5655
5987
|
getPlaceholder,
|
|
5656
5988
|
onClickItem,
|
|
5657
|
-
dragIndicatorStyle
|
|
5989
|
+
dragIndicatorStyle,
|
|
5990
|
+
sortableId,
|
|
5991
|
+
sharedDragProps
|
|
5658
5992
|
} = props;
|
|
5659
|
-
const [internalHoveredId, setHoveredId] = (0,
|
|
5660
|
-
const [internalRenamingId, setRenamingId] = (0,
|
|
5661
|
-
const [dropdownOpenId, setDropdownOpenId] = (0,
|
|
5993
|
+
const [internalHoveredId, setHoveredId] = (0, import_react54.useState)();
|
|
5994
|
+
const [internalRenamingId, setRenamingId] = (0, import_react54.useState)();
|
|
5995
|
+
const [dropdownOpenId, setDropdownOpenId] = (0, import_react54.useState)();
|
|
5662
5996
|
const hoveredId = internalHoveredId ?? testHoveredId;
|
|
5663
5997
|
const renamingId = testRenamingId ?? internalRenamingId;
|
|
5664
5998
|
const handleSelect = (itemId, event) => {
|
|
@@ -5683,17 +6017,17 @@ var List = memoGeneric(
|
|
|
5683
6017
|
);
|
|
5684
6018
|
};
|
|
5685
6019
|
const ViewComponent = expandable ? TreeView : ListView;
|
|
5686
|
-
const fileDropTargetRef = (0,
|
|
6020
|
+
const fileDropTargetRef = (0, import_react54.useRef)(null);
|
|
5687
6021
|
const { isDropTargetActive, dropTargetProps } = useFileDropTarget(
|
|
5688
6022
|
fileDropTargetRef,
|
|
5689
6023
|
onFilesDrop
|
|
5690
6024
|
);
|
|
5691
|
-
(0,
|
|
6025
|
+
(0, import_react54.useImperativeHandle)(ref, () => ({
|
|
5692
6026
|
editName: (id) => {
|
|
5693
6027
|
setRenamingId(id);
|
|
5694
6028
|
}
|
|
5695
6029
|
}));
|
|
5696
|
-
return /* @__PURE__ */
|
|
6030
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5697
6031
|
ViewComponent.Root,
|
|
5698
6032
|
{
|
|
5699
6033
|
variant: "bare",
|
|
@@ -5715,6 +6049,8 @@ var List = memoGeneric(
|
|
|
5715
6049
|
onMoveItem,
|
|
5716
6050
|
renderEmptyState,
|
|
5717
6051
|
getDropTargetParentIndex,
|
|
6052
|
+
sharedDragProps,
|
|
6053
|
+
sortableId,
|
|
5718
6054
|
...dropTargetProps,
|
|
5719
6055
|
renderItem: (item, _, { isDragOverlay }) => {
|
|
5720
6056
|
const id = getId(item);
|
|
@@ -5736,7 +6072,7 @@ var List = memoGeneric(
|
|
|
5736
6072
|
handleSelect(id);
|
|
5737
6073
|
}
|
|
5738
6074
|
};
|
|
5739
|
-
const action = (isHovered || isSelected) && !isRenaming && (typeof renderAction === "function" ? renderAction({ item, selected: isSelected, onOpenChange }) : renderAction === "menu" && menuItems && /* @__PURE__ */
|
|
6075
|
+
const action = (isHovered || isSelected) && !isRenaming && (typeof renderAction === "function" ? renderAction({ item, selected: isSelected, onOpenChange }) : renderAction === "menu" && menuItems && /* @__PURE__ */ import_react54.default.createElement(
|
|
5740
6076
|
ActionMenu,
|
|
5741
6077
|
{
|
|
5742
6078
|
menuItems,
|
|
@@ -5752,7 +6088,7 @@ var List = memoGeneric(
|
|
|
5752
6088
|
));
|
|
5753
6089
|
const end = action || detailPosition === "end" && renderDetail?.(item, isSelected);
|
|
5754
6090
|
const below = detailPosition === "below" && renderDetail?.(item, isSelected);
|
|
5755
|
-
return /* @__PURE__ */
|
|
6091
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5756
6092
|
ViewComponent.Row,
|
|
5757
6093
|
{
|
|
5758
6094
|
id,
|
|
@@ -5800,12 +6136,12 @@ var List = memoGeneric(
|
|
|
5800
6136
|
},
|
|
5801
6137
|
dragIndicatorStyle
|
|
5802
6138
|
},
|
|
5803
|
-
/* @__PURE__ */
|
|
6139
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5804
6140
|
"div",
|
|
5805
6141
|
{
|
|
5806
6142
|
className: cx("flex flex-1 items-center px-2", rowGapMap[size2])
|
|
5807
6143
|
},
|
|
5808
|
-
thumbnail && /* @__PURE__ */
|
|
6144
|
+
thumbnail && /* @__PURE__ */ import_react54.default.createElement(
|
|
5809
6145
|
"div",
|
|
5810
6146
|
{
|
|
5811
6147
|
className: cx(
|
|
@@ -5818,7 +6154,7 @@ var List = memoGeneric(
|
|
|
5818
6154
|
},
|
|
5819
6155
|
thumbnail
|
|
5820
6156
|
),
|
|
5821
|
-
/* @__PURE__ */
|
|
6157
|
+
/* @__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
6158
|
ViewComponent.EditableRowTitle,
|
|
5823
6159
|
{
|
|
5824
6160
|
value: getName(item),
|
|
@@ -5833,7 +6169,7 @@ var List = memoGeneric(
|
|
|
5833
6169
|
e.stopPropagation();
|
|
5834
6170
|
}
|
|
5835
6171
|
}
|
|
5836
|
-
) : /* @__PURE__ */
|
|
6172
|
+
) : /* @__PURE__ */ import_react54.default.createElement(
|
|
5837
6173
|
ViewComponent.RowTitle,
|
|
5838
6174
|
{
|
|
5839
6175
|
className: cx(
|
|
@@ -5842,8 +6178,8 @@ var List = memoGeneric(
|
|
|
5842
6178
|
)
|
|
5843
6179
|
},
|
|
5844
6180
|
getName(item)
|
|
5845
|
-
)), end && detailPosition === "end" && /* @__PURE__ */
|
|
5846
|
-
end && detailPosition === "below" && /* @__PURE__ */
|
|
6181
|
+
)), end && detailPosition === "end" && /* @__PURE__ */ import_react54.default.createElement(DetailContainer, { selected: isSelected }, end)), below && /* @__PURE__ */ import_react54.default.createElement(DetailContainer, { selected: isSelected }, below)),
|
|
6182
|
+
end && detailPosition === "below" && /* @__PURE__ */ import_react54.default.createElement(DetailContainer, { selected: isSelected }, end)
|
|
5847
6183
|
)
|
|
5848
6184
|
);
|
|
5849
6185
|
}
|
|
@@ -5851,11 +6187,11 @@ var List = memoGeneric(
|
|
|
5851
6187
|
);
|
|
5852
6188
|
})
|
|
5853
6189
|
);
|
|
5854
|
-
var DetailContainer = (0,
|
|
6190
|
+
var DetailContainer = (0, import_react54.memo)(function DetailContainer2({
|
|
5855
6191
|
children,
|
|
5856
6192
|
selected
|
|
5857
6193
|
}) {
|
|
5858
|
-
return /* @__PURE__ */
|
|
6194
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5859
6195
|
"div",
|
|
5860
6196
|
{
|
|
5861
6197
|
className: cx("flex items-center gap-2", selected && "text-primary"),
|
|
@@ -5900,20 +6236,20 @@ var fontStyleMap = {
|
|
|
5900
6236
|
// src/components/Collection.tsx
|
|
5901
6237
|
var Collection = forwardRefGeneric(function Collection2(props, ref) {
|
|
5902
6238
|
const { viewType, ...rest } = props;
|
|
5903
|
-
return viewType === "grid" ? /* @__PURE__ */
|
|
6239
|
+
return viewType === "grid" ? /* @__PURE__ */ import_react55.default.createElement(Grid, { ref, ...rest }) : /* @__PURE__ */ import_react55.default.createElement(List, { ref, ...rest });
|
|
5904
6240
|
});
|
|
5905
6241
|
|
|
5906
6242
|
// src/components/ColorSwatch.tsx
|
|
5907
|
-
var
|
|
6243
|
+
var import_react56 = __toESM(require("react"));
|
|
5908
6244
|
var colorSwatchSizeMap = {
|
|
5909
6245
|
xsmall: 21,
|
|
5910
6246
|
small: 27,
|
|
5911
6247
|
medium: 36,
|
|
5912
6248
|
large: 48
|
|
5913
6249
|
};
|
|
5914
|
-
var ColorSwatch = (0,
|
|
6250
|
+
var ColorSwatch = (0, import_react56.forwardRef)(function ColorSwatch2({ color, size: size2 = "small", checked, style: style2, ...props }, ref) {
|
|
5915
6251
|
const sizePx = colorSwatchSizeMap[size2];
|
|
5916
|
-
return /* @__PURE__ */
|
|
6252
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5917
6253
|
"button",
|
|
5918
6254
|
{
|
|
5919
6255
|
...props,
|
|
@@ -5934,7 +6270,7 @@ var ColorSwatch = (0, import_react55.forwardRef)(function ColorSwatch2({ color,
|
|
|
5934
6270
|
|
|
5935
6271
|
// src/components/ColorSwatchControl.tsx
|
|
5936
6272
|
var ToggleGroupPrimitive = __toESM(require("@radix-ui/react-toggle-group"));
|
|
5937
|
-
var
|
|
6273
|
+
var import_react57 = __toESM(require("react"));
|
|
5938
6274
|
function ColorSwatchControl(props) {
|
|
5939
6275
|
const {
|
|
5940
6276
|
options,
|
|
@@ -5949,7 +6285,7 @@ function ColorSwatchControl(props) {
|
|
|
5949
6285
|
id,
|
|
5950
6286
|
style: style2
|
|
5951
6287
|
} = props;
|
|
5952
|
-
const styles3 = (0,
|
|
6288
|
+
const styles3 = (0, import_react57.useMemo)(() => {
|
|
5953
6289
|
return {
|
|
5954
6290
|
display: "grid",
|
|
5955
6291
|
gridTemplateColumns: `repeat(auto-fill, minmax(${colorSwatchSizeMap[size2]}px, 1fr))`,
|
|
@@ -5957,8 +6293,8 @@ function ColorSwatchControl(props) {
|
|
|
5957
6293
|
...style2
|
|
5958
6294
|
};
|
|
5959
6295
|
}, [size2, style2]);
|
|
5960
|
-
const content = /* @__PURE__ */
|
|
5961
|
-
const item = /* @__PURE__ */
|
|
6296
|
+
const content = /* @__PURE__ */ import_react57.default.createElement("div", { className, id, style: styles3 }, options.map((option) => {
|
|
6297
|
+
const item = /* @__PURE__ */ import_react57.default.createElement(
|
|
5962
6298
|
ColorSwatch,
|
|
5963
6299
|
{
|
|
5964
6300
|
key: option,
|
|
@@ -5971,7 +6307,7 @@ function ColorSwatchControl(props) {
|
|
|
5971
6307
|
checked: value === option
|
|
5972
6308
|
}
|
|
5973
6309
|
);
|
|
5974
|
-
return /* @__PURE__ */
|
|
6310
|
+
return /* @__PURE__ */ import_react57.default.createElement(
|
|
5975
6311
|
ToggleGroupPrimitive.Item,
|
|
5976
6312
|
{
|
|
5977
6313
|
asChild: true,
|
|
@@ -5982,7 +6318,7 @@ function ColorSwatchControl(props) {
|
|
|
5982
6318
|
item
|
|
5983
6319
|
);
|
|
5984
6320
|
}));
|
|
5985
|
-
return /* @__PURE__ */
|
|
6321
|
+
return /* @__PURE__ */ import_react57.default.createElement(
|
|
5986
6322
|
ToggleGroupPrimitive.Root,
|
|
5987
6323
|
{
|
|
5988
6324
|
type: "single",
|
|
@@ -5997,11 +6333,11 @@ function ColorSwatchControl(props) {
|
|
|
5997
6333
|
|
|
5998
6334
|
// src/components/Combobox.tsx
|
|
5999
6335
|
var import_noya_icons5 = require("@noya-app/noya-icons");
|
|
6000
|
-
var
|
|
6336
|
+
var import_react60 = __toESM(require("react"));
|
|
6001
6337
|
|
|
6002
6338
|
// src/utils/combobox.ts
|
|
6003
6339
|
var import_noya_utils9 = require("@noya-app/noya-utils");
|
|
6004
|
-
var
|
|
6340
|
+
var import_react58 = require("react");
|
|
6005
6341
|
|
|
6006
6342
|
// src/utils/fuzzyScorer.ts
|
|
6007
6343
|
var import_vscode_fuzzy_scorer = require("vscode-fuzzy-scorer");
|
|
@@ -6323,7 +6659,7 @@ function getNextIndex({
|
|
|
6323
6659
|
return nextIndex;
|
|
6324
6660
|
}
|
|
6325
6661
|
function useComboboxState(state) {
|
|
6326
|
-
return (0,
|
|
6662
|
+
return (0, import_react58.useSyncExternalStore)(
|
|
6327
6663
|
state.subscribe,
|
|
6328
6664
|
state.getSnapshot,
|
|
6329
6665
|
state.getSnapshot
|
|
@@ -6332,7 +6668,7 @@ function useComboboxState(state) {
|
|
|
6332
6668
|
|
|
6333
6669
|
// src/components/ComboboxMenu.tsx
|
|
6334
6670
|
var import_noya_icons4 = require("@noya-app/noya-icons");
|
|
6335
|
-
var
|
|
6671
|
+
var import_react59 = __toESM(require("react"));
|
|
6336
6672
|
var ComboboxMenu = memoGeneric(
|
|
6337
6673
|
forwardRefGeneric(function ComboboxMenu2({
|
|
6338
6674
|
items,
|
|
@@ -6344,7 +6680,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6344
6680
|
indented,
|
|
6345
6681
|
iconPosition = "right"
|
|
6346
6682
|
}, forwardedRef) {
|
|
6347
|
-
return /* @__PURE__ */
|
|
6683
|
+
return /* @__PURE__ */ import_react59.default.createElement(
|
|
6348
6684
|
ListView.Root,
|
|
6349
6685
|
{
|
|
6350
6686
|
ref: forwardedRef,
|
|
@@ -6360,7 +6696,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6360
6696
|
style: style2,
|
|
6361
6697
|
renderItem: (item, i) => {
|
|
6362
6698
|
if (item.type === "sectionHeader") {
|
|
6363
|
-
return /* @__PURE__ */
|
|
6699
|
+
return /* @__PURE__ */ import_react59.default.createElement(ListView.Row, { key: item.id, isSectionHeader: true }, indented && /* @__PURE__ */ import_react59.default.createElement(
|
|
6364
6700
|
Spacer.Horizontal,
|
|
6365
6701
|
{
|
|
6366
6702
|
size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET + CHECKBOX_INDENT_WIDTH
|
|
@@ -6371,7 +6707,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6371
6707
|
item: typeof item.title === "string" ? item.title : item.value,
|
|
6372
6708
|
itemScore: item
|
|
6373
6709
|
});
|
|
6374
|
-
return /* @__PURE__ */
|
|
6710
|
+
return /* @__PURE__ */ import_react59.default.createElement(
|
|
6375
6711
|
ListView.Row,
|
|
6376
6712
|
{
|
|
6377
6713
|
key: item.value,
|
|
@@ -6384,12 +6720,12 @@ var ComboboxMenu = memoGeneric(
|
|
|
6384
6720
|
}
|
|
6385
6721
|
}
|
|
6386
6722
|
},
|
|
6387
|
-
/* @__PURE__ */
|
|
6723
|
+
/* @__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
6724
|
Spacer.Horizontal,
|
|
6389
6725
|
{
|
|
6390
6726
|
size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET
|
|
6391
6727
|
}
|
|
6392
|
-
) : null, iconPosition === "left" && item.icon && /* @__PURE__ */
|
|
6728
|
+
) : 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
6729
|
"span",
|
|
6394
6730
|
{
|
|
6395
6731
|
key: `${item.value}-token-${j}`,
|
|
@@ -6400,7 +6736,7 @@ var ComboboxMenu = memoGeneric(
|
|
|
6400
6736
|
},
|
|
6401
6737
|
token.text
|
|
6402
6738
|
))),
|
|
6403
|
-
(item.shortcut || item.icon && iconPosition === "right") && /* @__PURE__ */
|
|
6739
|
+
(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
6740
|
);
|
|
6405
6741
|
}
|
|
6406
6742
|
}
|
|
@@ -6427,7 +6763,7 @@ var Combobox = memoGeneric(
|
|
|
6427
6763
|
onDeleteWhenEmpty,
|
|
6428
6764
|
...rest
|
|
6429
6765
|
}, forwardedRef) {
|
|
6430
|
-
const props = (0,
|
|
6766
|
+
const props = (0, import_react60.useMemo)(() => {
|
|
6431
6767
|
if (rest.mode === "string") {
|
|
6432
6768
|
return {
|
|
6433
6769
|
mode: rest.mode,
|
|
@@ -6457,7 +6793,7 @@ var Combobox = memoGeneric(
|
|
|
6457
6793
|
rest.onBlur,
|
|
6458
6794
|
rest.allowArbitraryValues
|
|
6459
6795
|
]);
|
|
6460
|
-
const ref = (0,
|
|
6796
|
+
const ref = (0, import_react60.useRef)(null);
|
|
6461
6797
|
function getInitialValueString() {
|
|
6462
6798
|
if (props.mode === "string") {
|
|
6463
6799
|
return props.value ?? "";
|
|
@@ -6466,7 +6802,7 @@ var Combobox = memoGeneric(
|
|
|
6466
6802
|
}
|
|
6467
6803
|
}
|
|
6468
6804
|
const initialValueString = getInitialValueString();
|
|
6469
|
-
const [comboboxState] = (0,
|
|
6805
|
+
const [comboboxState] = (0, import_react60.useState)(
|
|
6470
6806
|
() => new ComboboxState(
|
|
6471
6807
|
items,
|
|
6472
6808
|
initialValueString,
|
|
@@ -6474,26 +6810,26 @@ var Combobox = memoGeneric(
|
|
|
6474
6810
|
)
|
|
6475
6811
|
);
|
|
6476
6812
|
const state = useComboboxState(comboboxState);
|
|
6477
|
-
const [isFocused, setIsFocused] = (0,
|
|
6478
|
-
const listRef = (0,
|
|
6479
|
-
const [shouldBlur, setShouldBlur] = (0,
|
|
6813
|
+
const [isFocused, setIsFocused] = (0, import_react60.useState)(false);
|
|
6814
|
+
const listRef = (0, import_react60.useRef)(null);
|
|
6815
|
+
const [shouldBlur, setShouldBlur] = (0, import_react60.useState)(false);
|
|
6480
6816
|
const { fieldId: id } = useLabel({
|
|
6481
6817
|
fieldId: rest.id
|
|
6482
6818
|
});
|
|
6483
|
-
(0,
|
|
6819
|
+
(0, import_react60.useEffect)(() => {
|
|
6484
6820
|
comboboxState.setItems(items);
|
|
6485
6821
|
}, [items, comboboxState]);
|
|
6486
|
-
(0,
|
|
6822
|
+
(0, import_react60.useEffect)(() => {
|
|
6487
6823
|
comboboxState.setFilter(initialValueString);
|
|
6488
6824
|
}, [comboboxState, initialValueString]);
|
|
6489
6825
|
const { filter, selectedIndex, filteredItems } = state;
|
|
6490
6826
|
const shouldShowMenu = isFocused && !(hideMenuWhenEmptyValue && filter === "");
|
|
6491
|
-
(0,
|
|
6827
|
+
(0, import_react60.useEffect)(() => {
|
|
6492
6828
|
if (listRef.current) {
|
|
6493
6829
|
listRef.current.scrollToIndex(selectedIndex);
|
|
6494
6830
|
}
|
|
6495
6831
|
}, [selectedIndex]);
|
|
6496
|
-
const handleBlur = (0,
|
|
6832
|
+
const handleBlur = (0, import_react60.useCallback)(() => {
|
|
6497
6833
|
ref.current?.blur();
|
|
6498
6834
|
comboboxState.reset(initialValueString);
|
|
6499
6835
|
if (props.mode === "string") {
|
|
@@ -6512,7 +6848,7 @@ var Combobox = memoGeneric(
|
|
|
6512
6848
|
}
|
|
6513
6849
|
setIsFocused(false);
|
|
6514
6850
|
}, [filter, initialValueString, props, state, comboboxState]);
|
|
6515
|
-
const handleFocus = (0,
|
|
6851
|
+
const handleFocus = (0, import_react60.useCallback)(
|
|
6516
6852
|
(event) => {
|
|
6517
6853
|
setIsFocused(true);
|
|
6518
6854
|
comboboxState.reset(
|
|
@@ -6526,7 +6862,7 @@ var Combobox = memoGeneric(
|
|
|
6526
6862
|
},
|
|
6527
6863
|
[initialValueString, onFocus, openMenuBehavior, comboboxState]
|
|
6528
6864
|
);
|
|
6529
|
-
const handleUpdateSelection = (0,
|
|
6865
|
+
const handleUpdateSelection = (0, import_react60.useCallback)(
|
|
6530
6866
|
(item) => {
|
|
6531
6867
|
if (item.type !== void 0) return;
|
|
6532
6868
|
const selectedItem = comboboxState.selectCurrentItem(item);
|
|
@@ -6542,7 +6878,7 @@ var Combobox = memoGeneric(
|
|
|
6542
6878
|
},
|
|
6543
6879
|
[props, comboboxState]
|
|
6544
6880
|
);
|
|
6545
|
-
const handleIndexChange = (0,
|
|
6881
|
+
const handleIndexChange = (0, import_react60.useCallback)(
|
|
6546
6882
|
(index) => {
|
|
6547
6883
|
comboboxState.setSelectedIndex(index);
|
|
6548
6884
|
const item = comboboxState.getSelectedItem();
|
|
@@ -6558,7 +6894,7 @@ var Combobox = memoGeneric(
|
|
|
6558
6894
|
},
|
|
6559
6895
|
[props, comboboxState]
|
|
6560
6896
|
);
|
|
6561
|
-
const handleChange = (0,
|
|
6897
|
+
const handleChange = (0, import_react60.useCallback)(
|
|
6562
6898
|
(value) => {
|
|
6563
6899
|
if (readOnly) return;
|
|
6564
6900
|
comboboxState.setFilter(value);
|
|
@@ -6573,7 +6909,7 @@ var Combobox = memoGeneric(
|
|
|
6573
6909
|
},
|
|
6574
6910
|
[readOnly, props, comboboxState]
|
|
6575
6911
|
);
|
|
6576
|
-
const handleKeyDown = (0,
|
|
6912
|
+
const handleKeyDown = (0, import_react60.useCallback)(
|
|
6577
6913
|
(event) => {
|
|
6578
6914
|
let handled = false;
|
|
6579
6915
|
const item = comboboxState.getSelectedItem();
|
|
@@ -6662,7 +6998,7 @@ var Combobox = memoGeneric(
|
|
|
6662
6998
|
]
|
|
6663
6999
|
);
|
|
6664
7000
|
const typeaheadValue = comboboxState.getTypeaheadValue();
|
|
6665
|
-
(0,
|
|
7001
|
+
(0, import_react60.useImperativeHandle)(forwardedRef, () => ({
|
|
6666
7002
|
focus: () => {
|
|
6667
7003
|
ref.current?.focus();
|
|
6668
7004
|
if (ref.current) {
|
|
@@ -6681,7 +7017,7 @@ var Combobox = memoGeneric(
|
|
|
6681
7017
|
ref.current?.setSelectionRange(0, ref.current.value.length);
|
|
6682
7018
|
}
|
|
6683
7019
|
}));
|
|
6684
|
-
const handleChevronClick = (0,
|
|
7020
|
+
const handleChevronClick = (0, import_react60.useCallback)(
|
|
6685
7021
|
(event) => {
|
|
6686
7022
|
event.stopPropagation();
|
|
6687
7023
|
if (shouldShowMenu) {
|
|
@@ -6701,14 +7037,14 @@ var Combobox = memoGeneric(
|
|
|
6701
7037
|
comboboxState
|
|
6702
7038
|
]
|
|
6703
7039
|
);
|
|
6704
|
-
(0,
|
|
7040
|
+
(0, import_react60.useEffect)(() => {
|
|
6705
7041
|
if (!shouldBlur) return;
|
|
6706
7042
|
if (document.activeElement !== ref.current) return;
|
|
6707
7043
|
setShouldBlur(false);
|
|
6708
7044
|
ref.current?.focus();
|
|
6709
7045
|
handleBlur();
|
|
6710
7046
|
}, [shouldBlur, handleBlur]);
|
|
6711
|
-
const { sectionHeaderCount, menuItemsCount } = (0,
|
|
7047
|
+
const { sectionHeaderCount, menuItemsCount } = (0, import_react60.useMemo)(
|
|
6712
7048
|
() => ({
|
|
6713
7049
|
sectionHeaderCount: filteredItems.filter(
|
|
6714
7050
|
(item) => isMenuItemSectionHeader(item)
|
|
@@ -6722,19 +7058,19 @@ var Combobox = memoGeneric(
|
|
|
6722
7058
|
const hasCheckedItems = items.some(
|
|
6723
7059
|
(item) => isSelectableMenuItem(item) && item.checked
|
|
6724
7060
|
);
|
|
6725
|
-
return /* @__PURE__ */
|
|
7061
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
6726
7062
|
InputField2.Root,
|
|
6727
7063
|
{
|
|
6728
7064
|
id,
|
|
6729
7065
|
size: size2,
|
|
6730
7066
|
sideOffset: 6,
|
|
6731
|
-
end: /* @__PURE__ */
|
|
7067
|
+
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
7068
|
InputField2.Button,
|
|
6733
7069
|
{
|
|
6734
7070
|
variant: "floating",
|
|
6735
7071
|
onClick: handleChevronClick
|
|
6736
7072
|
},
|
|
6737
|
-
/* @__PURE__ */
|
|
7073
|
+
/* @__PURE__ */ import_react60.default.createElement(
|
|
6738
7074
|
import_noya_icons5.DropdownChevronIcon,
|
|
6739
7075
|
{
|
|
6740
7076
|
className: cx(
|
|
@@ -6753,7 +7089,7 @@ var Combobox = memoGeneric(
|
|
|
6753
7089
|
ListView.rowHeight * 10.5
|
|
6754
7090
|
);
|
|
6755
7091
|
const listSize = { width, height };
|
|
6756
|
-
return /* @__PURE__ */
|
|
7092
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
6757
7093
|
"div",
|
|
6758
7094
|
{
|
|
6759
7095
|
className: cx(
|
|
@@ -6761,7 +7097,7 @@ var Combobox = memoGeneric(
|
|
|
6761
7097
|
shouldShowMenu && !readOnly ? "flex" : "hidden"
|
|
6762
7098
|
)
|
|
6763
7099
|
},
|
|
6764
|
-
filteredItems.length > 0 && !loading ? /* @__PURE__ */
|
|
7100
|
+
filteredItems.length > 0 && !loading ? /* @__PURE__ */ import_react60.default.createElement(
|
|
6765
7101
|
ComboboxMenu,
|
|
6766
7102
|
{
|
|
6767
7103
|
ref: listRef,
|
|
@@ -6775,11 +7111,11 @@ var Combobox = memoGeneric(
|
|
|
6775
7111
|
},
|
|
6776
7112
|
indented: hasCheckedItems
|
|
6777
7113
|
}
|
|
6778
|
-
) : /* @__PURE__ */
|
|
7114
|
+
) : /* @__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
7115
|
);
|
|
6780
7116
|
}
|
|
6781
7117
|
},
|
|
6782
|
-
/* @__PURE__ */
|
|
7118
|
+
/* @__PURE__ */ import_react60.default.createElement(
|
|
6783
7119
|
InputField2.Input,
|
|
6784
7120
|
{
|
|
6785
7121
|
ref,
|
|
@@ -6804,7 +7140,7 @@ var Combobox = memoGeneric(
|
|
|
6804
7140
|
...readOnly ? { readOnly: true } : {}
|
|
6805
7141
|
}
|
|
6806
7142
|
),
|
|
6807
|
-
filter && typeaheadValue && typeaheadValue.toLowerCase().startsWith(filter.toLowerCase()) && /* @__PURE__ */
|
|
7143
|
+
filter && typeaheadValue && typeaheadValue.toLowerCase().startsWith(filter.toLowerCase()) && /* @__PURE__ */ import_react60.default.createElement(
|
|
6808
7144
|
InputField2.Typeahead,
|
|
6809
7145
|
{
|
|
6810
7146
|
value: typeaheadValue,
|
|
@@ -6818,22 +7154,22 @@ var Combobox = memoGeneric(
|
|
|
6818
7154
|
);
|
|
6819
7155
|
|
|
6820
7156
|
// src/components/CommandPalette.tsx
|
|
6821
|
-
var
|
|
7157
|
+
var import_react63 = __toESM(require("react"));
|
|
6822
7158
|
|
|
6823
7159
|
// src/components/SearchCompletionMenu.tsx
|
|
6824
7160
|
var import_noya_keymap5 = require("@noya-app/noya-keymap");
|
|
6825
|
-
var
|
|
7161
|
+
var import_react62 = __toESM(require("react"));
|
|
6826
7162
|
|
|
6827
7163
|
// src/components/Divider.tsx
|
|
6828
|
-
var
|
|
6829
|
-
var Divider = (0,
|
|
7164
|
+
var import_react61 = __toESM(require("react"));
|
|
7165
|
+
var Divider = (0, import_react61.memo)(function Divider2({
|
|
6830
7166
|
variant = "normal",
|
|
6831
7167
|
overflow = 0,
|
|
6832
7168
|
className,
|
|
6833
7169
|
style: style2,
|
|
6834
7170
|
...props
|
|
6835
7171
|
}) {
|
|
6836
|
-
return /* @__PURE__ */
|
|
7172
|
+
return /* @__PURE__ */ import_react61.default.createElement(
|
|
6837
7173
|
"div",
|
|
6838
7174
|
{
|
|
6839
7175
|
className: cx(
|
|
@@ -6853,14 +7189,14 @@ var Divider = (0, import_react60.memo)(function Divider2({
|
|
|
6853
7189
|
}
|
|
6854
7190
|
);
|
|
6855
7191
|
});
|
|
6856
|
-
var DividerVertical = (0,
|
|
7192
|
+
var DividerVertical = (0, import_react61.memo)(function DividerVertical2({
|
|
6857
7193
|
variant = "normal",
|
|
6858
7194
|
overflow = 0,
|
|
6859
7195
|
className,
|
|
6860
7196
|
style: style2,
|
|
6861
7197
|
...props
|
|
6862
7198
|
}) {
|
|
6863
|
-
return /* @__PURE__ */
|
|
7199
|
+
return /* @__PURE__ */ import_react61.default.createElement(
|
|
6864
7200
|
"div",
|
|
6865
7201
|
{
|
|
6866
7202
|
className: cx(`
|
|
@@ -6880,7 +7216,7 @@ var DividerVertical = (0, import_react60.memo)(function DividerVertical2({
|
|
|
6880
7216
|
});
|
|
6881
7217
|
|
|
6882
7218
|
// src/components/SearchCompletionMenu.tsx
|
|
6883
|
-
var SearchCompletionMenu = (0,
|
|
7219
|
+
var SearchCompletionMenu = (0, import_react62.forwardRef)(function SearchCompletionMenu2({
|
|
6884
7220
|
onSelect,
|
|
6885
7221
|
onHover,
|
|
6886
7222
|
onClose,
|
|
@@ -6889,17 +7225,17 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6889
7225
|
testSelectedIndex,
|
|
6890
7226
|
testSearch
|
|
6891
7227
|
}, forwardedRef) {
|
|
6892
|
-
const [state, setState] = (0,
|
|
7228
|
+
const [state, setState] = (0, import_react62.useState)({
|
|
6893
7229
|
search: testSearch ?? "",
|
|
6894
7230
|
index: 0
|
|
6895
7231
|
});
|
|
6896
7232
|
const { index, search } = state;
|
|
6897
|
-
const listRef =
|
|
7233
|
+
const listRef = import_react62.default.useRef(null);
|
|
6898
7234
|
const hasCheckedItems = items.some((item) => item.checked);
|
|
6899
|
-
(0,
|
|
7235
|
+
(0, import_react62.useEffect)(() => {
|
|
6900
7236
|
listRef.current?.scrollToIndex(index);
|
|
6901
7237
|
}, [index]);
|
|
6902
|
-
const results = (0,
|
|
7238
|
+
const results = (0, import_react62.useMemo)(
|
|
6903
7239
|
() => fuzzyFilter({
|
|
6904
7240
|
items: items.map(
|
|
6905
7241
|
(item) => typeof item.title === "string" ? item.title : item.value
|
|
@@ -6911,13 +7247,13 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6911
7247
|
})),
|
|
6912
7248
|
[items, search]
|
|
6913
7249
|
);
|
|
6914
|
-
const setSearch = (0,
|
|
7250
|
+
const setSearch = (0, import_react62.useCallback)((search2) => {
|
|
6915
7251
|
setState((state2) => ({ ...state2, search: search2, index: 0 }));
|
|
6916
7252
|
}, []);
|
|
6917
|
-
const setIndex = (0,
|
|
7253
|
+
const setIndex = (0, import_react62.useCallback)((index2) => {
|
|
6918
7254
|
setState((state2) => ({ ...state2, index: index2 }));
|
|
6919
7255
|
}, []);
|
|
6920
|
-
(0,
|
|
7256
|
+
(0, import_react62.useEffect)(() => {
|
|
6921
7257
|
onHover?.(results[index]);
|
|
6922
7258
|
}, [index, onHover, results]);
|
|
6923
7259
|
const searchHeight = 31;
|
|
@@ -6932,14 +7268,14 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6932
7268
|
width: listSize.width,
|
|
6933
7269
|
height: searchHeight + listSize.height
|
|
6934
7270
|
};
|
|
6935
|
-
const selectAndClose = (0,
|
|
7271
|
+
const selectAndClose = (0, import_react62.useCallback)(
|
|
6936
7272
|
(item) => {
|
|
6937
7273
|
onSelect(item);
|
|
6938
7274
|
onClose();
|
|
6939
7275
|
},
|
|
6940
7276
|
[onSelect, onClose]
|
|
6941
7277
|
);
|
|
6942
|
-
const handleKeyDown = (0,
|
|
7278
|
+
const handleKeyDown = (0, import_react62.useCallback)(
|
|
6943
7279
|
(event) => {
|
|
6944
7280
|
(0, import_noya_keymap5.handleKeyboardEvent)(event.nativeEvent, (0, import_noya_keymap5.getCurrentPlatform)(navigator), {
|
|
6945
7281
|
ArrowUp: () => {
|
|
@@ -6967,13 +7303,13 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6967
7303
|
},
|
|
6968
7304
|
[index, onClose, selectAndClose, results, setIndex]
|
|
6969
7305
|
);
|
|
6970
|
-
const inputRef = (0,
|
|
6971
|
-
(0,
|
|
7306
|
+
const inputRef = (0, import_react62.useRef)(null);
|
|
7307
|
+
(0, import_react62.useImperativeHandle)(forwardedRef, () => ({
|
|
6972
7308
|
focus: () => {
|
|
6973
7309
|
inputRef.current?.focus();
|
|
6974
7310
|
}
|
|
6975
7311
|
}));
|
|
6976
|
-
return /* @__PURE__ */
|
|
7312
|
+
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
7313
|
InputField2.Input,
|
|
6978
7314
|
{
|
|
6979
7315
|
ref: inputRef,
|
|
@@ -6993,7 +7329,7 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
6993
7329
|
onChange: setSearch,
|
|
6994
7330
|
onKeyDown: handleKeyDown
|
|
6995
7331
|
}
|
|
6996
|
-
)), /* @__PURE__ */
|
|
7332
|
+
)), /* @__PURE__ */ import_react62.default.createElement(Divider, null), results.length > 0 ? /* @__PURE__ */ import_react62.default.createElement(
|
|
6997
7333
|
ComboboxMenu,
|
|
6998
7334
|
{
|
|
6999
7335
|
ref: listRef,
|
|
@@ -7008,29 +7344,29 @@ var SearchCompletionMenu = (0, import_react61.forwardRef)(function SearchComplet
|
|
|
7008
7344
|
onHoverIndex: setIndex,
|
|
7009
7345
|
indented: hasCheckedItems
|
|
7010
7346
|
}
|
|
7011
|
-
) : /* @__PURE__ */
|
|
7347
|
+
) : /* @__PURE__ */ import_react62.default.createElement(
|
|
7012
7348
|
"div",
|
|
7013
7349
|
{
|
|
7014
7350
|
...listSize,
|
|
7015
7351
|
className: "flex flex-col p-20 items-center justify-center"
|
|
7016
7352
|
},
|
|
7017
|
-
/* @__PURE__ */
|
|
7353
|
+
/* @__PURE__ */ import_react62.default.createElement(Small, { color: "textDisabled" }, "No results")
|
|
7018
7354
|
));
|
|
7019
7355
|
});
|
|
7020
7356
|
|
|
7021
7357
|
// src/components/CommandPalette.tsx
|
|
7022
|
-
var CommandPalette = (0,
|
|
7358
|
+
var CommandPalette = (0, import_react63.memo)(function CommandPalette2({
|
|
7023
7359
|
showCommandPalette,
|
|
7024
7360
|
setShowCommandPalette,
|
|
7025
7361
|
items,
|
|
7026
7362
|
onSelect,
|
|
7027
7363
|
onHover
|
|
7028
7364
|
}) {
|
|
7029
|
-
const menuRef =
|
|
7030
|
-
const handleClose =
|
|
7365
|
+
const menuRef = import_react63.default.useRef(null);
|
|
7366
|
+
const handleClose = import_react63.default.useCallback(() => {
|
|
7031
7367
|
setShowCommandPalette(false);
|
|
7032
7368
|
}, [setShowCommandPalette]);
|
|
7033
|
-
return /* @__PURE__ */
|
|
7369
|
+
return /* @__PURE__ */ import_react63.default.createElement(
|
|
7034
7370
|
Dialog,
|
|
7035
7371
|
{
|
|
7036
7372
|
style: {
|
|
@@ -7056,7 +7392,7 @@ var CommandPalette = (0, import_react62.memo)(function CommandPalette2({
|
|
|
7056
7392
|
}, 0);
|
|
7057
7393
|
}
|
|
7058
7394
|
},
|
|
7059
|
-
/* @__PURE__ */
|
|
7395
|
+
/* @__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
7396
|
SearchCompletionMenu,
|
|
7061
7397
|
{
|
|
7062
7398
|
ref: menuRef,
|
|
@@ -7071,21 +7407,21 @@ var CommandPalette = (0, import_react62.memo)(function CommandPalette2({
|
|
|
7071
7407
|
});
|
|
7072
7408
|
|
|
7073
7409
|
// src/components/connected-users-menu/ConnectedUsersMenuLayout.tsx
|
|
7074
|
-
var
|
|
7075
|
-
var UserAvatar = ({ userId, name, image }) => /* @__PURE__ */
|
|
7410
|
+
var import_react64 = __toESM(require("react"));
|
|
7411
|
+
var UserAvatar = ({ userId, name, image }) => /* @__PURE__ */ import_react64.default.createElement(
|
|
7076
7412
|
Tooltip,
|
|
7077
7413
|
{
|
|
7078
7414
|
key: userId,
|
|
7079
|
-
content: /* @__PURE__ */
|
|
7415
|
+
content: /* @__PURE__ */ import_react64.default.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ import_react64.default.createElement(Small, null, name))
|
|
7080
7416
|
},
|
|
7081
|
-
/* @__PURE__ */
|
|
7417
|
+
/* @__PURE__ */ import_react64.default.createElement(Avatar, { size: INPUT_HEIGHT, userId, name, image })
|
|
7082
7418
|
);
|
|
7083
7419
|
var ConnectedUsersMenuLayout = ({
|
|
7084
7420
|
renderUsers,
|
|
7085
7421
|
launchAIAssistant,
|
|
7086
7422
|
isAssistantOpen
|
|
7087
7423
|
}) => {
|
|
7088
|
-
return /* @__PURE__ */
|
|
7424
|
+
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
7425
|
Button_default,
|
|
7090
7426
|
{
|
|
7091
7427
|
active: isAssistantOpen,
|
|
@@ -7098,7 +7434,7 @@ var ConnectedUsersMenuLayout = ({
|
|
|
7098
7434
|
|
|
7099
7435
|
// src/components/DraggableMenuButton.tsx
|
|
7100
7436
|
var import_noya_icons6 = require("@noya-app/noya-icons");
|
|
7101
|
-
var
|
|
7437
|
+
var import_react65 = __toESM(require("react"));
|
|
7102
7438
|
var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
7103
7439
|
items,
|
|
7104
7440
|
onSelect,
|
|
@@ -7107,9 +7443,9 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7107
7443
|
className,
|
|
7108
7444
|
style: style2
|
|
7109
7445
|
}) {
|
|
7110
|
-
const [open, setOpen] = (0,
|
|
7111
|
-
const [downPosition, setDownPosition] = (0,
|
|
7112
|
-
const handlePointerDownCapture = (0,
|
|
7446
|
+
const [open, setOpen] = (0, import_react65.useState)(false);
|
|
7447
|
+
const [downPosition, setDownPosition] = (0, import_react65.useState)(null);
|
|
7448
|
+
const handlePointerDownCapture = (0, import_react65.useCallback)(
|
|
7113
7449
|
(event) => {
|
|
7114
7450
|
if (open) {
|
|
7115
7451
|
setDownPosition(null);
|
|
@@ -7122,7 +7458,7 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7122
7458
|
},
|
|
7123
7459
|
[open]
|
|
7124
7460
|
);
|
|
7125
|
-
const handlePointerUp = (0,
|
|
7461
|
+
const handlePointerUp = (0, import_react65.useCallback)(
|
|
7126
7462
|
(event) => {
|
|
7127
7463
|
if (open || !downPosition) {
|
|
7128
7464
|
setDownPosition(null);
|
|
@@ -7138,13 +7474,13 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7138
7474
|
},
|
|
7139
7475
|
[downPosition, open]
|
|
7140
7476
|
);
|
|
7141
|
-
const handleOpenChange = (0,
|
|
7477
|
+
const handleOpenChange = (0, import_react65.useCallback)(
|
|
7142
7478
|
(isOpen) => {
|
|
7143
7479
|
if (!isOpen) setOpen(false);
|
|
7144
7480
|
},
|
|
7145
7481
|
[setOpen]
|
|
7146
7482
|
);
|
|
7147
|
-
return /* @__PURE__ */
|
|
7483
|
+
return /* @__PURE__ */ import_react65.default.createElement(
|
|
7148
7484
|
"div",
|
|
7149
7485
|
{
|
|
7150
7486
|
className: cx(
|
|
@@ -7160,7 +7496,7 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7160
7496
|
onClick?.();
|
|
7161
7497
|
}
|
|
7162
7498
|
},
|
|
7163
|
-
items && onSelect ? /* @__PURE__ */
|
|
7499
|
+
items && onSelect ? /* @__PURE__ */ import_react65.default.createElement(
|
|
7164
7500
|
DropdownMenu,
|
|
7165
7501
|
{
|
|
7166
7502
|
open,
|
|
@@ -7169,13 +7505,13 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7169
7505
|
onSelect,
|
|
7170
7506
|
shouldBindKeyboardShortcuts: false
|
|
7171
7507
|
},
|
|
7172
|
-
/* @__PURE__ */
|
|
7508
|
+
/* @__PURE__ */ import_react65.default.createElement("div", { className: "pointer-events-none h-[15px]" }, /* @__PURE__ */ import_react65.default.createElement(
|
|
7173
7509
|
import_noya_icons6.DragHandleDots2Icon,
|
|
7174
7510
|
{
|
|
7175
7511
|
color: isVisible || open ? cssVars.colors.icon : "transparent"
|
|
7176
7512
|
}
|
|
7177
7513
|
))
|
|
7178
|
-
) : /* @__PURE__ */
|
|
7514
|
+
) : /* @__PURE__ */ import_react65.default.createElement(
|
|
7179
7515
|
import_noya_icons6.DragHandleDots2Icon,
|
|
7180
7516
|
{
|
|
7181
7517
|
color: isVisible || open ? cssVars.colors.icon : "transparent"
|
|
@@ -7186,10 +7522,10 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7186
7522
|
|
|
7187
7523
|
// src/components/Drawer.tsx
|
|
7188
7524
|
var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
|
|
7189
|
-
var
|
|
7190
|
-
var
|
|
7191
|
-
var Drawer =
|
|
7192
|
-
|
|
7525
|
+
var React61 = __toESM(require("react"));
|
|
7526
|
+
var import_react66 = require("react");
|
|
7527
|
+
var Drawer = React61.memo(
|
|
7528
|
+
React61.forwardRef(function Drawer2({
|
|
7193
7529
|
open,
|
|
7194
7530
|
onOpenChange,
|
|
7195
7531
|
trigger,
|
|
@@ -7208,7 +7544,7 @@ var Drawer = React58.memo(
|
|
|
7208
7544
|
value: open,
|
|
7209
7545
|
onChange: onOpenChange
|
|
7210
7546
|
});
|
|
7211
|
-
(0,
|
|
7547
|
+
(0, import_react66.useImperativeHandle)(forwardedRef, () => ({
|
|
7212
7548
|
expand: () => {
|
|
7213
7549
|
setInternalOpen(true);
|
|
7214
7550
|
},
|
|
@@ -7219,7 +7555,7 @@ var Drawer = React58.memo(
|
|
|
7219
7555
|
return internalOpen;
|
|
7220
7556
|
}
|
|
7221
7557
|
}));
|
|
7222
|
-
const inner = /* @__PURE__ */
|
|
7558
|
+
const inner = /* @__PURE__ */ React61.createElement(React61.Fragment, null, /* @__PURE__ */ React61.createElement(
|
|
7223
7559
|
Dialog3.Overlay,
|
|
7224
7560
|
{
|
|
7225
7561
|
className: cx(
|
|
@@ -7227,7 +7563,7 @@ var Drawer = React58.memo(
|
|
|
7227
7563
|
positioning === "absolute" ? "absolute" : "fixed"
|
|
7228
7564
|
)
|
|
7229
7565
|
}
|
|
7230
|
-
), /* @__PURE__ */
|
|
7566
|
+
), /* @__PURE__ */ React61.createElement(
|
|
7231
7567
|
Dialog3.Content,
|
|
7232
7568
|
{
|
|
7233
7569
|
id,
|
|
@@ -7239,24 +7575,24 @@ var Drawer = React58.memo(
|
|
|
7239
7575
|
className
|
|
7240
7576
|
)
|
|
7241
7577
|
},
|
|
7242
|
-
title && /* @__PURE__ */
|
|
7578
|
+
title && /* @__PURE__ */ React61.createElement(Dialog3.Title, null, title),
|
|
7243
7579
|
children
|
|
7244
7580
|
));
|
|
7245
|
-
return /* @__PURE__ */
|
|
7581
|
+
return /* @__PURE__ */ React61.createElement(
|
|
7246
7582
|
Dialog3.Root,
|
|
7247
7583
|
{
|
|
7248
7584
|
key: "dialog",
|
|
7249
7585
|
open: internalOpen,
|
|
7250
7586
|
onOpenChange: setInternalOpen
|
|
7251
7587
|
},
|
|
7252
|
-
/* @__PURE__ */
|
|
7253
|
-
portalled ? /* @__PURE__ */
|
|
7588
|
+
/* @__PURE__ */ React61.createElement(Dialog3.Trigger, { key: "trigger" }, trigger),
|
|
7589
|
+
portalled ? /* @__PURE__ */ React61.createElement(Dialog3.Portal, { container: portalContainer }, inner) : inner
|
|
7254
7590
|
);
|
|
7255
7591
|
})
|
|
7256
7592
|
);
|
|
7257
7593
|
|
|
7258
7594
|
// src/components/Fade.tsx
|
|
7259
|
-
var
|
|
7595
|
+
var import_react67 = __toESM(require("react"));
|
|
7260
7596
|
var Fade = ({
|
|
7261
7597
|
children,
|
|
7262
7598
|
direction = "right",
|
|
@@ -7278,7 +7614,7 @@ var Fade = ({
|
|
|
7278
7614
|
top: "left-0 right-0 top-0",
|
|
7279
7615
|
bottom: "left-0 right-0 bottom-0"
|
|
7280
7616
|
}[direction];
|
|
7281
|
-
return /* @__PURE__ */
|
|
7617
|
+
return /* @__PURE__ */ import_react67.default.createElement("div", { className: cx("relative", className), style: { height } }, position === "front" ? children : null, /* @__PURE__ */ import_react67.default.createElement(
|
|
7282
7618
|
"div",
|
|
7283
7619
|
{
|
|
7284
7620
|
className: cx(
|
|
@@ -7297,17 +7633,17 @@ var Fade = ({
|
|
|
7297
7633
|
};
|
|
7298
7634
|
|
|
7299
7635
|
// src/components/file-explorer/FileExplorerLayout.tsx
|
|
7300
|
-
var
|
|
7636
|
+
var import_react68 = __toESM(require("react"));
|
|
7301
7637
|
var FileExplorerLayout = ({
|
|
7302
7638
|
children,
|
|
7303
7639
|
className,
|
|
7304
7640
|
...props
|
|
7305
|
-
}) => /* @__PURE__ */
|
|
7641
|
+
}) => /* @__PURE__ */ import_react68.default.createElement(Section, { className: cx(className, "px-3 flex-1"), ...props }, children);
|
|
7306
7642
|
var FileExplorerUploadButton = ({
|
|
7307
7643
|
showUploadButton,
|
|
7308
7644
|
onUpload,
|
|
7309
7645
|
children
|
|
7310
|
-
}) => /* @__PURE__ */
|
|
7646
|
+
}) => /* @__PURE__ */ import_react68.default.createElement("div", { className: "flex items-center gap-2" }, showUploadButton && /* @__PURE__ */ import_react68.default.createElement(
|
|
7311
7647
|
IconButton,
|
|
7312
7648
|
{
|
|
7313
7649
|
iconName: "UploadIcon",
|
|
@@ -7318,14 +7654,14 @@ var FileExplorerUploadButton = ({
|
|
|
7318
7654
|
), children);
|
|
7319
7655
|
var FileExplorerCollection = forwardRefGeneric(
|
|
7320
7656
|
function FileExplorerCollection2({ ...props }, ref) {
|
|
7321
|
-
return /* @__PURE__ */
|
|
7657
|
+
return /* @__PURE__ */ import_react68.default.createElement(Collection, { ref, className: "-mx-3 flex-1", ...props });
|
|
7322
7658
|
}
|
|
7323
7659
|
);
|
|
7324
7660
|
var FileExplorerDetail = ({
|
|
7325
7661
|
selected,
|
|
7326
7662
|
size: size2,
|
|
7327
7663
|
children
|
|
7328
|
-
}) => /* @__PURE__ */
|
|
7664
|
+
}) => /* @__PURE__ */ import_react68.default.createElement(
|
|
7329
7665
|
"span",
|
|
7330
7666
|
{
|
|
7331
7667
|
className: cx(
|
|
@@ -7338,10 +7674,10 @@ var FileExplorerDetail = ({
|
|
|
7338
7674
|
var FileExplorerEmptyState = ({
|
|
7339
7675
|
label = "No files",
|
|
7340
7676
|
...props
|
|
7341
|
-
}) => /* @__PURE__ */
|
|
7677
|
+
}) => /* @__PURE__ */ import_react68.default.createElement(Banner, { label, className: "mx-3", ...props });
|
|
7342
7678
|
|
|
7343
7679
|
// src/components/FillInputField.tsx
|
|
7344
|
-
var
|
|
7680
|
+
var import_react70 = __toESM(require("react"));
|
|
7345
7681
|
|
|
7346
7682
|
// ../noya-file-format/src/types.ts
|
|
7347
7683
|
var types_exports = {};
|
|
@@ -7666,25 +8002,25 @@ var ClassValue = /* @__PURE__ */ ((ClassValue2) => {
|
|
|
7666
8002
|
})(ClassValue || {});
|
|
7667
8003
|
|
|
7668
8004
|
// src/components/FillPreviewBackground.tsx
|
|
7669
|
-
var
|
|
8005
|
+
var React65 = __toESM(require("react"));
|
|
7670
8006
|
|
|
7671
8007
|
// src/contexts/ImageDataContext.tsx
|
|
7672
|
-
var
|
|
7673
|
-
var ImageDataContext =
|
|
8008
|
+
var React64 = __toESM(require("react"));
|
|
8009
|
+
var ImageDataContext = React64.createContext(
|
|
7674
8010
|
void 0
|
|
7675
8011
|
);
|
|
7676
|
-
var ImageDataProvider =
|
|
8012
|
+
var ImageDataProvider = React64.memo(function ImageDataProvider2({
|
|
7677
8013
|
children,
|
|
7678
8014
|
getImageData
|
|
7679
8015
|
}) {
|
|
7680
|
-
const contextValue =
|
|
8016
|
+
const contextValue = React64.useMemo(
|
|
7681
8017
|
() => ({ getImageData: getImageData ?? (() => void 0) }),
|
|
7682
8018
|
[getImageData]
|
|
7683
8019
|
);
|
|
7684
|
-
return /* @__PURE__ */
|
|
8020
|
+
return /* @__PURE__ */ React64.createElement(ImageDataContext.Provider, { value: contextValue }, children);
|
|
7685
8021
|
});
|
|
7686
8022
|
function useImageData(ref) {
|
|
7687
|
-
const value =
|
|
8023
|
+
const value = React64.useContext(ImageDataContext);
|
|
7688
8024
|
if (!value) {
|
|
7689
8025
|
throw new Error("Missing ImageDataProvider");
|
|
7690
8026
|
}
|
|
@@ -7692,14 +8028,14 @@ function useImageData(ref) {
|
|
|
7692
8028
|
}
|
|
7693
8029
|
|
|
7694
8030
|
// src/hooks/useObjectURL.ts
|
|
7695
|
-
var
|
|
8031
|
+
var import_react69 = require("react");
|
|
7696
8032
|
function useObjectURL(object) {
|
|
7697
|
-
const objectURL = (0,
|
|
8033
|
+
const objectURL = (0, import_react69.useMemo)(() => {
|
|
7698
8034
|
if (object instanceof Blob) return URL.createObjectURL(object);
|
|
7699
8035
|
const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
|
|
7700
8036
|
return URL.createObjectURL(new Blob([bytes]));
|
|
7701
8037
|
}, [object]);
|
|
7702
|
-
(0,
|
|
8038
|
+
(0, import_react69.useLayoutEffect)(() => {
|
|
7703
8039
|
return () => URL.revokeObjectURL(objectURL);
|
|
7704
8040
|
}, [objectURL]);
|
|
7705
8041
|
return objectURL;
|
|
@@ -7750,10 +8086,10 @@ var dotsHorizontalSvg = (fillColor) => `
|
|
|
7750
8086
|
<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
8087
|
</svg>
|
|
7752
8088
|
`;
|
|
7753
|
-
var Background =
|
|
8089
|
+
var Background = React65.memo(function Background2({
|
|
7754
8090
|
background: background2
|
|
7755
8091
|
}) {
|
|
7756
|
-
return /* @__PURE__ */
|
|
8092
|
+
return /* @__PURE__ */ React65.createElement(
|
|
7757
8093
|
"span",
|
|
7758
8094
|
{
|
|
7759
8095
|
className: `${background2 ? `bg-[${background2}]` : "bg-input-background"} absolute inset-0`
|
|
@@ -7772,7 +8108,7 @@ function getPatternSizeAndPosition(fillType, tileScale) {
|
|
|
7772
8108
|
return "center / 100% 100%";
|
|
7773
8109
|
}
|
|
7774
8110
|
}
|
|
7775
|
-
var PatternPreviewBackground =
|
|
8111
|
+
var PatternPreviewBackground = React65.memo(
|
|
7776
8112
|
function PatternPreviewBackground2({
|
|
7777
8113
|
fillType,
|
|
7778
8114
|
tileScale,
|
|
@@ -7781,7 +8117,7 @@ var PatternPreviewBackground = React62.memo(
|
|
|
7781
8117
|
const image = useImageData(imageRef);
|
|
7782
8118
|
const url = useObjectURL(image);
|
|
7783
8119
|
const size2 = getPatternSizeAndPosition(fillType, tileScale);
|
|
7784
|
-
const background2 =
|
|
8120
|
+
const background2 = React65.useMemo(
|
|
7785
8121
|
() => [
|
|
7786
8122
|
size2,
|
|
7787
8123
|
`url(${url})`,
|
|
@@ -7789,44 +8125,44 @@ var PatternPreviewBackground = React62.memo(
|
|
|
7789
8125
|
].join(" "),
|
|
7790
8126
|
[fillType, size2, url]
|
|
7791
8127
|
);
|
|
7792
|
-
return /* @__PURE__ */
|
|
8128
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7793
8129
|
}
|
|
7794
8130
|
);
|
|
7795
|
-
var ColorPreviewBackground =
|
|
8131
|
+
var ColorPreviewBackground = React65.memo(function ColorPreviewBackground2({
|
|
7796
8132
|
color
|
|
7797
8133
|
}) {
|
|
7798
|
-
const background2 =
|
|
8134
|
+
const background2 = React65.useMemo(
|
|
7799
8135
|
() => sketchColorToRgbaString(color),
|
|
7800
8136
|
[color]
|
|
7801
8137
|
);
|
|
7802
|
-
return /* @__PURE__ */
|
|
8138
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7803
8139
|
});
|
|
7804
|
-
var GradientPreviewBackground =
|
|
8140
|
+
var GradientPreviewBackground = React65.memo(
|
|
7805
8141
|
function GradientPreviewBackground2({
|
|
7806
8142
|
gradient
|
|
7807
8143
|
}) {
|
|
7808
|
-
const background2 =
|
|
8144
|
+
const background2 = React65.useMemo(
|
|
7809
8145
|
() => getGradientBackground(gradient.stops, gradient.gradientType, 180),
|
|
7810
8146
|
[gradient.gradientType, gradient.stops]
|
|
7811
8147
|
);
|
|
7812
|
-
return /* @__PURE__ */
|
|
8148
|
+
return /* @__PURE__ */ React65.createElement(Background, { background: background2 });
|
|
7813
8149
|
}
|
|
7814
8150
|
);
|
|
7815
8151
|
var background = `center url("data:image/svg+xml;utf8,${dotsHorizontalSvg(
|
|
7816
8152
|
cssVars.colors.placeholderDots
|
|
7817
8153
|
)}") no-repeat`;
|
|
7818
|
-
var FillPreviewBackground =
|
|
8154
|
+
var FillPreviewBackground = React65.memo(function FillPreviewBackground2({
|
|
7819
8155
|
value
|
|
7820
8156
|
}) {
|
|
7821
|
-
if (!value) return /* @__PURE__ */
|
|
8157
|
+
if (!value) return /* @__PURE__ */ React65.createElement(Background, { background });
|
|
7822
8158
|
switch (value._class) {
|
|
7823
8159
|
case "color":
|
|
7824
|
-
return /* @__PURE__ */
|
|
8160
|
+
return /* @__PURE__ */ React65.createElement(ColorPreviewBackground, { color: value });
|
|
7825
8161
|
case "gradient":
|
|
7826
|
-
return /* @__PURE__ */
|
|
8162
|
+
return /* @__PURE__ */ React65.createElement(GradientPreviewBackground, { gradient: value });
|
|
7827
8163
|
case "pattern":
|
|
7828
8164
|
if (!value.image) return null;
|
|
7829
|
-
return /* @__PURE__ */
|
|
8165
|
+
return /* @__PURE__ */ React65.createElement(
|
|
7830
8166
|
PatternPreviewBackground,
|
|
7831
8167
|
{
|
|
7832
8168
|
fillType: value.patternFillType,
|
|
@@ -7838,7 +8174,7 @@ var FillPreviewBackground = React62.memo(function FillPreviewBackground2({
|
|
|
7838
8174
|
});
|
|
7839
8175
|
|
|
7840
8176
|
// src/components/FillInputField.tsx
|
|
7841
|
-
var FillButton = (0,
|
|
8177
|
+
var FillButton = (0, import_react70.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react70.default.createElement(
|
|
7842
8178
|
"button",
|
|
7843
8179
|
{
|
|
7844
8180
|
ref,
|
|
@@ -7849,14 +8185,14 @@ var FillButton = (0, import_react69.forwardRef)(({ className, ...props }, ref) =
|
|
|
7849
8185
|
...props
|
|
7850
8186
|
}
|
|
7851
8187
|
));
|
|
7852
|
-
var FillInputField = (0,
|
|
7853
|
-
(0,
|
|
7854
|
-
return /* @__PURE__ */
|
|
8188
|
+
var FillInputField = (0, import_react70.memo)(
|
|
8189
|
+
(0, import_react70.forwardRef)(function FillInputField2({ id, value, ...rest }, ref) {
|
|
8190
|
+
return /* @__PURE__ */ import_react70.default.createElement(FillButton, { ref, id, ...rest }, /* @__PURE__ */ import_react70.default.createElement(FillPreviewBackground, { value }));
|
|
7855
8191
|
})
|
|
7856
8192
|
);
|
|
7857
8193
|
|
|
7858
8194
|
// src/components/FloatingWindow.tsx
|
|
7859
|
-
var
|
|
8195
|
+
var import_react71 = __toESM(require("react"));
|
|
7860
8196
|
var styles2 = {
|
|
7861
8197
|
noSelect: {
|
|
7862
8198
|
userSelect: "none",
|
|
@@ -7949,7 +8285,7 @@ function defaultRenderToolbar({
|
|
|
7949
8285
|
toolbarContent,
|
|
7950
8286
|
onClose
|
|
7951
8287
|
}) {
|
|
7952
|
-
return /* @__PURE__ */
|
|
8288
|
+
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
8289
|
IconButton,
|
|
7954
8290
|
{
|
|
7955
8291
|
iconName: "Cross3Icon",
|
|
@@ -7976,16 +8312,16 @@ var FloatingWindow = ({
|
|
|
7976
8312
|
toolbarContent,
|
|
7977
8313
|
renderToolbar = defaultRenderToolbar
|
|
7978
8314
|
}) => {
|
|
7979
|
-
const [position, setPosition] = (0,
|
|
7980
|
-
const [size2, setSize] = (0,
|
|
8315
|
+
const [position, setPosition] = (0, import_react71.useState)({ x: initialX, y: initialY });
|
|
8316
|
+
const [size2, setSize] = (0, import_react71.useState)({
|
|
7981
8317
|
width: initialWidth,
|
|
7982
8318
|
height: initialHeight
|
|
7983
8319
|
});
|
|
7984
|
-
const [isDragging, setIsDragging] = (0,
|
|
7985
|
-
const [isResizing, setIsResizing] = (0,
|
|
7986
|
-
const [dragOffset, setDragOffset] = (0,
|
|
7987
|
-
const [resizeDirection, setResizeDirection] = (0,
|
|
7988
|
-
const wrapperRef = (0,
|
|
8320
|
+
const [isDragging, setIsDragging] = (0, import_react71.useState)(false);
|
|
8321
|
+
const [isResizing, setIsResizing] = (0, import_react71.useState)(false);
|
|
8322
|
+
const [dragOffset, setDragOffset] = (0, import_react71.useState)({ x: 0, y: 0 });
|
|
8323
|
+
const [resizeDirection, setResizeDirection] = (0, import_react71.useState)(null);
|
|
8324
|
+
const wrapperRef = (0, import_react71.useRef)(null);
|
|
7989
8325
|
const toggleGlobalTextSelection = (disable) => {
|
|
7990
8326
|
if (disable) {
|
|
7991
8327
|
document.body.style.userSelect = "none";
|
|
@@ -7993,7 +8329,7 @@ var FloatingWindow = ({
|
|
|
7993
8329
|
document.body.style.userSelect = "";
|
|
7994
8330
|
}
|
|
7995
8331
|
};
|
|
7996
|
-
const handleMouseDown = (0,
|
|
8332
|
+
const handleMouseDown = (0, import_react71.useCallback)((e) => {
|
|
7997
8333
|
if (!wrapperRef.current) return;
|
|
7998
8334
|
const rect = wrapperRef.current.getBoundingClientRect();
|
|
7999
8335
|
setDragOffset({
|
|
@@ -8002,7 +8338,7 @@ var FloatingWindow = ({
|
|
|
8002
8338
|
});
|
|
8003
8339
|
setIsDragging(true);
|
|
8004
8340
|
}, []);
|
|
8005
|
-
const handleResizeStart = (0,
|
|
8341
|
+
const handleResizeStart = (0, import_react71.useCallback)(
|
|
8006
8342
|
(direction) => (e) => {
|
|
8007
8343
|
e.stopPropagation();
|
|
8008
8344
|
setIsResizing(true);
|
|
@@ -8011,7 +8347,7 @@ var FloatingWindow = ({
|
|
|
8011
8347
|
},
|
|
8012
8348
|
[]
|
|
8013
8349
|
);
|
|
8014
|
-
const handleMouseMove = (0,
|
|
8350
|
+
const handleMouseMove = (0, import_react71.useCallback)(
|
|
8015
8351
|
(e) => {
|
|
8016
8352
|
if (isDragging) {
|
|
8017
8353
|
setPosition({
|
|
@@ -8065,13 +8401,13 @@ var FloatingWindow = ({
|
|
|
8065
8401
|
minHeight
|
|
8066
8402
|
]
|
|
8067
8403
|
);
|
|
8068
|
-
const handleMouseUp = (0,
|
|
8404
|
+
const handleMouseUp = (0, import_react71.useCallback)((_e) => {
|
|
8069
8405
|
setIsDragging(false);
|
|
8070
8406
|
setIsResizing(false);
|
|
8071
8407
|
setResizeDirection(null);
|
|
8072
8408
|
toggleGlobalTextSelection(false);
|
|
8073
8409
|
}, []);
|
|
8074
|
-
|
|
8410
|
+
import_react71.default.useEffect(() => {
|
|
8075
8411
|
document.addEventListener("mousemove", handleMouseMove);
|
|
8076
8412
|
document.addEventListener("mouseup", handleMouseUp);
|
|
8077
8413
|
return () => {
|
|
@@ -8081,11 +8417,11 @@ var FloatingWindow = ({
|
|
|
8081
8417
|
}, [handleMouseMove, handleMouseUp]);
|
|
8082
8418
|
const floatingWindowManager = useFloatingWindowManager();
|
|
8083
8419
|
const currentFloatingWindow = useCurrentFloatingWindowInternal();
|
|
8084
|
-
const handleClose = (0,
|
|
8420
|
+
const handleClose = (0, import_react71.useCallback)(() => {
|
|
8085
8421
|
if (onClose) onClose();
|
|
8086
8422
|
floatingWindowManager.closeWindow(currentFloatingWindow.id);
|
|
8087
8423
|
}, [currentFloatingWindow.id, floatingWindowManager, onClose]);
|
|
8088
|
-
return /* @__PURE__ */
|
|
8424
|
+
return /* @__PURE__ */ import_react71.default.createElement(
|
|
8089
8425
|
"div",
|
|
8090
8426
|
{
|
|
8091
8427
|
ref: wrapperRef,
|
|
@@ -8100,7 +8436,7 @@ var FloatingWindow = ({
|
|
|
8100
8436
|
zIndex: cssVars.zIndex.menu
|
|
8101
8437
|
}
|
|
8102
8438
|
},
|
|
8103
|
-
/* @__PURE__ */
|
|
8439
|
+
/* @__PURE__ */ import_react71.default.createElement(
|
|
8104
8440
|
"div",
|
|
8105
8441
|
{
|
|
8106
8442
|
style: {
|
|
@@ -8111,9 +8447,9 @@ var FloatingWindow = ({
|
|
|
8111
8447
|
},
|
|
8112
8448
|
renderToolbar({ title, toolbarContent, onClose: handleClose })
|
|
8113
8449
|
),
|
|
8114
|
-
/* @__PURE__ */
|
|
8115
|
-
/* @__PURE__ */
|
|
8116
|
-
Object.entries(resizeHandlePositions).map(([direction, style2]) => /* @__PURE__ */
|
|
8450
|
+
/* @__PURE__ */ import_react71.default.createElement(Divider, null),
|
|
8451
|
+
/* @__PURE__ */ import_react71.default.createElement("div", { style: styles2.content }, children),
|
|
8452
|
+
Object.entries(resizeHandlePositions).map(([direction, style2]) => /* @__PURE__ */ import_react71.default.createElement(
|
|
8117
8453
|
"div",
|
|
8118
8454
|
{
|
|
8119
8455
|
key: direction,
|
|
@@ -8126,8 +8462,8 @@ var FloatingWindow = ({
|
|
|
8126
8462
|
|
|
8127
8463
|
// src/components/GradientPicker.tsx
|
|
8128
8464
|
var import_noya_colorpicker2 = require("@noya-app/noya-colorpicker");
|
|
8129
|
-
var
|
|
8130
|
-
var GradientPicker =
|
|
8465
|
+
var React68 = __toESM(require("react"));
|
|
8466
|
+
var GradientPicker = React68.memo(function GradientPicker2({
|
|
8131
8467
|
value,
|
|
8132
8468
|
selectedStop,
|
|
8133
8469
|
onChangeColor,
|
|
@@ -8136,7 +8472,7 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8136
8472
|
onDelete,
|
|
8137
8473
|
onSelectStop
|
|
8138
8474
|
}) {
|
|
8139
|
-
const colorModel =
|
|
8475
|
+
const colorModel = React68.useMemo(
|
|
8140
8476
|
() => ({
|
|
8141
8477
|
defaultColor: { r: 0, g: 0, b: 0, a: 1 },
|
|
8142
8478
|
toHsva: import_noya_colorpicker2.rgbaToHsva,
|
|
@@ -8145,30 +8481,30 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8145
8481
|
}),
|
|
8146
8482
|
[]
|
|
8147
8483
|
);
|
|
8148
|
-
const rgbaColor =
|
|
8484
|
+
const rgbaColor = React68.useMemo(
|
|
8149
8485
|
() => sketchColorToRgba(value[selectedStop].color),
|
|
8150
8486
|
[value, selectedStop]
|
|
8151
8487
|
);
|
|
8152
|
-
const handleChangeColor =
|
|
8488
|
+
const handleChangeColor = React68.useCallback(
|
|
8153
8489
|
(value2) => {
|
|
8154
8490
|
onChangeColor(rgbaToSketchColor(value2));
|
|
8155
8491
|
},
|
|
8156
8492
|
[onChangeColor]
|
|
8157
8493
|
);
|
|
8158
|
-
const handleAddGradientStop =
|
|
8494
|
+
const handleAddGradientStop = React68.useCallback(
|
|
8159
8495
|
(value2, position) => {
|
|
8160
8496
|
onAdd(rgbaToSketchColor(value2), position);
|
|
8161
8497
|
},
|
|
8162
8498
|
[onAdd]
|
|
8163
8499
|
);
|
|
8164
|
-
return /* @__PURE__ */
|
|
8500
|
+
return /* @__PURE__ */ React68.createElement(
|
|
8165
8501
|
import_noya_colorpicker2.ColorPicker,
|
|
8166
8502
|
{
|
|
8167
8503
|
onChange: handleChangeColor,
|
|
8168
8504
|
colorModel,
|
|
8169
8505
|
color: rgbaColor
|
|
8170
8506
|
},
|
|
8171
|
-
/* @__PURE__ */
|
|
8507
|
+
/* @__PURE__ */ React68.createElement(
|
|
8172
8508
|
import_noya_colorpicker2.Gradient,
|
|
8173
8509
|
{
|
|
8174
8510
|
gradients: value,
|
|
@@ -8179,19 +8515,19 @@ var GradientPicker = React65.memo(function GradientPicker2({
|
|
|
8179
8515
|
onDelete
|
|
8180
8516
|
}
|
|
8181
8517
|
),
|
|
8182
|
-
/* @__PURE__ */
|
|
8183
|
-
/* @__PURE__ */
|
|
8184
|
-
/* @__PURE__ */
|
|
8185
|
-
/* @__PURE__ */
|
|
8186
|
-
/* @__PURE__ */
|
|
8187
|
-
/* @__PURE__ */
|
|
8518
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 10 }),
|
|
8519
|
+
/* @__PURE__ */ React68.createElement(import_noya_colorpicker2.Saturation, null),
|
|
8520
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 12 }),
|
|
8521
|
+
/* @__PURE__ */ React68.createElement(import_noya_colorpicker2.Hue, null),
|
|
8522
|
+
/* @__PURE__ */ React68.createElement(Spacer.Vertical, { size: 5 }),
|
|
8523
|
+
/* @__PURE__ */ React68.createElement(import_noya_colorpicker2.Alpha, null)
|
|
8188
8524
|
);
|
|
8189
8525
|
});
|
|
8190
8526
|
|
|
8191
8527
|
// src/components/InspectorContainer.tsx
|
|
8192
|
-
var
|
|
8193
|
-
var InspectorContainer = (0,
|
|
8194
|
-
(0,
|
|
8528
|
+
var import_react72 = __toESM(require("react"));
|
|
8529
|
+
var InspectorContainer = (0, import_react72.memo)(
|
|
8530
|
+
(0, import_react72.forwardRef)(function InspectorContainer2({
|
|
8195
8531
|
header,
|
|
8196
8532
|
children,
|
|
8197
8533
|
fallback,
|
|
@@ -8200,7 +8536,7 @@ var InspectorContainer = (0, import_react71.memo)(
|
|
|
8200
8536
|
className,
|
|
8201
8537
|
style: style2
|
|
8202
8538
|
}, forwardedRef) {
|
|
8203
|
-
return /* @__PURE__ */
|
|
8539
|
+
return /* @__PURE__ */ import_react72.default.createElement(
|
|
8204
8540
|
"div",
|
|
8205
8541
|
{
|
|
8206
8542
|
ref: forwardedRef,
|
|
@@ -8215,32 +8551,32 @@ var InspectorContainer = (0, import_react71.memo)(
|
|
|
8215
8551
|
}
|
|
8216
8552
|
},
|
|
8217
8553
|
header,
|
|
8218
|
-
children ? /* @__PURE__ */
|
|
8554
|
+
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
8555
|
);
|
|
8220
8556
|
})
|
|
8221
8557
|
);
|
|
8222
8558
|
|
|
8223
8559
|
// src/components/LabeledElementView.tsx
|
|
8224
8560
|
var kiwi = __toESM(require("kiwi.js"));
|
|
8225
|
-
var
|
|
8226
|
-
var LabeledElementView =
|
|
8561
|
+
var React70 = __toESM(require("react"));
|
|
8562
|
+
var LabeledElementView = React70.memo(function LabeledElementView2({
|
|
8227
8563
|
children,
|
|
8228
8564
|
renderLabel
|
|
8229
8565
|
}) {
|
|
8230
|
-
const elementIds =
|
|
8231
|
-
(child) =>
|
|
8566
|
+
const elementIds = React70.Children.toArray(children).flatMap(
|
|
8567
|
+
(child) => React70.isValidElement(child) && child.type === React70.Fragment ? child.props.children : [child]
|
|
8232
8568
|
).map(
|
|
8233
|
-
(child) =>
|
|
8569
|
+
(child) => React70.isValidElement(child) && "id" in child.props ? child.props.id : null
|
|
8234
8570
|
).filter((id) => !!id);
|
|
8235
8571
|
const serializedIds = elementIds.join(",");
|
|
8236
|
-
const containerRef =
|
|
8237
|
-
const refs =
|
|
8572
|
+
const containerRef = React70.useRef(null);
|
|
8573
|
+
const refs = React70.useMemo(() => {
|
|
8238
8574
|
return Object.fromEntries(
|
|
8239
|
-
serializedIds.split(",").map((id) => [id,
|
|
8575
|
+
serializedIds.split(",").map((id) => [id, React70.createRef()])
|
|
8240
8576
|
);
|
|
8241
8577
|
}, [serializedIds]);
|
|
8242
|
-
const labelElements =
|
|
8243
|
-
return serializedIds.split(",").map((id, index) => /* @__PURE__ */
|
|
8578
|
+
const labelElements = React70.useMemo(() => {
|
|
8579
|
+
return serializedIds.split(",").map((id, index) => /* @__PURE__ */ React70.createElement(
|
|
8244
8580
|
"span",
|
|
8245
8581
|
{
|
|
8246
8582
|
key: id,
|
|
@@ -8253,7 +8589,7 @@ var LabeledElementView = React67.memo(function LabeledElementView2({
|
|
|
8253
8589
|
})
|
|
8254
8590
|
));
|
|
8255
8591
|
}, [refs, serializedIds, renderLabel]);
|
|
8256
|
-
|
|
8592
|
+
React70.useLayoutEffect(() => {
|
|
8257
8593
|
if (!containerRef.current) return;
|
|
8258
8594
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
8259
8595
|
const solver = new kiwi.Solver();
|
|
@@ -8315,19 +8651,19 @@ var LabeledElementView = React67.memo(function LabeledElementView2({
|
|
|
8315
8651
|
`${Math.max(...heights)}px`
|
|
8316
8652
|
);
|
|
8317
8653
|
}, [refs, labelElements]);
|
|
8318
|
-
return /* @__PURE__ */
|
|
8654
|
+
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
8655
|
});
|
|
8320
8656
|
|
|
8321
8657
|
// src/components/LabeledField.tsx
|
|
8322
|
-
var
|
|
8658
|
+
var import_react74 = __toESM(require("react"));
|
|
8323
8659
|
|
|
8324
8660
|
// src/hooks/useIndent.ts
|
|
8325
|
-
var
|
|
8326
|
-
var IndentContext =
|
|
8661
|
+
var import_react73 = __toESM(require("react"));
|
|
8662
|
+
var IndentContext = import_react73.default.createContext({
|
|
8327
8663
|
indentLevel: 0
|
|
8328
8664
|
});
|
|
8329
8665
|
var useIndent = () => {
|
|
8330
|
-
const { indentLevel } =
|
|
8666
|
+
const { indentLevel } = import_react73.default.useContext(IndentContext);
|
|
8331
8667
|
return indentLevel;
|
|
8332
8668
|
};
|
|
8333
8669
|
|
|
@@ -8340,7 +8676,7 @@ var labeledFieldStyles = (labelPosition) => cx(
|
|
|
8340
8676
|
var labelPositionInset = {
|
|
8341
8677
|
position: "inset"
|
|
8342
8678
|
};
|
|
8343
|
-
var LabeledField = (0,
|
|
8679
|
+
var LabeledField = (0, import_react74.memo)(function LabeledField2({
|
|
8344
8680
|
children,
|
|
8345
8681
|
label,
|
|
8346
8682
|
labelPosition: labelPositionProp,
|
|
@@ -8356,15 +8692,15 @@ var LabeledField = (0, import_react73.memo)(function LabeledField2({
|
|
|
8356
8692
|
const labelWidth = labelWidthFromContext ?? minWidth;
|
|
8357
8693
|
const labelPositionFromContext = useLabelPosition();
|
|
8358
8694
|
const labelPosition = labelPositionProp ?? labelPositionFromContext ?? "start";
|
|
8359
|
-
const labeledFieldClasses = (0,
|
|
8695
|
+
const labeledFieldClasses = (0, import_react74.useMemo)(
|
|
8360
8696
|
() => labeledFieldStyles(labelPosition),
|
|
8361
8697
|
[labelPosition]
|
|
8362
8698
|
);
|
|
8363
|
-
const labelContextValue = (0,
|
|
8699
|
+
const labelContextValue = (0, import_react74.useMemo)(
|
|
8364
8700
|
() => ({ fieldId, label }),
|
|
8365
8701
|
[fieldId, label]
|
|
8366
8702
|
);
|
|
8367
|
-
const indentStyle = (0,
|
|
8703
|
+
const indentStyle = (0, import_react74.useMemo)(
|
|
8368
8704
|
() => ({
|
|
8369
8705
|
width: indentLevel * 8,
|
|
8370
8706
|
flexBasis: indentLevel * 8,
|
|
@@ -8373,20 +8709,20 @@ var LabeledField = (0, import_react73.memo)(function LabeledField2({
|
|
|
8373
8709
|
}),
|
|
8374
8710
|
[indentLevel]
|
|
8375
8711
|
);
|
|
8376
|
-
const fieldStyle = (0,
|
|
8712
|
+
const fieldStyle = (0, import_react74.useMemo)(
|
|
8377
8713
|
() => ({
|
|
8378
8714
|
minWidth: `calc(100% - ${labelWidth + indentLevel * 8 + 6}px)`
|
|
8379
8715
|
}),
|
|
8380
8716
|
[labelWidth, indentLevel]
|
|
8381
8717
|
);
|
|
8382
|
-
const labelStyle = (0,
|
|
8718
|
+
const labelStyle = (0, import_react74.useMemo)(
|
|
8383
8719
|
() => ({
|
|
8384
8720
|
minWidth: `calc(${labelWidth}px - ${indentLevel * 8}px)`,
|
|
8385
8721
|
...labelStyleProp
|
|
8386
8722
|
}),
|
|
8387
8723
|
[labelWidth, indentLevel, labelStyleProp]
|
|
8388
8724
|
);
|
|
8389
|
-
return /* @__PURE__ */
|
|
8725
|
+
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
8726
|
Label,
|
|
8391
8727
|
{
|
|
8392
8728
|
htmlFor: fieldId,
|
|
@@ -8395,12 +8731,12 @@ var LabeledField = (0, import_react73.memo)(function LabeledField2({
|
|
|
8395
8731
|
...props
|
|
8396
8732
|
},
|
|
8397
8733
|
label
|
|
8398
|
-
), labelPosition === "start" ? /* @__PURE__ */
|
|
8734
|
+
), labelPosition === "start" ? /* @__PURE__ */ import_react74.default.createElement("div", { className: "flex-auto flex", style: fieldStyle }, children) : children)));
|
|
8399
8735
|
});
|
|
8400
8736
|
|
|
8401
8737
|
// src/components/MediaThumbnail.tsx
|
|
8402
8738
|
var import_noya_icons7 = require("@noya-app/noya-icons");
|
|
8403
|
-
var
|
|
8739
|
+
var import_react75 = __toESM(require("react"));
|
|
8404
8740
|
|
|
8405
8741
|
// src/components/catppuccin/fileIcons.ts
|
|
8406
8742
|
var fileIcons = {
|
|
@@ -10840,7 +11176,7 @@ var getThumbnailColors = (colorScheme, selected) => {
|
|
|
10840
11176
|
};
|
|
10841
11177
|
}
|
|
10842
11178
|
};
|
|
10843
|
-
var MediaThumbnail = (0,
|
|
11179
|
+
var MediaThumbnail = (0, import_react75.memo)(function MediaThumbnail2({
|
|
10844
11180
|
contentType: contentTypeProp,
|
|
10845
11181
|
selected = false,
|
|
10846
11182
|
className,
|
|
@@ -10855,18 +11191,18 @@ var MediaThumbnail = (0, import_react74.memo)(function MediaThumbnail2({
|
|
|
10855
11191
|
selected
|
|
10856
11192
|
);
|
|
10857
11193
|
const contentType = getAssetType(contentTypeProp);
|
|
10858
|
-
const iconStyles = (0,
|
|
11194
|
+
const iconStyles = (0, import_react75.useMemo)(
|
|
10859
11195
|
() => ({
|
|
10860
11196
|
width: iconSizeMap[size2],
|
|
10861
11197
|
height: iconSizeMap[size2]
|
|
10862
11198
|
}),
|
|
10863
11199
|
[size2]
|
|
10864
11200
|
);
|
|
10865
|
-
const content = (0,
|
|
11201
|
+
const content = (0, import_react75.useMemo)(() => {
|
|
10866
11202
|
switch (contentType) {
|
|
10867
11203
|
case "image":
|
|
10868
|
-
if (!url) return /* @__PURE__ */
|
|
10869
|
-
return /* @__PURE__ */
|
|
11204
|
+
if (!url) return /* @__PURE__ */ import_react75.default.createElement(import_noya_icons7.ImageIcon, { color: iconColor, style: iconStyles });
|
|
11205
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
10870
11206
|
"img",
|
|
10871
11207
|
{
|
|
10872
11208
|
src: url,
|
|
@@ -10876,18 +11212,18 @@ var MediaThumbnail = (0, import_react74.memo)(function MediaThumbnail2({
|
|
|
10876
11212
|
}
|
|
10877
11213
|
);
|
|
10878
11214
|
case "video":
|
|
10879
|
-
return /* @__PURE__ */
|
|
11215
|
+
return /* @__PURE__ */ import_react75.default.createElement(import_noya_icons7.VideoIcon, { color: iconColor, style: iconStyles });
|
|
10880
11216
|
case "audio":
|
|
10881
|
-
return /* @__PURE__ */
|
|
11217
|
+
return /* @__PURE__ */ import_react75.default.createElement(import_noya_icons7.SpeakerLoudIcon, { color: iconColor, style: iconStyles });
|
|
10882
11218
|
default:
|
|
10883
11219
|
if (iconName) {
|
|
10884
11220
|
const Icon = Icons[iconName];
|
|
10885
|
-
return /* @__PURE__ */
|
|
11221
|
+
return /* @__PURE__ */ import_react75.default.createElement(Icon, { color: iconColor, style: iconStyles });
|
|
10886
11222
|
}
|
|
10887
11223
|
if (fileName) {
|
|
10888
11224
|
const fileIcon = findFileIcon(fileName);
|
|
10889
11225
|
if (fileIcon) {
|
|
10890
|
-
return /* @__PURE__ */
|
|
11226
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
10891
11227
|
"img",
|
|
10892
11228
|
{
|
|
10893
11229
|
src: `https://api.iconify.design/catppuccin/${fileIcon}.svg?height=none&box=1`,
|
|
@@ -10897,10 +11233,10 @@ var MediaThumbnail = (0, import_react74.memo)(function MediaThumbnail2({
|
|
|
10897
11233
|
);
|
|
10898
11234
|
}
|
|
10899
11235
|
}
|
|
10900
|
-
return /* @__PURE__ */
|
|
11236
|
+
return /* @__PURE__ */ import_react75.default.createElement(import_noya_icons7.FileIcon, { color: iconColor, style: iconStyles });
|
|
10901
11237
|
}
|
|
10902
11238
|
}, [contentType, url, iconColor, iconStyles, iconName, fileName]);
|
|
10903
|
-
return /* @__PURE__ */
|
|
11239
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
10904
11240
|
"div",
|
|
10905
11241
|
{
|
|
10906
11242
|
className: cx(
|
|
@@ -10931,18 +11267,18 @@ function findFileIcon(fileName) {
|
|
|
10931
11267
|
}
|
|
10932
11268
|
|
|
10933
11269
|
// src/components/Message.tsx
|
|
10934
|
-
var
|
|
10935
|
-
var Message = (0,
|
|
10936
|
-
(0,
|
|
11270
|
+
var import_react76 = __toESM(require("react"));
|
|
11271
|
+
var Message = (0, import_react76.memo)(
|
|
11272
|
+
(0, import_react76.forwardRef)(function Message2({ role, children, user, avatarSize = INPUT_HEIGHT }, ref) {
|
|
10937
11273
|
const randomId = crypto.randomUUID();
|
|
10938
11274
|
const userMessageBackgroundColor = colorFromString(user?.id ?? randomId);
|
|
10939
|
-
const styles3 = (0,
|
|
11275
|
+
const styles3 = (0, import_react76.useMemo)(
|
|
10940
11276
|
() => role === "user" ? {
|
|
10941
11277
|
backgroundColor: userMessageBackgroundColor
|
|
10942
11278
|
} : void 0,
|
|
10943
11279
|
[userMessageBackgroundColor, role]
|
|
10944
11280
|
);
|
|
10945
|
-
return /* @__PURE__ */
|
|
11281
|
+
return /* @__PURE__ */ import_react76.default.createElement(
|
|
10946
11282
|
"div",
|
|
10947
11283
|
{
|
|
10948
11284
|
className: cx(
|
|
@@ -10950,15 +11286,15 @@ var Message = (0, import_react75.memo)(
|
|
|
10950
11286
|
role === "user" ? "flex-row-reverse" : "flex-row"
|
|
10951
11287
|
)
|
|
10952
11288
|
},
|
|
10953
|
-
role === "assistant" ? /* @__PURE__ */
|
|
11289
|
+
role === "assistant" ? /* @__PURE__ */ import_react76.default.createElement(
|
|
10954
11290
|
Avatar,
|
|
10955
11291
|
{
|
|
10956
11292
|
name: "Assistant",
|
|
10957
11293
|
size: avatarSize,
|
|
10958
11294
|
backgroundColor: cssVars.colors.primaryPastel
|
|
10959
11295
|
},
|
|
10960
|
-
/* @__PURE__ */
|
|
10961
|
-
) : /* @__PURE__ */
|
|
11296
|
+
/* @__PURE__ */ import_react76.default.createElement(Logo, { style: { width: 15 }, fill: cssVars.colors.primary })
|
|
11297
|
+
) : /* @__PURE__ */ import_react76.default.createElement(
|
|
10962
11298
|
Avatar,
|
|
10963
11299
|
{
|
|
10964
11300
|
userId: !user ? randomId : user?.id,
|
|
@@ -10967,7 +11303,7 @@ var Message = (0, import_react75.memo)(
|
|
|
10967
11303
|
size: avatarSize
|
|
10968
11304
|
}
|
|
10969
11305
|
),
|
|
10970
|
-
/* @__PURE__ */
|
|
11306
|
+
/* @__PURE__ */ import_react76.default.createElement(
|
|
10971
11307
|
"div",
|
|
10972
11308
|
{
|
|
10973
11309
|
className: cx(
|
|
@@ -10977,7 +11313,7 @@ var Message = (0, import_react75.memo)(
|
|
|
10977
11313
|
style: styles3,
|
|
10978
11314
|
ref
|
|
10979
11315
|
},
|
|
10980
|
-
/* @__PURE__ */
|
|
11316
|
+
/* @__PURE__ */ import_react76.default.createElement(
|
|
10981
11317
|
Text,
|
|
10982
11318
|
{
|
|
10983
11319
|
variant: "small",
|
|
@@ -10992,9 +11328,9 @@ var Message = (0, import_react75.memo)(
|
|
|
10992
11328
|
|
|
10993
11329
|
// src/components/pipeline/PipelineResultLayout.tsx
|
|
10994
11330
|
var import_noya_icons8 = require("@noya-app/noya-icons");
|
|
10995
|
-
var
|
|
11331
|
+
var import_react77 = __toESM(require("react"));
|
|
10996
11332
|
var PipelineResultLink = ({ url }) => {
|
|
10997
|
-
return /* @__PURE__ */
|
|
11333
|
+
return /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex flex-col gap-0.5" }, /* @__PURE__ */ import_react77.default.createElement(
|
|
10998
11334
|
"a",
|
|
10999
11335
|
{
|
|
11000
11336
|
href: url,
|
|
@@ -11002,15 +11338,15 @@ var PipelineResultLink = ({ url }) => {
|
|
|
11002
11338
|
rel: "noopener noreferrer",
|
|
11003
11339
|
className: "flex text-primary hover:opacity-80 border border-divider rounded-md"
|
|
11004
11340
|
},
|
|
11005
|
-
/* @__PURE__ */
|
|
11006
|
-
/* @__PURE__ */
|
|
11007
|
-
/* @__PURE__ */
|
|
11341
|
+
/* @__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" })),
|
|
11342
|
+
/* @__PURE__ */ import_react77.default.createElement(DividerVertical, null),
|
|
11343
|
+
/* @__PURE__ */ import_react77.default.createElement(Small, { className: "truncate p-2 flex-1" }, url)
|
|
11008
11344
|
));
|
|
11009
11345
|
};
|
|
11010
11346
|
var PipelineResultLayout = ({
|
|
11011
11347
|
children
|
|
11012
11348
|
}) => {
|
|
11013
|
-
return /* @__PURE__ */
|
|
11349
|
+
return /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex flex-col gap-2" }, children);
|
|
11014
11350
|
};
|
|
11015
11351
|
function getPipelineResultLink(value) {
|
|
11016
11352
|
if (typeof value !== "object" || value === null) return void 0;
|
|
@@ -11026,27 +11362,27 @@ function getPipelineResultLink(value) {
|
|
|
11026
11362
|
// src/components/Progress.tsx
|
|
11027
11363
|
var import_noya_utils10 = require("@noya-app/noya-utils");
|
|
11028
11364
|
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"));
|
|
11029
|
-
var
|
|
11365
|
+
var React76 = __toESM(require("react"));
|
|
11030
11366
|
function Progress({
|
|
11031
11367
|
value,
|
|
11032
11368
|
variant = "normal",
|
|
11033
11369
|
className
|
|
11034
11370
|
}) {
|
|
11035
11371
|
const clampedValue = (0, import_noya_utils10.clamp)(value, 0, 100);
|
|
11036
|
-
const transformStyles =
|
|
11372
|
+
const transformStyles = React76.useMemo(
|
|
11037
11373
|
() => ({
|
|
11038
11374
|
transform: `translateX(-${100 - clampedValue}%)`
|
|
11039
11375
|
}),
|
|
11040
11376
|
[clampedValue]
|
|
11041
11377
|
);
|
|
11042
|
-
return /* @__PURE__ */
|
|
11378
|
+
return /* @__PURE__ */ React76.createElement(
|
|
11043
11379
|
ProgressPrimitive.Root,
|
|
11044
11380
|
{
|
|
11045
11381
|
className: cx(`relative hidden bg-input-background h-[5px] `, className),
|
|
11046
11382
|
style: { transform: "translateZ(0)" },
|
|
11047
11383
|
value: clampedValue
|
|
11048
11384
|
},
|
|
11049
|
-
/* @__PURE__ */
|
|
11385
|
+
/* @__PURE__ */ React76.createElement(
|
|
11050
11386
|
ProgressPrimitive.Indicator,
|
|
11051
11387
|
{
|
|
11052
11388
|
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 +11393,7 @@ function Progress({
|
|
|
11057
11393
|
}
|
|
11058
11394
|
|
|
11059
11395
|
// src/components/Section.tsx
|
|
11060
|
-
var
|
|
11396
|
+
var import_react78 = __toESM(require("react"));
|
|
11061
11397
|
var titleIconStyle = {
|
|
11062
11398
|
marginRight: "8px",
|
|
11063
11399
|
alignSelf: "flex-start",
|
|
@@ -11081,7 +11417,7 @@ var SectionInternal = ({
|
|
|
11081
11417
|
inlineBlockWrapper: true
|
|
11082
11418
|
}
|
|
11083
11419
|
}) => {
|
|
11084
|
-
const style2 = (0,
|
|
11420
|
+
const style2 = (0, import_react78.useMemo)(
|
|
11085
11421
|
() => ({
|
|
11086
11422
|
display: "flex",
|
|
11087
11423
|
flexDirection: "column",
|
|
@@ -11092,15 +11428,15 @@ var SectionInternal = ({
|
|
|
11092
11428
|
}),
|
|
11093
11429
|
[titleTextStyle, title, extraPadding, styleProp]
|
|
11094
11430
|
);
|
|
11095
|
-
const hasChildren =
|
|
11096
|
-
const headerStyle = (0,
|
|
11431
|
+
const hasChildren = import_react78.default.Children.toArray(children).some((child) => !!child);
|
|
11432
|
+
const headerStyle = (0, import_react78.useMemo)(
|
|
11097
11433
|
() => ({
|
|
11098
11434
|
marginBottom: hasChildren ? "4px" : void 0,
|
|
11099
11435
|
minHeight: INPUT_HEIGHT
|
|
11100
11436
|
}),
|
|
11101
11437
|
[hasChildren]
|
|
11102
11438
|
);
|
|
11103
|
-
return /* @__PURE__ */
|
|
11439
|
+
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
11440
|
};
|
|
11105
11441
|
var ExpandableSection = ({
|
|
11106
11442
|
storageKey,
|
|
@@ -11113,12 +11449,12 @@ var ExpandableSection = ({
|
|
|
11113
11449
|
initialVisibility
|
|
11114
11450
|
);
|
|
11115
11451
|
const expanded = visibility === "show";
|
|
11116
|
-
return /* @__PURE__ */
|
|
11452
|
+
return /* @__PURE__ */ import_react78.default.createElement(
|
|
11117
11453
|
SectionInternal,
|
|
11118
11454
|
{
|
|
11119
11455
|
...props,
|
|
11120
11456
|
right: !props.hideRightWhenCollapsed || expanded ? props.right : null,
|
|
11121
|
-
title: /* @__PURE__ */
|
|
11457
|
+
title: /* @__PURE__ */ import_react78.default.createElement("div", { className: "flex gap-1 items-center" }, props.title, /* @__PURE__ */ import_react78.default.createElement(
|
|
11122
11458
|
IconButton,
|
|
11123
11459
|
{
|
|
11124
11460
|
iconName: expanded ? "ChevronDownIcon2" : "ChevronRightIcon2",
|
|
@@ -11129,20 +11465,20 @@ var ExpandableSection = ({
|
|
|
11129
11465
|
expanded && props.children
|
|
11130
11466
|
);
|
|
11131
11467
|
};
|
|
11132
|
-
var Section = (0,
|
|
11468
|
+
var Section = (0, import_react78.memo)(function InspectorSection({
|
|
11133
11469
|
storageKey,
|
|
11134
11470
|
...props
|
|
11135
11471
|
}) {
|
|
11136
|
-
return storageKey ? /* @__PURE__ */
|
|
11472
|
+
return storageKey ? /* @__PURE__ */ import_react78.default.createElement(ExpandableSection, { ...props, storageKey }) : /* @__PURE__ */ import_react78.default.createElement(SectionInternal, { ...props });
|
|
11137
11473
|
});
|
|
11138
11474
|
|
|
11139
11475
|
// src/components/SegmentedControl.tsx
|
|
11140
11476
|
var ToggleGroupPrimitive2 = __toESM(require("@radix-ui/react-toggle-group"));
|
|
11141
|
-
var
|
|
11142
|
-
var SegmentedControlContext = (0,
|
|
11477
|
+
var import_react79 = __toESM(require("react"));
|
|
11478
|
+
var SegmentedControlContext = (0, import_react79.createContext)({
|
|
11143
11479
|
colorScheme: "primary"
|
|
11144
11480
|
});
|
|
11145
|
-
var SegmentedControlItem = (0,
|
|
11481
|
+
var SegmentedControlItem = (0, import_react79.forwardRef)(function SegmentedControlItem2({
|
|
11146
11482
|
value,
|
|
11147
11483
|
tooltip,
|
|
11148
11484
|
title,
|
|
@@ -11152,8 +11488,8 @@ var SegmentedControlItem = (0, import_react78.forwardRef)(function SegmentedCont
|
|
|
11152
11488
|
variant = "default",
|
|
11153
11489
|
...props
|
|
11154
11490
|
}, forwardedRef) {
|
|
11155
|
-
const { colorScheme } = (0,
|
|
11156
|
-
const itemElement = /* @__PURE__ */
|
|
11491
|
+
const { colorScheme } = (0, import_react79.useContext)(SegmentedControlContext);
|
|
11492
|
+
const itemElement = /* @__PURE__ */ import_react79.default.createElement(
|
|
11157
11493
|
ToggleGroupPrimitive2.Item,
|
|
11158
11494
|
{
|
|
11159
11495
|
ref: forwardedRef,
|
|
@@ -11173,7 +11509,7 @@ var SegmentedControlItem = (0, import_react78.forwardRef)(function SegmentedCont
|
|
|
11173
11509
|
),
|
|
11174
11510
|
...props
|
|
11175
11511
|
},
|
|
11176
|
-
/* @__PURE__ */
|
|
11512
|
+
/* @__PURE__ */ import_react79.default.createElement(
|
|
11177
11513
|
"span",
|
|
11178
11514
|
{
|
|
11179
11515
|
className: cx(
|
|
@@ -11185,7 +11521,7 @@ var SegmentedControlItem = (0, import_react78.forwardRef)(function SegmentedCont
|
|
|
11185
11521
|
title
|
|
11186
11522
|
)
|
|
11187
11523
|
);
|
|
11188
|
-
return tooltip ? /* @__PURE__ */
|
|
11524
|
+
return tooltip ? /* @__PURE__ */ import_react79.default.createElement(Tooltip, { content: tooltip }, itemElement) : itemElement;
|
|
11189
11525
|
});
|
|
11190
11526
|
var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
11191
11527
|
id: idProp,
|
|
@@ -11198,16 +11534,16 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
11198
11534
|
className,
|
|
11199
11535
|
style: style2
|
|
11200
11536
|
}) {
|
|
11201
|
-
const contextValue = (0,
|
|
11537
|
+
const contextValue = (0, import_react79.useMemo)(() => ({ colorScheme }), [colorScheme]);
|
|
11202
11538
|
const { fieldId: id } = useLabel({ fieldId: idProp });
|
|
11203
|
-
const handleValueChange = (0,
|
|
11539
|
+
const handleValueChange = (0, import_react79.useCallback)(
|
|
11204
11540
|
(value2) => {
|
|
11205
11541
|
if (!allowEmpty && !value2) return;
|
|
11206
11542
|
onValueChange?.(value2);
|
|
11207
11543
|
},
|
|
11208
11544
|
[allowEmpty, onValueChange]
|
|
11209
11545
|
);
|
|
11210
|
-
return /* @__PURE__ */
|
|
11546
|
+
return /* @__PURE__ */ import_react79.default.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react79.default.createElement(
|
|
11211
11547
|
ToggleGroupPrimitive2.Root,
|
|
11212
11548
|
{
|
|
11213
11549
|
id,
|
|
@@ -11225,13 +11561,13 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
|
|
|
11225
11561
|
gridTemplateColumns: `repeat(${items.length}, 1fr)`
|
|
11226
11562
|
}
|
|
11227
11563
|
},
|
|
11228
|
-
items.map((item, index) => /* @__PURE__ */
|
|
11564
|
+
items.map((item, index) => /* @__PURE__ */ import_react79.default.createElement(SegmentedControlItem, { key: index, ...item, variant }))
|
|
11229
11565
|
));
|
|
11230
11566
|
});
|
|
11231
11567
|
|
|
11232
11568
|
// src/components/SelectionToolbar.tsx
|
|
11233
11569
|
var PopperPrimitive = __toESM(require("@radix-ui/react-popper"));
|
|
11234
|
-
var
|
|
11570
|
+
var import_react80 = __toESM(require("react"));
|
|
11235
11571
|
var import_react_dom3 = require("react-dom");
|
|
11236
11572
|
var createVirtualElement = (rect) => ({
|
|
11237
11573
|
getBoundingClientRect: () => ({
|
|
@@ -11246,22 +11582,22 @@ var createVirtualElement = (rect) => ({
|
|
|
11246
11582
|
toJSON: () => null
|
|
11247
11583
|
})
|
|
11248
11584
|
});
|
|
11249
|
-
var SelectionToolbarContainer = (0,
|
|
11585
|
+
var SelectionToolbarContainer = (0, import_react80.memo)(
|
|
11250
11586
|
function SelectionToolbarContainer2({
|
|
11251
11587
|
rect,
|
|
11252
11588
|
children,
|
|
11253
11589
|
portalContainer
|
|
11254
11590
|
}) {
|
|
11255
11591
|
const portalScopeId = usePortalScopeId();
|
|
11256
|
-
const containerRef =
|
|
11592
|
+
const containerRef = import_react80.default.useRef(null);
|
|
11257
11593
|
const size2 = useSize(containerRef, "width");
|
|
11258
|
-
const virtualRef = (0,
|
|
11594
|
+
const virtualRef = (0, import_react80.useMemo)(
|
|
11259
11595
|
() => ({
|
|
11260
11596
|
current: createVirtualElement(rect)
|
|
11261
11597
|
}),
|
|
11262
11598
|
[rect]
|
|
11263
11599
|
);
|
|
11264
|
-
const popperContent = /* @__PURE__ */
|
|
11600
|
+
const popperContent = /* @__PURE__ */ import_react80.default.createElement(
|
|
11265
11601
|
PopperPrimitive.Content,
|
|
11266
11602
|
{
|
|
11267
11603
|
...portalScopeProps(portalScopeId),
|
|
@@ -11278,7 +11614,7 @@ var SelectionToolbarContainer = (0, import_react79.memo)(
|
|
|
11278
11614
|
["--n-input-background"]: "transparent"
|
|
11279
11615
|
}
|
|
11280
11616
|
},
|
|
11281
|
-
/* @__PURE__ */
|
|
11617
|
+
/* @__PURE__ */ import_react80.default.createElement(
|
|
11282
11618
|
"div",
|
|
11283
11619
|
{
|
|
11284
11620
|
ref: containerRef,
|
|
@@ -11291,14 +11627,14 @@ var SelectionToolbarContainer = (0, import_react79.memo)(
|
|
|
11291
11627
|
children
|
|
11292
11628
|
)
|
|
11293
11629
|
);
|
|
11294
|
-
return /* @__PURE__ */
|
|
11630
|
+
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
11631
|
}
|
|
11296
11632
|
);
|
|
11297
11633
|
|
|
11298
11634
|
// src/components/SelectMenu.tsx
|
|
11299
11635
|
var import_noya_icons9 = require("@noya-app/noya-icons");
|
|
11300
11636
|
var Select = __toESM(require("@radix-ui/react-select"));
|
|
11301
|
-
var
|
|
11637
|
+
var import_react81 = __toESM(require("react"));
|
|
11302
11638
|
var readOnlyStyle = {
|
|
11303
11639
|
justifyContent: "flex-start",
|
|
11304
11640
|
textAlign: "left"
|
|
@@ -11329,7 +11665,7 @@ var SelectMenuTrigger = memoGeneric(function SelectMenuTrigger2({
|
|
|
11329
11665
|
fieldId: props.id
|
|
11330
11666
|
});
|
|
11331
11667
|
const labelPosition = useLabelPosition();
|
|
11332
|
-
return /* @__PURE__ */
|
|
11668
|
+
return /* @__PURE__ */ import_react81.default.createElement(Select.SelectTrigger, { asChild: true, onFocus, onBlur }, /* @__PURE__ */ import_react81.default.createElement(
|
|
11333
11669
|
Button,
|
|
11334
11670
|
{
|
|
11335
11671
|
id,
|
|
@@ -11341,10 +11677,10 @@ var SelectMenuTrigger = memoGeneric(function SelectMenuTrigger2({
|
|
|
11341
11677
|
),
|
|
11342
11678
|
disabled
|
|
11343
11679
|
},
|
|
11344
|
-
icon && /* @__PURE__ */
|
|
11345
|
-
label && labelPosition === "inset" && /* @__PURE__ */
|
|
11346
|
-
/* @__PURE__ */
|
|
11347
|
-
/* @__PURE__ */
|
|
11680
|
+
icon && /* @__PURE__ */ import_react81.default.createElement("span", { className: "pr-1.5" }, renderIcon(icon)),
|
|
11681
|
+
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)),
|
|
11682
|
+
/* @__PURE__ */ import_react81.default.createElement("span", { className: "flex-1 flex" }, /* @__PURE__ */ import_react81.default.createElement(Select.Value, { placeholder })),
|
|
11683
|
+
/* @__PURE__ */ import_react81.default.createElement(
|
|
11348
11684
|
import_noya_icons9.DropdownChevronIcon,
|
|
11349
11685
|
{
|
|
11350
11686
|
className: cx(
|
|
@@ -11381,7 +11717,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11381
11717
|
(item) => isSelectableMenuItem(item) && item.value === value
|
|
11382
11718
|
);
|
|
11383
11719
|
const icon = selectedItem?.icon;
|
|
11384
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
11720
|
+
const [internalOpen, setInternalOpen] = (0, import_react81.useState)(open);
|
|
11385
11721
|
const { label, fieldId: id } = useLabel({
|
|
11386
11722
|
label: props.label,
|
|
11387
11723
|
fieldId: props.id
|
|
@@ -11392,8 +11728,8 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11392
11728
|
}
|
|
11393
11729
|
setInternalOpen(open2);
|
|
11394
11730
|
};
|
|
11395
|
-
const readOnlyButton = (0,
|
|
11396
|
-
() => /* @__PURE__ */
|
|
11731
|
+
const readOnlyButton = (0, import_react81.useMemo)(
|
|
11732
|
+
() => /* @__PURE__ */ import_react81.default.createElement(
|
|
11397
11733
|
Button,
|
|
11398
11734
|
{
|
|
11399
11735
|
id,
|
|
@@ -11403,11 +11739,11 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11403
11739
|
disabled
|
|
11404
11740
|
},
|
|
11405
11741
|
icon && renderIcon(icon),
|
|
11406
|
-
/* @__PURE__ */
|
|
11742
|
+
/* @__PURE__ */ import_react81.default.createElement("span", { className: "flex flex-1" }, selectedItem?.title ?? value)
|
|
11407
11743
|
),
|
|
11408
11744
|
[icon, id, style2, className, disabled, value, selectedItem]
|
|
11409
11745
|
);
|
|
11410
|
-
const contentStyle = (0,
|
|
11746
|
+
const contentStyle = (0, import_react81.useMemo)(() => {
|
|
11411
11747
|
return {
|
|
11412
11748
|
width: "var(--radix-select-trigger-width)",
|
|
11413
11749
|
minWidth: "max-content",
|
|
@@ -11415,7 +11751,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11415
11751
|
...contentStyleProp
|
|
11416
11752
|
};
|
|
11417
11753
|
}, [contentStyleProp]);
|
|
11418
|
-
const content = /* @__PURE__ */
|
|
11754
|
+
const content = /* @__PURE__ */ import_react81.default.createElement(
|
|
11419
11755
|
Select.Root,
|
|
11420
11756
|
{
|
|
11421
11757
|
value,
|
|
@@ -11423,7 +11759,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11423
11759
|
open,
|
|
11424
11760
|
onOpenChange: handleOpenChange
|
|
11425
11761
|
},
|
|
11426
|
-
/* @__PURE__ */
|
|
11762
|
+
/* @__PURE__ */ import_react81.default.createElement(
|
|
11427
11763
|
SelectMenuTrigger,
|
|
11428
11764
|
{
|
|
11429
11765
|
id,
|
|
@@ -11438,7 +11774,7 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11438
11774
|
label
|
|
11439
11775
|
}
|
|
11440
11776
|
),
|
|
11441
|
-
/* @__PURE__ */
|
|
11777
|
+
/* @__PURE__ */ import_react81.default.createElement(Select.Portal, null, /* @__PURE__ */ import_react81.default.createElement(
|
|
11442
11778
|
Select.Content,
|
|
11443
11779
|
{
|
|
11444
11780
|
...portalScopeProps(portalScopeId),
|
|
@@ -11449,14 +11785,14 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11449
11785
|
align: "center",
|
|
11450
11786
|
style: contentStyle
|
|
11451
11787
|
},
|
|
11452
|
-
/* @__PURE__ */
|
|
11788
|
+
/* @__PURE__ */ import_react81.default.createElement(Select.ScrollUpButton, { className: scrollButtonStyles }, /* @__PURE__ */ import_react81.default.createElement(
|
|
11453
11789
|
import_noya_icons9.ChevronUpIcon,
|
|
11454
11790
|
{
|
|
11455
11791
|
className: cx("transition-transform duration-100")
|
|
11456
11792
|
}
|
|
11457
11793
|
)),
|
|
11458
|
-
/* @__PURE__ */
|
|
11459
|
-
/* @__PURE__ */
|
|
11794
|
+
/* @__PURE__ */ import_react81.default.createElement(Select.Viewport, null, /* @__PURE__ */ import_react81.default.createElement(MenuViewport, { items, Components: Components3 })),
|
|
11795
|
+
/* @__PURE__ */ import_react81.default.createElement(Select.ScrollDownButton, { className: scrollButtonStyles }, /* @__PURE__ */ import_react81.default.createElement(import_noya_icons9.ChevronDownIcon, null))
|
|
11460
11796
|
))
|
|
11461
11797
|
);
|
|
11462
11798
|
return readOnly ? readOnlyButton : content;
|
|
@@ -11464,13 +11800,13 @@ var SelectMenu = memoGeneric(function SelectMenu2({
|
|
|
11464
11800
|
|
|
11465
11801
|
// src/components/Slider.tsx
|
|
11466
11802
|
var RadixSlider = __toESM(require("@radix-ui/react-slider"));
|
|
11467
|
-
var
|
|
11803
|
+
var import_react82 = __toESM(require("react"));
|
|
11468
11804
|
var THUMB_WIDTH = 8;
|
|
11469
11805
|
var thumbStyle = {
|
|
11470
11806
|
width: THUMB_WIDTH
|
|
11471
11807
|
};
|
|
11472
11808
|
var insetEndStyles2 = getInsetEndStyles();
|
|
11473
|
-
var Slider = (0,
|
|
11809
|
+
var Slider = (0, import_react82.memo)(function Slider2({
|
|
11474
11810
|
style: style2,
|
|
11475
11811
|
className,
|
|
11476
11812
|
value,
|
|
@@ -11484,7 +11820,7 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11484
11820
|
readOnly = false,
|
|
11485
11821
|
...props
|
|
11486
11822
|
}) {
|
|
11487
|
-
const arrayValue = (0,
|
|
11823
|
+
const arrayValue = (0, import_react82.useMemo)(
|
|
11488
11824
|
() => [Math.min(Math.max(value, min), max)],
|
|
11489
11825
|
[value, min, max]
|
|
11490
11826
|
);
|
|
@@ -11493,13 +11829,13 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11493
11829
|
fieldId: props.id
|
|
11494
11830
|
});
|
|
11495
11831
|
const labelPosition = useLabelPosition();
|
|
11496
|
-
const handleValueChange = (0,
|
|
11832
|
+
const handleValueChange = (0, import_react82.useCallback)(
|
|
11497
11833
|
(arrayValue2) => {
|
|
11498
11834
|
onValueChange(arrayValue2[0]);
|
|
11499
11835
|
},
|
|
11500
11836
|
[onValueChange]
|
|
11501
11837
|
);
|
|
11502
|
-
const percentage = (0,
|
|
11838
|
+
const percentage = (0, import_react82.useMemo)(() => {
|
|
11503
11839
|
const rawPercent = (arrayValue[0] - min) / (max - min);
|
|
11504
11840
|
const adjustedPercent = rawPercent * (100 - THUMB_WIDTH * 100 / 300) + THUMB_WIDTH * 50 / 300;
|
|
11505
11841
|
return {
|
|
@@ -11507,19 +11843,19 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11507
11843
|
adjusted: adjustedPercent
|
|
11508
11844
|
};
|
|
11509
11845
|
}, [arrayValue, min, max]);
|
|
11510
|
-
const trackFillStyle = (0,
|
|
11846
|
+
const trackFillStyle = (0, import_react82.useMemo)(
|
|
11511
11847
|
() => ({
|
|
11512
11848
|
clipPath: `inset(0 ${100 - percentage.adjusted}% 0 0)`
|
|
11513
11849
|
}),
|
|
11514
11850
|
[percentage.adjusted]
|
|
11515
11851
|
);
|
|
11516
|
-
const labelStyle = (0,
|
|
11852
|
+
const labelStyle = (0, import_react82.useMemo)(
|
|
11517
11853
|
() => ({
|
|
11518
11854
|
clipPath: `inset(0 ${100 - percentage.raw}% 0 0)`
|
|
11519
11855
|
}),
|
|
11520
11856
|
[percentage.raw]
|
|
11521
11857
|
);
|
|
11522
|
-
return /* @__PURE__ */
|
|
11858
|
+
return /* @__PURE__ */ import_react82.default.createElement(
|
|
11523
11859
|
RadixSlider.Root,
|
|
11524
11860
|
{
|
|
11525
11861
|
min,
|
|
@@ -11537,7 +11873,7 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11537
11873
|
onBlur,
|
|
11538
11874
|
disabled: readOnly
|
|
11539
11875
|
},
|
|
11540
|
-
/* @__PURE__ */
|
|
11876
|
+
/* @__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
11877
|
"div",
|
|
11542
11878
|
{
|
|
11543
11879
|
style: trackFillStyle,
|
|
@@ -11548,8 +11884,8 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11548
11884
|
)
|
|
11549
11885
|
}
|
|
11550
11886
|
)),
|
|
11551
|
-
label && labelPosition === "inset" && colorScheme !== void 0 && /* @__PURE__ */
|
|
11552
|
-
/* @__PURE__ */
|
|
11887
|
+
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)),
|
|
11888
|
+
/* @__PURE__ */ import_react82.default.createElement(
|
|
11553
11889
|
RadixSlider.Thumb,
|
|
11554
11890
|
{
|
|
11555
11891
|
style: thumbStyle,
|
|
@@ -11564,9 +11900,28 @@ var Slider = (0, import_react81.memo)(function Slider2({
|
|
|
11564
11900
|
);
|
|
11565
11901
|
});
|
|
11566
11902
|
|
|
11903
|
+
// src/components/sorting/createSharedDrag.tsx
|
|
11904
|
+
var React82 = __toESM(require("react"));
|
|
11905
|
+
function createSharedDrag() {
|
|
11906
|
+
const dragRegistrationContext = React82.createContext(null);
|
|
11907
|
+
const activeDragContext = React82.createContext(
|
|
11908
|
+
null
|
|
11909
|
+
);
|
|
11910
|
+
const sharedDragProps = {
|
|
11911
|
+
dragRegistrationContext,
|
|
11912
|
+
activeDragContext
|
|
11913
|
+
};
|
|
11914
|
+
const Provider3 = ({ children }) => /* @__PURE__ */ React82.createElement(SharedDragProvider, { sharedDragProps }, children);
|
|
11915
|
+
return {
|
|
11916
|
+
Provider: Provider3,
|
|
11917
|
+
Sortable: (props) => /* @__PURE__ */ React82.createElement(Sortable, { sharedDragProps, ...props }),
|
|
11918
|
+
props: sharedDragProps
|
|
11919
|
+
};
|
|
11920
|
+
}
|
|
11921
|
+
|
|
11567
11922
|
// src/components/Switch.tsx
|
|
11568
11923
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
11569
|
-
var
|
|
11924
|
+
var React83 = __toESM(require("react"));
|
|
11570
11925
|
var Switch = function Switch2({
|
|
11571
11926
|
id,
|
|
11572
11927
|
value,
|
|
@@ -11578,7 +11933,7 @@ var Switch = function Switch2({
|
|
|
11578
11933
|
style: style2,
|
|
11579
11934
|
className
|
|
11580
11935
|
}) {
|
|
11581
|
-
return /* @__PURE__ */
|
|
11936
|
+
return /* @__PURE__ */ React83.createElement(
|
|
11582
11937
|
SwitchPrimitive.Root,
|
|
11583
11938
|
{
|
|
11584
11939
|
id,
|
|
@@ -11597,20 +11952,20 @@ var Switch = function Switch2({
|
|
|
11597
11952
|
onFocus,
|
|
11598
11953
|
onBlur
|
|
11599
11954
|
},
|
|
11600
|
-
/* @__PURE__ */
|
|
11955
|
+
/* @__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
11956
|
);
|
|
11602
11957
|
};
|
|
11603
11958
|
|
|
11604
11959
|
// src/components/UserPointer.tsx
|
|
11605
|
-
var
|
|
11606
|
-
var UserPointerContainer = (0,
|
|
11960
|
+
var import_react83 = __toESM(require("react"));
|
|
11961
|
+
var UserPointerContainer = (0, import_react83.memo)(function UserPointerContainer2({
|
|
11607
11962
|
point,
|
|
11608
11963
|
visible,
|
|
11609
11964
|
children,
|
|
11610
11965
|
className,
|
|
11611
11966
|
style: style2
|
|
11612
11967
|
}) {
|
|
11613
|
-
return /* @__PURE__ */
|
|
11968
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
11614
11969
|
"div",
|
|
11615
11970
|
{
|
|
11616
11971
|
style: {
|
|
@@ -11627,13 +11982,13 @@ var UserPointerContainer = (0, import_react82.memo)(function UserPointerContaine
|
|
|
11627
11982
|
children
|
|
11628
11983
|
);
|
|
11629
11984
|
});
|
|
11630
|
-
var UserNameTag = (0,
|
|
11985
|
+
var UserNameTag = (0, import_react83.memo)(function UserNameTag2({
|
|
11631
11986
|
backgroundColor,
|
|
11632
11987
|
className,
|
|
11633
11988
|
style: style2,
|
|
11634
11989
|
children
|
|
11635
11990
|
}) {
|
|
11636
|
-
return /* @__PURE__ */
|
|
11991
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
11637
11992
|
"span",
|
|
11638
11993
|
{
|
|
11639
11994
|
className: cx(
|
|
@@ -11649,14 +12004,14 @@ var UserNameTag = (0, import_react82.memo)(function UserNameTag2({
|
|
|
11649
12004
|
children
|
|
11650
12005
|
);
|
|
11651
12006
|
});
|
|
11652
|
-
var UserPointerIcon = (0,
|
|
12007
|
+
var UserPointerIcon = (0, import_react83.memo)(function PointerIcon({
|
|
11653
12008
|
size: size2,
|
|
11654
12009
|
color = "black",
|
|
11655
12010
|
className,
|
|
11656
12011
|
style: style2
|
|
11657
12012
|
}) {
|
|
11658
12013
|
const points = "0,5 10,0 10,10";
|
|
11659
|
-
return /* @__PURE__ */
|
|
12014
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
11660
12015
|
"svg",
|
|
11661
12016
|
{
|
|
11662
12017
|
width: size2,
|
|
@@ -11671,7 +12026,7 @@ var UserPointerIcon = (0, import_react82.memo)(function PointerIcon({
|
|
|
11671
12026
|
...style2
|
|
11672
12027
|
}
|
|
11673
12028
|
},
|
|
11674
|
-
/* @__PURE__ */
|
|
12029
|
+
/* @__PURE__ */ import_react83.default.createElement(
|
|
11675
12030
|
"polygon",
|
|
11676
12031
|
{
|
|
11677
12032
|
points,
|
|
@@ -11684,7 +12039,7 @@ var UserPointerIcon = (0, import_react82.memo)(function PointerIcon({
|
|
|
11684
12039
|
});
|
|
11685
12040
|
var POINTER_SIZE = 12;
|
|
11686
12041
|
var POINTER_OVERLAP = 6;
|
|
11687
|
-
var UserPointer = (0,
|
|
12042
|
+
var UserPointer = (0, import_react83.memo)(function UserPointer2({
|
|
11688
12043
|
userId,
|
|
11689
12044
|
name,
|
|
11690
12045
|
visible = true,
|
|
@@ -11693,22 +12048,22 @@ var UserPointer = (0, import_react82.memo)(function UserPointer2({
|
|
|
11693
12048
|
style: style2,
|
|
11694
12049
|
className
|
|
11695
12050
|
}) {
|
|
11696
|
-
const userBackgroundColor = (0,
|
|
12051
|
+
const userBackgroundColor = (0, import_react83.useMemo)(
|
|
11697
12052
|
() => backgroundColor ?? colorFromString(userId ?? name ?? ""),
|
|
11698
12053
|
[backgroundColor, userId, name]
|
|
11699
12054
|
);
|
|
11700
|
-
const pointerOverlapStyle = (0,
|
|
12055
|
+
const pointerOverlapStyle = (0, import_react83.useMemo)(
|
|
11701
12056
|
() => ({
|
|
11702
12057
|
marginRight: `-${POINTER_OVERLAP}px`,
|
|
11703
12058
|
marginBottom: `-${POINTER_OVERLAP}px`
|
|
11704
12059
|
}),
|
|
11705
12060
|
[]
|
|
11706
12061
|
);
|
|
11707
|
-
const nameTagOverlapStyle = (0,
|
|
12062
|
+
const nameTagOverlapStyle = (0, import_react83.useMemo)(
|
|
11708
12063
|
() => ({ marginLeft: `${POINTER_SIZE - POINTER_OVERLAP + 1}px` }),
|
|
11709
12064
|
[]
|
|
11710
12065
|
);
|
|
11711
|
-
return /* @__PURE__ */
|
|
12066
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
11712
12067
|
UserPointerContainer,
|
|
11713
12068
|
{
|
|
11714
12069
|
point,
|
|
@@ -11716,14 +12071,14 @@ var UserPointer = (0, import_react82.memo)(function UserPointer2({
|
|
|
11716
12071
|
className,
|
|
11717
12072
|
style: style2
|
|
11718
12073
|
},
|
|
11719
|
-
name && /* @__PURE__ */
|
|
12074
|
+
name && /* @__PURE__ */ import_react83.default.createElement("div", { className: "relative" }, /* @__PURE__ */ import_react83.default.createElement(
|
|
11720
12075
|
UserPointerIcon,
|
|
11721
12076
|
{
|
|
11722
12077
|
size: POINTER_SIZE,
|
|
11723
12078
|
color: userBackgroundColor,
|
|
11724
12079
|
style: pointerOverlapStyle
|
|
11725
12080
|
}
|
|
11726
|
-
), /* @__PURE__ */
|
|
12081
|
+
), /* @__PURE__ */ import_react83.default.createElement(
|
|
11727
12082
|
UserNameTag,
|
|
11728
12083
|
{
|
|
11729
12084
|
backgroundColor: userBackgroundColor,
|
|
@@ -11736,18 +12091,18 @@ var UserPointer = (0, import_react82.memo)(function UserPointer2({
|
|
|
11736
12091
|
|
|
11737
12092
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
11738
12093
|
var import_noya_keymap6 = require("@noya-app/noya-keymap");
|
|
11739
|
-
var
|
|
12094
|
+
var import_react88 = __toESM(require("react"));
|
|
11740
12095
|
|
|
11741
12096
|
// src/hooks/useWindowSize.tsx
|
|
11742
|
-
var
|
|
12097
|
+
var import_react84 = require("react");
|
|
11743
12098
|
function useWindowSize() {
|
|
11744
|
-
const [size2, setSize] = (0,
|
|
12099
|
+
const [size2, setSize] = (0, import_react84.useState)(
|
|
11745
12100
|
typeof window === "undefined" ? { width: 0, height: 0 } : {
|
|
11746
12101
|
width: window.innerWidth,
|
|
11747
12102
|
height: window.innerHeight
|
|
11748
12103
|
}
|
|
11749
12104
|
);
|
|
11750
|
-
(0,
|
|
12105
|
+
(0, import_react84.useEffect)(() => {
|
|
11751
12106
|
const handleResize = () => setSize({
|
|
11752
12107
|
width: window.innerWidth,
|
|
11753
12108
|
height: window.innerHeight
|
|
@@ -11759,18 +12114,18 @@ function useWindowSize() {
|
|
|
11759
12114
|
}
|
|
11760
12115
|
|
|
11761
12116
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
11762
|
-
var
|
|
12117
|
+
var import_react86 = __toESM(require("react"));
|
|
11763
12118
|
|
|
11764
12119
|
// src/hooks/usePreservePanelSize.tsx
|
|
11765
|
-
var
|
|
12120
|
+
var import_react85 = require("react");
|
|
11766
12121
|
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
11767
12122
|
var LEFT_SIDEBAR_ID = "editor-left-sidebar";
|
|
11768
12123
|
var RIGHT_SIDEBAR_ID = "editor-right-sidebar";
|
|
11769
12124
|
var CONTENT_AREA_ID = "editor-content-area";
|
|
11770
12125
|
function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
11771
12126
|
const windowSize = useWindowSize();
|
|
11772
|
-
const layoutRef = (0,
|
|
11773
|
-
(0,
|
|
12127
|
+
const layoutRef = (0, import_react85.useRef)();
|
|
12128
|
+
(0, import_react85.useLayoutEffect)(() => {
|
|
11774
12129
|
const panelGroup = document.querySelector(
|
|
11775
12130
|
`[data-panel-group-id="${EDITOR_PANEL_GROUP_ID}"]`
|
|
11776
12131
|
);
|
|
@@ -11813,7 +12168,7 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
|
11813
12168
|
panelGroupObserver.disconnect();
|
|
11814
12169
|
};
|
|
11815
12170
|
}, [panelGroupRef, setPanelLayoutState]);
|
|
11816
|
-
(0,
|
|
12171
|
+
(0, import_react85.useLayoutEffect)(() => {
|
|
11817
12172
|
if (!layoutRef.current) return;
|
|
11818
12173
|
const {
|
|
11819
12174
|
windowWidth: oldWindowWidth,
|
|
@@ -11899,7 +12254,7 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
|
11899
12254
|
}
|
|
11900
12255
|
|
|
11901
12256
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
11902
|
-
var DrawerWorkspaceLayout = (0,
|
|
12257
|
+
var DrawerWorkspaceLayout = (0, import_react86.memo)(function DrawerWorkspaceLayout2({
|
|
11903
12258
|
leftPanel,
|
|
11904
12259
|
leftSidebarRef,
|
|
11905
12260
|
rightPanel,
|
|
@@ -11908,9 +12263,9 @@ var DrawerWorkspaceLayout = (0, import_react85.memo)(function DrawerWorkspaceLay
|
|
|
11908
12263
|
internalLayoutState,
|
|
11909
12264
|
handleChangeLayoutState
|
|
11910
12265
|
}) {
|
|
11911
|
-
const portalContainer = (0,
|
|
11912
|
-
const [mounted, setMounted] = (0,
|
|
11913
|
-
(0,
|
|
12266
|
+
const portalContainer = (0, import_react86.useRef)(null);
|
|
12267
|
+
const [mounted, setMounted] = (0, import_react86.useState)(false);
|
|
12268
|
+
(0, import_react86.useLayoutEffect)(() => {
|
|
11914
12269
|
if (mounted) return;
|
|
11915
12270
|
setMounted(true);
|
|
11916
12271
|
handleChangeLayoutState({
|
|
@@ -11920,14 +12275,14 @@ var DrawerWorkspaceLayout = (0, import_react85.memo)(function DrawerWorkspaceLay
|
|
|
11920
12275
|
}, [handleChangeLayoutState, mounted]);
|
|
11921
12276
|
const leftSidebarCollapsed = internalLayoutState?.leftSidebarCollapsed ?? false;
|
|
11922
12277
|
const rightSidebarCollapsed = internalLayoutState?.rightSidebarCollapsed ?? false;
|
|
11923
|
-
return /* @__PURE__ */
|
|
12278
|
+
return /* @__PURE__ */ import_react86.default.createElement(
|
|
11924
12279
|
"div",
|
|
11925
12280
|
{
|
|
11926
12281
|
ref: portalContainer,
|
|
11927
12282
|
id: EDITOR_PANEL_GROUP_ID,
|
|
11928
12283
|
className: "flex flex-1 relative focus:outline-none"
|
|
11929
12284
|
},
|
|
11930
|
-
leftPanel && /* @__PURE__ */
|
|
12285
|
+
leftPanel && /* @__PURE__ */ import_react86.default.createElement(
|
|
11931
12286
|
Drawer,
|
|
11932
12287
|
{
|
|
11933
12288
|
id: LEFT_SIDEBAR_ID,
|
|
@@ -11948,7 +12303,7 @@ var DrawerWorkspaceLayout = (0, import_react85.memo)(function DrawerWorkspaceLay
|
|
|
11948
12303
|
leftPanel
|
|
11949
12304
|
),
|
|
11950
12305
|
centerPanel,
|
|
11951
|
-
rightPanel && /* @__PURE__ */
|
|
12306
|
+
rightPanel && /* @__PURE__ */ import_react86.default.createElement(
|
|
11952
12307
|
Drawer,
|
|
11953
12308
|
{
|
|
11954
12309
|
id: RIGHT_SIDEBAR_ID,
|
|
@@ -11972,9 +12327,9 @@ var DrawerWorkspaceLayout = (0, import_react85.memo)(function DrawerWorkspaceLay
|
|
|
11972
12327
|
});
|
|
11973
12328
|
|
|
11974
12329
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
11975
|
-
var
|
|
12330
|
+
var import_react87 = __toESM(require("react"));
|
|
11976
12331
|
var import_react_resizable_panels = require("react-resizable-panels");
|
|
11977
|
-
var PanelWorkspaceLayout = (0,
|
|
12332
|
+
var PanelWorkspaceLayout = (0, import_react87.memo)(function PanelWorkspaceLayout2({
|
|
11978
12333
|
leftPanel,
|
|
11979
12334
|
rightPanel,
|
|
11980
12335
|
centerPanel,
|
|
@@ -11987,9 +12342,9 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
11987
12342
|
rightSidebarRef,
|
|
11988
12343
|
handleChangeLayoutState
|
|
11989
12344
|
}) {
|
|
11990
|
-
const panelGroupRef = (0,
|
|
12345
|
+
const panelGroupRef = (0, import_react87.useRef)(null);
|
|
11991
12346
|
usePreservePanelSize(panelGroupRef, handleChangeLayoutState);
|
|
11992
|
-
return /* @__PURE__ */
|
|
12347
|
+
return /* @__PURE__ */ import_react87.default.createElement(
|
|
11993
12348
|
import_react_resizable_panels.PanelGroup,
|
|
11994
12349
|
{
|
|
11995
12350
|
ref: panelGroupRef,
|
|
@@ -11998,7 +12353,7 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
11998
12353
|
direction: "horizontal",
|
|
11999
12354
|
autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : void 0
|
|
12000
12355
|
},
|
|
12001
|
-
leftPanel && /* @__PURE__ */
|
|
12356
|
+
leftPanel && /* @__PURE__ */ import_react87.default.createElement(import_react87.default.Fragment, null, /* @__PURE__ */ import_react87.default.createElement(
|
|
12002
12357
|
import_react_resizable_panels.Panel,
|
|
12003
12358
|
{
|
|
12004
12359
|
id: LEFT_SIDEBAR_ID,
|
|
@@ -12011,8 +12366,8 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
12011
12366
|
collapsible: true
|
|
12012
12367
|
},
|
|
12013
12368
|
internalLayoutState?.leftSidebarCollapsed ? null : leftPanel
|
|
12014
|
-
), /* @__PURE__ */
|
|
12015
|
-
/* @__PURE__ */
|
|
12369
|
+
), /* @__PURE__ */ import_react87.default.createElement(import_react_resizable_panels.PanelResizeHandle, { className: "cursor-col-resize w-px h-full bg-divider" })),
|
|
12370
|
+
/* @__PURE__ */ import_react87.default.createElement(
|
|
12016
12371
|
import_react_resizable_panels.Panel,
|
|
12017
12372
|
{
|
|
12018
12373
|
id: CONTENT_AREA_ID,
|
|
@@ -12023,7 +12378,7 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
12023
12378
|
},
|
|
12024
12379
|
centerPanel
|
|
12025
12380
|
),
|
|
12026
|
-
rightPanel && /* @__PURE__ */
|
|
12381
|
+
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
12382
|
import_react_resizable_panels.Panel,
|
|
12028
12383
|
{
|
|
12029
12384
|
id: RIGHT_SIDEBAR_ID,
|
|
@@ -12041,7 +12396,7 @@ var PanelWorkspaceLayout = (0, import_react86.memo)(function PanelWorkspaceLayou
|
|
|
12041
12396
|
});
|
|
12042
12397
|
|
|
12043
12398
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
12044
|
-
var WorkspaceLayout = (0,
|
|
12399
|
+
var WorkspaceLayout = (0, import_react88.forwardRef)(function WorkspaceLayout2({
|
|
12045
12400
|
autoSavePrefix,
|
|
12046
12401
|
left,
|
|
12047
12402
|
right,
|
|
@@ -12072,7 +12427,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12072
12427
|
} = {},
|
|
12073
12428
|
theme
|
|
12074
12429
|
}, forwardedRef) {
|
|
12075
|
-
const containerRef =
|
|
12430
|
+
const containerRef = import_react88.default.useRef(null);
|
|
12076
12431
|
const containerSize = useSize(containerRef);
|
|
12077
12432
|
const windowSize = useWindowSize();
|
|
12078
12433
|
const parentSize = detectSize === "window" ? windowSize : containerSize && containerSize.width > 0 ? containerSize : windowSize;
|
|
@@ -12103,17 +12458,17 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12103
12458
|
rightSidebarMinPercentage,
|
|
12104
12459
|
rightSidebarMaxPercentage
|
|
12105
12460
|
);
|
|
12106
|
-
const leftSidebarRef = (0,
|
|
12107
|
-
const rightSidebarRef = (0,
|
|
12108
|
-
const [internalLayoutState, setInternalLayoutState] = (0,
|
|
12109
|
-
const handleChangeLayoutState = (0,
|
|
12461
|
+
const leftSidebarRef = (0, import_react88.useRef)(null);
|
|
12462
|
+
const rightSidebarRef = (0, import_react88.useRef)(null);
|
|
12463
|
+
const [internalLayoutState, setInternalLayoutState] = (0, import_react88.useState)(null);
|
|
12464
|
+
const handleChangeLayoutState = (0, import_react88.useCallback)(
|
|
12110
12465
|
(state) => {
|
|
12111
12466
|
setInternalLayoutState(state);
|
|
12112
12467
|
onChangeLayoutState?.(state);
|
|
12113
12468
|
},
|
|
12114
12469
|
[onChangeLayoutState]
|
|
12115
12470
|
);
|
|
12116
|
-
(0,
|
|
12471
|
+
(0, import_react88.useImperativeHandle)(forwardedRef, () => ({
|
|
12117
12472
|
setLeftExpanded: (expanded) => {
|
|
12118
12473
|
if (expanded) {
|
|
12119
12474
|
leftSidebarRef.current?.expand();
|
|
@@ -12170,7 +12525,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12170
12525
|
}
|
|
12171
12526
|
});
|
|
12172
12527
|
const centerPanelPercentage = 100 - (left ? leftSidebarPercentage : 0) - (right ? rightSidebarPercentage : 0);
|
|
12173
|
-
const leftPanel = left ? /* @__PURE__ */
|
|
12528
|
+
const leftPanel = left ? /* @__PURE__ */ import_react88.default.createElement(
|
|
12174
12529
|
PanelInner,
|
|
12175
12530
|
{
|
|
12176
12531
|
style: leftStyle,
|
|
@@ -12178,7 +12533,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12178
12533
|
},
|
|
12179
12534
|
left
|
|
12180
12535
|
) : null;
|
|
12181
|
-
const rightPanel = right ? /* @__PURE__ */
|
|
12536
|
+
const rightPanel = right ? /* @__PURE__ */ import_react88.default.createElement(
|
|
12182
12537
|
PanelInner,
|
|
12183
12538
|
{
|
|
12184
12539
|
style: rightStyle,
|
|
@@ -12186,7 +12541,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12186
12541
|
},
|
|
12187
12542
|
right
|
|
12188
12543
|
) : null;
|
|
12189
|
-
const centerPanel = /* @__PURE__ */
|
|
12544
|
+
const centerPanel = /* @__PURE__ */ import_react88.default.createElement(PanelInner, { className: "bg-canvas-background" }, children);
|
|
12190
12545
|
const leftSidebarOptions = {
|
|
12191
12546
|
minSize: leftSidebarMinPercentage,
|
|
12192
12547
|
maxSize: leftSidebarMaxPercentage,
|
|
@@ -12201,7 +12556,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12201
12556
|
};
|
|
12202
12557
|
const LayoutComponent = sideType === "panel" ? PanelWorkspaceLayout : sideType === "drawer" ? DrawerWorkspaceLayout : parentSize.width > sideTypeBreakpoint ? PanelWorkspaceLayout : DrawerWorkspaceLayout;
|
|
12203
12558
|
const readyToRender = detectSize === "window" || containerSize && containerSize.width > 0;
|
|
12204
|
-
return /* @__PURE__ */
|
|
12559
|
+
return /* @__PURE__ */ import_react88.default.createElement(
|
|
12205
12560
|
"div",
|
|
12206
12561
|
{
|
|
12207
12562
|
ref: containerRef,
|
|
@@ -12211,7 +12566,7 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12211
12566
|
"data-theme": theme
|
|
12212
12567
|
},
|
|
12213
12568
|
toolbar,
|
|
12214
|
-
/* @__PURE__ */
|
|
12569
|
+
/* @__PURE__ */ import_react88.default.createElement("div", { className: "flex flex-row flex-1 relative" }, readyToRender && /* @__PURE__ */ import_react88.default.createElement(
|
|
12215
12570
|
LayoutComponent,
|
|
12216
12571
|
{
|
|
12217
12572
|
leftPanel,
|
|
@@ -12229,12 +12584,12 @@ var WorkspaceLayout = (0, import_react87.forwardRef)(function WorkspaceLayout2({
|
|
|
12229
12584
|
))
|
|
12230
12585
|
);
|
|
12231
12586
|
});
|
|
12232
|
-
var PanelInner = (0,
|
|
12587
|
+
var PanelInner = (0, import_react88.memo)(function PanelInner2({
|
|
12233
12588
|
children,
|
|
12234
12589
|
style: style2,
|
|
12235
12590
|
className
|
|
12236
12591
|
}) {
|
|
12237
|
-
return /* @__PURE__ */
|
|
12592
|
+
return /* @__PURE__ */ import_react88.default.createElement("div", { style: style2, className: cx("absolute inset-0 flex", className) }, children);
|
|
12238
12593
|
});
|
|
12239
12594
|
|
|
12240
12595
|
// src/hooks/usePlatform.ts
|
|
@@ -12247,9 +12602,9 @@ function usePlatformModKey() {
|
|
|
12247
12602
|
}
|
|
12248
12603
|
|
|
12249
12604
|
// src/hooks/useTheme.ts
|
|
12250
|
-
var
|
|
12605
|
+
var import_react89 = require("react");
|
|
12251
12606
|
function useTheme() {
|
|
12252
|
-
const [theme, setTheme] = (0,
|
|
12607
|
+
const [theme, setTheme] = (0, import_react89.useState)("light");
|
|
12253
12608
|
const checkTheme = () => {
|
|
12254
12609
|
const currentTheme = document.body.getAttribute("data-theme");
|
|
12255
12610
|
switch (currentTheme) {
|
|
@@ -12261,7 +12616,7 @@ function useTheme() {
|
|
|
12261
12616
|
break;
|
|
12262
12617
|
}
|
|
12263
12618
|
};
|
|
12264
|
-
(0,
|
|
12619
|
+
(0, import_react89.useEffect)(() => {
|
|
12265
12620
|
checkTheme();
|
|
12266
12621
|
const observer = new MutationObserver((mutations) => {
|
|
12267
12622
|
mutations.forEach((mutation) => {
|
|
@@ -12366,7 +12721,9 @@ function acceptsDrop({
|
|
|
12366
12721
|
return defaultAcceptsDrop(
|
|
12367
12722
|
sourceIndexPath.at(-1),
|
|
12368
12723
|
targetIndexPath.at(-1),
|
|
12369
|
-
position
|
|
12724
|
+
position,
|
|
12725
|
+
"",
|
|
12726
|
+
""
|
|
12370
12727
|
);
|
|
12371
12728
|
}
|
|
12372
12729
|
return true;
|
|
@@ -12387,11 +12744,11 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
12387
12744
|
|
|
12388
12745
|
// src/components/DimensionInput.tsx
|
|
12389
12746
|
var import_noya_utils12 = require("@noya-app/noya-utils");
|
|
12390
|
-
var
|
|
12747
|
+
var React89 = __toESM(require("react"));
|
|
12391
12748
|
function getNewValue(value, mode, delta) {
|
|
12392
12749
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
12393
12750
|
}
|
|
12394
|
-
var DimensionInput =
|
|
12751
|
+
var DimensionInput = React89.memo(function DimensionInput2({
|
|
12395
12752
|
id,
|
|
12396
12753
|
value,
|
|
12397
12754
|
onSetValue,
|
|
@@ -12401,15 +12758,15 @@ var DimensionInput = React85.memo(function DimensionInput2({
|
|
|
12401
12758
|
disabled,
|
|
12402
12759
|
trigger = "submit"
|
|
12403
12760
|
}) {
|
|
12404
|
-
const handleNudgeValue =
|
|
12761
|
+
const handleNudgeValue = React89.useCallback(
|
|
12405
12762
|
(value2) => onSetValue(value2, "adjust"),
|
|
12406
12763
|
[onSetValue]
|
|
12407
12764
|
);
|
|
12408
|
-
const handleSetValue =
|
|
12765
|
+
const handleSetValue = React89.useCallback(
|
|
12409
12766
|
(value2) => onSetValue(value2, "replace"),
|
|
12410
12767
|
[onSetValue]
|
|
12411
12768
|
);
|
|
12412
|
-
return /* @__PURE__ */
|
|
12769
|
+
return /* @__PURE__ */ React89.createElement(LabeledField, { label, labelPosition: "inset" }, /* @__PURE__ */ React89.createElement(InputField2.Root, { id, width: size2 }, /* @__PURE__ */ React89.createElement(
|
|
12413
12770
|
InputField2.NumberInput,
|
|
12414
12771
|
{
|
|
12415
12772
|
value: value === void 0 ? value : (0, import_noya_utils12.round)(value, 2),
|
|
@@ -12436,8 +12793,8 @@ __export(InspectorPrimitives_exports, {
|
|
|
12436
12793
|
Title: () => Title4,
|
|
12437
12794
|
VerticalSeparator: () => VerticalSeparator
|
|
12438
12795
|
});
|
|
12439
|
-
var
|
|
12440
|
-
var Section2 = (0,
|
|
12796
|
+
var import_react90 = __toESM(require("react"));
|
|
12797
|
+
var Section2 = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12441
12798
|
"div",
|
|
12442
12799
|
{
|
|
12443
12800
|
ref,
|
|
@@ -12445,8 +12802,8 @@ var Section2 = (0, import_react89.forwardRef)(({ className, ...props }, ref) =>
|
|
|
12445
12802
|
...props
|
|
12446
12803
|
}
|
|
12447
12804
|
));
|
|
12448
|
-
var SectionHeader3 = (0,
|
|
12449
|
-
var Title4 = (0,
|
|
12805
|
+
var SectionHeader3 = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement("div", { ref, className: cx(`flex items-center `, className), ...props }));
|
|
12806
|
+
var Title4 = (0, import_react90.forwardRef)(({ className, $textStyle, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12450
12807
|
"div",
|
|
12451
12808
|
{
|
|
12452
12809
|
ref,
|
|
@@ -12457,7 +12814,7 @@ var Title4 = (0, import_react89.forwardRef)(({ className, $textStyle, ...props }
|
|
|
12457
12814
|
...props
|
|
12458
12815
|
}
|
|
12459
12816
|
));
|
|
12460
|
-
var Row = (0,
|
|
12817
|
+
var Row = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12461
12818
|
"div",
|
|
12462
12819
|
{
|
|
12463
12820
|
ref,
|
|
@@ -12465,7 +12822,7 @@ var Row = (0, import_react89.forwardRef)(({ className, ...props }, ref) => /* @_
|
|
|
12465
12822
|
...props
|
|
12466
12823
|
}
|
|
12467
12824
|
));
|
|
12468
|
-
var Column = (0,
|
|
12825
|
+
var Column = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12469
12826
|
"div",
|
|
12470
12827
|
{
|
|
12471
12828
|
ref,
|
|
@@ -12473,7 +12830,7 @@ var Column = (0, import_react89.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
12473
12830
|
...props
|
|
12474
12831
|
}
|
|
12475
12832
|
));
|
|
12476
|
-
var Checkbox3 = (0,
|
|
12833
|
+
var Checkbox3 = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12477
12834
|
"input",
|
|
12478
12835
|
{
|
|
12479
12836
|
ref,
|
|
@@ -12482,7 +12839,7 @@ var Checkbox3 = (0, import_react89.forwardRef)(({ className, ...props }, ref) =>
|
|
|
12482
12839
|
...props
|
|
12483
12840
|
}
|
|
12484
12841
|
));
|
|
12485
|
-
var Text3 = (0,
|
|
12842
|
+
var Text3 = (0, import_react90.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ import_react90.default.createElement(
|
|
12486
12843
|
"span",
|
|
12487
12844
|
{
|
|
12488
12845
|
ref,
|
|
@@ -12490,14 +12847,14 @@ var Text3 = (0, import_react89.forwardRef)(({ className, ...props }, ref) => /*
|
|
|
12490
12847
|
...props
|
|
12491
12848
|
}
|
|
12492
12849
|
));
|
|
12493
|
-
var VerticalSeparator = () => /* @__PURE__ */
|
|
12494
|
-
var HorizontalSeparator = () => /* @__PURE__ */
|
|
12495
|
-
var RowLabel = (0,
|
|
12850
|
+
var VerticalSeparator = () => /* @__PURE__ */ import_react90.default.createElement(Spacer.Vertical, { size: "inspector-v-separator" });
|
|
12851
|
+
var HorizontalSeparator = () => /* @__PURE__ */ import_react90.default.createElement(Spacer.Horizontal, { size: "inspector-h-separator" });
|
|
12852
|
+
var RowLabel = (0, import_react90.forwardRef)(function RowLabel2({
|
|
12496
12853
|
className,
|
|
12497
12854
|
$textStyle,
|
|
12498
12855
|
...props
|
|
12499
12856
|
}, ref) {
|
|
12500
|
-
return /* @__PURE__ */
|
|
12857
|
+
return /* @__PURE__ */ import_react90.default.createElement(
|
|
12501
12858
|
"label",
|
|
12502
12859
|
{
|
|
12503
12860
|
ref,
|
|
@@ -12509,7 +12866,7 @@ var RowLabel = (0, import_react89.forwardRef)(function RowLabel2({
|
|
|
12509
12866
|
}
|
|
12510
12867
|
);
|
|
12511
12868
|
});
|
|
12512
|
-
var LabeledRow = (0,
|
|
12869
|
+
var LabeledRow = (0, import_react90.memo)(function LabeledRow2({
|
|
12513
12870
|
id,
|
|
12514
12871
|
children,
|
|
12515
12872
|
label,
|
|
@@ -12517,11 +12874,11 @@ var LabeledRow = (0, import_react89.memo)(function LabeledRow2({
|
|
|
12517
12874
|
right,
|
|
12518
12875
|
className
|
|
12519
12876
|
}) {
|
|
12520
|
-
return /* @__PURE__ */
|
|
12877
|
+
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
12878
|
});
|
|
12522
12879
|
|
|
12523
12880
|
// src/components/BaseToolbar.tsx
|
|
12524
|
-
var
|
|
12881
|
+
var import_react91 = __toESM(require("react"));
|
|
12525
12882
|
var toolbarStyle = {
|
|
12526
12883
|
[cssVarNames.colors.inputBackground]: "transparent"
|
|
12527
12884
|
};
|
|
@@ -12532,7 +12889,7 @@ function BaseToolbar({
|
|
|
12532
12889
|
logo,
|
|
12533
12890
|
showDivider = true
|
|
12534
12891
|
}) {
|
|
12535
|
-
return /* @__PURE__ */
|
|
12892
|
+
return /* @__PURE__ */ import_react91.default.createElement("div", { className: "flex flex-col", style: toolbarStyle }, /* @__PURE__ */ import_react91.default.createElement(
|
|
12536
12893
|
"div",
|
|
12537
12894
|
{
|
|
12538
12895
|
className: "flex items-center pr-2.5 bg-sidebar-background flex-none relative @container/toolbar",
|
|
@@ -12540,10 +12897,10 @@ function BaseToolbar({
|
|
|
12540
12897
|
flex: `0 0 ${cssVars.spacing.toolbarHeight}`
|
|
12541
12898
|
}
|
|
12542
12899
|
},
|
|
12543
|
-
logo && /* @__PURE__ */
|
|
12544
|
-
/* @__PURE__ */
|
|
12545
|
-
left && /* @__PURE__ */
|
|
12546
|
-
/* @__PURE__ */
|
|
12900
|
+
logo && /* @__PURE__ */ import_react91.default.createElement(import_react91.default.Fragment, null, logo, /* @__PURE__ */ import_react91.default.createElement(DividerVertical, null)),
|
|
12901
|
+
/* @__PURE__ */ import_react91.default.createElement(Spacer.Horizontal, { size: 10 }),
|
|
12902
|
+
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 })),
|
|
12903
|
+
/* @__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
12904
|
"div",
|
|
12548
12905
|
{
|
|
12549
12906
|
style: {
|
|
@@ -12555,15 +12912,15 @@ function BaseToolbar({
|
|
|
12555
12912
|
},
|
|
12556
12913
|
children
|
|
12557
12914
|
)),
|
|
12558
|
-
/* @__PURE__ */
|
|
12559
|
-
/* @__PURE__ */
|
|
12560
|
-
/* @__PURE__ */
|
|
12561
|
-
), showDivider && /* @__PURE__ */
|
|
12915
|
+
/* @__PURE__ */ import_react91.default.createElement(Spacer.Horizontal, null),
|
|
12916
|
+
/* @__PURE__ */ import_react91.default.createElement(Spacer.Horizontal, { size: 10 }),
|
|
12917
|
+
/* @__PURE__ */ import_react91.default.createElement("div", { className: "flex gap-toolbar-separator" }, right)
|
|
12918
|
+
), showDivider && /* @__PURE__ */ import_react91.default.createElement(Divider, { variant: "strong" }));
|
|
12562
12919
|
}
|
|
12563
12920
|
|
|
12564
12921
|
// src/components/Toolbar.tsx
|
|
12565
12922
|
var import_noya_keymap7 = require("@noya-app/noya-keymap");
|
|
12566
|
-
var
|
|
12923
|
+
var import_react92 = __toESM(require("react"));
|
|
12567
12924
|
var iconButtonStyle = {
|
|
12568
12925
|
height: 27,
|
|
12569
12926
|
width: 27,
|
|
@@ -12573,8 +12930,8 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12573
12930
|
item,
|
|
12574
12931
|
onSelectMenuItem
|
|
12575
12932
|
}) {
|
|
12576
|
-
const [open, setOpen] =
|
|
12577
|
-
return /* @__PURE__ */
|
|
12933
|
+
const [open, setOpen] = import_react92.default.useState(false);
|
|
12934
|
+
return /* @__PURE__ */ import_react92.default.createElement(
|
|
12578
12935
|
DropdownMenu,
|
|
12579
12936
|
{
|
|
12580
12937
|
open,
|
|
@@ -12586,7 +12943,7 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12586
12943
|
}
|
|
12587
12944
|
}
|
|
12588
12945
|
},
|
|
12589
|
-
/* @__PURE__ */
|
|
12946
|
+
/* @__PURE__ */ import_react92.default.createElement(
|
|
12590
12947
|
Button,
|
|
12591
12948
|
{
|
|
12592
12949
|
disabled: item.disabled,
|
|
@@ -12600,15 +12957,18 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
12600
12957
|
});
|
|
12601
12958
|
var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
12602
12959
|
item,
|
|
12603
|
-
onSelectMenuItem
|
|
12960
|
+
onSelectMenuItem,
|
|
12961
|
+
as
|
|
12604
12962
|
}) {
|
|
12605
|
-
const content = /* @__PURE__ */
|
|
12963
|
+
const content = /* @__PURE__ */ import_react92.default.createElement(
|
|
12606
12964
|
Button,
|
|
12607
12965
|
{
|
|
12966
|
+
as,
|
|
12608
12967
|
disabled: item.disabled,
|
|
12609
12968
|
active: item.checked,
|
|
12610
12969
|
icon: item.icon,
|
|
12611
12970
|
style: item.icon && !item.title ? iconButtonStyle : void 0,
|
|
12971
|
+
...as === "a" && { href: item.value },
|
|
12612
12972
|
onClick: () => {
|
|
12613
12973
|
if (onSelectMenuItem && item.value) {
|
|
12614
12974
|
onSelectMenuItem(item.value);
|
|
@@ -12617,32 +12977,42 @@ var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
|
12617
12977
|
},
|
|
12618
12978
|
item.title
|
|
12619
12979
|
);
|
|
12620
|
-
return item.tooltip ? /* @__PURE__ */
|
|
12980
|
+
return item.tooltip ? /* @__PURE__ */ import_react92.default.createElement(Tooltip, { sideOffset: 10, content: item.tooltip }, content) : content;
|
|
12621
12981
|
});
|
|
12622
12982
|
var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
12623
12983
|
item,
|
|
12624
|
-
onSelectMenuItem
|
|
12984
|
+
onSelectMenuItem,
|
|
12985
|
+
buttonAs
|
|
12625
12986
|
}) {
|
|
12626
12987
|
if (item.type === "sectionHeader") return null;
|
|
12627
12988
|
if (item.type === "separator") {
|
|
12628
|
-
return /* @__PURE__ */
|
|
12989
|
+
return /* @__PURE__ */ import_react92.default.createElement(DividerVertical, { overflow: 4 });
|
|
12629
12990
|
}
|
|
12630
12991
|
if (isSelectableMenuItem(item)) {
|
|
12631
|
-
return /* @__PURE__ */
|
|
12992
|
+
return /* @__PURE__ */ import_react92.default.createElement(
|
|
12993
|
+
ToolbarMenuButton,
|
|
12994
|
+
{
|
|
12995
|
+
item,
|
|
12996
|
+
onSelectMenuItem,
|
|
12997
|
+
as: buttonAs
|
|
12998
|
+
}
|
|
12999
|
+
);
|
|
12632
13000
|
}
|
|
12633
|
-
return /* @__PURE__ */
|
|
13001
|
+
return /* @__PURE__ */ import_react92.default.createElement(ToolbarMenuDropdown, { item, onSelectMenuItem });
|
|
12634
13002
|
});
|
|
12635
13003
|
var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
12636
13004
|
items,
|
|
12637
|
-
onSelectMenuItem
|
|
13005
|
+
onSelectMenuItem,
|
|
13006
|
+
buttonAs
|
|
12638
13007
|
}) {
|
|
12639
|
-
return /* @__PURE__ */
|
|
12640
|
-
return /* @__PURE__ */
|
|
13008
|
+
return /* @__PURE__ */ import_react92.default.createElement(import_react92.default.Fragment, null, items.map((item, i) => {
|
|
13009
|
+
return /* @__PURE__ */ import_react92.default.createElement(
|
|
12641
13010
|
ToolbarMenuItem,
|
|
12642
13011
|
{
|
|
12643
13012
|
key: i,
|
|
12644
13013
|
item,
|
|
12645
|
-
onSelectMenuItem
|
|
13014
|
+
onSelectMenuItem,
|
|
13015
|
+
buttonAs
|
|
12646
13016
|
}
|
|
12647
13017
|
);
|
|
12648
13018
|
}));
|
|
@@ -12655,28 +13025,28 @@ function Toolbar({
|
|
|
12655
13025
|
onSelectMenuItem,
|
|
12656
13026
|
shouldBindKeyboardShortcuts = true
|
|
12657
13027
|
}) {
|
|
12658
|
-
const allMenuItems =
|
|
13028
|
+
const allMenuItems = import_react92.default.useMemo(
|
|
12659
13029
|
() => [...leftMenuItems, ...rightMenuItems],
|
|
12660
13030
|
[leftMenuItems, rightMenuItems]
|
|
12661
13031
|
);
|
|
12662
13032
|
(0, import_noya_keymap7.useKeyboardShortcuts)(
|
|
12663
|
-
|
|
13033
|
+
import_react92.default.useMemo(
|
|
12664
13034
|
() => onSelectMenuItem && shouldBindKeyboardShortcuts ? getKeyboardShortcutsForMenuItems(allMenuItems, onSelectMenuItem) : {},
|
|
12665
13035
|
[allMenuItems, onSelectMenuItem, shouldBindKeyboardShortcuts]
|
|
12666
13036
|
)
|
|
12667
13037
|
);
|
|
12668
|
-
return /* @__PURE__ */
|
|
13038
|
+
return /* @__PURE__ */ import_react92.default.createElement(
|
|
12669
13039
|
BaseToolbar,
|
|
12670
13040
|
{
|
|
12671
13041
|
logo,
|
|
12672
|
-
left: leftMenuItems.length > 0 && /* @__PURE__ */
|
|
13042
|
+
left: leftMenuItems.length > 0 && /* @__PURE__ */ import_react92.default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ import_react92.default.createElement(
|
|
12673
13043
|
ToolbarMenu,
|
|
12674
13044
|
{
|
|
12675
13045
|
items: leftMenuItems,
|
|
12676
13046
|
onSelectMenuItem
|
|
12677
13047
|
}
|
|
12678
13048
|
)),
|
|
12679
|
-
right: rightMenuItems.length > 0 && /* @__PURE__ */
|
|
13049
|
+
right: rightMenuItems.length > 0 && /* @__PURE__ */ import_react92.default.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ import_react92.default.createElement(
|
|
12680
13050
|
ToolbarMenu,
|
|
12681
13051
|
{
|
|
12682
13052
|
items: rightMenuItems,
|
|
@@ -12789,9 +13159,11 @@ function Toolbar({
|
|
|
12789
13159
|
SegmentedControl,
|
|
12790
13160
|
SelectMenu,
|
|
12791
13161
|
SelectionToolbarContainer,
|
|
13162
|
+
SharedDragProvider,
|
|
12792
13163
|
Slider,
|
|
12793
13164
|
Small,
|
|
12794
13165
|
Sortable,
|
|
13166
|
+
SortableItemContext,
|
|
12795
13167
|
Spacer,
|
|
12796
13168
|
Switch,
|
|
12797
13169
|
Text,
|
|
@@ -12813,7 +13185,9 @@ function Toolbar({
|
|
|
12813
13185
|
colorForStringValues,
|
|
12814
13186
|
colorFromString,
|
|
12815
13187
|
colorSwatchSizeMap,
|
|
13188
|
+
createDragItemKey,
|
|
12816
13189
|
createSectionedMenu,
|
|
13190
|
+
createSharedDrag,
|
|
12817
13191
|
cssVarNames,
|
|
12818
13192
|
cssVars,
|
|
12819
13193
|
cx,
|
|
@@ -12826,6 +13200,7 @@ function Toolbar({
|
|
|
12826
13200
|
getFieldSpacing,
|
|
12827
13201
|
getGradientBackground,
|
|
12828
13202
|
getGridSize,
|
|
13203
|
+
getItemFirstCollisionDetection,
|
|
12829
13204
|
getKeyboardShortcutsForMenuItems,
|
|
12830
13205
|
getMenuItemKey,
|
|
12831
13206
|
getNewValue,
|
|
@@ -12841,6 +13216,7 @@ function Toolbar({
|
|
|
12841
13216
|
mergeConflictingClassNames,
|
|
12842
13217
|
moveTreeItem,
|
|
12843
13218
|
normalizeListTargetIndex,
|
|
13219
|
+
parseDragItemKey,
|
|
12844
13220
|
popoverStyle,
|
|
12845
13221
|
portalScopeDataSetName,
|
|
12846
13222
|
portalScopePropName,
|
|
@@ -12883,6 +13259,7 @@ function Toolbar({
|
|
|
12883
13259
|
usePreservePanelSize,
|
|
12884
13260
|
useTheme,
|
|
12885
13261
|
validateDropIndicator,
|
|
13262
|
+
withDragProvider,
|
|
12886
13263
|
withSeparatorElements
|
|
12887
13264
|
});
|
|
12888
13265
|
//# sourceMappingURL=index.js.map
|