@window-splitter/state 1.0.1 → 1.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.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +144 -0
- package/CHANGELOG.md +17 -0
- package/dist/commonjs/index.d.ts +6 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +2 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/__snapshots__/machine.test.ts.snap +2 -0
- package/src/index.ts +8 -1
package/src/index.ts
CHANGED
|
@@ -317,6 +317,11 @@ export interface GroupMachineContextValue {
|
|
|
317
317
|
* How to save the persisted state
|
|
318
318
|
*/
|
|
319
319
|
autosaveStrategy?: "localStorage" | "cookie";
|
|
320
|
+
/**
|
|
321
|
+
* The amount to move the drag handle when shift is held down.
|
|
322
|
+
* @default 15px
|
|
323
|
+
*/
|
|
324
|
+
shiftAmount?: number;
|
|
320
325
|
}
|
|
321
326
|
|
|
322
327
|
interface LockGroupEvent {
|
|
@@ -1119,7 +1124,7 @@ function updateLayout(
|
|
|
1119
1124
|
: dragEvent.value.deltaY;
|
|
1120
1125
|
|
|
1121
1126
|
if (dragEvent.value.shiftKey) {
|
|
1122
|
-
moveAmount *= 15;
|
|
1127
|
+
moveAmount *= context.shiftAmount ?? 15;
|
|
1123
1128
|
}
|
|
1124
1129
|
|
|
1125
1130
|
if (moveAmount === 0) {
|
|
@@ -1689,6 +1694,7 @@ export interface GroupMachineInput {
|
|
|
1689
1694
|
groupId: string;
|
|
1690
1695
|
items?: Item[];
|
|
1691
1696
|
autosaveStrategy?: "localStorage" | "cookie";
|
|
1697
|
+
shiftAmount?: number;
|
|
1692
1698
|
}
|
|
1693
1699
|
|
|
1694
1700
|
export type State = "idle" | "dragging" | "togglingCollapse";
|
|
@@ -1712,6 +1718,7 @@ export function groupMachine(
|
|
|
1712
1718
|
dragOvershoot: new Big(0),
|
|
1713
1719
|
groupId: input.groupId || `group-${groupId++}`,
|
|
1714
1720
|
autosaveStrategy: input.autosaveStrategy,
|
|
1721
|
+
shiftAmount: input.shiftAmount ?? 15,
|
|
1715
1722
|
};
|
|
1716
1723
|
|
|
1717
1724
|
const actions = {
|