@linkurious/ogma-linkurious-parser 4.1.7 → 4.1.9
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/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +4099 -0
- package/dist/index.mjs.map +1 -0
- package/dist/ogma/features/nodeGrouping.d.ts +15 -1
- package/dist/styles/styleRules.d.ts +8 -0
- package/dist/tools/ogmaTool.d.ts +3 -1
- package/package.json +23 -21
- package/dist/captions/captions.js +0 -115
- package/dist/captions/captions.js.map +0 -1
- package/dist/filters/filters.js +0 -167
- package/dist/filters/filters.js.map +0 -1
- package/dist/index.js +0 -56
- package/dist/index.js.map +0 -1
- package/dist/ogma/features/OgmaStore.js +0 -37
- package/dist/ogma/features/OgmaStore.js.map +0 -1
- package/dist/ogma/features/captions.js +0 -117
- package/dist/ogma/features/captions.js.map +0 -1
- package/dist/ogma/features/nodeGrouping.js +0 -283
- package/dist/ogma/features/nodeGrouping.js.map +0 -1
- package/dist/ogma/features/reactive.js +0 -132
- package/dist/ogma/features/reactive.js.map +0 -1
- package/dist/ogma/features/selectors.js +0 -97
- package/dist/ogma/features/selectors.js.map +0 -1
- package/dist/ogma/features/styles.js +0 -689
- package/dist/ogma/features/styles.js.map +0 -1
- package/dist/ogma/features/transformations.js +0 -86
- package/dist/ogma/features/transformations.js.map +0 -1
- package/dist/ogma/index.js +0 -326
- package/dist/ogma/index.js.map +0 -1
- package/dist/styles/edgeAttributes.js +0 -115
- package/dist/styles/edgeAttributes.js.map +0 -1
- package/dist/styles/itemAttributes.js +0 -133
- package/dist/styles/itemAttributes.js.map +0 -1
- package/dist/styles/nodeAttributes.js +0 -228
- package/dist/styles/nodeAttributes.js.map +0 -1
- package/dist/styles/styleRule.js +0 -194
- package/dist/styles/styleRule.js.map +0 -1
- package/dist/styles/styleRules.js +0 -292
- package/dist/styles/styleRules.js.map +0 -1
- package/dist/tools/colorPalette.js +0 -145
- package/dist/tools/colorPalette.js.map +0 -1
- package/dist/tools/ogmaTool.js +0 -86
- package/dist/tools/ogmaTool.js.map +0 -1
- package/dist/tools/tools.js +0 -409
- package/dist/tools/tools.js.map +0 -1
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasSelectionProperties = exports.getSelectionProperties = exports.getUniqSelectionEntity = exports.getUniqSelectionTypes = exports.getUniqSelection = exports.getSelectionEntity = exports.getSelectionState = exports.getSelectionSize = void 0;
|
|
4
|
-
const rest_client_1 = require("@linkurious/rest-client");
|
|
5
|
-
/**
|
|
6
|
-
* Return the current size of the selection
|
|
7
|
-
*/
|
|
8
|
-
const getSelectionSize = (state) => {
|
|
9
|
-
return state.selection.size;
|
|
10
|
-
};
|
|
11
|
-
exports.getSelectionSize = getSelectionSize;
|
|
12
|
-
/**
|
|
13
|
-
* Return the current state of the selection
|
|
14
|
-
*/
|
|
15
|
-
const getSelectionState = (state) => {
|
|
16
|
-
switch (state.selection.size) {
|
|
17
|
-
case 1:
|
|
18
|
-
return 'selection';
|
|
19
|
-
case 0:
|
|
20
|
-
return 'noSelection';
|
|
21
|
-
default:
|
|
22
|
-
return 'multiSelection';
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
exports.getSelectionState = getSelectionState;
|
|
26
|
-
/**
|
|
27
|
-
* Get the entityType of the current selection
|
|
28
|
-
*/
|
|
29
|
-
const getSelectionEntity = (state) => {
|
|
30
|
-
if (state.selection.size === 0) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
return state.selection.isNode ? rest_client_1.EntityType.NODE : rest_client_1.EntityType.EDGE;
|
|
34
|
-
};
|
|
35
|
-
exports.getSelectionEntity = getSelectionEntity;
|
|
36
|
-
/**
|
|
37
|
-
* Return the item selection if there's only one item selected
|
|
38
|
-
*/
|
|
39
|
-
const getUniqSelection = (state) => {
|
|
40
|
-
return state.selection.size === 1 ? state.selection.get(0) : undefined;
|
|
41
|
-
};
|
|
42
|
-
exports.getUniqSelection = getUniqSelection;
|
|
43
|
-
/**
|
|
44
|
-
* Return the types of the current selection (if only one item is selected)
|
|
45
|
-
*/
|
|
46
|
-
const getUniqSelectionTypes = (state) => {
|
|
47
|
-
const uniqSelection = (0, exports.getUniqSelection)(state);
|
|
48
|
-
if (uniqSelection === undefined) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
if (uniqSelection.isNode) {
|
|
52
|
-
return uniqSelection.getData('categories');
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
return [uniqSelection.getData('type')];
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
exports.getUniqSelectionTypes = getUniqSelectionTypes;
|
|
59
|
-
/**
|
|
60
|
-
* Return the entityType of the current selection if there's only one item selected
|
|
61
|
-
*/
|
|
62
|
-
const getUniqSelectionEntity = (state) => {
|
|
63
|
-
const uniqSelection = (0, exports.getUniqSelection)(state);
|
|
64
|
-
if (uniqSelection === undefined) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
if (uniqSelection.isNode) {
|
|
68
|
-
return 'node';
|
|
69
|
-
}
|
|
70
|
-
return 'edge';
|
|
71
|
-
};
|
|
72
|
-
exports.getUniqSelectionEntity = getUniqSelectionEntity;
|
|
73
|
-
/**
|
|
74
|
-
* Return the properties of the current selection if there's only one item selected
|
|
75
|
-
*/
|
|
76
|
-
const getSelectionProperties = (state) => {
|
|
77
|
-
const uniqSelection = (0, exports.getUniqSelection)(state);
|
|
78
|
-
if (uniqSelection !== undefined) {
|
|
79
|
-
const properties = uniqSelection.getData().properties;
|
|
80
|
-
return Object.keys(properties).map((propKey) => {
|
|
81
|
-
return {
|
|
82
|
-
key: propKey,
|
|
83
|
-
value: properties[propKey]
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return [];
|
|
88
|
-
};
|
|
89
|
-
exports.getSelectionProperties = getSelectionProperties;
|
|
90
|
-
/**
|
|
91
|
-
* Return true if the current selection has properties
|
|
92
|
-
*/
|
|
93
|
-
const hasSelectionProperties = (state) => {
|
|
94
|
-
return (0, exports.getSelectionProperties)(state).length > 0;
|
|
95
|
-
};
|
|
96
|
-
exports.hasSelectionProperties = hasSelectionProperties;
|
|
97
|
-
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../src/ogma/features/selectors.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,yDAA2E;AAO3E;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,KAAgB,EAAU,EAAE;IAC3D,OAAQ,KAAK,CAAC,SAAkC,CAAC,IAAI,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEF;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAgB,EAAkB,EAAE;IACpE,QAAS,KAAK,CAAC,SAAkC,CAAC,IAAI,EAAE,CAAC;QACvD,KAAK,CAAC;YACJ,OAAO,WAAW,CAAC;QAErB,KAAK,CAAC;YACJ,OAAO,aAAa,CAAC;QAEvB;YACE,OAAO,gBAAgB,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B;AAEF;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAAgB,EAA0B,EAAE;IAC7E,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAQ,KAAK,CAAC,SAAkC,CAAC,MAAM,CAAC,CAAC,CAAC,wBAAU,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAU,CAAC,IAAI,CAAC;AAC9F,CAAC,CAAC;AALW,QAAA,kBAAkB,sBAK7B;AAEF;;GAEG;AACI,MAAM,g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AG,aAAa,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC;QACtD,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7C,OAAO;gBACL,GAAG,EAAE,OAAO;gBACZ,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;aAC3B,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAZW,QAAA,sBAAsB,0BAYjC;AAEF;;GAEG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAAgB,EAAW,EAAE;IAClE,OAAO,IAAA,8BAAsB,EAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAClD,CAAC,CAAC;AAFW,QAAA,sBAAsB,0BAEjC","sourcesContent":["'use strict';\n\nimport {EntityType, LkEdgeData, LkNodeData} from '@linkurious/rest-client';\nimport {Edge, ItemList, Node} from '@linkurious/ogma';\n\nimport {OgmaState} from './reactive';\n\nexport type SelectionState = 'selection' | 'multiSelection' | 'noSelection';\n\n/**\n * Return the current size of the selection\n */\nexport const getSelectionSize = (state: OgmaState): number => {\n return (state.selection as ItemList<LkNodeData>).size;\n};\n\n/**\n * Return the current state of the selection\n */\nexport const getSelectionState = (state: OgmaState): SelectionState => {\n switch ((state.selection as ItemList<LkNodeData>).size) {\n case 1:\n return 'selection';\n\n case 0:\n return 'noSelection';\n\n default:\n return 'multiSelection';\n }\n};\n\n/**\n * Get the entityType of the current selection\n */\nexport const getSelectionEntity = (state: OgmaState): EntityType | undefined => {\n if (state.selection.size === 0) {\n return undefined;\n }\n return (state.selection as ItemList<LkNodeData>).isNode ? EntityType.NODE : EntityType.EDGE;\n};\n\n/**\n * Return the item selection if there's only one item selected\n */\nexport const getUniqSelection = (\n state: OgmaState\n): Node<LkNodeData, LkEdgeData> | Edge<LkEdgeData, LkNodeData> | undefined => {\n return state.selection.size === 1 ? state.selection.get(0) : undefined;\n};\n\n/**\n * Return the types of the current selection (if only one item is selected)\n */\nexport const getUniqSelectionTypes = (state: OgmaState): Array<string> | undefined => {\n const uniqSelection = getUniqSelection(state);\n if (uniqSelection === undefined) {\n return undefined;\n }\n if (uniqSelection.isNode) {\n return uniqSelection.getData('categories');\n } else {\n return [uniqSelection.getData('type')];\n }\n};\n\n/**\n * Return the entityType of the current selection if there's only one item selected\n */\nexport const getUniqSelectionEntity = (state: OgmaState): 'node' | 'edge' | undefined => {\n const uniqSelection = getUniqSelection(state);\n if (uniqSelection === undefined) {\n return undefined;\n }\n if (uniqSelection.isNode) {\n return 'node';\n }\n return 'edge';\n};\n\n/**\n * Return the properties of the current selection if there's only one item selected\n */\nexport const getSelectionProperties = (state: OgmaState): Array<{key: string; value: any}> => {\n const uniqSelection = getUniqSelection(state);\n if (uniqSelection !== undefined) {\n const properties = uniqSelection.getData().properties;\n return Object.keys(properties).map((propKey) => {\n return {\n key: propKey,\n value: properties[propKey]\n };\n });\n }\n return [];\n};\n\n/**\n * Return true if the current selection has properties\n */\nexport const hasSelectionProperties = (state: OgmaState): boolean => {\n return getSelectionProperties(state).length > 0;\n};\n"]}
|