insync-stage-handler 4.0.0-beta.2 → 4.0.0-beta.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/dist/library.js +43 -18
- package/dist/library.js.map +1 -1
- package/dist/module.js +44 -19
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -38,9 +38,23 @@ const listEntities = R.curry((entitiesContainerPath, from) => R.pipe(R.converge(
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Return the version of a stage object.
|
|
41
|
+
*
|
|
42
|
+
* Compatibility rule:
|
|
43
|
+
* Some legacy stages are marked as version 4 while still carrying
|
|
44
|
+
* Golden Layout data under layout.entities.layoutSections and no
|
|
45
|
+
* layout.dockviewLayout. Those need to pass through v3-to-v4.
|
|
46
|
+
*
|
|
41
47
|
* @param {Object} stage The stage for which to return the version.
|
|
42
48
|
*/
|
|
43
|
-
var detectVersion =
|
|
49
|
+
var detectVersion = (stage = {}) => {
|
|
50
|
+
const version = R.defaultTo(1)(R.prop("version", stage));
|
|
51
|
+
const hasLegacyLayoutSections = R.hasPath(["layout", "entities", "layoutSections", "byId"], stage);
|
|
52
|
+
const hasDockviewLayout = R.hasPath(["layout", "dockviewLayout"], stage);
|
|
53
|
+
if (version >= 4 && hasLegacyLayoutSections && !hasDockviewLayout) {
|
|
54
|
+
return 3;
|
|
55
|
+
}
|
|
56
|
+
return version;
|
|
57
|
+
};
|
|
44
58
|
|
|
45
59
|
class ValidationError extends Error {
|
|
46
60
|
setErrors(errors) {
|
|
@@ -3588,10 +3602,10 @@ const scaleZoomSteps$1 = stage => {
|
|
|
3588
3602
|
zoomSteps: rest.zoomStepsIsScaled ? zoomSteps : zoomSteps.map(step => step * Math.sqrt(measurementScale))
|
|
3589
3603
|
}))))(stage);
|
|
3590
3604
|
};
|
|
3591
|
-
const updateVersion$
|
|
3605
|
+
const updateVersion$2 = R__namespace.assoc("version", 3);
|
|
3592
3606
|
var v2ToV3$1 = R__namespace.pipe(R__namespace.tap(stage => {
|
|
3593
3607
|
console.log("upgrading ", stage, " from 2 to 3");
|
|
3594
|
-
}), consolidate, R__namespace.unless(R__namespace.prop("error"), R__namespace.pipe(R__namespace.prop("stage"), removeOutlets$1, scaleZoomSteps$1, dataStreamsToMeasurements$1, createTimingSlice, createTimelineSlice, createFilesTimings, createComments, createCommentsTimings, createTimelineGroups, createTimeline, fixTracks, updateVersion$
|
|
3608
|
+
}), consolidate, R__namespace.unless(R__namespace.prop("error"), R__namespace.pipe(R__namespace.prop("stage"), removeOutlets$1, scaleZoomSteps$1, dataStreamsToMeasurements$1, createTimingSlice, createTimelineSlice, createFilesTimings, createComments, createCommentsTimings, createTimelineGroups, createTimeline, fixTracks, updateVersion$2, fixPanels$1, upgradeResources)));
|
|
3595
3609
|
|
|
3596
3610
|
/**
|
|
3597
3611
|
* v3-to-v4 Stage Upgrader
|
|
@@ -3627,7 +3641,11 @@ const isComponentSection = section => {
|
|
|
3627
3641
|
};
|
|
3628
3642
|
const getRootSection = (content, sections) => {
|
|
3629
3643
|
const rootId = getSectionId(content && content[0]);
|
|
3630
|
-
|
|
3644
|
+
if (rootId) {
|
|
3645
|
+
return sections[rootId];
|
|
3646
|
+
}
|
|
3647
|
+
const firstId = Object.keys(sections)[0];
|
|
3648
|
+
return firstId ? sections[firstId] : undefined;
|
|
3631
3649
|
};
|
|
3632
3650
|
const getOrientationForSection = section => {
|
|
3633
3651
|
return (section === null || section === void 0 ? void 0 : section.type) === "row" ? DOCKVIEW_HORIZONTAL : DOCKVIEW_VERTICAL;
|
|
@@ -3666,6 +3684,19 @@ const createDockviewGroupId = section => {
|
|
|
3666
3684
|
}
|
|
3667
3685
|
return `${section.id}__group`;
|
|
3668
3686
|
};
|
|
3687
|
+
const findFirstLeafGroupId = node => {
|
|
3688
|
+
if (!node) {
|
|
3689
|
+
return undefined;
|
|
3690
|
+
}
|
|
3691
|
+
if (node.type === "leaf") {
|
|
3692
|
+
var _node$data;
|
|
3693
|
+
return (_node$data = node.data) === null || _node$data === void 0 ? void 0 : _node$data.id;
|
|
3694
|
+
}
|
|
3695
|
+
if (!Array.isArray(node.data) || node.data.length === 0) {
|
|
3696
|
+
return undefined;
|
|
3697
|
+
}
|
|
3698
|
+
return findFirstLeafGroupId(node.data[0]);
|
|
3699
|
+
};
|
|
3669
3700
|
const createDockviewLeaf = (section, sections) => {
|
|
3670
3701
|
const childValues = section.type === "stack" ? section.content || [] : [section.id];
|
|
3671
3702
|
const panelIds = childValues.map(getSectionId).filter(panelId => Boolean(sections[panelId]));
|
|
@@ -3727,7 +3758,6 @@ const createPanelsById = sections => {
|
|
|
3727
3758
|
}, {}))(sections);
|
|
3728
3759
|
};
|
|
3729
3760
|
const convertLegacyLayoutToDockview = stage => {
|
|
3730
|
-
var _rootSection$content;
|
|
3731
3761
|
const content = R__namespace.path(["layout", "content"], stage);
|
|
3732
3762
|
const rawSections = R__namespace.pathOr({}, ["layout", "entities", "layoutSections", "byId"], stage);
|
|
3733
3763
|
const assetsById = R__namespace.pathOr({}, ["assets", "entities", "assets", "byId"], stage);
|
|
@@ -3745,7 +3775,7 @@ const convertLegacyLayoutToDockview = stage => {
|
|
|
3745
3775
|
orientation: getOrientationForSection(rootSection)
|
|
3746
3776
|
},
|
|
3747
3777
|
panels: createPanelsById(sections),
|
|
3748
|
-
activeGroup:
|
|
3778
|
+
activeGroup: findFirstLeafGroupId(rootNode)
|
|
3749
3779
|
};
|
|
3750
3780
|
};
|
|
3751
3781
|
const upgradeToDockviewLayout = stage => {
|
|
@@ -3765,12 +3795,12 @@ const upgradeToDockviewLayout = stage => {
|
|
|
3765
3795
|
// Preserve these layout state properties if they exist
|
|
3766
3796
|
R__namespace.when(R__namespace.hasPath(["layout", "focus"]), R__namespace.identity), R__namespace.when(R__namespace.hasPath(["layout", "dragging"]), R__namespace.identity), R__namespace.when(R__namespace.hasPath(["layout", "resizingPanels"]), R__namespace.identity))(stage);
|
|
3767
3797
|
};
|
|
3768
|
-
const updateVersion$
|
|
3769
|
-
var
|
|
3798
|
+
const updateVersion$1 = R__namespace.assoc("version", 4);
|
|
3799
|
+
var stageV3ToV4 = R__namespace.pipe(R__namespace.tap(stage => {
|
|
3770
3800
|
console.log("upgrading ", stage, " from 3 to 4");
|
|
3771
|
-
}), upgradeToDockviewLayout, updateVersion$
|
|
3801
|
+
}), upgradeToDockviewLayout, updateVersion$1);
|
|
3772
3802
|
|
|
3773
|
-
var upgraders = () => [[2, v1ToV2], [3, v2ToV3$1], [4,
|
|
3803
|
+
var upgraders = () => [[2, v1ToV2], [3, v2ToV3$1], [4, stageV3ToV4]];
|
|
3774
3804
|
|
|
3775
3805
|
const resolveFrom = stage => detectVersion(stage);
|
|
3776
3806
|
const resolveTo = to => R.defaultTo(R.last(versions))(to);
|
|
@@ -3952,19 +3982,14 @@ const scaleZoomSteps = stage => settings => {
|
|
|
3952
3982
|
}))))(settings);
|
|
3953
3983
|
};
|
|
3954
3984
|
const removeTimeline = R__namespace.dissoc("timeline");
|
|
3955
|
-
const updateVersion
|
|
3985
|
+
const updateVersion = R__namespace.assoc("version", 3);
|
|
3956
3986
|
var v2ToV3 = R__namespace.curry((stage, settings) => {
|
|
3957
3987
|
return R__namespace.pipe(R__namespace.tap(s => {
|
|
3958
3988
|
console.log("upgrading settings", s, " from 2 to 3");
|
|
3959
|
-
}), R__namespace.pipe(removeOutlets, dataStreamsToMeasurements, updateVersion
|
|
3989
|
+
}), R__namespace.pipe(removeOutlets, dataStreamsToMeasurements, updateVersion, scaleZoomSteps(stage), fixPanels, removeTimeline))(settings);
|
|
3960
3990
|
});
|
|
3961
3991
|
|
|
3962
|
-
|
|
3963
|
-
var v3ToV4 = R__namespace.curry((stage, settings) => {
|
|
3964
|
-
return R__namespace.pipe(R__namespace.tap(s => {
|
|
3965
|
-
console.log("upgrading settings", s, " from 3 to 4", stage.version);
|
|
3966
|
-
}), updateVersion)(settings);
|
|
3967
|
-
});
|
|
3992
|
+
var v3ToV4 = (stage, settings) => stageV3ToV4(settings);
|
|
3968
3993
|
|
|
3969
3994
|
var settingsUpgrader = R__namespace.curry((stage, settings) => {
|
|
3970
3995
|
const targetVersion = R__namespace.propOr(3, "version", stage);
|