insync-stage-handler 4.0.0-beta.1 → 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 +49 -8
- package/dist/library.js.map +1 -1
- package/dist/module.js +50 -9
- 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) {
|
|
@@ -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 => {
|
|
@@ -3766,11 +3796,11 @@ const upgradeToDockviewLayout = stage => {
|
|
|
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
3798
|
const updateVersion$1 = R__namespace.assoc("version", 4);
|
|
3769
|
-
var
|
|
3799
|
+
var stageV3ToV4 = R__namespace.pipe(R__namespace.tap(stage => {
|
|
3770
3800
|
console.log("upgrading ", stage, " from 3 to 4");
|
|
3771
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);
|
|
@@ -3959,15 +3989,26 @@ var v2ToV3 = R__namespace.curry((stage, settings) => {
|
|
|
3959
3989
|
}), R__namespace.pipe(removeOutlets, dataStreamsToMeasurements, updateVersion, scaleZoomSteps(stage), fixPanels, removeTimeline))(settings);
|
|
3960
3990
|
});
|
|
3961
3991
|
|
|
3992
|
+
var v3ToV4 = (stage, settings) => stageV3ToV4(settings);
|
|
3993
|
+
|
|
3962
3994
|
var settingsUpgrader = R__namespace.curry((stage, settings) => {
|
|
3963
|
-
|
|
3995
|
+
const targetVersion = R__namespace.propOr(3, "version", stage);
|
|
3996
|
+
const getVersion = R__namespace.propOr(2, "version");
|
|
3997
|
+
let upgraded = settings;
|
|
3998
|
+
if (getVersion(upgraded) < 3 && targetVersion >= 3) {
|
|
3999
|
+
upgraded = v2ToV3(stage, upgraded);
|
|
4000
|
+
}
|
|
4001
|
+
if (getVersion(upgraded) < 4 && targetVersion >= 4) {
|
|
4002
|
+
upgraded = v3ToV4(stage, upgraded);
|
|
4003
|
+
}
|
|
4004
|
+
return upgraded;
|
|
3964
4005
|
});
|
|
3965
4006
|
|
|
3966
4007
|
const settingsCleaner = R__namespace.pipe(R__namespace.dissocPath(["timer", "wantedTime"]));
|
|
3967
4008
|
var settingsHandler = (stage, settings) => R__namespace.pipe(settingsUpgrader(stage), settingsCleaner)(settings);
|
|
3968
4009
|
|
|
3969
4010
|
var name = "insync-stage-handler";
|
|
3970
|
-
var version = "4.0.0-beta.
|
|
4011
|
+
var version = "4.0.0-beta.2";
|
|
3971
4012
|
var description = "Handles stages files. This consists of validating, upgrading and consolodating them.";
|
|
3972
4013
|
var author = "David Ammeraal (Noterik B.V.)";
|
|
3973
4014
|
var license = "MIT";
|