@window-splitter/state 0.5.1 → 0.5.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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > @window-splitter/state@0.5.0 build /Users/andrew/Documents/react-window-splitter/packages/state
3
+ > @window-splitter/state@0.5.1 build /Users/andrew/Documents/react-window-splitter/packages/state
4
4
  > tshy
5
5
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v0.5.2 (Wed Apr 23 2025)
2
+
3
+ #### ⚠️ Pushed to `main`
4
+
5
+ - switch to tiny-invariant (lisowski54@gmail.com)
6
+
7
+ #### Authors: 1
8
+
9
+ - Andrew Lisowski (lisowski54@gmail.com)
10
+
11
+ ---
12
+
1
13
  # v0.5.0 (Thu Apr 17 2025)
2
14
 
3
15
  #### 🚀 Enhancement
@@ -29,7 +29,7 @@ exports.dragHandlePayload = dragHandlePayload;
29
29
  const universal_cookie_1 = __importDefault(require("universal-cookie"));
30
30
  const rafz_1 = require("@react-spring/rafz");
31
31
  const xstate_1 = require("xstate");
32
- const invariant_1 = __importDefault(require("invariant"));
32
+ const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
33
33
  const big_js_1 = __importDefault(require("big.js"));
34
34
  // #region Constants
35
35
  /** The default amount a user can `dragOvershoot` before the panel collapses */
@@ -118,7 +118,7 @@ function prepareSnapshot(snapshot) {
118
118
  }
119
119
  /** Assert that the provided event is one of the accepted types */
120
120
  function isEvent(event, eventType) {
121
- (0, invariant_1.default)(eventType.includes(event.type), `Invalid event type: ${eventType}. Expected: ${eventType.join(" | ")}`);
121
+ (0, tiny_invariant_1.default)(eventType.includes(event.type), `Invalid event type: ${eventType}. Expected: ${eventType.join(" | ")}`);
122
122
  }
123
123
  /** Determine if an item is a panel */
124
124
  function isPanelData(value) {
@@ -297,7 +297,7 @@ function getCollapsiblePanelForHandleId(context, handleId) {
297
297
  */
298
298
  function getHandleForPanelId(context, panelId) {
299
299
  const panelIndex = context.items.findIndex((item) => item.id === panelId);
300
- (0, invariant_1.default)(panelIndex !== -1, `Expected panel before: ${panelId}`);
300
+ (0, tiny_invariant_1.default)(panelIndex !== -1, `Expected panel before: ${panelId}`);
301
301
  let item = context.items[panelIndex + 1];
302
302
  if (item && isPanelHandle(item)) {
303
303
  return { item, direction: 1 };
@@ -337,7 +337,7 @@ function sortWithOrder(items) {
337
337
  }
338
338
  /** Check if the panel has space available to add to */
339
339
  function panelHasSpace(context, item, adjustment) {
340
- (0, invariant_1.default)(item.currentValue.type === "pixel", `panelHasSpace only works with number values: ${item.id} ${item.currentValue}`);
340
+ (0, tiny_invariant_1.default)(item.currentValue.type === "pixel", `panelHasSpace only works with number values: ${item.id} ${item.currentValue}`);
341
341
  if (item.collapsible && !item.collapsed) {
342
342
  return true;
343
343
  }
@@ -582,9 +582,9 @@ function updateLayout(context, dragEvent) {
582
582
  dragOvershoot: context.dragOvershoot.add(moveAmount),
583
583
  };
584
584
  }
585
- (0, invariant_1.default)(isPanelData(panelBefore), `Expected panel before: ${handle.id}`);
585
+ (0, tiny_invariant_1.default)(isPanelData(panelBefore), `Expected panel before: ${handle.id}`);
586
586
  const panelAfter = newItems[handleIndex - moveDirection];
587
- (0, invariant_1.default)(panelAfter && isPanelData(panelAfter), `Expected panel after: ${handle.id}`);
587
+ (0, tiny_invariant_1.default)(panelAfter && isPanelData(panelAfter), `Expected panel after: ${handle.id}`);
588
588
  if (panelAfter.currentValue.value.eq(getUnitPixelValue(context, panelAfter.max))) {
589
589
  return {
590
590
  dragOvershoot: context.dragOvershoot.add(moveAmount),
@@ -1131,7 +1131,7 @@ exports.groupMachine = (0, xstate_1.createMachine)({
1131
1131
  onToggleCollapseComplete: (0, xstate_1.assign)({
1132
1132
  items: ({ context, event: e }) => {
1133
1133
  const { output } = e;
1134
- (0, invariant_1.default)(output, "Expected output from animation actor");
1134
+ (0, tiny_invariant_1.default)(output, "Expected output from animation actor");
1135
1135
  const panel = getPanelWithId(context, output.panelId);
1136
1136
  panel.collapsed = output.action === "collapse";
1137
1137
  if (panel.collapsed) {