@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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/commonjs/index.js +7 -7
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -5
- package/src/index.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
package/dist/commonjs/index.js
CHANGED
|
@@ -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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
585
|
+
(0, tiny_invariant_1.default)(isPanelData(panelBefore), `Expected panel before: ${handle.id}`);
|
|
586
586
|
const panelAfter = newItems[handleIndex - moveDirection];
|
|
587
|
-
(0,
|
|
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,
|
|
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) {
|