@linkurious/ogma-linkurious-parser 3.0.11 → 3.1.1

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Edge, EdgeList, Node, NodeList, EdgeId, NodeId, RawEdge, RawItem, RawNode, PropertyPath, Item, ItemId, EdgeStyle, PixelSize, EdgeExtremity, EdgeType, GeoModeOptions } from 'ogma';
1
+ export { Edge, EdgeList, Node, NodeList, EdgeId, NodeId, RawEdge, RawItem, RawNode, PropertyPath, Item, ItemId, EdgeStyle, PixelSize, EdgeExtremity, EdgeType, GeoModeOptions, EdgesDataEvent, NodesDataEvent, NodesDragEndEvent, NodesEvent } from '@linkurious/ogma';
2
2
  export { Captions } from './captions/captions';
3
3
  export { ItemAttributes, BASE_GREY } from './styles/itemAttributes';
4
4
  export { EdgeAttributes } from './styles/edgeAttributes';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var ogma_1 = require("ogma");
3
+ var ogma_1 = require("@linkurious/ogma");
4
4
  exports.Edge = ogma_1.Edge;
5
5
  exports.EdgeList = ogma_1.EdgeList;
6
6
  exports.Node = ogma_1.Node;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,6BAkBc;AAjBZ,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AACR,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AAgBV,gDAA6C;AAArC,8BAAA,QAAQ,CAAA;AAChB,0DAAkE;AAA1D,0CAAA,cAAc,CAAA;AAAE,qCAAA,SAAS,CAAA;AACjC,0DAAuD;AAA/C,0CAAA,cAAc,CAAA;AACtB,0DAAuD;AAA/C,0CAAA,cAAc,CAAA;AACtB,gDAA4D;AAApD,gCAAA,SAAS,CAAA;AAAE,oCAAA,aAAa,CAAA;AAChC,kDAAkE;AAA1D,kCAAA,UAAU,CAAA;AAAE,iCAAA,SAAS,CAAA;AAC7B,iDAA+E;AAAvE,6BAAA,SAAS,CAAA;AAAgB,kCAAA,cAAc,CAAA;AAC/C,mEAAmE;AAA3D,+CAAA,kBAAkB,CAAA;AAC1B,qDAAmE;AAA3D,iCAAA,WAAW,CAAA;AAEnB,6CAA2C;AAAnC,+BAAA,SAAS,CAAA;AACjB,qDAAiD;AAAzC,qCAAA,WAAW,CAAA;AACnB,6CAA0C;AAAlC,4BAAA,OAAO,CAAA;AACf,uDASmC;AARjC,uCAAA,gBAAgB,CAAA;AAChB,wCAAA,iBAAiB,CAAA;AACjB,yCAAA,kBAAkB,CAAA;AAClB,uCAAA,gBAAgB,CAAA;AAChB,4CAAA,qBAAqB,CAAA;AACrB,6CAAA,sBAAsB,CAAA;AACtB,6CAAA,sBAAsB,CAAA;AACtB,6CAAA,sBAAsB,CAAA;AAExB,+BAAkD;AAA1C,wBAAA,MAAM,CAAA;AAAE,oCAAA,kBAAkB,CAAA","sourcesContent":["'use strict';\n\nexport {\n Edge,\n EdgeList,\n Node,\n NodeList,\n EdgeId,\n NodeId,\n RawEdge,\n RawItem,\n RawNode,\n PropertyPath,\n Item,\n ItemId,\n EdgeStyle,\n PixelSize,\n EdgeExtremity,\n EdgeType,\n GeoModeOptions\n} from 'ogma';\n\nexport {Captions} from './captions/captions';\nexport {ItemAttributes, BASE_GREY} from './styles/itemAttributes';\nexport {EdgeAttributes} from './styles/edgeAttributes';\nexport {NodeAttributes} from './styles/nodeAttributes';\nexport {StyleRule, StyleRuleType} from './styles/styleRule';\nexport {StyleRules, StyleType, Legend} from './styles/styleRules';\nexport {StylesViz, StylesConfig, FILTER_OPACITY} from './ogma/features/styles';\nexport {TransformationsViz} from './ogma/features/transformations';\nexport {CaptionsViz, CaptionState} from './ogma/features/captions';\nexport {OgmaState} from './ogma/features/reactive';\nexport {OgmaTools} from './tools/ogmaTool';\nexport {HTML_COLORS} from './tools/colorPalette';\nexport {Filters} from './filters/filters';\nexport {\n getSelectionSize,\n getSelectionState,\n getSelectionEntity,\n getUniqSelection,\n getUniqSelectionTypes,\n getUniqSelectionEntity,\n getSelectionProperties,\n hasSelectionProperties\n} from './ogma/features/selectors';\nexport {LKOgma, ANIMATION_DURATION} from './ogma';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yCAsB0B;AArBxB,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AACR,sBAAA,IAAI,CAAA;AACJ,0BAAA,QAAQ,CAAA;AAoBV,gDAA6C;AAArC,8BAAA,QAAQ,CAAA;AAChB,0DAAkE;AAA1D,0CAAA,cAAc,CAAA;AAAE,qCAAA,SAAS,CAAA;AACjC,0DAAuD;AAA/C,0CAAA,cAAc,CAAA;AACtB,0DAAuD;AAA/C,0CAAA,cAAc,CAAA;AACtB,gDAA4D;AAApD,gCAAA,SAAS,CAAA;AAAE,oCAAA,aAAa,CAAA;AAChC,kDAAkE;AAA1D,kCAAA,UAAU,CAAA;AAAE,iCAAA,SAAS,CAAA;AAC7B,iDAA+E;AAAvE,6BAAA,SAAS,CAAA;AAAgB,kCAAA,cAAc,CAAA;AAC/C,mEAAmE;AAA3D,+CAAA,kBAAkB,CAAA;AAC1B,qDAAmE;AAA3D,iCAAA,WAAW,CAAA;AAEnB,6CAA2C;AAAnC,+BAAA,SAAS,CAAA;AACjB,qDAAiD;AAAzC,qCAAA,WAAW,CAAA;AACnB,6CAA0C;AAAlC,4BAAA,OAAO,CAAA;AACf,uDASmC;AARjC,uCAAA,gBAAgB,CAAA;AAChB,wCAAA,iBAAiB,CAAA;AACjB,yCAAA,kBAAkB,CAAA;AAClB,uCAAA,gBAAgB,CAAA;AAChB,4CAAA,qBAAqB,CAAA;AACrB,6CAAA,sBAAsB,CAAA;AACtB,6CAAA,sBAAsB,CAAA;AACtB,6CAAA,sBAAsB,CAAA;AAExB,+BAAkD;AAA1C,wBAAA,MAAM,CAAA;AAAE,oCAAA,kBAAkB,CAAA","sourcesContent":["'use strict';\n\nexport {\n Edge,\n EdgeList,\n Node,\n NodeList,\n EdgeId,\n NodeId,\n RawEdge,\n RawItem,\n RawNode,\n PropertyPath,\n Item,\n ItemId,\n EdgeStyle,\n PixelSize,\n EdgeExtremity,\n EdgeType,\n GeoModeOptions,\n EdgesDataEvent,\n NodesDataEvent,\n NodesDragEndEvent,\n NodesEvent\n} from '@linkurious/ogma';\n\nexport {Captions} from './captions/captions';\nexport {ItemAttributes, BASE_GREY} from './styles/itemAttributes';\nexport {EdgeAttributes} from './styles/edgeAttributes';\nexport {NodeAttributes} from './styles/nodeAttributes';\nexport {StyleRule, StyleRuleType} from './styles/styleRule';\nexport {StyleRules, StyleType, Legend} from './styles/styleRules';\nexport {StylesViz, StylesConfig, FILTER_OPACITY} from './ogma/features/styles';\nexport {TransformationsViz} from './ogma/features/transformations';\nexport {CaptionsViz, CaptionState} from './ogma/features/captions';\nexport {OgmaState} from './ogma/features/reactive';\nexport {OgmaTools} from './tools/ogmaTool';\nexport {HTML_COLORS} from './tools/colorPalette';\nexport {Filters} from './filters/filters';\nexport {\n getSelectionSize,\n getSelectionState,\n getSelectionEntity,\n getUniqSelection,\n getUniqSelectionTypes,\n getUniqSelectionEntity,\n getSelectionProperties,\n hasSelectionProperties\n} from './ogma/features/selectors';\nexport {LKOgma, ANIMATION_DURATION} from './ogma';\n"]}
@@ -1,4 +1,4 @@
1
- import * as Ogma from 'ogma';
1
+ import * as Ogma from '@linkurious/ogma';
2
2
  import { ItemFieldsCaptions } from '@linkurious/rest-client';
3
3
  import { LKOgma } from '../..';
4
4
  export interface CaptionState {
@@ -12,7 +12,6 @@ export declare class CaptionsViz {
12
12
  edgesCaptionsRule: Ogma.StyleRule;
13
13
  private _ogma;
14
14
  private _schema;
15
- private _exportCaptionClass;
16
15
  constructor(ogma: LKOgma, _nodeMaxTextLength: number | undefined, _edgeMaxTextLength: number | undefined);
17
16
  /**
18
17
  * Refresh the schema
@@ -30,8 +29,4 @@ export declare class CaptionsViz {
30
29
  * Create or update edgeCaptionRule
31
30
  */
32
31
  updateEdgeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void;
33
- /**
34
- * Set the class for exported nodes and edges
35
- */
36
- setExportCaptionClass(textWrappingLength?: boolean): void;
37
32
  }
@@ -145,39 +145,6 @@ var CaptionsViz = /** @class */ (function () {
145
145
  return this.edgesCaptionsRule.refresh();
146
146
  }
147
147
  };
148
- /**
149
- * Set the class for exported nodes and edges
150
- */
151
- CaptionsViz.prototype.setExportCaptionClass = function (textWrappingLength) {
152
- var _this = this;
153
- if (!this._exportCaptionClass) {
154
- this._exportCaptionClass = this._ogma.styles.createClass({
155
- name: 'exportedCaption',
156
- nodeAttributes: {
157
- text: {
158
- content: function (node) {
159
- if (node === undefined) {
160
- return "";
161
- }
162
- return __1.Captions.getText(node.getData(), _this._schema.node);
163
- }
164
- }
165
- },
166
- nodeDependencies: { self: { data: true } },
167
- edgeAttributes: {
168
- text: {
169
- content: function (edge) {
170
- if (edge === undefined) {
171
- return "";
172
- }
173
- return __1.Captions.getText(edge.getData(), _this._schema.edge);
174
- }
175
- }
176
- },
177
- edgeDependencies: { self: { data: true } }
178
- });
179
- }
180
- };
181
148
  return CaptionsViz;
182
149
  }());
183
150
  exports.CaptionsViz = CaptionsViz;
@@ -1 +1 @@
1
- {"version":3,"file":"captions.js","sourceRoot":"","sources":["../../../src/ogma/features/captions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMb,2BAAuC;AACvC,2CAAwC;AAOxC;IAOE,qBACE,IAAY,EACJ,kBAAsC,EACtC,kBAAsC;QADtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,uBAAkB,GAAlB,kBAAkB,CAA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ACJ,OAAO,EAAE,UAAC,IAAsB;4BAC9B,IAAI,IAAI,KAAK,SAAS,EAAE;gCACtB,OAAO,EAAE,CAAC;6BACX;4BACD,OAAO,YAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;wBAC7D,CAAC;qBACF;iBACF;gBACD,gBAAgB,EAAE,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,EAAC;aACvC,CAAC,CAAC;SACJ;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AApID,IAoIC;AApIY,kCAAW","sourcesContent":["'use strict';\n\nimport * as Ogma from 'ogma';\nimport {Node, Edge} from 'ogma';\nimport {ItemFieldsCaptions} from '@linkurious/rest-client';\n\nimport {Captions, LKOgma} from '../..';\nimport {Tools} from '../../tools/tools';\n\nexport interface CaptionState {\n node: ItemFieldsCaptions;\n edge: ItemFieldsCaptions;\n}\n\nexport class CaptionsViz {\n public nodesCaptionsRule!: Ogma.StyleRule;\n public edgesCaptionsRule!: Ogma.StyleRule;\n private _ogma: LKOgma;\n private _schema: CaptionState = {node: {}, edge: {}};\n private _exportCaptionClass!: Ogma.StyleClass;\n\n constructor(\n ogma: LKOgma,\n private _nodeMaxTextLength: number | undefined,\n private _edgeMaxTextLength: number | undefined\n ) {\n this._ogma = ogma;\n }\n\n /**\n * Refresh the schema\n */\n public refreshSchema(schema: CaptionState): void {\n this._schema = schema;\n }\n\n /**\n * Refresh visualization captions rules\n */\n public async initVizCaptions(schema: CaptionState): Promise<void> {\n if (this._ogma.LKCaptions.nodesCaptionsRule) {\n this._ogma.LKCaptions.refreshSchema(schema);\n await this._ogma.LKCaptions.updateNodeCaptions();\n } else {\n this._ogma.LKCaptions.updateNodeCaptions(schema.node);\n }\n if (this._ogma.LKCaptions.edgesCaptionsRule) {\n this._ogma.LKCaptions.refreshSchema(schema);\n await this._ogma.LKCaptions.updateEdgeCaptions();\n } else {\n this._ogma.LKCaptions.updateEdgeCaptions(schema.edge);\n }\n }\n\n /**\n * Create or update nodeCaptionRule\n */\n public updateNodeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void {\n if (schema) {\n this._schema.node = schema;\n }\n if (!Tools.isDefined(this.nodesCaptionsRule)) {\n this.nodesCaptionsRule = this._ogma.styles.addRule({\n nodeAttributes: {\n text: {\n content: (node: Ogma.Node | undefined) => {\n if (node === undefined) {\n return ``;\n }\n const value = Captions.getText(node.getData(), this._schema.node);\n return Tools.isDefined(this._nodeMaxTextLength)\n ? Tools.truncate(value, 'middle', this._nodeMaxTextLength)\n : value;\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n return this.nodesCaptionsRule.refresh();\n }\n }\n\n /**\n * Create or update edgeCaptionRule\n */\n public updateEdgeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void {\n if (schema) {\n this._schema.edge = schema;\n }\n if (!Tools.isDefined(this.edgesCaptionsRule)) {\n this.edgesCaptionsRule = this._ogma.styles.addRule({\n edgeAttributes: {\n text: {\n content: (edge: Ogma.Edge | undefined) => {\n if (edge === undefined || edge.getData() === undefined) {\n return ``;\n }\n const value = Captions.getText(edge.getData(), this._schema.edge);\n return Tools.isDefined(this._edgeMaxTextLength)\n ? Tools.truncate(value, 'middle', this._edgeMaxTextLength)\n : value;\n }\n }\n },\n edgeSelector: (edge) => !edge.isVirtual() && edge.isVisible(),\n // ogma will trigger the rendering if data change or the shape change (to trigger the rendering when edges are grouped)\n edgeDependencies: {self: {data: true, attributes: ['shape.style']}}\n });\n } else {\n return this.edgesCaptionsRule.refresh();\n }\n }\n\n /**\n * Set the class for exported nodes and edges\n */\n public setExportCaptionClass(textWrappingLength?: boolean): void {\n if (!this._exportCaptionClass) {\n this._exportCaptionClass = this._ogma.styles.createClass({\n name: 'exportedCaption',\n nodeAttributes: {\n text: {\n content: (node: Node | undefined) => {\n if (node === undefined) {\n return ``;\n }\n return Captions.getText(node.getData(), this._schema.node);\n }\n }\n },\n nodeDependencies: {self: {data: true}},\n edgeAttributes: {\n text: {\n content: (edge: Edge | undefined) => {\n if (edge === undefined) {\n return ``;\n }\n return Captions.getText(edge.getData(), this._schema.edge);\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n }\n }\n}\n"]}
1
+ {"version":3,"file":"captions.js","sourceRoot":"","sources":["../../../src/ogma/features/captions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKb,2BAAuC;AACvC,2CAAwC;AAOxC;IAME,qBACE,IAAY,EACJ,kBAAsC,EACtC,kBAAsC;QADtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QALxC,YAAO,GAAiB,EAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAC,CAAC;QAOnD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;OAEG;IACI,mCAAa,GAApB,UAAqB,MAAoB;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;OAEG;IACU,qCAAe,GAA5B,UAA6B,MAAoB;;;;;6BAC3C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAvC,wBAAuC;wBACzC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;wBAC5C,qBAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,EAAE,EAAA;;wBAAhD,SAAgD,CAAC;;;wBAEjD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;;;6BAEpD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAvC,wBAAuC;wBACzC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;wBA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{Captions, LKOgma} from '../..';\nimport {Tools} from '../../tools/tools';\n\nexport interface CaptionState {\n node: ItemFieldsCaptions;\n edge: ItemFieldsCaptions;\n}\n\nexport class CaptionsViz {\n public nodesCaptionsRule!: Ogma.StyleRule;\n public edgesCaptionsRule!: Ogma.StyleRule;\n private _ogma: LKOgma;\n private _schema: CaptionState = {node: {}, edge: {}};\n\n constructor(\n ogma: LKOgma,\n private _nodeMaxTextLength: number | undefined,\n private _edgeMaxTextLength: number | undefined\n ) {\n this._ogma = ogma;\n }\n\n /**\n * Refresh the schema\n */\n public refreshSchema(schema: CaptionState): void {\n this._schema = schema;\n }\n\n /**\n * Refresh visualization captions rules\n */\n public async initVizCaptions(schema: CaptionState): Promise<void> {\n if (this._ogma.LKCaptions.nodesCaptionsRule) {\n this._ogma.LKCaptions.refreshSchema(schema);\n await this._ogma.LKCaptions.updateNodeCaptions();\n } else {\n this._ogma.LKCaptions.updateNodeCaptions(schema.node);\n }\n if (this._ogma.LKCaptions.edgesCaptionsRule) {\n this._ogma.LKCaptions.refreshSchema(schema);\n await this._ogma.LKCaptions.updateEdgeCaptions();\n } else {\n this._ogma.LKCaptions.updateEdgeCaptions(schema.edge);\n }\n }\n\n /**\n * Create or update nodeCaptionRule\n */\n public updateNodeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void {\n if (schema) {\n this._schema.node = schema;\n }\n if (!Tools.isDefined(this.nodesCaptionsRule)) {\n this.nodesCaptionsRule = this._ogma.styles.addRule({\n nodeAttributes: {\n text: {\n content: (node: Ogma.Node | undefined) => {\n if (node === undefined) {\n return ``;\n }\n const value = Captions.getText(node.getData(), this._schema.node);\n return Tools.isDefined(this._nodeMaxTextLength)\n ? Tools.truncate(value, 'middle', this._nodeMaxTextLength)\n : value;\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n return this.nodesCaptionsRule.refresh();\n }\n }\n\n /**\n * Create or update edgeCaptionRule\n */\n public updateEdgeCaptions(schema?: ItemFieldsCaptions): Promise<void> | void {\n if (schema) {\n this._schema.edge = schema;\n }\n if (!Tools.isDefined(this.edgesCaptionsRule)) {\n this.edgesCaptionsRule = this._ogma.styles.addRule({\n edgeAttributes: {\n text: {\n content: (edge: Ogma.Edge | undefined) => {\n if (edge === undefined || edge.getData() === undefined) {\n return ``;\n }\n const value = Captions.getText(edge.getData(), this._schema.edge);\n return Tools.isDefined(this._edgeMaxTextLength)\n ? Tools.truncate(value, 'middle', this._edgeMaxTextLength)\n : value;\n }\n }\n },\n edgeSelector: (edge) => !edge.isVirtual() && edge.isVisible(),\n // ogma will trigger the rendering if data change or the shape change (to trigger the rendering when edges are grouped)\n edgeDependencies: {self: {data: true, attributes: ['shape.style']}}\n });\n } else {\n return this.edgesCaptionsRule.refresh();\n }\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { NodeList, EdgeList } from 'ogma';
1
+ import { NodeList, EdgeList } from '@linkurious/ogma';
2
2
  import { LkEdgeData, LkNodeData } from '@linkurious/rest-client';
3
3
  import { LKOgma } from '../index';
4
4
  import { OgmaStore } from './OgmaStore';
@@ -21,6 +21,10 @@ export declare class RxViz {
21
21
  private _animationThrottle;
22
22
  constructor(ogma: LKOgma);
23
23
  get store(): OgmaStore;
24
+ /**
25
+ * Listen to ogma events and update the state
26
+ */
27
+ listenToSelectionEvents(): void;
24
28
  /**
25
29
  * Store new items in state
26
30
  */
@@ -33,10 +37,6 @@ export declare class RxViz {
33
37
  * store new edge selection in state
34
38
  */
35
39
  private storeEdgeSelection;
36
- /**
37
- * Listen to ogma events and update the state
38
- */
39
- private listenToSelectionEvents;
40
40
  }
41
41
  export declare class DummyNodeList {
42
42
  size: number;
@@ -31,34 +31,13 @@ var RxViz = /** @class */ (function () {
31
31
  enumerable: true,
32
32
  configurable: true
33
33
  });
34
- /**
35
- * Store new items in state
36
- */
37
- RxViz.prototype.storeItems = function (state) {
38
- return __assign(__assign({}, state), { items: {
39
- node: this._ogma.getNodes().getId(),
40
- edge: this._ogma.getEdges().getId()
41
- } });
42
- };
43
- /**
44
- * Store new node selection in state
45
- */
46
- RxViz.prototype.storeNodeSelection = function (state) {
47
- return __assign(__assign({}, state), { selection: this._ogma.getSelectedNodes() });
48
- };
49
- /**
50
- * store new edge selection in state
51
- */
52
- RxViz.prototype.storeEdgeSelection = function (state) {
53
- return __assign(__assign({}, state), { selection: this._ogma.getSelectedEdges() });
54
- };
55
34
  /**
56
35
  * Listen to ogma events and update the state
57
36
  */
58
37
  RxViz.prototype.listenToSelectionEvents = function () {
59
38
  var _this = this;
60
39
  var count = 0;
61
- this._ogma.modules.events.on('animate', function (e) {
40
+ this._ogma.events.on('animate', function (e) {
62
41
  var animationEnd = ++count;
63
42
  _this._store.dispatch(function (state) { return (__assign(__assign({}, state), { animation: true })); });
64
43
  clearTimeout(_this._animationThrottle);
@@ -68,37 +47,37 @@ var RxViz = /** @class */ (function () {
68
47
  }
69
48
  }, e.duration + index_1.ANIMATION_DURATION + 100);
70
49
  });
71
- this._ogma.events.onDragStart(function () {
50
+ this._ogma.events.on('dragStart', function () {
72
51
  _this._store.dispatch(function (state) { return (__assign(__assign({}, state), { animation: true })); });
73
52
  });
74
- this._ogma.events.onDragEnd(function () {
53
+ this._ogma.events.on('dragEnd', function () {
75
54
  _this._store.dispatch(function (state) { return (__assign(__assign({}, state), { animation: false })); });
76
55
  });
77
- this._ogma.events.onNodesAdded(function () {
56
+ this._ogma.events.on('addNodes', function () {
78
57
  _this._store.dispatch(_this.storeItems.bind(_this));
79
58
  });
80
- this._ogma.events.onNodesRemoved(function () {
59
+ this._ogma.events.on('removeNodes', function () {
81
60
  _this._store.dispatch(_this.storeItems.bind(_this));
82
61
  });
83
- this._ogma.events.onEdgesAdded(function () {
62
+ this._ogma.events.on('addEdges', function () {
84
63
  _this._store.dispatch(_this.storeItems.bind(_this));
85
64
  });
86
- this._ogma.events.onEdgesRemoved(function () {
65
+ this._ogma.events.on('removeEdges', function () {
87
66
  _this._store.dispatch(_this.storeItems.bind(_this));
88
67
  });
89
- this._ogma.events.onNodesSelected(function () {
68
+ this._ogma.events.on('nodesSelected', function () {
90
69
  _this._store.dispatch(_this.storeNodeSelection.bind(_this));
91
70
  });
92
- this._ogma.events.onEdgesSelected(function () {
71
+ this._ogma.events.on('edgesSelected', function () {
93
72
  _this._store.dispatch(_this.storeEdgeSelection.bind(_this));
94
73
  });
95
- this._ogma.events.onNodesUnselected(function () {
74
+ this._ogma.events.on('nodesUnselected', function () {
96
75
  _this._store.dispatch(_this.storeNodeSelection.bind(_this));
97
76
  });
98
- this._ogma.events.onEdgesUnselected(function () {
77
+ this._ogma.events.on('edgesUnselected', function () {
99
78
  _this._store.dispatch(_this.storeEdgeSelection.bind(_this));
100
79
  });
101
- this._ogma.events.onNodeDataChange(function (evt) {
80
+ this._ogma.events.on('updateNodeData', function (evt) {
102
81
  if (evt !== undefined) {
103
82
  evt.changes.forEach(function (change) {
104
83
  _this._store.dispatch(function (state) { return (__assign(__assign({}, state), { changes: {
@@ -109,7 +88,7 @@ var RxViz = /** @class */ (function () {
109
88
  });
110
89
  }
111
90
  });
112
- this._ogma.events.onEdgeDataChange(function (evt) {
91
+ this._ogma.events.on('updateEdgeData', function (evt) {
113
92
  if (evt !== undefined) {
114
93
  evt.changes.forEach(function (change) {
115
94
  _this._store.dispatch(function (state) { return (__assign(__assign({}, state), { changes: {
@@ -121,6 +100,27 @@ var RxViz = /** @class */ (function () {
121
100
  }
122
101
  });
123
102
  };
103
+ /**
104
+ * Store new items in state
105
+ */
106
+ RxViz.prototype.storeItems = function (state) {
107
+ return __assign(__assign({}, state), { items: {
108
+ node: this._ogma.getNodes().getId(),
109
+ edge: this._ogma.getEdges().getId()
110
+ } });
111
+ };
112
+ /**
113
+ * Store new node selection in state
114
+ */
115
+ RxViz.prototype.storeNodeSelection = function (state) {
116
+ return __assign(__assign({}, state), { selection: this._ogma.getSelectedNodes() });
117
+ };
118
+ /**
119
+ * store new edge selection in state
120
+ */
121
+ RxViz.prototype.storeEdgeSelection = function (state) {
122
+ return __assign(__assign({}, state), { selection: this._ogma.getSelectedEdges() });
123
+ };
124
124
  return RxViz;
125
125
  }());
126
126
  exports.RxViz = RxViz;
@@ -1 +1 @@
1
- {"version":3,"file":"reactive.js","sourceRoot":"","sources":["../../../src/ogma/features/reactive.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAKb,kCAAoD;AAEpD,yCAAsC;AAStC;IAUE,eAAY,IAAY;QARhB,WAAM,GAAc,IAAI,qBAAS,CAAC;YACxC,SAAS,EAAE,IAAI,aAAa,EAAS;YACrC,KAAK,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAC;YAC3B,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QAID,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAED,sBAAW,wBAAK;aAAhB;YACE,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAED;;OAEG;IACK,0BAAU,GAAlB,UAAmB,KAAgB;QACjC,6BACK,KAAK,KACR,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE;gBACnC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE;aACpC,IACD;IACJ,CAAC;IAED;;OAEG;IACK,kCAAkB,GAA1B,UAA2B,KAAgB;QACzC,6BACK,KAAK,KACR,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAsC,IAC5E;IACJ,CAAC;IAED;;OAEG;IACK,kCAAkB,GAA1B,UAA2B,KAAgB;QACzC,6BACK,KAAK,KACR,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAsC,IAC5E;IACJ,CAAC;IAED;;OAEG;IACK,uCAAuB,GAA/B;QAAA,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oBAAC;AAAD,CAAC,AAHD,IAGC;AAHY,sCAAa","sourcesContent":["'use strict';\n\nimport Ogma, {NodeList, EdgeList} from 'ogma';\nimport {LkEdgeData, LkNodeData} from '@linkurious/rest-client';\n\nimport {ANIMATION_DURATION, LKOgma} from '../index';\n\nimport {OgmaStore} from './OgmaStore';\n\nexport interface OgmaState {\n selection: NodeList<LkNodeData, LkEdgeData> | EdgeList<LkEdgeData, LkNodeData>;\n items: {node: Array<string | number>; edge: Array<string | number>};\n changes: {entityType: 'node' | 'edge'; input: string | string[] | null; value: any} | undefined;\n animation: boolean;\n}\n\nexport class RxViz {\n private _ogma: Ogma;\n private _store: OgmaStore = new OgmaStore({\n selection: new DummyNodeList() as any,\n items: {node: [], edge: []},\n changes: undefined,\n animation: false\n });\n private _animationThrottle: any;\n\n constructor(ogma: LKOgma) {\n this._ogma = ogma;\n this.listenToSelectionEvents();\n }\n\n public get store(): OgmaStore {\n return this._store;\n }\n\n /**\n * Store new items in state\n */\n private storeItems(state: OgmaState): OgmaState {\n return {\n ...state,\n items: {\n node: this._ogma.getNodes().getId(),\n edge: this._ogma.getEdges().getId()\n }\n };\n }\n\n /**\n * Store new node selection in state\n */\n private storeNodeSelection(state: OgmaState): OgmaState {\n return {\n ...state,\n selection: this._ogma.getSelectedNodes() as NodeList<LkNodeData, LkEdgeData>\n };\n }\n\n /**\n * store new edge selection in state\n */\n private storeEdgeSelection(state: OgmaState): OgmaState {\n return {\n ...state,\n selection: this._ogma.getSelectedEdges() as EdgeList<LkEdgeData, LkNodeData>\n };\n }\n\n /**\n * Listen to ogma events and update the state\n */\n private listenToSelectionEvents(): void {\n let count = 0;\n (this._ogma as any).modules.events.on('animate', (e: {duration: number}) => {\n const animationEnd = ++count;\n this._store.dispatch((state) => ({...state, animation: true}));\n clearTimeout(this._animationThrottle);\n this._animationThrottle = setTimeout(() => {\n if (count === animationEnd) {\n this._store.dispatch((state) => ({...state, animation: false}));\n }\n }, e.duration + ANIMATION_DURATION + 100);\n });\n\n this._ogma.events.onDragStart(() => {\n this._store.dispatch((state) => ({...state, animation: true}));\n });\n\n this._ogma.events.onDragEnd(() => {\n this._store.dispatch((state) => ({...state, animation: false}));\n });\n\n this._ogma.events.onNodesAdded(() => {\n this._store.dispatch(this.storeItems.bind(this));\n });\n this._ogma.events.onNodesRemoved(() => {\n this._store.dispatch(this.storeItems.bind(this));\n });\n this._ogma.events.onEdgesAdded(() => {\n this._store.dispatch(this.storeItems.bind(this));\n });\n this._ogma.events.onEdgesRemoved(() => {\n this._store.dispatch(this.storeItems.bind(this));\n });\n\n this._ogma.events.onNodesSelected(() => {\n this._store.dispatch(this.storeNodeSelection.bind(this));\n });\n\n this._ogma.events.onEdgesSelected(() => {\n this._store.dispatch(this.storeEdgeSelection.bind(this));\n });\n\n this._ogma.events.onNodesUnselected(() => {\n this._store.dispatch(this.storeNodeSelection.bind(this));\n });\n\n this._ogma.events.onEdgesUnselected(() => {\n this._store.dispatch(this.storeEdgeSelection.bind(this));\n });\n\n this._ogma.events.onNodeDataChange((evt) => {\n if (evt !== undefined) {\n evt.changes.forEach((change) => {\n this._store.dispatch((state) => ({\n ...state,\n changes: {\n entityType: 'node',\n input: change.property,\n value: change.newValues[0]\n }\n }));\n });\n }\n });\n\n this._ogma.events.onEdgeDataChange((evt) => {\n if (evt !== undefined) {\n evt.changes.forEach((change) => {\n this._store.dispatch((state) => ({\n ...state,\n changes: {\n entityType: 'edge',\n input: change.property,\n value: change.newValues[0]\n }\n }));\n });\n }\n });\n }\n}\n\nexport class DummyNodeList {\n public size = 0;\n public isNode = true;\n}\n"]}
1
+ {"version":3,"file":"reactive.js","sourceRoot":"","sources":["../../../src/ogma/features/reactive.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAKb,kCAAoD;AAEpD,yCAAsC;AAStC;IAUE,eAAY,IAAY;QARhB,WAAM,GAAc,IAAI,qBAAS,CAAC;YACxC,SAAS,EAAE,IAAI,aAAa,EAAS;YACrC,KAAK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,MAAM;oBACzB,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBAC3B,KAAK,KACR,OAAO,EAAE;4BACP,UAAU,EAAE,MAAM;4BAClB,KAAK,EAAE,MAAM,CAAC,QAAQ;4BACtB,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;yBAC3B,IACD,EAP8B,CAO9B,CAAC,CAAC;gBACN,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,0BAAU,GAAlB,UAAmB,KAAgB;QACjC,6BACK,KAAK,KACR,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE;gBACnC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE;aACpC,IACD;IACJ,CAAC;IAED;;OAEG;IACK,kCAAkB,GAA1B,UAA2B,KAAgB;QACzC,6BACK,KAAK,KACR,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,IACxC;IACJ,CAAC;IAED;;OAEG;IACK,kCAAkB,GAA1B,UAA2B,KAAgB;QACzC,6BACK,KAAK,KACR,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,IACxC;IACJ,CAAC;IACH,YAAC;AAAD,CAAC,AAvID,IAuIC;AAvIY,sBAAK;AAyIlB;IAAA;QACS,SAAI,GAAG,CAAC,CAAC;QACT,WAAM,GAAG,IAAI,CAAC;IACvB,CAAC;IAAD,oBAAC;AAAD,CAAC,AAHD,IAGC;AAHY,sCAAa","sourcesContent":["'use strict';\n\nimport Ogma, {NodeList, EdgeList} from '@linkurious/ogma';\nimport {LkEdgeData, LkNodeData} from '@linkurious/rest-client';\n\nimport {ANIMATION_DURATION, LKOgma} from '../index';\n\nimport {OgmaStore} from './OgmaStore';\n\nexport interface OgmaState {\n selection: NodeList<LkNodeData, LkEdgeData> | EdgeList<LkEdgeData, LkNodeData>;\n items: {node: Array<string | number>; edge: Array<string | number>};\n changes: {entityType: 'node' | 'edge'; input: string | string[] | null; value: any} | undefined;\n animation: boolean;\n}\n\nexport class RxViz {\n private _ogma: Ogma;\n private _store: OgmaStore = new OgmaStore({\n selection: new DummyNodeList() as any,\n items: {node: [], edge: []},\n changes: undefined,\n animation: false\n });\n private _animationThrottle: any;\n\n constructor(ogma: LKOgma) {\n this._ogma = ogma;\n this.listenToSelectionEvents();\n }\n\n public get store(): OgmaStore {\n return this._store;\n }\n\n /**\n * Listen to ogma events and update the state\n */\n public listenToSelectionEvents(): void {\n let count = 0;\n this._ogma.events.on('animate', (e: {duration: number}) => {\n const animationEnd = ++count;\n this._store.dispatch((state) => ({...state, animation: true}));\n clearTimeout(this._animationThrottle);\n this._animationThrottle = setTimeout(() => {\n if (count === animationEnd) {\n this._store.dispatch((state) => ({...state, animation: false}));\n }\n }, e.duration + ANIMATION_DURATION + 100);\n });\n\n this._ogma.events.on('dragStart', () => {\n this._store.dispatch((state) => ({...state, animation: true}));\n });\n\n this._ogma.events.on('dragEnd', () => {\n this._store.dispatch((state) => ({...state, animation: false}));\n });\n\n this._ogma.events.on('addNodes', () => {\n this._store.dispatch(this.storeItems.bind(this));\n });\n this._ogma.events.on('removeNodes', () => {\n this._store.dispatch(this.storeItems.bind(this));\n });\n this._ogma.events.on('addEdges', () => {\n this._store.dispatch(this.storeItems.bind(this));\n });\n this._ogma.events.on('removeEdges', () => {\n this._store.dispatch(this.storeItems.bind(this));\n });\n\n this._ogma.events.on('nodesSelected', () => {\n this._store.dispatch(this.storeNodeSelection.bind(this));\n });\n\n this._ogma.events.on('edgesSelected', () => {\n this._store.dispatch(this.storeEdgeSelection.bind(this));\n });\n\n this._ogma.events.on('nodesUnselected', () => {\n this._store.dispatch(this.storeNodeSelection.bind(this));\n });\n\n this._ogma.events.on('edgesUnselected', () => {\n this._store.dispatch(this.storeEdgeSelection.bind(this));\n });\n\n this._ogma.events.on('updateNodeData', (evt) => {\n if (evt !== undefined) {\n evt.changes.forEach((change) => {\n this._store.dispatch((state) => ({\n ...state,\n changes: {\n entityType: 'node',\n input: change.property,\n value: change.newValues[0]\n }\n }));\n });\n }\n });\n\n this._ogma.events.on('updateEdgeData', (evt) => {\n if (evt !== undefined) {\n evt.changes.forEach((change) => {\n this._store.dispatch((state) => ({\n ...state,\n changes: {\n entityType: 'edge',\n input: change.property,\n value: change.newValues[0]\n }\n }));\n });\n }\n });\n }\n\n /**\n * Store new items in state\n */\n private storeItems(state: OgmaState): OgmaState {\n return {\n ...state,\n items: {\n node: this._ogma.getNodes().getId(),\n edge: this._ogma.getEdges().getId()\n }\n };\n }\n\n /**\n * Store new node selection in state\n */\n private storeNodeSelection(state: OgmaState): OgmaState {\n return {\n ...state,\n selection: this._ogma.getSelectedNodes()\n };\n }\n\n /**\n * store new edge selection in state\n */\n private storeEdgeSelection(state: OgmaState): OgmaState {\n return {\n ...state,\n selection: this._ogma.getSelectedEdges()\n };\n }\n}\n\nexport class DummyNodeList {\n public size = 0;\n public isNode = true;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { EntityType, LkEdgeData, LkNodeData } from '@linkurious/rest-client';
2
- import { Edge, Node } from 'ogma';
2
+ import { Edge, Node } from '@linkurious/ogma';
3
3
  import { OgmaState } from './reactive';
4
4
  export declare type SelectionState = 'selection' | 'multiSelection' | 'noSelection';
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../src/ogma/features/selectors.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,uDAA2E;AAO3E;;GAEG;AACU,QAAA,gBAAgB,GAAG,UAAC,KAAgB;IAC/C,OAAQ,KAAK,CAAC,SAAkC,CAAC,IAAI,CAAC;AACxD,CAAC,CAAC;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAG,UAAC,KAAgB;IAChD,QAAS,KAAK,CAAC,SAAkC,CA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MAAM,EAAE;QACxB,OAAO,MAAM,CAAC;KACf;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;GAEG;AACU,QAAA,sBAAsB,GAAG,UAAC,KAAgB;IACrD,IAAM,aAAa,GAAG,wBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,aAAa,KAAK,SAAS,EAAE;QAC/B,IAAM,YAAU,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC;QACtD,OAAO,MAAM,CAAC,IAAI,CAAC,YAAU,CAAC,CAAC,GAAG,CAAC,UAAC,OAAO;YACzC,OAAO;gBACL,GAAG,EAAE,OAAO;gBACZ,KAAK,EAAE,YAAU,CAAC,OAAO,CAAC;aAC3B,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;GAEG;AACU,QAAA,sBAAsB,GAAG,UAAC,KAAgB;IACrD,OAAO,8BAAsB,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAClD,CAAC,CAAC","sourcesContent":["'use strict';\n\nimport {EntityType, LkEdgeData, LkNodeData} from '@linkurious/rest-client';\nimport {Edge, ItemList, Node} from '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"]}
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../src/ogma/features/selectors.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,uDAA2E;AAO3E;;GAEG;AACU,QAAA,gBAAgB,GAAG,UAAC,KAAgB;IAC/C,OAAQ,KAAK,CAAC,SAAkC,CAAC,IAAI,CAAC;AACxD,CAAC,CAAC;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAG,UAAC,KAAgB;IAChD,QAAS,KAAK,CAAC,SAAkC,CAAC,IAAI,EAAE;QACtD,KAAK,CAAC;YACJ,OAAO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,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;GAEG;AACU,QAAA,sBAAsB,GAAG,UAAC,KAAgB;IACrD,IAAM,aAAa,GAAG,wBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,IAAI,aAAa,KAAK,SAAS,EAAE;QAC/B,IAAM,YAAU,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC;QACtD,OAAO,MAAM,CAAC,IAAI,CAAC,YAAU,CAAC,CAAC,GAAG,CAAC,UAAC,OAAO;YACzC,OAAO;gBACL,GAAG,EAAE,OAAO;gBACZ,KAAK,EAAE,YAAU,CAAC,OAAO,CAAC;aAC3B,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;GAEG;AACU,QAAA,sBAAsB,GAAG,UAAC,KAAgB;IACrD,OAAO,8BAAsB,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAClD,CAAC,CAAC","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"]}
@@ -296,27 +296,17 @@ var StylesViz = /** @class */ (function () {
296
296
  nodeAttributes: {
297
297
  text: {
298
298
  minVisibleSize: 0,
299
- font: 'arial',
300
- backgroundColor: null,
301
- maxLineLength: textWrappingLength ? 30 : 0,
302
- scale: 0.3,
303
- margin: 0,
304
- scaling: true,
305
- tip: false
299
+ size: 8,
300
+ maxLineLength: textWrappingLength ? 30 : 0
306
301
  },
307
302
  halo: null
308
303
  },
309
304
  edgeAttributes: {
310
305
  text: {
311
- scaling: false,
312
- font: 'arial',
313
- backgroundColor: null,
314
306
  minVisibleSize: 0,
315
- size: 3,
316
- margin: 0
307
+ size: 8
317
308
  },
318
- halo: null,
319
- shape: 'tapered'
309
+ halo: null
320
310
  }
321
311
  });
322
312
  }
@@ -413,8 +403,8 @@ var StylesViz = /** @class */ (function () {
413
403
  self: { attributes: ['layoutable'] }
414
404
  }
415
405
  });
416
- this._ogma.events.onNodesAdded(function (nodesEvent) { return nodesEvent.nodes.addClass('degreeIndicator'); });
417
- this._ogma.events.onNodesAdded(function (nodesEvent) { return nodesEvent.nodes.addClass('pinnedIndicator'); });
406
+ this._ogma.events.on('addNodes', function (nodesEvent) { return nodesEvent.nodes.addClass('degreeIndicator'); });
407
+ this._ogma.events.on('addNodes', function (nodesEvent) { return nodesEvent.nodes.addClass('pinnedIndicator'); });
418
408
  };
419
409
  /**
420
410
  * Delete the rule to display badges
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/ogma/features/styles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAgBb,2BASe;AACf,2CAAwC;AAYxC,IAAM,2BAA2B,GAAgD;IAC/E,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;QACvB,cAAc,EAAE,CAAC;KAClB;IACD,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC;IACvB,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,IAAM,2BAA2B,GAAgD;IAC/E,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;QACvB,cAAc,EAAE,CAAC;KAClB;IACD,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,IAAM,uBAAuB,GAAG;IAC9B,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,CAAC;IACR,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,CAAC;IACd,oBAAoB,EAAE,KAAK;CAK5B,CAAC;AAEF,IAAM,uBAAuB,GAAG;IAC9B,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,QAAQ;IACvB,KAAK,EAAE,CAAC;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C,CAAC;yBACnD;oBACH,CAAC;iBACF;gBACD,gBAAgB,EAAE,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,EAAC;aACvC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,eAAe,EAAC,CAAC,CAAC;YACvD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SAC/B;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AAnrBD,IAmrBC;AAnrBY,8BAAS","sourcesContent":["'use strict';\n\nimport * as o from 'ogma';\nimport {Edge, EdgeAttributesValue, NodeAttributesValue, StyleClass, StyleRule} from 'ogma';\nimport {\n GenericObject,\n IEdgeStyle,\n INodeStyle,\n IStyleRule,\n LkEdgeData,\n LkNodeData,\n OgmaEdgeShape,\n OgmaNodeShape,\n TextOptions\n} from '@linkurious/rest-client';\n\nimport {\n BASE_GREY,\n EdgeAttributes,\n LKOgma,\n NodeAttributes,\n OgmaTools,\n StyleRule as LKStyleRule,\n StyleRules,\n StyleType\n} from '../..';\nimport {Tools} from '../../tools/tools';\n\nexport interface StylesConfig {\n nodeColorStyleRules: Array<LKStyleRule>;\n nodeIconStyleRules: Array<LKStyleRule>;\n nodeSizeStyleRules: Array<LKStyleRule>;\n nodeShapeStyleRules?: Array<LKStyleRule>;\n edgeColorStyleRules: Array<LKStyleRule>;\n edgeWidthStyleRules: Array<LKStyleRule>;\n edgeShapeStyleRules?: Array<LKStyleRule>;\n}\n\nconst HOVERED_SELECTED_NODE_STYLE: NodeAttributesValue<LkNodeData, LkEdgeData> = {\n text: {\n style: 'bold',\n backgroundColor: '#fff',\n minVisibleSize: 0\n },\n outerStroke: {width: 2},\n outline: false\n};\n\nconst HOVERED_SELECTED_EDGE_STYLE: EdgeAttributesValue<LkEdgeData, LkNodeData> = {\n text: {\n style: 'bold',\n backgroundColor: '#fff',\n minVisibleSize: 0\n },\n outline: false\n};\n\nconst NODE_HALO_CONFIGURATION = {\n color: '#FFF',\n width: 7,\n scalingMethod: 'scaled',\n strokeWidth: 0,\n hideNonAdjacentEdges: false\n} as {\n color: '#FFF';\n width: 7;\n strokeWidth: 0;\n};\n\nconst EDGE_HALO_CONFIGURATION = {\n color: '#FFF',\n scalingMethod: 'scaled',\n width: 4\n} as {\n color: '#FFF';\n width: 4;\n};\n\nconst DEFAULT_OGMA_FONT = \"'roboto', sans-serif\";\nconst DARK_FONT_COLOR = '#000';\nconst CLEAR_FONT_COLOR = '#FFF';\nconst ITEM_DEFAULT_COLOR = '#7f7f7f';\nexport const FILTER_OPACITY = 0.2;\n\nexport class StylesViz {\n private _ogma: LKOgma;\n private _exportClass!: StyleClass;\n private _nodeDefaultStylesRules!: StyleRule<LkNodeData, LkEdgeData>;\n // @ts-ignore\n private _nodeDefaultHaloRules!: StyleRule<LkNodeData, LkEdgeData>;\n private _edgeDefaultStylesRules!: StyleRule<LkNodeData, LkEdgeData>;\n // @ts-ignore\n private _edgeDefaultHaloRules!: StyleRule<LkNodeData, LkEdgeData>;\n\n private _nodeAttributes: NodeAttributes = new NodeAttributes({});\n private _edgeAttributes: EdgeAttributes = new EdgeAttributes({});\n\n private _ogmaNodeColor!: StyleRule;\n private _ogmaNodeIcon!: StyleRule;\n private _ogmaNodeSize!: StyleRule;\n private _ogmaNodeShape!: StyleRule;\n private _ogmaEdgeColor!: StyleRule;\n private _ogmaEdgeWidth!: StyleRule;\n private _ogmaEdgeShape!: StyleRule;\n private _defaultConfiguration: {\n node: {\n nodeRadius?: number;\n shape?: OgmaNodeShape;\n text?: TextOptions & {\n nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center';\n };\n };\n edge: {\n edgeWidth?: number;\n shape?: OgmaEdgeShape;\n text?: TextOptions;\n };\n };\n\n constructor(\n ogma: LKOgma,\n configuration: {\n node: {\n nodeRadius?: number;\n shape?: OgmaNodeShape;\n text?: TextOptions & {\n nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center';\n };\n };\n edge: {\n edgeWidth?: number;\n shape?: OgmaEdgeShape;\n text?: TextOptions;\n };\n }\n ) {\n this._ogma = ogma;\n this._defaultConfiguration = configuration;\n }\n\n /**\n * Set nodes default styles based on the configuration\n */\n public setNodesDefaultStyles(): void {\n // setting selection and hover attributes\n this._ogma.styles.setHoveredNodeAttributes(HOVERED_SELECTED_NODE_STYLE);\n this._ogma.styles.setSelectedNodeAttributes(HOVERED_SELECTED_NODE_STYLE);\n // setting default styles\n this._nodeDefaultStylesRules = this._ogma.styles.addRule({\n nodeAttributes: {\n text: {\n minVisibleSize:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.minVisibleSize\n ? this._defaultConfiguration.node.text.minVisibleSize\n : 12,\n maxLineLength:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.maxLineLength !== undefined\n ? this._defaultConfiguration.node.text.maxLineLength\n : 30,\n position:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.nodePosition !== undefined\n ? this._defaultConfiguration.node.text.nodePosition\n : 'bottom',\n backgroundColor:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.backgroundColor !== undefined\n ? this._defaultConfiguration.node.text.backgroundColor\n : 'null',\n font:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.font !== undefined\n ? this._defaultConfiguration.node.text.font\n : \"'roboto', sans-serif\",\n color:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.color !== undefined\n ? this._defaultConfiguration.node.text.color\n : 'black',\n size:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.size !== undefined\n ? this._defaultConfiguration.node.text.size\n : 14,\n margin: 5\n },\n radius: this.defaultNodeRadius(this._defaultConfiguration.node),\n icon: {\n minVisibleSize: 15\n },\n color: ITEM_DEFAULT_COLOR,\n shape:\n this._defaultConfiguration.node.shape !== undefined\n ? this._defaultConfiguration.node.shape\n : ('circle' as OgmaNodeShape),\n innerStroke: {\n width: 3\n },\n outline: false\n }\n });\n }\n\n /**\n * Set edges default styles based on the configuration\n */\n public setEdgesDefaultStyles(): void {\n // setting selection and hover attributes\n this._ogma.styles.setHoveredEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);\n this._ogma.styles.setSelectedEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);\n // setting default styles\n this._edgeDefaultStylesRules = this._ogma.styles.addRule({\n edgeAttributes: {\n text: {\n minVisibleSize:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.minVisibleSize\n ? this._defaultConfiguration.edge.text.minVisibleSize\n : 3,\n maxLineLength:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.maxLineLength !== undefined\n ? this._defaultConfiguration.edge.text.maxLineLength\n : 30,\n backgroundColor:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.backgroundColor !== undefined\n ? this._defaultConfiguration.edge.text.backgroundColor\n : null,\n font:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.font !== undefined\n ? this._defaultConfiguration.edge.text.font\n : \"'roboto', sans-serif\",\n color:\n this._defaultConfiguration.edge !== undefined &&\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.color !== undefined\n ? this._defaultConfiguration.edge.text.color\n : 'black',\n size:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.size !== undefined\n ? this._defaultConfiguration.edge.text.size\n : 14\n },\n width: this.defaultEdgeWidth(this._defaultConfiguration.edge),\n shape:\n this._defaultConfiguration.edge.shape !== undefined\n ? this._defaultConfiguration.edge.shape\n : 'arrow',\n color: ITEM_DEFAULT_COLOR\n }\n });\n }\n\n /**\n * Set nodes default styles based on the configuration\n */\n public setNodesDefaultHalo(): void {\n // setting default halo style\n this._nodeDefaultHaloRules = this._ogma.styles.addRule({\n nodeSelector: (node) => node && !node.hasClass('filtered'),\n nodeAttributes: {\n halo: (node) => {\n if (\n node !== undefined &&\n (node.isSelected() ||\n node.getAdjacentNodes({}).isSelected().includes(true) ||\n node.getAdjacentEdges().isSelected().includes(true))\n ) {\n return {\n ...NODE_HALO_CONFIGURATION,\n scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled'\n };\n }\n return null;\n }\n },\n // recalculate the rule *only* when itself or adjacent\n // elements change their selection status\n nodeDependencies: {\n self: {\n selection: true\n },\n adjacentNodes: {\n selection: true\n },\n adjacentEdges: {\n selection: true\n }\n }\n });\n }\n\n /**\n * Set edges default styles based on the configuration\n */\n public setEdgesDefaultHalo(): void {\n // setting default halo styles\n this._edgeDefaultHaloRules = this._ogma.styles.addRule({\n edgeSelector: (edge: Edge) =>\n edge && edge.getSource() && edge.getTarget() && !edge.hasClass('filtered'),\n edgeAttributes: {\n halo: (edge) => {\n if (\n edge &&\n (edge.isSelected() || edge.getSource().isSelected() || edge.getTarget().isSelected())\n ) {\n return {\n ...EDGE_HALO_CONFIGURATION,\n scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled'\n };\n }\n return null;\n }\n },\n // this rule will only be invoked when the selection status\n // of the edge or it's extremities is changed\n edgeDependencies: {\n self: {\n selection: true\n },\n extremities: {\n selection: true\n }\n }\n });\n }\n\n /**\n * Return the default node radius set in configuration or 5\n *\n * @returns {number}\n */\n private defaultNodeRadius(styles: any): number {\n return this.defaultStylesHas(styles, ['nodeRadius']) ? styles.nodeRadius : 5;\n }\n\n /**\n * Return the default edge width set in configuration or 1\n *\n * @returns {number}\n */\n private defaultEdgeWidth(styles: any): number {\n return this.defaultStylesHas(styles, ['edgeWidth']) ? styles.edgeWidth : 1;\n }\n\n /**\n * Check if a style property exists in the default styles object\n */\n private defaultStylesHas(styles: GenericObject<unknown>, propertyPath: Array<string>): boolean {\n if (!Tools.isDefined(styles)) {\n return false;\n }\n return Tools.getIn(styles, propertyPath) !== undefined;\n }\n\n /**\n * Set styles for the class \"filtered\"\n */\n public setFilterClass(): void {\n this._ogma.styles.createClass({\n name: 'filtered',\n nodeAttributes: {\n opacity: FILTER_OPACITY,\n layer: -1,\n detectable: false,\n badges: {\n topRight: {\n text: null\n },\n bottomRight: {\n text: null\n }\n },\n text: null,\n color: 'rgb(240, 240, 240)',\n innerStroke: {\n width: 1,\n color: BASE_GREY,\n minVisibleSize: 1\n },\n shape: 'circle',\n image: null,\n icon: null,\n radius: '100%'\n },\n edgeAttributes: {\n opacity: FILTER_OPACITY,\n layer: -1,\n detectable: false,\n text: null,\n color: BASE_GREY,\n shape: 'line',\n width: 0.2\n }\n });\n }\n\n /**\n * Set the class for exported nodes and edges\n */\n public setExportClass(textWrappingLength?: boolean): void {\n if (!this._exportClass) {\n this._exportClass = this._ogma.styles.createClass({\n name: 'exported',\n nodeAttributes: {\n text: {\n minVisibleSize: 0,\n font: 'arial',\n backgroundColor: null,\n maxLineLength: textWrappingLength ? 30 : 0,\n scale: 0.3,\n margin: 0,\n scaling: true,\n tip: false\n },\n halo: null\n },\n edgeAttributes: {\n text: {\n scaling: false,\n font: 'arial',\n backgroundColor: null,\n minVisibleSize: 0,\n size: 3,\n margin: 0\n },\n halo: null,\n shape: 'tapered'\n }\n });\n } else {\n this._exportClass.update({\n nodeAttributes: {\n text: {\n maxLineLength: textWrappingLength ? 30 : 0\n },\n halo: null\n }\n });\n }\n }\n\n /**\n * Set the rule to display badges\n */\n public setBadgeRule() {\n this._ogma.styles.createClass({\n name: 'degreeIndicator',\n nodeAttributes: {\n badges: {\n topRight: (node) => {\n if (node !== undefined) {\n const degree = Tools.getHiddenNeighbors(node.toList());\n const badgeContent = Tools.formatNumber(degree);\n if (degree > 0) {\n const nodeColor = Array.isArray(node.getAttribute('color'))\n ? node.getAttribute('color')![0]\n : node.getAttribute('color');\n const textColor = OgmaTools.isBright(nodeColor as o.Color)\n ? DARK_FONT_COLOR\n : CLEAR_FONT_COLOR;\n const isSupernode = node.getData(['statistics', 'supernode']);\n let content = null;\n if (+badgeContent !== 0) {\n content = isSupernode ? badgeContent + '+' : badgeContent;\n }\n return {\n color: 'inherit',\n minVisibleSize: 20,\n stroke: {\n width: 0,\n color: null\n },\n text: {\n font:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.font !== undefined\n ? this._defaultConfiguration.node.text.font\n : DEFAULT_OGMA_FONT,\n scale: 0.4,\n color: textColor,\n content: content\n }\n };\n }\n }\n }\n }\n }\n });\n this._ogma.styles.createClass({\n name: 'pinnedIndicator',\n nodeAttributes: {\n badges: {\n bottomRight: (node) => {\n if (node !== undefined && !node.getAttribute('layoutable')) {\n const nodeColor = Array.isArray(node.getAttribute('color'))\n ? node.getAttribute('color')![0]\n : node.getAttribute('color');\n const textColor = OgmaTools.isBright(nodeColor as o.Color)\n ? DARK_FONT_COLOR\n : CLEAR_FONT_COLOR;\n return {\n color: 'inherit',\n minVisibleSize: 20,\n stroke: {\n width: 0,\n color: null\n },\n text: {\n font: 'FontAwesome',\n scale: 0.4,\n color: textColor,\n content: node.getAttribute('layoutable') ? null : '\\uf08d'\n }\n };\n }\n }\n }\n },\n nodeDependencies: {\n self: {attributes: ['layoutable']}\n }\n });\n this._ogma.events.onNodesAdded((nodesEvent) => nodesEvent!.nodes.addClass('degreeIndicator'));\n this._ogma.events.onNodesAdded((nodesEvent) => nodesEvent!.nodes.addClass('pinnedIndicator'));\n }\n\n /**\n * Delete the rule to display badges\n */\n public deleteBadgeRule() {\n this._ogma.getNodes().removeClasses(['degreeIndicator', 'pinnedIndicator'], 0);\n }\n\n /**\n * set text overlap to true or false\n *\n * @param {boolean} overlap\n */\n public toggleTextOverlap(overlap?: boolean): void {\n this._ogma.setOptions({texts: {preventOverlap: overlap}});\n }\n\n /**\n * refresh nodes and edge rules\n *\n */\n public refreshRules(): void {\n this._nodeDefaultStylesRules.refresh();\n this._edgeDefaultStylesRules.refresh();\n }\n\n /**\n * Create / refresh an ogma rule for node colors\n */\n public refreshNodeColors(colorStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeColor)) {\n this._nodeAttributes.refresh({color: colorStyleRules});\n this._ogmaNodeColor = this._ogma.styles.addRule({\n nodeAttributes: {\n color: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.color(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({color: colorStyleRules});\n this._ogmaNodeColor.refresh();\n // TODO refresh node icons when moving the code from LKE\n // this.refreshIconsColor();\n }\n }\n\n /**\n * Return an array of StyleRules with only the style that need to be applied\n */\n public getStyleRule(\n state: Array<IStyleRule<INodeStyle | IEdgeStyle>>,\n styleType: StyleType\n ): LKStyleRule[] {\n return new StyleRules(state)[styleType];\n }\n\n public initNodeColors(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeColorRules = this.getStyleRule(nodeRules, StyleType.COLOR);\n this.refreshNodeColors(nodeColorRules);\n }\n\n public initNodesIcons(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeIconsRules = this.getStyleRule(nodeRules, StyleType.ICON);\n this.refreshNodeIcons(nodeIconsRules);\n }\n\n public initNodesSizes(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeSizeRules = this.getStyleRule(nodeRules, StyleType.SIZE);\n this.refreshNodeSize(nodeSizeRules);\n }\n\n public initNodesShapes(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeShapesRules = this.getStyleRule(nodeRules, StyleType.SHAPE);\n this.refreshNodeShape(nodeShapesRules);\n }\n\n public initEdgesWidth(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesWidthRules = this.getStyleRule(edgeRules, StyleType.WIDTH);\n this.refreshEdgeWidth(edgesWidthRules);\n }\n\n public initEdgesShape(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesShapeRules = this.getStyleRule(edgeRules, StyleType.SHAPE);\n this.refreshEdgeShape(edgesShapeRules);\n }\n\n public initEdgesColor(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesColorRules = this.getStyleRule(edgeRules, StyleType.COLOR);\n this.refreshEdgeColors(edgesColorRules);\n }\n\n /**\n * Create / refresh an ogma rule for node icons\n *\n * @param {Array<any>} iconStyleRules\n */\n public refreshNodeIcons(iconStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeIcon)) {\n this._nodeAttributes.refresh({icon: iconStyleRules});\n this._ogmaNodeIcon = this._ogma.styles.addRule({\n nodeAttributes: {\n icon: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.icon(node.getData()).icon;\n }\n },\n image: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.icon(node.getData()).image;\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({icon: iconStyleRules});\n this._ogmaNodeIcon.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for node sizes\n *\n * @param {Array<any>} sizeStyleRules\n */\n public refreshNodeSize(sizeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeSize)) {\n this._nodeAttributes.refresh({size: sizeStyleRules});\n this._ogmaNodeSize = this._ogma.styles.addRule({\n nodeAttributes: {\n radius: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.size(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({size: sizeStyleRules});\n this._ogmaNodeSize.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for node images\n *\n * @param {Array<any>} shapeStyleRules\n */\n public refreshNodeShape(shapeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeShape)) {\n this._nodeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaNodeShape = this._ogma.styles.addRule({\n nodeAttributes: {\n shape: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.shape(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaNodeShape.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge colors\n */\n public refreshEdgeColors(colorStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeColor)) {\n this._edgeAttributes.refresh({color: colorStyleRules});\n this._ogmaEdgeColor = this._ogma.styles.addRule({\n edgeAttributes: {\n color: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.color(edge.getData());\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n } else {\n this._edgeAttributes.refresh({color: colorStyleRules});\n this._ogmaEdgeColor.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge width\n *\n * @param {Array<LKStyleRule>} widthStyleRules\n */\n public refreshEdgeWidth(widthStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeWidth)) {\n this._edgeAttributes.refresh({width: widthStyleRules});\n this._ogmaEdgeWidth = this._ogma.styles.addRule({\n edgeAttributes: {\n width: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.width(edge.getData());\n }\n }\n },\n edgeDependencies: {\n self: {data: true}\n }\n });\n } else {\n this._edgeAttributes.refresh({width: widthStyleRules});\n this._ogmaEdgeWidth.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge width\n *\n * @param {Array<LKStyleRule>} shapeStyleRules\n */\n public refreshEdgeShape(shapeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeShape)) {\n this._edgeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaEdgeShape = this._ogma.styles.addRule({\n edgeAttributes: {\n shape: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.shape(edge.getData());\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n } else {\n this._edgeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaEdgeShape.refresh();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/ogma/features/styles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAsBb,2BASe;AACf,2CAAwC;AAYxC,IAAM,2BAA2B,GAAgD;IAC/E,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;QACvB,cAAc,EAAE,CAAC;KAClB;IACD,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC;IACvB,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,IAAM,2BAA2B,GAAgD;IAC/E,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;QACvB,cAAc,EAAE,CAAC;KAClB;IACD,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,IAAM,uBAAuB,GAAG;IAC9B,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,CAAC;IACR,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,CAAC;IACd,oBAAoB,EAAE,KAAK;CAK5B,CAAC;AAEF,IAAM,uBAAuB,GAAG;IAC9B,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,QAAQ;IACvB,KAAK,EAAE,CAAC;CAIT,CAAC;AAEF,IAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACjD,IAAM,eAAe,GAAG,MAAM,CAAC;AAC/B,IAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,IAAM,kBAAkB,GAAG,SAAS,CAAC;AACxB,QAAA,cAAc,GAAG,GAAG,CAAC;AAElC;IAmCE,mBACE,IAAY,EACZ,aAaC;QAxCK,oBAAe,GAAmB,IAAI,kBAAc,CAAC,EAAE,CAAC,CAAC;QACzD,oBAAe,GAAmB,IAAI,kBAAc,CAAC,EAAE,CAAC,CAAC;QAyC/D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;aACF,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,eAAe,EAAC,CAAC,CAAC;YACvD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SAC/B;IACH,CAAC;IAED;;;;OAIG;IACI,oCAAgB,GAAvB,UAAwB,eAAmC;QAA3D,iBAiBC;QAhBC,IAAI,CAAC,aAAK,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;YACzC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,eAAe,EAAC,CAAC,CAAC;YACvD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;gBAC9C,cAAc,EAAE;oBACd,KAAK,EAAE,UAAC,IAAwB;wBAC9B,IAAI,IAAI,KAAK,SAAS,EAAE;4BACtB,OAAO,KAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;yBACnD;oBACH,CAAC;iBACF;gBACD,gBAAgB,EAAE,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,EAAC;aACvC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,eAAe,EAAC,CAAC,CAAC;YACvD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SAC/B;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AAzqBD,IAyqBC;AAzqBY,8BAAS","sourcesContent":["'use strict';\n\nimport * as o from '@linkurious/ogma';\nimport {\n Edge,\n EdgeAttributesValue,\n NodeAttributesValue,\n StyleClass,\n StyleRule\n} from '@linkurious/ogma';\nimport {\n GenericObject,\n IEdgeStyle,\n INodeStyle,\n IStyleRule,\n LkEdgeData,\n LkNodeData,\n OgmaEdgeShape,\n OgmaNodeShape,\n TextOptions\n} from '@linkurious/rest-client';\n\nimport {\n BASE_GREY,\n EdgeAttributes,\n LKOgma,\n NodeAttributes,\n OgmaTools,\n StyleRule as LKStyleRule,\n StyleRules,\n StyleType\n} from '../..';\nimport {Tools} from '../../tools/tools';\n\nexport interface StylesConfig {\n nodeColorStyleRules: Array<LKStyleRule>;\n nodeIconStyleRules: Array<LKStyleRule>;\n nodeSizeStyleRules: Array<LKStyleRule>;\n nodeShapeStyleRules?: Array<LKStyleRule>;\n edgeColorStyleRules: Array<LKStyleRule>;\n edgeWidthStyleRules: Array<LKStyleRule>;\n edgeShapeStyleRules?: Array<LKStyleRule>;\n}\n\nconst HOVERED_SELECTED_NODE_STYLE: NodeAttributesValue<LkNodeData, LkEdgeData> = {\n text: {\n style: 'bold',\n backgroundColor: '#fff',\n minVisibleSize: 0\n },\n outerStroke: {width: 2},\n outline: false\n};\n\nconst HOVERED_SELECTED_EDGE_STYLE: EdgeAttributesValue<LkEdgeData, LkNodeData> = {\n text: {\n style: 'bold',\n backgroundColor: '#fff',\n minVisibleSize: 0\n },\n outline: false\n};\n\nconst NODE_HALO_CONFIGURATION = {\n color: '#FFF',\n width: 7,\n scalingMethod: 'scaled',\n strokeWidth: 0,\n hideNonAdjacentEdges: false\n} as {\n color: '#FFF';\n width: 7;\n strokeWidth: 0;\n};\n\nconst EDGE_HALO_CONFIGURATION = {\n color: '#FFF',\n scalingMethod: 'scaled',\n width: 4\n} as {\n color: '#FFF';\n width: 4;\n};\n\nconst DEFAULT_OGMA_FONT = \"'roboto', sans-serif\";\nconst DARK_FONT_COLOR = '#000';\nconst CLEAR_FONT_COLOR = '#FFF';\nconst ITEM_DEFAULT_COLOR = '#7f7f7f';\nexport const FILTER_OPACITY = 0.2;\n\nexport class StylesViz {\n private _ogma: LKOgma;\n private _exportClass!: StyleClass;\n private _nodeDefaultStylesRules!: StyleRule<LkNodeData, LkEdgeData>;\n // @ts-ignore\n private _nodeDefaultHaloRules!: StyleRule<LkNodeData, LkEdgeData>;\n private _edgeDefaultStylesRules!: StyleRule<LkNodeData, LkEdgeData>;\n // @ts-ignore\n private _edgeDefaultHaloRules!: StyleRule<LkNodeData, LkEdgeData>;\n\n private _nodeAttributes: NodeAttributes = new NodeAttributes({});\n private _edgeAttributes: EdgeAttributes = new EdgeAttributes({});\n\n private _ogmaNodeColor!: StyleRule;\n private _ogmaNodeIcon!: StyleRule;\n private _ogmaNodeSize!: StyleRule;\n private _ogmaNodeShape!: StyleRule;\n private _ogmaEdgeColor!: StyleRule;\n private _ogmaEdgeWidth!: StyleRule;\n private _ogmaEdgeShape!: StyleRule;\n private _defaultConfiguration: {\n node: {\n nodeRadius?: number;\n shape?: OgmaNodeShape;\n text?: TextOptions & {\n nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center';\n };\n };\n edge: {\n edgeWidth?: number;\n shape?: OgmaEdgeShape;\n text?: TextOptions;\n };\n };\n\n constructor(\n ogma: LKOgma,\n configuration: {\n node: {\n nodeRadius?: number;\n shape?: OgmaNodeShape;\n text?: TextOptions & {\n nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center';\n };\n };\n edge: {\n edgeWidth?: number;\n shape?: OgmaEdgeShape;\n text?: TextOptions;\n };\n }\n ) {\n this._ogma = ogma;\n this._defaultConfiguration = configuration;\n }\n\n /**\n * Set nodes default styles based on the configuration\n */\n public setNodesDefaultStyles(): void {\n // setting selection and hover attributes\n this._ogma.styles.setHoveredNodeAttributes(HOVERED_SELECTED_NODE_STYLE);\n this._ogma.styles.setSelectedNodeAttributes(HOVERED_SELECTED_NODE_STYLE);\n // setting default styles\n this._nodeDefaultStylesRules = this._ogma.styles.addRule({\n nodeAttributes: {\n text: {\n minVisibleSize:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.minVisibleSize\n ? this._defaultConfiguration.node.text.minVisibleSize\n : 12,\n maxLineLength:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.maxLineLength !== undefined\n ? this._defaultConfiguration.node.text.maxLineLength\n : 30,\n position:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.nodePosition !== undefined\n ? this._defaultConfiguration.node.text.nodePosition\n : 'bottom',\n backgroundColor:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.backgroundColor !== undefined\n ? this._defaultConfiguration.node.text.backgroundColor\n : 'null',\n font:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.font !== undefined\n ? this._defaultConfiguration.node.text.font\n : \"'roboto', sans-serif\",\n color:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.color !== undefined\n ? this._defaultConfiguration.node.text.color\n : 'black',\n size:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.size !== undefined\n ? this._defaultConfiguration.node.text.size\n : 14,\n margin: 5\n },\n radius: this.defaultNodeRadius(this._defaultConfiguration.node),\n icon: {\n minVisibleSize: 15\n },\n color: ITEM_DEFAULT_COLOR,\n shape:\n this._defaultConfiguration.node.shape !== undefined\n ? this._defaultConfiguration.node.shape\n : ('circle' as OgmaNodeShape),\n innerStroke: {\n width: 3\n },\n outline: false\n }\n });\n }\n\n /**\n * Set edges default styles based on the configuration\n */\n public setEdgesDefaultStyles(): void {\n // setting selection and hover attributes\n this._ogma.styles.setHoveredEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);\n this._ogma.styles.setSelectedEdgeAttributes(HOVERED_SELECTED_EDGE_STYLE);\n // setting default styles\n this._edgeDefaultStylesRules = this._ogma.styles.addRule({\n edgeAttributes: {\n text: {\n minVisibleSize:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.minVisibleSize\n ? this._defaultConfiguration.edge.text.minVisibleSize\n : 3,\n maxLineLength:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.maxLineLength !== undefined\n ? this._defaultConfiguration.edge.text.maxLineLength\n : 30,\n backgroundColor:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.backgroundColor !== undefined\n ? this._defaultConfiguration.edge.text.backgroundColor\n : null,\n font:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.font !== undefined\n ? this._defaultConfiguration.edge.text.font\n : \"'roboto', sans-serif\",\n color:\n this._defaultConfiguration.edge !== undefined &&\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.color !== undefined\n ? this._defaultConfiguration.edge.text.color\n : 'black',\n size:\n this._defaultConfiguration.edge.text !== undefined &&\n this._defaultConfiguration.edge.text.size !== undefined\n ? this._defaultConfiguration.edge.text.size\n : 14\n },\n width: this.defaultEdgeWidth(this._defaultConfiguration.edge),\n shape:\n this._defaultConfiguration.edge.shape !== undefined\n ? this._defaultConfiguration.edge.shape\n : 'arrow',\n color: ITEM_DEFAULT_COLOR\n }\n });\n }\n\n /**\n * Set nodes default styles based on the configuration\n */\n public setNodesDefaultHalo(): void {\n // setting default halo style\n this._nodeDefaultHaloRules = this._ogma.styles.addRule({\n nodeSelector: (node) => node && !node.hasClass('filtered'),\n nodeAttributes: {\n halo: (node) => {\n if (\n node !== undefined &&\n (node.isSelected() ||\n node.getAdjacentNodes({}).isSelected().includes(true) ||\n node.getAdjacentEdges().isSelected().includes(true))\n ) {\n return {\n ...NODE_HALO_CONFIGURATION,\n scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled'\n };\n }\n return null;\n }\n },\n // recalculate the rule *only* when itself or adjacent\n // elements change their selection status\n nodeDependencies: {\n self: {\n selection: true\n },\n adjacentNodes: {\n selection: true\n },\n adjacentEdges: {\n selection: true\n }\n }\n });\n }\n\n /**\n * Set edges default styles based on the configuration\n */\n public setEdgesDefaultHalo(): void {\n // setting default halo styles\n this._edgeDefaultHaloRules = this._ogma.styles.addRule({\n edgeSelector: (edge: Edge) =>\n edge && edge.getSource() && edge.getTarget() && !edge.hasClass('filtered'),\n edgeAttributes: {\n halo: (edge) => {\n if (\n edge &&\n (edge.isSelected() || edge.getSource().isSelected() || edge.getTarget().isSelected())\n ) {\n return {\n ...EDGE_HALO_CONFIGURATION,\n scalingMethod: this._ogma.geo.enabled() ? 'fixed' : 'scaled'\n };\n }\n return null;\n }\n },\n // this rule will only be invoked when the selection status\n // of the edge or it's extremities is changed\n edgeDependencies: {\n self: {\n selection: true\n },\n extremities: {\n selection: true\n }\n }\n });\n }\n\n /**\n * Return the default node radius set in configuration or 5\n *\n * @returns {number}\n */\n private defaultNodeRadius(styles: any): number {\n return this.defaultStylesHas(styles, ['nodeRadius']) ? styles.nodeRadius : 5;\n }\n\n /**\n * Return the default edge width set in configuration or 1\n *\n * @returns {number}\n */\n private defaultEdgeWidth(styles: any): number {\n return this.defaultStylesHas(styles, ['edgeWidth']) ? styles.edgeWidth : 1;\n }\n\n /**\n * Check if a style property exists in the default styles object\n */\n private defaultStylesHas(styles: GenericObject<unknown>, propertyPath: Array<string>): boolean {\n if (!Tools.isDefined(styles)) {\n return false;\n }\n return Tools.getIn(styles, propertyPath) !== undefined;\n }\n\n /**\n * Set styles for the class \"filtered\"\n */\n public setFilterClass(): void {\n this._ogma.styles.createClass({\n name: 'filtered',\n nodeAttributes: {\n opacity: FILTER_OPACITY,\n layer: -1,\n detectable: false,\n badges: {\n topRight: {\n text: null\n },\n bottomRight: {\n text: null\n }\n },\n text: null,\n color: 'rgb(240, 240, 240)',\n innerStroke: {\n width: 1,\n color: BASE_GREY,\n minVisibleSize: 1\n },\n shape: 'circle',\n image: null,\n icon: null,\n radius: '100%'\n },\n edgeAttributes: {\n opacity: FILTER_OPACITY,\n layer: -1,\n detectable: false,\n text: null,\n color: BASE_GREY,\n shape: 'line',\n width: 0.2\n }\n });\n }\n\n /**\n * Set the class for exported nodes and edges\n */\n public setExportClass(textWrappingLength?: boolean): void {\n if (!this._exportClass) {\n this._exportClass = this._ogma.styles.createClass({\n name: 'exported',\n nodeAttributes: {\n text: {\n minVisibleSize: 0,\n size: 8,\n maxLineLength: textWrappingLength ? 30 : 0\n },\n halo: null\n },\n edgeAttributes: {\n text: {\n minVisibleSize: 0,\n size: 8\n },\n halo: null\n }\n });\n } else {\n this._exportClass.update({\n nodeAttributes: {\n text: {\n maxLineLength: textWrappingLength ? 30 : 0\n },\n halo: null\n }\n });\n }\n }\n\n /**\n * Set the rule to display badges\n */\n public setBadgeRule() {\n this._ogma.styles.createClass({\n name: 'degreeIndicator',\n nodeAttributes: {\n badges: {\n topRight: (node) => {\n if (node !== undefined) {\n const degree = Tools.getHiddenNeighbors(node.toList());\n const badgeContent = Tools.formatNumber(degree);\n if (degree > 0) {\n const nodeColor = Array.isArray(node.getAttribute('color'))\n ? node.getAttribute('color')![0]\n : node.getAttribute('color');\n const textColor = OgmaTools.isBright(nodeColor as o.Color)\n ? DARK_FONT_COLOR\n : CLEAR_FONT_COLOR;\n const isSupernode = node.getData(['statistics', 'supernode']);\n let content = null;\n if (+badgeContent !== 0) {\n content = isSupernode ? badgeContent + '+' : badgeContent;\n }\n return {\n color: 'inherit',\n minVisibleSize: 20,\n stroke: {\n width: 0,\n color: null\n },\n text: {\n font:\n this._defaultConfiguration.node.text !== undefined &&\n this._defaultConfiguration.node.text.font !== undefined\n ? this._defaultConfiguration.node.text.font\n : DEFAULT_OGMA_FONT,\n scale: 0.4,\n color: textColor,\n content: content\n }\n };\n }\n }\n }\n }\n }\n });\n this._ogma.styles.createClass({\n name: 'pinnedIndicator',\n nodeAttributes: {\n badges: {\n bottomRight: (node) => {\n if (node !== undefined && !node.getAttribute('layoutable')) {\n const nodeColor = Array.isArray(node.getAttribute('color'))\n ? node.getAttribute('color')![0]\n : node.getAttribute('color');\n const textColor = OgmaTools.isBright(nodeColor as o.Color)\n ? DARK_FONT_COLOR\n : CLEAR_FONT_COLOR;\n return {\n color: 'inherit',\n minVisibleSize: 20,\n stroke: {\n width: 0,\n color: null\n },\n text: {\n font: 'FontAwesome',\n scale: 0.4,\n color: textColor,\n content: node.getAttribute('layoutable') ? null : '\\uf08d'\n }\n };\n }\n }\n }\n },\n nodeDependencies: {\n self: {attributes: ['layoutable']}\n }\n });\n this._ogma.events.on('addNodes', (nodesEvent) => nodesEvent.nodes.addClass('degreeIndicator'));\n this._ogma.events.on('addNodes', (nodesEvent) => nodesEvent.nodes.addClass('pinnedIndicator'));\n }\n\n /**\n * Delete the rule to display badges\n */\n public deleteBadgeRule() {\n this._ogma.getNodes().removeClasses(['degreeIndicator', 'pinnedIndicator'], 0);\n }\n\n /**\n * set text overlap to true or false\n *\n * @param {boolean} overlap\n */\n public toggleTextOverlap(overlap?: boolean): void {\n this._ogma.setOptions({texts: {preventOverlap: overlap}});\n }\n\n /**\n * refresh nodes and edge rules\n *\n */\n public refreshRules(): void {\n this._nodeDefaultStylesRules.refresh();\n this._edgeDefaultStylesRules.refresh();\n }\n\n /**\n * Create / refresh an ogma rule for node colors\n */\n public refreshNodeColors(colorStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeColor)) {\n this._nodeAttributes.refresh({color: colorStyleRules});\n this._ogmaNodeColor = this._ogma.styles.addRule({\n nodeAttributes: {\n color: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.color(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({color: colorStyleRules});\n this._ogmaNodeColor.refresh();\n // TODO refresh node icons when moving the code from LKE\n // this.refreshIconsColor();\n }\n }\n\n /**\n * Return an array of StyleRules with only the style that need to be applied\n */\n public getStyleRule(\n state: Array<IStyleRule<INodeStyle | IEdgeStyle>>,\n styleType: StyleType\n ): LKStyleRule[] {\n return new StyleRules(state)[styleType];\n }\n\n public initNodeColors(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeColorRules = this.getStyleRule(nodeRules, StyleType.COLOR);\n this.refreshNodeColors(nodeColorRules);\n }\n\n public initNodesIcons(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeIconsRules = this.getStyleRule(nodeRules, StyleType.ICON);\n this.refreshNodeIcons(nodeIconsRules);\n }\n\n public initNodesSizes(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeSizeRules = this.getStyleRule(nodeRules, StyleType.SIZE);\n this.refreshNodeSize(nodeSizeRules);\n }\n\n public initNodesShapes(nodeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const nodeShapesRules = this.getStyleRule(nodeRules, StyleType.SHAPE);\n this.refreshNodeShape(nodeShapesRules);\n }\n\n public initEdgesWidth(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesWidthRules = this.getStyleRule(edgeRules, StyleType.WIDTH);\n this.refreshEdgeWidth(edgesWidthRules);\n }\n\n public initEdgesShape(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesShapeRules = this.getStyleRule(edgeRules, StyleType.SHAPE);\n this.refreshEdgeShape(edgesShapeRules);\n }\n\n public initEdgesColor(edgeRules: Array<IStyleRule<INodeStyle | IEdgeStyle>>) {\n const edgesColorRules = this.getStyleRule(edgeRules, StyleType.COLOR);\n this.refreshEdgeColors(edgesColorRules);\n }\n\n /**\n * Create / refresh an ogma rule for node icons\n *\n * @param {Array<any>} iconStyleRules\n */\n public refreshNodeIcons(iconStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeIcon)) {\n this._nodeAttributes.refresh({icon: iconStyleRules});\n this._ogmaNodeIcon = this._ogma.styles.addRule({\n nodeAttributes: {\n icon: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.icon(node.getData()).icon;\n }\n },\n image: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.icon(node.getData()).image;\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({icon: iconStyleRules});\n this._ogmaNodeIcon.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for node sizes\n *\n * @param {Array<any>} sizeStyleRules\n */\n public refreshNodeSize(sizeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeSize)) {\n this._nodeAttributes.refresh({size: sizeStyleRules});\n this._ogmaNodeSize = this._ogma.styles.addRule({\n nodeAttributes: {\n radius: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.size(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({size: sizeStyleRules});\n this._ogmaNodeSize.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for node images\n *\n * @param {Array<any>} shapeStyleRules\n */\n public refreshNodeShape(shapeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaNodeShape)) {\n this._nodeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaNodeShape = this._ogma.styles.addRule({\n nodeAttributes: {\n shape: (node: o.Node | undefined) => {\n if (node !== undefined) {\n return this._nodeAttributes.shape(node.getData());\n }\n }\n },\n nodeDependencies: {self: {data: true}}\n });\n } else {\n this._nodeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaNodeShape.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge colors\n */\n public refreshEdgeColors(colorStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeColor)) {\n this._edgeAttributes.refresh({color: colorStyleRules});\n this._ogmaEdgeColor = this._ogma.styles.addRule({\n edgeAttributes: {\n color: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.color(edge.getData());\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n } else {\n this._edgeAttributes.refresh({color: colorStyleRules});\n this._ogmaEdgeColor.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge width\n *\n * @param {Array<LKStyleRule>} widthStyleRules\n */\n public refreshEdgeWidth(widthStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeWidth)) {\n this._edgeAttributes.refresh({width: widthStyleRules});\n this._ogmaEdgeWidth = this._ogma.styles.addRule({\n edgeAttributes: {\n width: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.width(edge.getData());\n }\n }\n },\n edgeDependencies: {\n self: {data: true}\n }\n });\n } else {\n this._edgeAttributes.refresh({width: widthStyleRules});\n this._ogmaEdgeWidth.refresh();\n }\n }\n\n /**\n * Create / refresh an ogma rule for edge width\n *\n * @param {Array<LKStyleRule>} shapeStyleRules\n */\n public refreshEdgeShape(shapeStyleRules: Array<LKStyleRule>): void {\n if (!Tools.isDefined(this._ogmaEdgeShape)) {\n this._edgeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaEdgeShape = this._ogma.styles.addRule({\n edgeAttributes: {\n shape: (edge: o.Edge | undefined) => {\n if (edge !== undefined) {\n return this._edgeAttributes.shape(edge.getData());\n }\n }\n },\n edgeDependencies: {self: {data: true}}\n });\n } else {\n this._edgeAttributes.refresh({shape: shapeStyleRules});\n this._ogmaEdgeShape.refresh();\n }\n }\n}\n"]}