@window-splitter/state 1.1.1 → 1.1.2
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/CHANGELOG.md +13 -0
- package/dist/commonjs/index.d.ts +9 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +15 -3
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +9 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +15 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +30 -4
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@window-splitter/state",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.2",
|
|
6
6
|
"description": "A state machine for a WAI-ARIA compliant window splitter",
|
|
7
7
|
"homepage": "https://react-window-splitter-six.vercel.app",
|
|
8
8
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@internal/eslint-config": "1.1.
|
|
32
|
+
"@internal/eslint-config": "1.1.2",
|
|
33
33
|
"@testing-library/react": "^16.0.0",
|
|
34
34
|
"@types/big.js": "^6.2.2",
|
|
35
35
|
"@vitest/browser": "catalog:",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"window"
|
|
78
78
|
],
|
|
79
79
|
"types": "./dist/commonjs/index.d.ts",
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "d9d2440aa94cb486fa4334f69a7e4717926f3192"
|
|
81
81
|
}
|
package/src/index.ts
CHANGED
|
@@ -290,6 +290,15 @@ interface ExpandPanelEvent extends ControlledCollapseToggle {
|
|
|
290
290
|
resolve?: () => void;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
interface UpdateItemIndexEvent {
|
|
294
|
+
/** Update the index of a panel */
|
|
295
|
+
type: "updateItemIndex";
|
|
296
|
+
/** The panel to update */
|
|
297
|
+
itemId: string;
|
|
298
|
+
/** The new index of the panel */
|
|
299
|
+
index: number;
|
|
300
|
+
}
|
|
301
|
+
|
|
293
302
|
interface SetPanelPixelSizeEvent {
|
|
294
303
|
/**
|
|
295
304
|
* This event is used by the imperative panel API.
|
|
@@ -354,7 +363,8 @@ export type GroupMachineEvent =
|
|
|
354
363
|
| RebindPanelCallbacksEvent
|
|
355
364
|
| UpdateConstraintsEvent
|
|
356
365
|
| LockGroupEvent
|
|
357
|
-
| UnlockGroupEvent
|
|
366
|
+
| UnlockGroupEvent
|
|
367
|
+
| UpdateItemIndexEvent;
|
|
358
368
|
|
|
359
369
|
type EventForType<T extends GroupMachineEvent["type"]> = Extract<
|
|
360
370
|
GroupMachineEvent,
|
|
@@ -2042,6 +2052,13 @@ export function groupMachine(
|
|
|
2042
2052
|
}
|
|
2043
2053
|
|
|
2044
2054
|
switch (event.type) {
|
|
2055
|
+
case "updateItemIndex":
|
|
2056
|
+
context.items = sortWithOrder(
|
|
2057
|
+
context.items.map((item) =>
|
|
2058
|
+
item.id === event.itemId ? { ...item, order: event.index } : item
|
|
2059
|
+
)
|
|
2060
|
+
);
|
|
2061
|
+
break;
|
|
2045
2062
|
case "registerPanel":
|
|
2046
2063
|
context.items = addDeDuplicatedItems(context.items, {
|
|
2047
2064
|
type: "panel",
|
|
@@ -2079,11 +2096,20 @@ export function groupMachine(
|
|
|
2079
2096
|
event.data.collapsed &&
|
|
2080
2097
|
event.data.collapsedSize
|
|
2081
2098
|
) {
|
|
2082
|
-
currentValue =
|
|
2099
|
+
currentValue = {
|
|
2100
|
+
type: "pixel",
|
|
2101
|
+
value: getUnitPixelValue(context, event.data.collapsedSize),
|
|
2102
|
+
};
|
|
2083
2103
|
} else if (event.data.default) {
|
|
2084
|
-
currentValue =
|
|
2104
|
+
currentValue = {
|
|
2105
|
+
type: "pixel",
|
|
2106
|
+
value: getUnitPixelValue(context, event.data.default),
|
|
2107
|
+
};
|
|
2085
2108
|
} else {
|
|
2086
|
-
currentValue =
|
|
2109
|
+
currentValue = {
|
|
2110
|
+
type: "pixel",
|
|
2111
|
+
value: getUnitPixelValue(context, event.data.min),
|
|
2112
|
+
};
|
|
2087
2113
|
}
|
|
2088
2114
|
|
|
2089
2115
|
const newItems = addDeDuplicatedItems(context.items, {
|