@vuu-ui/vuu-utils 4.0.1 → 4.1.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.
Files changed (40) hide show
  1. package/package.json +7 -7
  2. package/src/vendor/@dnd-kit/abstract/index.d.ts +114 -32
  3. package/src/vendor/@dnd-kit/abstract/index.js +430 -280
  4. package/src/vendor/@dnd-kit/abstract/index.js.map +1 -1
  5. package/src/vendor/@dnd-kit/abstract/modifiers.d.ts +7 -7
  6. package/src/vendor/@dnd-kit/abstract/modifiers.js.map +1 -1
  7. package/src/vendor/@dnd-kit/abstract/package.json +8 -3
  8. package/src/vendor/@dnd-kit/collision/dist/index.js +10 -3
  9. package/src/vendor/@dnd-kit/collision/package.json +8 -3
  10. package/src/vendor/@dnd-kit/dom/index.d.ts +225 -126
  11. package/src/vendor/@dnd-kit/dom/index.js +998 -484
  12. package/src/vendor/@dnd-kit/dom/index.js.map +1 -1
  13. package/src/vendor/@dnd-kit/dom/modifiers.d.ts +1 -1
  14. package/src/vendor/@dnd-kit/dom/package.json +11 -5
  15. package/src/vendor/@dnd-kit/dom/plugins/debug.js +10 -7
  16. package/src/vendor/@dnd-kit/dom/plugins/debug.js.map +1 -1
  17. package/src/vendor/@dnd-kit/dom/sortable.d.ts +45 -11
  18. package/src/vendor/@dnd-kit/dom/sortable.js +203 -54
  19. package/src/vendor/@dnd-kit/dom/sortable.js.map +1 -1
  20. package/src/vendor/@dnd-kit/dom/utilities.d.ts +82 -10
  21. package/src/vendor/@dnd-kit/dom/utilities.js +249 -95
  22. package/src/vendor/@dnd-kit/dom/utilities.js.map +1 -1
  23. package/src/vendor/@dnd-kit/geometry/package.json +7 -2
  24. package/src/vendor/@dnd-kit/react/hooks.js +61 -38
  25. package/src/vendor/@dnd-kit/react/hooks.js.map +1 -0
  26. package/src/vendor/@dnd-kit/react/index.d.ts +18 -9
  27. package/src/vendor/@dnd-kit/react/index.js +100 -59
  28. package/src/vendor/@dnd-kit/react/index.js.map +1 -0
  29. package/src/vendor/@dnd-kit/react/package.json +17 -5
  30. package/src/vendor/@dnd-kit/react/sortable.d.ts +1 -1
  31. package/src/vendor/@dnd-kit/react/sortable.js +24 -10
  32. package/src/vendor/@dnd-kit/react/sortable.js.map +1 -0
  33. package/src/vendor/@dnd-kit/react/utilities.js.map +1 -0
  34. package/src/vendor/@dnd-kit/state/dist/index.js +1 -1
  35. package/src/vendor/@dnd-kit/state/package.json +6 -1
  36. package/src/vendor/@preact/signals-core/dist/signals-core.js +1 -1
  37. package/src/vendor/@preact/signals-core/dist/signals-core.js.map +1 -1
  38. package/types/ThemeProvider.d.ts +1 -1
  39. package/types/context-definitions/DataProvider.d.ts +1 -1
  40. package/types/context-definitions/DataSourceProvider.d.ts +1 -1
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.1",
2
+ "version": "4.1.0",
3
3
  "author": "heswell",
4
4
  "main": "./src/index.js",
5
5
  "license": "Apache-2.0",
@@ -14,15 +14,15 @@
14
14
  "@salt-ds/core": "1.74.0"
15
15
  },
16
16
  "devDependencies": {
17
- "@dnd-kit/react": "^0.1.21",
18
- "@vuu-ui/vuu-data-types": "4.0.1",
19
- "@vuu-ui/vuu-table-types": "4.0.1",
20
- "@vuu-ui/vuu-filter-types": "4.0.1",
21
- "@vuu-ui/vuu-protocol-types": "4.0.1"
17
+ "@dnd-kit/react": "^0.5.0",
18
+ "@vuu-ui/vuu-data-types": "4.1.0",
19
+ "@vuu-ui/vuu-table-types": "4.1.0",
20
+ "@vuu-ui/vuu-filter-types": "4.1.0",
21
+ "@vuu-ui/vuu-protocol-types": "4.1.0"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@internationalized/date": "^3.0.0",
25
- "@vuu-ui/vuu-filter-parser": "4.0.1",
25
+ "@vuu-ui/vuu-filter-parser": "4.1.0",
26
26
  "clsx": "^2.0.0",
27
27
  "react": "^19.2.3",
28
28
  "react-dom": "^19.2.3"
@@ -57,6 +57,8 @@ interface Input$2<T extends Data = Data> {
57
57
  * @template T - The type of data associated with the entity.
58
58
  */
59
59
  declare class Entity<T extends Data = Data, U extends DragDropManager<any, any> = DragDropManager<any, any>> {
60
+ #private;
61
+ static pendingIdChanges: Map<Entity, UniqueIdentifier> | null;
60
62
  /**
61
63
  * Creates a new instance of the `Entity` class.
62
64
  *
@@ -68,14 +70,12 @@ declare class Entity<T extends Data = Data, U extends DragDropManager<any, any>
68
70
  * The manager that controls the drag and drop operations.
69
71
  */
70
72
  accessor manager: U | undefined;
71
- /**
72
- * The unique identifier of the entity.
73
- */
74
- accessor id: UniqueIdentifier;
73
+ get id(): UniqueIdentifier;
74
+ set id(value: UniqueIdentifier);
75
75
  /**
76
76
  * The data associated with the entity.
77
77
  */
78
- accessor data: Data;
78
+ accessor data: T;
79
79
  /**
80
80
  * A boolean indicating whether the entity is disabled.
81
81
  */
@@ -247,10 +247,7 @@ declare abstract class Plugin<T extends DragDropManager<any, any> = DragDropMana
247
247
  * @param callback - The effect callback to register
248
248
  * @returns A function to dispose of the effect
249
249
  */
250
- protected registerEffect(callback: () => void): {
251
- (): void;
252
- [Symbol.dispose](): void;
253
- };
250
+ protected registerEffect(callback: () => void): CleanupFunction;
254
251
  /**
255
252
  * Destroys a plugin instance and cleans up its resources.
256
253
  *
@@ -371,7 +368,7 @@ declare function configure<T extends PluginConstructor<any, any, any>, V extends
371
368
  * @param plugin - The plugin constructor to configure
372
369
  * @returns A function that takes options and returns a plugin descriptor
373
370
  */
374
- declare function configurator<T extends PluginConstructor<any, any, any>>(plugin: T): (options: InferPluginOptions<T>) => PluginDescriptor<any, any, T>;
371
+ declare function configurator<T extends PluginConstructor<any, any, any>>(plugin: T): (options: InferPluginOptions<T>) => PluginDescriptor<any, Plugin<any, InferPluginOptions<T>>, T>;
375
372
  /**
376
373
  * Normalizes a plugin constructor or descriptor into a descriptor.
377
374
  *
@@ -418,6 +415,12 @@ declare class Status {
418
415
  * @returns true if no drag operation is in progress
419
416
  */
420
417
  get idle(): boolean;
418
+ /**
419
+ * Checks if the status is initialization-pending.
420
+ *
421
+ * @returns true if a drag operation is about to start
422
+ */
423
+ get initializationPending(): boolean;
421
424
  /**
422
425
  * Checks if the status is initializing.
423
426
  *
@@ -506,7 +509,9 @@ declare class DragOperation<T extends Draggable, U extends Droppable> implements
506
509
  /**
507
510
  * Gets the source draggable entity.
508
511
  *
509
- * @returns The current draggable entity or the previous one if the current is not found
512
+ * @returns The current draggable entity, falling back to the previous
513
+ * instance to bridge the gap when React unmounts and remounts a sortable
514
+ * during reparenting (e.g. moving an item between columns).
510
515
  */
511
516
  get source(): T | null;
512
517
  /**
@@ -668,6 +673,7 @@ interface Input$1<T extends Data = Data> extends Input$2<T> {
668
673
  sensors?: Sensors;
669
674
  modifiers?: Modifiers;
670
675
  alignment?: Alignment;
676
+ plugins?: Plugins;
671
677
  }
672
678
  /**
673
679
  * Possible status values for a draggable entity.
@@ -692,7 +698,7 @@ type DraggableStatus = 'idle' | 'dragging' | 'dropping';
692
698
  * - Status tracking during drag operations
693
699
  */
694
700
  declare class Draggable<T extends Data = Data, U extends DragDropManager<any, any> = DragDropManager<any, any>> extends Entity<T, U> {
695
- constructor({ modifiers, type, sensors, ...input }: Input$1<T>, manager: U | undefined);
701
+ constructor({ modifiers, type, sensors, plugins, effects, ...input }: Input$1<T>, manager: U | undefined);
696
702
  /** The type of the draggable entity */
697
703
  accessor type: Type | undefined;
698
704
  /** The sensors associated with the draggable entity */
@@ -701,6 +707,12 @@ declare class Draggable<T extends Data = Data, U extends DragDropManager<any, an
701
707
  accessor modifiers: Modifiers | undefined;
702
708
  /** The alignment of the draggable entity */
703
709
  alignment: Alignment | undefined;
710
+ /** Per-entity plugin configuration descriptors */
711
+ plugins: Plugins | undefined;
712
+ /**
713
+ * Look up per-entity options for a given plugin constructor.
714
+ */
715
+ pluginConfig<P extends PluginConstructor>(plugin: P): PluginDescriptor<any, any, P>['options'] | undefined;
704
716
  /** The current status of the draggable entity */
705
717
  accessor status: DraggableStatus;
706
718
  /**
@@ -915,6 +927,38 @@ declare class Droppable<T extends Data = Data, U extends DragDropManager<any, an
915
927
  get isDropTarget(): boolean;
916
928
  }
917
929
 
930
+ declare class ActivationController<E extends Event> extends AbortController {
931
+ private constraints;
932
+ private onActivate;
933
+ activated: boolean;
934
+ constructor(constraints: ActivationConstraints<E> | undefined, onActivate: (event: E) => void);
935
+ onEvent(event: E): void;
936
+ activate(event: E): void;
937
+ abort(event?: E): void;
938
+ }
939
+ interface ActivationConstraintOptions {
940
+ }
941
+ declare abstract class ActivationConstraint<E extends Event = Event, O extends ActivationConstraintOptions = ActivationConstraintOptions> {
942
+ #private;
943
+ protected options: O;
944
+ set controller(controller: ActivationController<E>);
945
+ constructor(options: O);
946
+ /**
947
+ * Called when the activation is triggered.
948
+ */
949
+ activate(event: E): void;
950
+ /**
951
+ * Called when the activation is aborted.
952
+ */
953
+ abstract abort(event?: E): void;
954
+ /**
955
+ * Called when an input event is received by the sensor.
956
+ * Returns `true` if this event triggers activation immediately.
957
+ */
958
+ abstract onEvent(event: E): void;
959
+ }
960
+ type ActivationConstraints<E extends Event> = ActivationConstraint<E>[];
961
+
918
962
  /**
919
963
  * Provides actions for controlling drag and drop operations.
920
964
  *
@@ -1119,41 +1163,42 @@ declare class Monitor<T extends Events> {
1119
1163
  protected dispatch<U extends keyof T>(name: U, ...args: any[]): void;
1120
1164
  }
1121
1165
  /**
1122
- * Type definition for drag and drop events.
1166
+ * Map of drag and drop event objects, keyed by event name.
1167
+ * Follows the same pattern as the DOM's `WindowEventMap`.
1123
1168
  *
1124
1169
  * @template T - The type of draggable entities
1125
1170
  * @template U - The type of droppable entities
1126
1171
  * @template V - The type of drag and drop manager
1127
1172
  */
1128
- type DragDropEvents<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> = {
1173
+ type DragDropEventMap<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> = {
1129
1174
  /** Event fired when collisions are detected */
1130
- collision(event: Preventable<{
1175
+ collision: Preventable<{
1131
1176
  collisions: Collisions;
1132
- }>, manager: V): void;
1177
+ }>;
1133
1178
  /** Event fired before a drag operation starts */
1134
- beforedragstart(event: Preventable<{
1179
+ beforedragstart: Preventable<{
1135
1180
  operation: DragOperationSnapshot<T, U>;
1136
1181
  nativeEvent?: Event;
1137
- }>, manager: V): void;
1182
+ }>;
1138
1183
  /** Event fired when a drag operation starts */
1139
- dragstart(event: {
1184
+ dragstart: {
1140
1185
  cancelable: false;
1141
1186
  operation: DragOperationSnapshot<T, U>;
1142
1187
  nativeEvent?: Event;
1143
- }, manager: V): void;
1188
+ };
1144
1189
  /** Event fired when a drag operation moves */
1145
- dragmove(event: Preventable<{
1190
+ dragmove: Preventable<{
1146
1191
  operation: DragOperationSnapshot<T, U>;
1147
1192
  to?: Coordinates;
1148
1193
  by?: Coordinates;
1149
1194
  nativeEvent?: Event;
1150
- }>, manager: V): void;
1195
+ }>;
1151
1196
  /** Event fired when a drag operation hovers over a droppable */
1152
- dragover(event: Preventable<{
1197
+ dragover: Preventable<{
1153
1198
  operation: DragOperationSnapshot<T, U>;
1154
- }>, manager: V): void;
1199
+ }>;
1155
1200
  /** Event fired when a drag operation ends */
1156
- dragend(event: {
1201
+ dragend: {
1157
1202
  operation: DragOperationSnapshot<T, U>;
1158
1203
  nativeEvent?: Event;
1159
1204
  canceled: boolean;
@@ -1161,8 +1206,26 @@ type DragDropEvents<T extends Draggable, U extends Droppable, V extends DragDrop
1161
1206
  resume(): void;
1162
1207
  abort(): void;
1163
1208
  };
1164
- }, manager: V): void;
1209
+ };
1210
+ };
1211
+ /**
1212
+ * Map of drag and drop event handler signatures, keyed by event name.
1213
+ * Each handler receives the event object and the manager instance.
1214
+ * Derived from `DragDropEventMap`.
1215
+ *
1216
+ * @template T - The type of draggable entities
1217
+ * @template U - The type of droppable entities
1218
+ * @template V - The type of drag and drop manager
1219
+ */
1220
+ type DragDropEventHandlers<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> = {
1221
+ [K in keyof DragDropEventMap<T, U, V>]: (event: DragDropEventMap<T, U, V>[K], manager: V) => void;
1165
1222
  };
1223
+ type CollisionEvent<T extends Draggable = Draggable, U extends Droppable = Droppable, V extends DragDropManager<T, U> = DragDropManager<T, U>> = DragDropEventMap<T, U, V>['collision'];
1224
+ type BeforeDragStartEvent<T extends Draggable = Draggable, U extends Droppable = Droppable, V extends DragDropManager<T, U> = DragDropManager<T, U>> = DragDropEventMap<T, U, V>['beforedragstart'];
1225
+ type DragStartEvent<T extends Draggable = Draggable, U extends Droppable = Droppable, V extends DragDropManager<T, U> = DragDropManager<T, U>> = DragDropEventMap<T, U, V>['dragstart'];
1226
+ type DragMoveEvent<T extends Draggable = Draggable, U extends Droppable = Droppable, V extends DragDropManager<T, U> = DragDropManager<T, U>> = DragDropEventMap<T, U, V>['dragmove'];
1227
+ type DragOverEvent<T extends Draggable = Draggable, U extends Droppable = Droppable, V extends DragDropManager<T, U> = DragDropManager<T, U>> = DragDropEventMap<T, U, V>['dragover'];
1228
+ type DragEndEvent<T extends Draggable = Draggable, U extends Droppable = Droppable, V extends DragDropManager<T, U> = DragDropManager<T, U>> = DragDropEventMap<T, U, V>['dragend'];
1166
1229
  /**
1167
1230
  * Monitors and dispatches drag and drop events.
1168
1231
  *
@@ -1170,7 +1233,7 @@ type DragDropEvents<T extends Draggable, U extends Droppable, V extends DragDrop
1170
1233
  * @template U - The type of droppable entities
1171
1234
  * @template V - The type of drag and drop manager
1172
1235
  */
1173
- declare class DragDropMonitor<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> extends Monitor<DragDropEvents<T, U, V>> {
1236
+ declare class DragDropMonitor<T extends Draggable, U extends Droppable, V extends DragDropManager<T, U>> extends Monitor<DragDropEventHandlers<T, U, V>> {
1174
1237
  private manager;
1175
1238
  /**
1176
1239
  * Creates a new drag and drop monitor.
@@ -1184,7 +1247,7 @@ declare class DragDropMonitor<T extends Draggable, U extends Droppable, V extend
1184
1247
  * @param type - The type of event to dispatch
1185
1248
  * @param event - The event data to dispatch
1186
1249
  */
1187
- dispatch<Key extends keyof DragDropEvents<T, U, V>>(type: Key, event: Parameters<DragDropEvents<T, U, V>[Key]>[0]): void;
1250
+ dispatch<Key extends keyof DragDropEventMap<T, U, V>>(type: Key, event: DragDropEventMap<T, U, V>[Key]): void;
1188
1251
  }
1189
1252
 
1190
1253
  /**
@@ -1203,10 +1266,29 @@ interface Renderer {
1203
1266
  get rendering(): Promise<void>;
1204
1267
  }
1205
1268
 
1269
+ /**
1270
+ * A value that can be provided as-is or as a function that receives defaults.
1271
+ *
1272
+ * @example
1273
+ * // As a plain array (replaces defaults)
1274
+ * plugins: [MyPlugin]
1275
+ *
1276
+ * // As a function (receives defaults)
1277
+ * plugins: (defaults) => [...defaults, MyPlugin]
1278
+ */
1279
+ type Customizable<T> = T | ((defaults: T) => T);
1280
+ /**
1281
+ * Resolves a customizable value by applying it to defaults.
1282
+ *
1283
+ * @param value - A value or function that receives defaults
1284
+ * @param defaults - The default value to use when undefined, or to pass to a function
1285
+ * @returns The resolved value
1286
+ */
1287
+ declare function resolveCustomizable<T>(value: Customizable<T> | undefined, defaults: T): T;
1206
1288
  type DragDropManagerInput<T extends DragDropManager<any, any>> = {
1207
- plugins?: Plugins<T>;
1208
- sensors?: Sensors<T>;
1209
- modifiers?: Modifiers<T>;
1289
+ plugins?: Customizable<Plugins<T>>;
1290
+ sensors?: Customizable<Sensors<T>>;
1291
+ modifiers?: Customizable<Modifiers<T>>;
1210
1292
  renderer?: Renderer;
1211
1293
  };
1212
1294
  /**
@@ -1276,4 +1358,4 @@ declare class DragDropManager<T extends Draggable, U extends Droppable> {
1276
1358
  destroy: () => void;
1277
1359
  }
1278
1360
 
1279
- export { type Collision, type CollisionDetector, CollisionPriority, CollisionType, CorePlugin, type Data, DragActions, type DragDropEvents, DragDropManager, type DragDropManagerInput, type DragOperationSnapshot as DragOperation, Status as DragOperationStatus, Draggable, type Input$1 as DraggableInput, Droppable, type Input as DroppableInput, Entity, Modifier, type ModifierConstructor, type Modifiers, Plugin, type PluginConstructor, type PluginDescriptor, type PluginOptions, PluginRegistry, type Plugins, type Renderer, Sensor, type SensorConstructor, type SensorDescriptor, type SensorOptions, type Sensors, type Type, type UniqueIdentifier, configurator, configure, descriptor, sortCollisions };
1361
+ export { ActivationConstraint, type ActivationConstraints, ActivationController, type BeforeDragStartEvent, type Collision, type CollisionDetector, type CollisionEvent, CollisionPriority, CollisionType, CorePlugin, type Customizable, type Data, DragActions, type DragDropEventHandlers, type DragDropEventMap, DragDropManager, type DragDropManagerInput, type DragEndEvent, type DragMoveEvent, type DragOperationSnapshot as DragOperation, Status as DragOperationStatus, type DragOverEvent, type DragStartEvent, Draggable, type Input$1 as DraggableInput, Droppable, type Input as DroppableInput, Entity, Modifier, type ModifierConstructor, type Modifiers, Plugin, type PluginConstructor, type PluginDescriptor, type PluginOptions, PluginRegistry, type Plugins, type Renderer, Sensor, type SensorConstructor, type SensorDescriptor, type SensorOptions, type Sensors, type Type, type UniqueIdentifier, configurator, configure, descriptor, resolveCustomizable, sortCollisions };