@window-splitter/state 1.1.3 → 1.1.4

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/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.3",
5
+ "version": "1.1.4",
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": {
@@ -19,21 +19,29 @@
19
19
  "engines": {
20
20
  "node": ">=18.0.0"
21
21
  },
22
+ "scripts": {
23
+ "build": "tshy",
24
+ "dev": "tshy -w",
25
+ "lint": "eslint .",
26
+ "test": "vitest",
27
+ "test:browser": "vitest",
28
+ "clean": "rm -rf dist .turbo .tshy .tshy-build"
29
+ },
22
30
  "license": "MIT",
23
31
  "devDependencies": {
24
- "@internal/eslint-config": "1.1.3",
32
+ "@internal/eslint-config": "1.1.4",
25
33
  "@testing-library/react": "^16.0.0",
26
34
  "@types/big.js": "^6.2.2",
27
- "@vitest/browser": "^3.1.2",
28
- "@vitest/coverage-istanbul": "^3.1.2",
29
- "eslint": "^9.9.0",
35
+ "@vitest/browser": "catalog:",
36
+ "@vitest/coverage-istanbul": "catalog:",
37
+ "eslint": "catalog:",
30
38
  "framer-motion": "^11.3.28",
31
39
  "jsdom": "^24.1.1",
32
- "playwright": "^1.46.0",
40
+ "playwright": "catalog:",
33
41
  "tiny-cookie": "^2.5.1",
34
- "tshy": "^3.0.2",
35
- "typescript": "^5.5.4",
36
- "vitest": "^3.1.2"
42
+ "tshy": "catalog:",
43
+ "typescript": "catalog:",
44
+ "vitest": "catalog:"
37
45
  },
38
46
  "dependencies": {
39
47
  "big.js": "^6.2.1"
@@ -69,13 +77,5 @@
69
77
  "window"
70
78
  ],
71
79
  "types": "./dist/commonjs/index.d.ts",
72
- "gitHead": "0fae9dff0a45d9423c1327667de042b70774b8bc",
73
- "scripts": {
74
- "build": "tshy",
75
- "dev": "tshy -w",
76
- "lint": "eslint .",
77
- "test": "vitest",
78
- "test:browser": "vitest",
79
- "clean": "rm -rf dist .turbo .tshy .tshy-build"
80
- }
81
- }
80
+ "gitHead": "df18ce3b7488d52f8d91ae7000f5dcaec65f6bdd"
81
+ }
package/src/index.ts CHANGED
@@ -1638,7 +1638,7 @@ function handleOverflow(context: GroupMachineContextValue) {
1638
1638
  const totalSize = pixelItems.reduce((acc, i) => acc.add(i), new Big(0));
1639
1639
  const overflow = totalSize.abs().sub(groupSize);
1640
1640
 
1641
- if (overflow.eq(0) || groupSize.eq(0)) {
1641
+ if (overflow.abs().lt(1) || groupSize.eq(0)) {
1642
1642
  return context;
1643
1643
  }
1644
1644
 
@@ -2216,7 +2216,7 @@ export function groupMachine(
2216
2216
  context.items = withLastKnownSize;
2217
2217
  } else if (
2218
2218
  totalSize > getGroupSize(context) &&
2219
- state.current !== "dragging"
2219
+ state.current === "idle"
2220
2220
  ) {
2221
2221
  context.items = handleOverflow({
2222
2222
  ...context,
@@ -537,6 +537,80 @@ describe("constraints", () => {
537
537
  await waitForIdle(actor);
538
538
  });
539
539
 
540
+
541
+ test("overflow measurements should not collapse panels during animation", async () => {
542
+ const actor = createActor({ groupId: "group" });
543
+
544
+ sendAll(actor, [
545
+ {
546
+ type: "registerPanel",
547
+ data: initializePanel({
548
+ id: "panel-1",
549
+ collapsible: true,
550
+ collapsedSize: "60px",
551
+ default: "140px",
552
+ }),
553
+ },
554
+ {
555
+ type: "registerPanelHandle",
556
+ data: initializePanelHandleData({ id: "resizer-1", size: "10px" }),
557
+ },
558
+ {
559
+ type: "registerPanel",
560
+ data: initializePanel({
561
+ id: "panel-2",
562
+ collapsible: true,
563
+ default: "140px",
564
+ collapseAnimation: {
565
+ easing: "ease-in-out",
566
+ duration: 500,
567
+ },
568
+ }),
569
+ },
570
+ ]);
571
+
572
+ actor.send({
573
+ type: "setSize",
574
+ size: { width: 300, height: 200 },
575
+ });
576
+ actor.send({
577
+ type: "setActualItemsSize",
578
+ childrenSizes: {
579
+ "panel-1": { width: 140, height: 200 },
580
+ "panel-2": { width: 140, height: 200 },
581
+ },
582
+ });
583
+
584
+ const panelBefore = actor.value.items.find(
585
+ (item) => isPanelData(item) && item.id === "panel-1"
586
+ );
587
+ expect(panelBefore?.collapsed).toBe(false);
588
+
589
+ actor.send({
590
+ type: "collapsePanel",
591
+ panelId: "panel-2",
592
+ });
593
+
594
+ await new Promise((resolve) => setTimeout(resolve, 50));
595
+
596
+ expect(actor.state.current).toBe("togglingCollapse");
597
+
598
+ actor.send({
599
+ type: "setActualItemsSize",
600
+ childrenSizes: {
601
+ "panel-1": { width: 200, height: 200 },
602
+ "panel-2": { width: 200, height: 200 },
603
+ },
604
+ });
605
+
606
+ const panelAfter = actor.value.items.find(
607
+ (item) => isPanelData(item) && item.id === "panel-1"
608
+ );
609
+ expect(panelAfter?.collapsed).toBe(false);
610
+
611
+ await waitForIdle(actor);
612
+ });
613
+
540
614
  test("supports 1 panel being collapsed with another panel expanding to fill", () => {
541
615
  const actor = createActor({
542
616
  groupId: "group",
@@ -1,18 +0,0 @@
1
-
2
- 
3
- > @window-splitter/state@1.1.0 lint /Users/alisowski/Documents/react-window-splitter/packages/state
4
- > eslint .
5
-
6
- =============
7
-
8
- WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
9
-
10
- You may find that it works just fine, or you may not.
11
-
12
- SUPPORTED TYPESCRIPT VERSIONS: >=4.7.4 <5.6.0
13
-
14
- YOUR TYPESCRIPT VERSION: 5.8.3
15
-
16
- Please only submit bug reports when using the officially supported version.
17
-
18
- =============
package/LICENSE DELETED
@@ -1,7 +0,0 @@
1
- Copyright 2025 Andrew Lisowski
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.