@forgeax/app-shell 0.43.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react.d.ts +18 -1
- package/dist/react.js +109 -0
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -92,6 +92,23 @@ interface AnchoredResizeHandleProps extends Omit<ResizeHandleProps, 'onDrag' | '
|
|
|
92
92
|
/** Product-neutral anchored resize session over the public pointer carrier. */
|
|
93
93
|
declare function AnchoredResizeHandle({ readSize, writeSize, direction, resizingBodyClassName, ...handleProps }: AnchoredResizeHandleProps): react.JSX.Element;
|
|
94
94
|
|
|
95
|
+
type PointerReorderFinishReason = 'pointerup' | 'pointercancel' | 'buttons-released' | 'replacement' | 'cancel' | 'dispose' | 'error';
|
|
96
|
+
interface PointerReorderSessionOptions<Item> {
|
|
97
|
+
readonly element: HTMLElement;
|
|
98
|
+
readonly target: Window;
|
|
99
|
+
readonly resolveItem: (target: EventTarget | null) => Item | null;
|
|
100
|
+
readonly canStart?: (event: globalThis.PointerEvent, item: Item) => boolean;
|
|
101
|
+
readonly reorder: (dragged: Item, over: Item, event: globalThis.PointerEvent) => void;
|
|
102
|
+
readonly onDraggingChange?: (item: Item | null, reason?: PointerReorderFinishReason) => void;
|
|
103
|
+
readonly equals?: (left: Item, right: Item) => boolean;
|
|
104
|
+
}
|
|
105
|
+
interface PointerReorderSession {
|
|
106
|
+
cancel(): void;
|
|
107
|
+
dispose(): void;
|
|
108
|
+
}
|
|
109
|
+
/** Own one delegated pointer reorder lifecycle without owning item identity or mutation policy. */
|
|
110
|
+
declare function installPointerReorderSession<Item>(options: PointerReorderSessionOptions<Item>): PointerReorderSession;
|
|
111
|
+
|
|
95
112
|
type PanelContentPadding = 'none' | 'sm' | 'md';
|
|
96
113
|
type PanelContentScroll = 'none' | 'auto';
|
|
97
114
|
type PanelContentTone = 'default' | 'surface' | 'tool';
|
|
@@ -233,4 +250,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
|
|
|
233
250
|
/** Structural shell marker that preserves the caller's semantic element. */
|
|
234
251
|
declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
|
|
235
252
|
|
|
236
|
-
export { type AnchoredResizeDirection, AnchoredResizeHandle, type AnchoredResizeHandleProps, type AnchoredResizeSession, DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type DockLayoutControlBinding, type DockLayoutControlBindingOptions, DockLayoutMenu, type DockLayoutMenuPanel, type DockLayoutMenuProps, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, PanelSurface, type PanelSurfaceProps, type PersistentSizeStorage, type PersistentSizeStore, type PersistentSizeStoreOptions, type PersistentSizeUpdate, type PointerDragFinishReason, type PointerDragSessionOptions, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, type ThresholdPointerDragFinishReason, type ThresholdPointerDragSession, type ThresholdPointerDragSessionOptions, applyAnchoredResizeDelta, beginAnchoredResize, createPersistentSizeStore, hashSlotHue, installPointerDragSession, installThresholdPointerDragSession, isSlotDebugEnabled, useDockLayoutControlBinding, useLocalSize, usePersistentSizeStore };
|
|
253
|
+
export { type AnchoredResizeDirection, AnchoredResizeHandle, type AnchoredResizeHandleProps, type AnchoredResizeSession, DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type DockLayoutControlBinding, type DockLayoutControlBindingOptions, DockLayoutMenu, type DockLayoutMenuPanel, type DockLayoutMenuProps, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, PanelSurface, type PanelSurfaceProps, type PersistentSizeStorage, type PersistentSizeStore, type PersistentSizeStoreOptions, type PersistentSizeUpdate, type PointerDragFinishReason, type PointerDragSessionOptions, type PointerReorderFinishReason, type PointerReorderSession, type PointerReorderSessionOptions, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, type ThresholdPointerDragFinishReason, type ThresholdPointerDragSession, type ThresholdPointerDragSessionOptions, applyAnchoredResizeDelta, beginAnchoredResize, createPersistentSizeStore, hashSlotHue, installPointerDragSession, installPointerReorderSession, installThresholdPointerDragSession, isSlotDebugEnabled, useDockLayoutControlBinding, useLocalSize, usePersistentSizeStore };
|
package/dist/react.js
CHANGED
|
@@ -1067,6 +1067,114 @@ function AnchoredResizeHandle({
|
|
|
1067
1067
|
);
|
|
1068
1068
|
}
|
|
1069
1069
|
|
|
1070
|
+
// src/pointer-reorder.ts
|
|
1071
|
+
function installPointerReorderSession(options) {
|
|
1072
|
+
const equals = options.equals ?? Object.is;
|
|
1073
|
+
let disposed = false;
|
|
1074
|
+
let generation = 0;
|
|
1075
|
+
let active = null;
|
|
1076
|
+
const publishDragging = (item, reason) => {
|
|
1077
|
+
try {
|
|
1078
|
+
options.onDraggingChange?.(item, reason);
|
|
1079
|
+
} catch {
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
const settle = (reason) => {
|
|
1083
|
+
const current = active;
|
|
1084
|
+
if (current === null) return;
|
|
1085
|
+
active = null;
|
|
1086
|
+
if (current.dragging) publishDragging(null, reason);
|
|
1087
|
+
};
|
|
1088
|
+
const onPointerDown = (event) => {
|
|
1089
|
+
if (disposed || event.button !== 0 || event.isPrimary === false) return;
|
|
1090
|
+
let item;
|
|
1091
|
+
try {
|
|
1092
|
+
item = options.resolveItem(event.target);
|
|
1093
|
+
if (item === null || options.canStart?.(event, item) === false) return;
|
|
1094
|
+
} catch {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
const nextGeneration = ++generation;
|
|
1098
|
+
settle("replacement");
|
|
1099
|
+
if (disposed || generation !== nextGeneration) return;
|
|
1100
|
+
active = {
|
|
1101
|
+
generation: nextGeneration,
|
|
1102
|
+
pointerId: event.pointerId,
|
|
1103
|
+
item,
|
|
1104
|
+
dragging: false,
|
|
1105
|
+
lastOver: null
|
|
1106
|
+
};
|
|
1107
|
+
};
|
|
1108
|
+
const onPointerMove = (event) => {
|
|
1109
|
+
const current = active;
|
|
1110
|
+
if (disposed || current === null || event.pointerId !== current.pointerId) return;
|
|
1111
|
+
if ((event.buttons & 1) !== 1) {
|
|
1112
|
+
settle("buttons-released");
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
let over;
|
|
1116
|
+
try {
|
|
1117
|
+
over = options.resolveItem(event.target);
|
|
1118
|
+
} catch {
|
|
1119
|
+
settle("error");
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
if (active !== current || current.generation !== generation) return;
|
|
1123
|
+
if (over === null) return;
|
|
1124
|
+
let sameItem;
|
|
1125
|
+
try {
|
|
1126
|
+
sameItem = equals(over, current.item);
|
|
1127
|
+
} catch {
|
|
1128
|
+
if (active === current) settle("error");
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
if (active !== current || current.generation !== generation || sameItem) return;
|
|
1132
|
+
if (current.lastOver !== null) {
|
|
1133
|
+
let sameTarget;
|
|
1134
|
+
try {
|
|
1135
|
+
sameTarget = equals(over, current.lastOver);
|
|
1136
|
+
} catch {
|
|
1137
|
+
if (active === current) settle("error");
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
if (active !== current || current.generation !== generation || sameTarget) return;
|
|
1141
|
+
}
|
|
1142
|
+
current.lastOver = over;
|
|
1143
|
+
if (!current.dragging) {
|
|
1144
|
+
current.dragging = true;
|
|
1145
|
+
publishDragging(current.item);
|
|
1146
|
+
if (active !== current || current.generation !== generation) return;
|
|
1147
|
+
}
|
|
1148
|
+
try {
|
|
1149
|
+
options.reorder(current.item, over, event);
|
|
1150
|
+
} catch {
|
|
1151
|
+
settle("error");
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
const onPointerFinish = (event) => {
|
|
1155
|
+
const current = active;
|
|
1156
|
+
if (disposed || current === null || event.pointerId !== current.pointerId) return;
|
|
1157
|
+
settle(event.type === "pointercancel" ? "pointercancel" : "pointerup");
|
|
1158
|
+
};
|
|
1159
|
+
options.element.addEventListener("pointerdown", onPointerDown);
|
|
1160
|
+
options.element.addEventListener("pointermove", onPointerMove);
|
|
1161
|
+
options.target.addEventListener("pointerup", onPointerFinish, true);
|
|
1162
|
+
options.target.addEventListener("pointercancel", onPointerFinish, true);
|
|
1163
|
+
return {
|
|
1164
|
+
cancel: () => settle("cancel"),
|
|
1165
|
+
dispose: () => {
|
|
1166
|
+
if (disposed) return;
|
|
1167
|
+
disposed = true;
|
|
1168
|
+
generation += 1;
|
|
1169
|
+
options.element.removeEventListener("pointerdown", onPointerDown);
|
|
1170
|
+
options.element.removeEventListener("pointermove", onPointerMove);
|
|
1171
|
+
options.target.removeEventListener("pointerup", onPointerFinish, true);
|
|
1172
|
+
options.target.removeEventListener("pointercancel", onPointerFinish, true);
|
|
1173
|
+
settle("dispose");
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1070
1178
|
// src/panel.tsx
|
|
1071
1179
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
1072
1180
|
function PanelEmptyState({
|
|
@@ -1435,6 +1543,7 @@ export {
|
|
|
1435
1543
|
createPersistentSizeStore,
|
|
1436
1544
|
hashSlotHue,
|
|
1437
1545
|
installPointerDragSession,
|
|
1546
|
+
installPointerReorderSession,
|
|
1438
1547
|
installThresholdPointerDragSession,
|
|
1439
1548
|
isSlotDebugEnabled,
|
|
1440
1549
|
useDockLayoutControlBinding,
|