@window-splitter/state 0.5.1 → 0.5.3

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": "0.5.1",
5
+ "version": "0.5.3",
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": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "license": "MIT",
30
30
  "devDependencies": {
31
- "@internal/eslint-config": "0.5.1",
31
+ "@internal/eslint-config": "0.5.3",
32
32
  "@testing-library/react": "^16.0.0",
33
33
  "@types/big.js": "^6.2.2",
34
34
  "@vitest/browser": "^2.0.5",
@@ -43,10 +43,9 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@react-spring/rafz": "^9.7.4",
46
- "@types/invariant": "^2.2.37",
47
46
  "big.js": "^6.2.1",
48
- "invariant": "^2.2.4",
49
- "universal-cookie": "^7.2.0",
47
+ "tiny-cookie": "^2.5.1",
48
+ "tiny-invariant": "^1.3.3",
50
49
  "xstate": "^5.17.4"
51
50
  },
52
51
  "tshy": {
@@ -80,5 +79,5 @@
80
79
  "window"
81
80
  ],
82
81
  "types": "./dist/commonjs/index.d.ts",
83
- "gitHead": "7107d50f4b302ac05eeeccd76df00e5cde5c8b42"
82
+ "gitHead": "686f0f6b0d0f0253a7a127fe44936b16c057c3c1"
84
83
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Cookies from "universal-cookie";
1
+ import * as Cookies from "tiny-cookie";
2
2
  import { raf } from "@react-spring/rafz";
3
3
  import {
4
4
  createMachine,
@@ -7,7 +7,7 @@ import {
7
7
  fromPromise,
8
8
  Snapshot,
9
9
  } from "xstate";
10
- import invariant from "invariant";
10
+ import invariant from "tiny-invariant";
11
11
  import Big from "big.js";
12
12
 
13
13
  // #region Constants
@@ -1850,11 +1850,10 @@ export const groupMachine = createMachine(
1850
1850
  if (context.autosaveStrategy === "localStorage") {
1851
1851
  localStorage.setItem(context.groupId, data);
1852
1852
  } else {
1853
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1854
- const ActualClass = (Cookies as any).default || Cookies;
1855
- const cookies = new ActualClass(null, { path: "/" });
1856
-
1857
- cookies.set(context.groupId, data, { path: "/", maxAge: 31536000 });
1853
+ Cookies.set(context.groupId, data, {
1854
+ path: "/",
1855
+ "max-age": 31536000,
1856
+ });
1858
1857
  }
1859
1858
  },
1860
1859
  notifyCollapseToggle: ({ context, event }) => {
@@ -20,7 +20,7 @@ import {
20
20
  import { Actor, createActor } from "xstate";
21
21
  import { spring } from "framer-motion";
22
22
  import Big from "big.js";
23
- import Cookies from "universal-cookie";
23
+ import * as Cookies from "tiny-cookie";
24
24
 
25
25
  function getTemplate(actor: Actor<typeof groupMachine>) {
26
26
  return buildTemplate(actor.getSnapshot().context);
@@ -2040,9 +2040,7 @@ describe("autosave", () => {
2040
2040
 
2041
2041
  await waitForIdle(actor);
2042
2042
 
2043
- const ActualClass = (Cookies as any).default || Cookies;
2044
- const cookies = new ActualClass(null, { path: "/" });
2045
- const snapshot = prepareSnapshot(cookies.get("group-2")!);
2043
+ const snapshot = prepareSnapshot(JSON.parse(Cookies.get("group-2")!));
2046
2044
  const actor2 = createActor(groupMachine, {
2047
2045
  // @ts-expect-error For tests
2048
2046
  input: {},