@neo4j-ndl/react-graph 1.3.39 → 1.3.41
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/lib/cjs/stories/{graph-visualization-color-range-styling.story.js → graph-visualization-range-styling.story.js} +15 -2
- package/lib/cjs/stories/graph-visualization-range-styling.story.js.map +1 -0
- package/lib/cjs/stories/index.js +5 -5
- package/lib/cjs/stories/index.js.map +1 -1
- package/lib/cjs/styling/compile-graph-styles.js +32 -0
- package/lib/cjs/styling/compile-graph-styles.js.map +1 -1
- package/lib/cjs/styling/style-types.js +29 -1
- package/lib/cjs/styling/style-types.js.map +1 -1
- package/lib/esm/stories/{graph-visualization-color-range-styling.story.js → graph-visualization-range-styling.story.js} +15 -2
- package/lib/esm/stories/graph-visualization-range-styling.story.js.map +1 -0
- package/lib/esm/stories/index.js +3 -3
- package/lib/esm/stories/index.js.map +1 -1
- package/lib/esm/styling/compile-graph-styles.js +32 -0
- package/lib/esm/styling/compile-graph-styles.js.map +1 -1
- package/lib/esm/styling/style-types.js +28 -0
- package/lib/esm/styling/style-types.js.map +1 -1
- package/lib/types/stories/{graph-visualization-color-range-styling.story.d.ts → graph-visualization-range-styling.story.d.ts} +1 -1
- package/lib/types/stories/graph-visualization-range-styling.story.d.ts.map +1 -0
- package/lib/types/stories/index.d.ts +2 -2
- package/lib/types/stories/index.d.ts.map +1 -1
- package/lib/types/styling/compile-graph-styles.d.ts.map +1 -1
- package/lib/types/styling/style-types.d.ts +56 -0
- package/lib/types/styling/style-types.d.ts.map +1 -1
- package/package.json +3 -3
- package/lib/cjs/stories/graph-visualization-color-range-styling.story.js.map +0 -1
- package/lib/esm/stories/graph-visualization-color-range-styling.story.js.map +0 -1
- package/lib/types/stories/graph-visualization-color-range-styling.story.d.ts.map +0 -1
|
@@ -37,6 +37,13 @@ const pokemonRules = [
|
|
|
37
37
|
maxValue: 88,
|
|
38
38
|
maxColor: '#e74c3c',
|
|
39
39
|
},
|
|
40
|
+
nodeSizeRange: {
|
|
41
|
+
onProperty: 'level',
|
|
42
|
+
minValue: 1,
|
|
43
|
+
maxValue: 88,
|
|
44
|
+
minSize: 20,
|
|
45
|
+
maxSize: 50,
|
|
46
|
+
},
|
|
40
47
|
captions: [
|
|
41
48
|
{ value: { property: 'name' }, styles: ['bold'] },
|
|
42
49
|
{ value: ' Lv', styles: [] },
|
|
@@ -56,7 +63,13 @@ const caughtRelRules = [
|
|
|
56
63
|
maxValue: 40,
|
|
57
64
|
maxColor: '#ff2d78',
|
|
58
65
|
},
|
|
59
|
-
|
|
66
|
+
relWidthRange: {
|
|
67
|
+
onProperty: 'level',
|
|
68
|
+
minValue: 1,
|
|
69
|
+
maxValue: 40,
|
|
70
|
+
minWidth: 1,
|
|
71
|
+
maxWidth: 8,
|
|
72
|
+
},
|
|
60
73
|
captions: [
|
|
61
74
|
{ value: 'Caught @ Lv', styles: [] },
|
|
62
75
|
{ value: { property: 'level' }, styles: ['bold'] },
|
|
@@ -79,4 +92,4 @@ const Component = () => {
|
|
|
79
92
|
return ((0, jsx_runtime_1.jsx)("div", { style: { height: '600px' }, children: (0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization, { nodes: story_data_1.advancedStoryGraph.nodes, rels: story_data_1.advancedStoryGraph.rels, className: story_data_1.containerClasses, nvlStyleRules: exports.colorRangeStyleRules }) }));
|
|
80
93
|
};
|
|
81
94
|
exports.default = Component;
|
|
82
|
-
//# sourceMappingURL=graph-visualization-
|
|
95
|
+
//# sourceMappingURL=graph-visualization-range-styling.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-visualization-range-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-range-styling.story.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gEAA4D;AAE5D,6CAAoE;AAEpE,MAAM,YAAY,GAAgB;IAChC;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,S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C,MAAM,CAAC,EAAE;aACnD;YACD,WAAW,EAAE,GAAG;SACjB;KACF;CACF,CAAC;AAEF,MAAM,cAAc,GAAgB;IAClC,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;IAC5D,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;IACzD,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;CACzD,CAAC;AAEW,QAAA,oBAAoB,GAAgB;IAC/C,GAAG,YAAY;IACf,GAAG,cAAc;IACjB,GAAG,cAAc;CAClB,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,gCAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAC7B,uBAAC,wCAAkB,IACjB,KAAK,EAAE,+BAAkB,CAAC,KAAK,EAC/B,IAAI,EAAE,+BAAkB,CAAC,IAAI,EAC7B,SAAS,EAAE,6BAAgB,EAC3B,aAAa,EAAE,4BAAoB,GACnC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { GraphVisualization } from '../graph-visualization';\nimport { type StyleRule } from '../styling/style-types';\nimport { advancedStoryGraph, containerClasses } from './story-data';\n\nconst pokemonRules: StyleRule[] = [\n {\n match: { label: 'Pokemon' },\n apply: {\n colorRange: {\n onProperty: 'level',\n minValue: 1,\n minColor: '#3498db',\n midValue: 45,\n midColor: '#f1c40f',\n maxValue: 88,\n maxColor: '#e74c3c',\n },\n nodeSizeRange: {\n onProperty: 'level',\n minValue: 1,\n maxValue: 88,\n minSize: 20,\n maxSize: 50,\n },\n captions: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' Lv', styles: [] },\n { value: { property: 'level' }, styles: [] },\n ],\n },\n },\n];\n\nconst caughtRelRules: StyleRule[] = [\n {\n match: { reltype: 'CAUGHT' },\n apply: {\n colorRange: {\n onProperty: 'level',\n minValue: 1,\n minColor: '#00d2ff',\n maxValue: 40,\n maxColor: '#ff2d78',\n },\n relWidthRange: {\n onProperty: 'level',\n minValue: 1,\n maxValue: 40,\n minWidth: 1,\n maxWidth: 8,\n },\n captions: [\n { value: 'Caught @ Lv', styles: [] },\n { value: { property: 'level' }, styles: ['bold'] },\n ],\n captionSize: 1.5,\n },\n },\n];\n\nconst otherNodeRules: StyleRule[] = [\n { match: { label: 'Trainer' }, apply: { color: '#95a5a6' } },\n { match: { label: 'Type' }, apply: { color: '#bdc3c7' } },\n { match: { label: 'Gym' }, apply: { color: '#bdc3c7' } },\n];\n\nexport const colorRangeStyleRules: StyleRule[] = [\n ...pokemonRules,\n ...caughtRelRules,\n ...otherNodeRules,\n];\n\nconst Component = () => {\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n nodes={advancedStoryGraph.nodes}\n rels={advancedStoryGraph.rels}\n className={containerClasses}\n nvlStyleRules={colorRangeStyleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
package/lib/cjs/stories/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.PreviewGraphVisualizationSrc = exports.
|
|
26
|
+
exports.PreviewGraphVisualizationSrc = exports.GraphVisualizationRangeStylingSrc = exports.GraphVisualizationRuleBasedStylingAdvancedSrc = exports.GraphVisualizationSearchSrc = exports.GraphVisualizationRuleBasedStylingSrc = exports.GraphVisualizationSimpleStylingSrc = exports.GraphVisualizationHighlightingSrc = exports.GraphVisualizationCustomSrc = exports.GraphVisualizationMaximalistSrc = exports.GraphVisualizationBarebonesSrc = exports.GraphVisualizationDefaultSrc = exports.PreviewGraphVisualization = exports.GraphVisualizationSimpleStyling = exports.GraphVisualizationSearch = exports.GraphVisualizationRuleBasedStyling = exports.GraphVisualizationRuleBasedStylingAdvanced = exports.GraphVisualizationRangeStyling = exports.GraphVisualizationMaximalist = exports.GraphVisualizationHighlighting = exports.GraphVisualizationDefault = exports.GraphVisualizationCustom = exports.GraphVisualizationBarebones = void 0;
|
|
27
27
|
var graph_visualization_barebones_story_1 = require("./graph-visualization-barebones.story");
|
|
28
28
|
Object.defineProperty(exports, "GraphVisualizationBarebones", { enumerable: true, get: function () { return __importDefault(graph_visualization_barebones_story_1).default; } });
|
|
29
29
|
var graph_visualization_custom_story_1 = require("./graph-visualization-custom.story");
|
|
@@ -34,8 +34,8 @@ var graph_visualization_highlighting_story_1 = require("./graph-visualization-hi
|
|
|
34
34
|
Object.defineProperty(exports, "GraphVisualizationHighlighting", { enumerable: true, get: function () { return __importDefault(graph_visualization_highlighting_story_1).default; } });
|
|
35
35
|
var graph_visualization_maximalist_story_1 = require("./graph-visualization-maximalist.story");
|
|
36
36
|
Object.defineProperty(exports, "GraphVisualizationMaximalist", { enumerable: true, get: function () { return __importDefault(graph_visualization_maximalist_story_1).default; } });
|
|
37
|
-
var
|
|
38
|
-
Object.defineProperty(exports, "
|
|
37
|
+
var graph_visualization_range_styling_story_1 = require("./graph-visualization-range-styling.story");
|
|
38
|
+
Object.defineProperty(exports, "GraphVisualizationRangeStyling", { enumerable: true, get: function () { return __importDefault(graph_visualization_range_styling_story_1).default; } });
|
|
39
39
|
var graph_visualization_rule_based_styling_advanced_story_1 = require("./graph-visualization-rule-based-styling-advanced.story");
|
|
40
40
|
Object.defineProperty(exports, "GraphVisualizationRuleBasedStylingAdvanced", { enumerable: true, get: function () { return __importDefault(graph_visualization_rule_based_styling_advanced_story_1).default; } });
|
|
41
41
|
var graph_visualization_rule_based_styling_story_1 = require("./graph-visualization-rule-based-styling.story");
|
|
@@ -48,11 +48,11 @@ var preview_graph_visualization_story_1 = require("./preview-graph-visualization
|
|
|
48
48
|
Object.defineProperty(exports, "PreviewGraphVisualization", { enumerable: true, get: function () { return __importDefault(preview_graph_visualization_story_1).default; } });
|
|
49
49
|
const utils_1 = require("../utils");
|
|
50
50
|
const graph_visualization_barebones_story_raw_1 = __importDefault(require("./graph-visualization-barebones.story?raw"));
|
|
51
|
-
const graph_visualization_color_range_styling_story_raw_1 = __importDefault(require("./graph-visualization-color-range-styling.story?raw"));
|
|
52
51
|
const graph_visualization_custom_story_raw_1 = __importDefault(require("./graph-visualization-custom.story?raw"));
|
|
53
52
|
const graph_visualization_default_story_raw_1 = __importDefault(require("./graph-visualization-default.story?raw"));
|
|
54
53
|
const graph_visualization_highlighting_story_raw_1 = __importDefault(require("./graph-visualization-highlighting.story?raw"));
|
|
55
54
|
const graph_visualization_maximalist_story_raw_1 = __importDefault(require("./graph-visualization-maximalist.story?raw"));
|
|
55
|
+
const graph_visualization_range_styling_story_raw_1 = __importDefault(require("./graph-visualization-range-styling.story?raw"));
|
|
56
56
|
const graph_visualization_rule_based_styling_story_raw_1 = __importDefault(require("./graph-visualization-rule-based-styling.story?raw"));
|
|
57
57
|
const graph_visualization_rule_based_styling_advanced_story_raw_1 = __importDefault(require("./graph-visualization-rule-based-styling-advanced.story?raw"));
|
|
58
58
|
const graph_visualization_search_story_raw_1 = __importDefault(require("./graph-visualization-search.story?raw"));
|
|
@@ -67,6 +67,6 @@ exports.GraphVisualizationSimpleStylingSrc = (0, utils_1.removeLicenseHeader)(gr
|
|
|
67
67
|
exports.GraphVisualizationRuleBasedStylingSrc = (0, utils_1.removeLicenseHeader)(graph_visualization_rule_based_styling_story_raw_1.default);
|
|
68
68
|
exports.GraphVisualizationSearchSrc = (0, utils_1.removeLicenseHeader)(graph_visualization_search_story_raw_1.default);
|
|
69
69
|
exports.GraphVisualizationRuleBasedStylingAdvancedSrc = (0, utils_1.removeLicenseHeader)(graph_visualization_rule_based_styling_advanced_story_raw_1.default);
|
|
70
|
-
exports.
|
|
70
|
+
exports.GraphVisualizationRangeStylingSrc = (0, utils_1.removeLicenseHeader)(graph_visualization_range_styling_story_raw_1.default);
|
|
71
71
|
exports.PreviewGraphVisualizationSrc = (0, utils_1.removeLicenseHeader)(preview_graph_visualization_story_raw_1.default);
|
|
72
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,6FAA+F;AAAtF,mKAAA,OAAO,OAA+B;AAC/C,uFAAyF;AAAhF,6JAAA,OAAO,OAA4B;AAC5C,yFAA2F;AAAlF,+JAAA,OAAO,OAA6B;AAC7C,mGAAqG;AAA5F,yKAAA,OAAO,OAAkC;AAClD,+FAAiG;AAAxF,qKAAA,OAAO,OAAgC;AAChD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,6FAA+F;AAAtF,mKAAA,OAAO,OAA+B;AAC/C,uFAAyF;AAAhF,6JAAA,OAAO,OAA4B;AAC5C,yFAA2F;AAAlF,+JAAA,OAAO,OAA6B;AAC7C,mGAAqG;AAA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D,+CAA+B,CAChC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as GraphVisualizationBarebones } from './graph-visualization-barebones.story';\nexport { default as GraphVisualizationCustom } from './graph-visualization-custom.story';\nexport { default as GraphVisualizationDefault } from './graph-visualization-default.story';\nexport { default as GraphVisualizationHighlighting } from './graph-visualization-highlighting.story';\nexport { default as GraphVisualizationMaximalist } from './graph-visualization-maximalist.story';\nexport { default as GraphVisualizationRangeStyling } from './graph-visualization-range-styling.story';\nexport { default as GraphVisualizationRuleBasedStylingAdvanced } from './graph-visualization-rule-based-styling-advanced.story';\nexport { default as GraphVisualizationRuleBasedStyling } from './graph-visualization-rule-based-styling.story';\nexport { default as GraphVisualizationSearch } from './graph-visualization-search.story';\nexport { default as GraphVisualizationSimpleStyling } from './graph-visualization-simple-styling.story';\nexport { default as PreviewGraphVisualization } from './preview-graph-visualization.story';\n\nimport { removeLicenseHeader } from '../utils';\nimport GraphVisualizationBarebonesSrcRaw from './graph-visualization-barebones.story?raw';\nimport GraphVisualizationCustomSrcRaw from './graph-visualization-custom.story?raw';\nimport GraphVisualizationDefaultSrcRaw from './graph-visualization-default.story?raw';\nimport GraphVisualizationHighlightingSrcRaw from './graph-visualization-highlighting.story?raw';\nimport GraphVisualizationMaximalistSrcRaw from './graph-visualization-maximalist.story?raw';\nimport GraphVisualizationRangeStylingRaw from './graph-visualization-range-styling.story?raw';\nimport GraphVisualizationRuleBasedStylingSrcRaw from './graph-visualization-rule-based-styling.story?raw';\nimport GraphVisualizationRuleBasedStylingAdvancedSrcRaw from './graph-visualization-rule-based-styling-advanced.story?raw';\nimport GraphVisualizationSearchSrcRaw from './graph-visualization-search.story?raw';\nimport GraphVisualizationSimpleStylingSrcRaw from './graph-visualization-simple-styling.story?raw';\nimport PreviewGraphVisualizationSrcRaw from './preview-graph-visualization.story?raw';\n\nexport const GraphVisualizationDefaultSrc = removeLicenseHeader(\n GraphVisualizationDefaultSrcRaw,\n);\n\nexport const GraphVisualizationBarebonesSrc = removeLicenseHeader(\n GraphVisualizationBarebonesSrcRaw,\n);\n\nexport const GraphVisualizationMaximalistSrc = removeLicenseHeader(\n GraphVisualizationMaximalistSrcRaw,\n);\n\nexport const GraphVisualizationCustomSrc = removeLicenseHeader(\n GraphVisualizationCustomSrcRaw,\n);\n\nexport const GraphVisualizationHighlightingSrc = removeLicenseHeader(\n GraphVisualizationHighlightingSrcRaw,\n);\n\nexport const GraphVisualizationSimpleStylingSrc = removeLicenseHeader(\n GraphVisualizationSimpleStylingSrcRaw,\n);\n\nexport const GraphVisualizationRuleBasedStylingSrc = removeLicenseHeader(\n GraphVisualizationRuleBasedStylingSrcRaw,\n);\n\nexport const GraphVisualizationSearchSrc = removeLicenseHeader(\n GraphVisualizationSearchSrcRaw,\n);\n\nexport const GraphVisualizationRuleBasedStylingAdvancedSrc =\n removeLicenseHeader(GraphVisualizationRuleBasedStylingAdvancedSrcRaw);\n\nexport const GraphVisualizationRangeStylingSrc = removeLicenseHeader(\n GraphVisualizationRangeStylingRaw,\n);\n\nexport const PreviewGraphVisualizationSrc = removeLicenseHeader(\n PreviewGraphVisualizationSrcRaw,\n);\n"]}
|
|
@@ -149,6 +149,24 @@ function getInterpolatedColor(colorRange, graphItem) {
|
|
|
149
149
|
}
|
|
150
150
|
return (0, react_color_1.rgbToHex)(rgb);
|
|
151
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Interpolates a numeric size/width from a range based on a graph item's property value.
|
|
154
|
+
* Returns the interpolated number, or null if the property is missing or non-numeric.
|
|
155
|
+
*/
|
|
156
|
+
function getInterpolatedSize(prop, minValue, maxValue, minOut, maxOut) {
|
|
157
|
+
if (prop === undefined) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const rawValue = extractPropertyValue(prop);
|
|
161
|
+
if (typeof rawValue !== 'number') {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
const actualMinValue = Math.min(minValue, maxValue);
|
|
165
|
+
const actualMaxValue = Math.max(minValue, maxValue);
|
|
166
|
+
const clampedValue = Math.max(actualMinValue, Math.min(actualMaxValue, rawValue));
|
|
167
|
+
const t = (0, color_interpolation_1.getWeight)(minValue, maxValue, clampedValue);
|
|
168
|
+
return minOut * (1 - t) + maxOut * t;
|
|
169
|
+
}
|
|
152
170
|
function extractPropertyValue(prop) {
|
|
153
171
|
switch (prop.type) {
|
|
154
172
|
case 'string':
|
|
@@ -312,6 +330,13 @@ function evaluateRelStyle(apply, rel) {
|
|
|
312
330
|
result.color = interpolated;
|
|
313
331
|
}
|
|
314
332
|
}
|
|
333
|
+
if (apply.relWidthRange !== undefined) {
|
|
334
|
+
const { onProperty, minValue, maxValue, minWidth, maxWidth } = apply.relWidthRange;
|
|
335
|
+
const interpolated = getInterpolatedSize(rel.properties[onProperty], minValue, maxValue, minWidth, maxWidth);
|
|
336
|
+
if (interpolated !== null) {
|
|
337
|
+
result.width = interpolated;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
315
340
|
return result;
|
|
316
341
|
}
|
|
317
342
|
/**
|
|
@@ -434,6 +459,13 @@ function evaluateNodeStyle(apply, node) {
|
|
|
434
459
|
result.color = interpolated;
|
|
435
460
|
}
|
|
436
461
|
}
|
|
462
|
+
if (apply.nodeSizeRange !== undefined) {
|
|
463
|
+
const { onProperty, minValue, maxValue, minSize, maxSize } = apply.nodeSizeRange;
|
|
464
|
+
const interpolated = getInterpolatedSize(node.properties[onProperty], minValue, maxValue, minSize, maxSize);
|
|
465
|
+
if (interpolated !== null) {
|
|
466
|
+
result.size = interpolated;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
437
469
|
return result;
|
|
438
470
|
}
|
|
439
471
|
function createRelStyleFunction(rules) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-graph-styles.js","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;AA8pBH,8CA2BC;AAvrBD,2DAAwE;AACxE,0CAAyC;AACzC,kDAA4E;AAO5E,+DAA6D;AAoB7D,SAAS,0BAA0B,CAAC,CAAY,EAAE,CAAY;IAC5D,OAAO,CAAC,CAAC,QAAS,GAAG,CAAC,CAAC,QAAS,CAAC;AACnC,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAsC;IAEtC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;IACnD,MAAM,gBAAgB,GAAgB,EAAE,CAAC;IACzC,MAAM,kBAAkB,GAAgB,EAAE,CAAC;IAE3C,0CAA0C;IAC1C,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,gBAAgB;YAChB,kBAAkB;YAClB,YAAY;YACZ,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IAEjC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;;QAC9B,IAAI,MAAA,KAAK,CAAC,QAAQ,mCAAI,KAAK,EAAE,CAAC;YAC5B,OAAO;QACT,CAAC;QAED,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;YACvD,MAAM,IA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C;IAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { calculateDefaultNodeColors } from '@neo4j-devtools/word-color';\nimport { tokens } from '@neo4j-ndl/base';\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n type NodeData,\n type PortableProperty,\n type RelData,\n} from '../graph-visualization-context';\nimport { getWeight, lerpColor } from './color-interpolation';\nimport {\n type Caption,\n type ColorRange,\n type CypherValue,\n type EvaluatedNvlNodeStyle,\n type EvaluatedNvlRelationshipStyle,\n type Style,\n type StyleRule,\n type Value,\n type Where,\n} from './style-types';\n\ntype StyleMatchers = {\n globalLabelRules: StyleRule[];\n globalReltypeRules: StyleRule[];\n rulesByLabel: Map<string, StyleRule[]>;\n rulesByType: Map<string, StyleRule[]>;\n};\n\nfunction compareByPriorityAscending(a: StyleRule, b: StyleRule): number {\n return a.priority! - b.priority!;\n}\n\nfunction collectStyleMatchers(\n styles: StyleRule[] | null | undefined,\n): StyleMatchers {\n const rulesByLabel = new Map<string, StyleRule[]>();\n const rulesByType = new Map<string, StyleRule[]>();\n const globalLabelRules: StyleRule[] = [];\n const globalReltypeRules: StyleRule[] = [];\n\n // Handle null/undefined styles gracefully\n if (!styles || styles.length === 0) {\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n }\n\n const totalRules = styles.length;\n\n styles.forEach((style, index) => {\n if (style.disabled ?? false) {\n return;\n }\n\n if (style.priority !== undefined && style.priority < 0) {\n throw new Error(\n `StyleRule priority must be >= 0, got ${style.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n // Fill in priority if not set (negative values preserve original order)\n const { priority, ...rest } = style;\n const ruleWithPriority: StyleRule = {\n ...rest,\n priority: priority ?? index - totalRules,\n };\n\n // style for nodes\n if ('label' in style.match) {\n // if the label is null, it's a global rule (matches any node)\n if (style.match.label === null) {\n globalLabelRules.push(ruleWithPriority);\n } else {\n // Specific label rule\n const existing = rulesByLabel.get(style.match.label) ?? [];\n rulesByLabel.set(style.match.label, [...existing, ruleWithPriority]);\n }\n }\n\n // style for relationships\n if ('reltype' in style.match) {\n if (style.match.reltype === null) {\n // Global reltype rule (matches any relationship)\n globalReltypeRules.push(ruleWithPriority);\n } else {\n // Specific reltype rule\n const existing = rulesByType.get(style.match.reltype) ?? [];\n rulesByType.set(style.match.reltype, [...existing, ruleWithPriority]);\n }\n }\n });\n\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n}\n\n/**\n * Interpolates a color from a ColorRange based on a graph item's property value.\n * Returns a #rrggbb hex string, or null if the colorRange config is invalid\n * (bad hex colors, invalid value range, missing/non-numeric property).\n */\nfunction getInterpolatedColor(\n colorRange: ColorRange,\n graphItem: NodeData | RelData,\n): string | null {\n const {\n onProperty,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n // min/max can be inverted, we need to now which one is bigger\n const actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n\n // Validate mid stop if provided\n let midRgb: RgbColor | undefined = undefined;\n if (midValue !== undefined && midColor !== undefined) {\n const isMidInRange =\n actualMinValue <= midValue && midValue <= actualMaxValue;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const prop = graphItem.properties[onProperty];\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number') {\n return null;\n }\n\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, rawValue),\n );\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && midValue !== undefined) {\n const t = getWeight(minValue, midValue, clampedValue);\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t = getWeight(midValue, maxValue, clampedValue);\n rgb = lerpColor(midRgb, maxRgb, t);\n }\n } else {\n const t = getWeight(minValue, maxValue, clampedValue);\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\nfunction extractPropertyValue(\n prop: PortableProperty,\n): string | number | boolean | null {\n switch (prop.type) {\n case 'string':\n return JSON.parse(prop.stringified);\n case 'number':\n case 'integer':\n case 'float':\n return Number(prop.stringified);\n case 'boolean':\n case 'Boolean':\n return prop.stringified === 'true';\n case 'null':\n return null;\n default:\n return prop.stringified;\n }\n}\n\n/**\n * Three-valued logic type matching Cypher/SQL semantics.\n * - `true`: condition is satisfied\n * - `false`: condition is not satisfied\n * - `null`: condition is unknown (e.g., comparing with null/missing property)\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\ntype Ternary = boolean | null;\n\n/**\n * Evaluates a WHERE clause using three-valued logic matching Cypher semantics.\n *\n * From Neo4j Cypher Manual:\n * - Comparing any value to `null` results in `null`, not `true` or `false`\n * - Accessing a non-existent property returns `null`\n * - In WHERE clauses, only `true` passes; both `false` and `null` exclude the row\n *\n * Three-valued logic rules:\n * - NOT null → null\n * - true AND null → null, false AND null → false\n * - true OR null → true, false OR null → null\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction evaluateWhere(node: NodeData | RelData, where?: Where): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = evaluateValue(left, node);\n const rightVal = evaluateValue(right, node);\n // In Cypher, null = null → null (not true)\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n // Cypher: NOT null → null\n const isMatch = evaluateWhere(node, where.not);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n const [left, right] = where.lessThan;\n return safeCompare(left, right, node, (a, b) => a < b);\n }\n\n if ('lessThanOrEqual' in where) {\n const [left, right] = where.lessThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a <= b);\n }\n\n if ('greaterThan' in where) {\n const [left, right] = where.greaterThan;\n return safeCompare(left, right, node, (a, b) => a > b);\n }\n\n if ('greaterThanOrEqual' in where) {\n const [left, right] = where.greaterThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a >= b);\n }\n\n if ('contains' in where) {\n const [left, right] = where.contains;\n return safeStringCompare(left, right, node, (a, b) => a.includes(b));\n }\n\n if ('startsWith' in where) {\n const [left, right] = where.startsWith;\n return safeStringCompare(left, right, node, (a, b) => a.startsWith(b));\n }\n\n if ('endsWith' in where) {\n const [left, right] = where.endsWith;\n return safeStringCompare(left, right, node, (a, b) => a.endsWith(b));\n }\n\n if ('isNull' in where) {\n // IS NULL returns true/false (never null)\n const value = evaluateValue(where.isNull, node);\n return value === null;\n }\n\n if ('and' in where) {\n // Cypher three-valued AND:\n // - If any is false → false\n // - Else if any is null → null\n // - Else → true\n let hasNull = false;\n for (const r of where.and) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n // Cypher three-valued OR:\n // - If any is true → true\n // - Else if any is null → null\n // - Else → false\n let hasNull = false;\n for (const r of where.or) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n if ('label' in where) {\n if ('labelsSorted' in node) {\n return where.label === null || node.labelsSorted.includes(where.label);\n }\n return false;\n }\n\n if ('reltype' in where) {\n if ('type' in node) {\n return where.reltype === null || (node as RelData).type === where.reltype;\n }\n return false;\n }\n\n if ('property' in where) {\n return where.property === null || where.property in node.properties;\n }\n\n return false;\n}\n\nfunction evaluateRelStyle(\n apply: Style,\n rel: RelData,\n): EvaluatedNvlRelationshipStyle {\n const result: EvaluatedNvlRelationshipStyle = {\n ...apply,\n captions: apply.captions?.map((caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: rel.type };\n }\n\n if ('property' in value) {\n const prop = rel.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: rel.id };\n }),\n };\n\n if (apply.colorRange !== undefined) {\n const interpolated = getInterpolatedColor(apply.colorRange, rel);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n return result;\n}\n\n/**\n * Safely compare two values using Cypher's three-valued logic.\n * Returns `null` if either operand is null (matching Cypher semantics).\n *\n * From Neo4j Cypher Manual:\n * \"Comparing any value to `null` using `=` or `<>` results in `null`\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction safeCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (\n a: NonNullable<CypherValue>,\n b: NonNullable<CypherValue>,\n ) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\n/**\n * String comparison using Cypher semantics.\n * Returns `null` if either operand is null OR not a string.\n *\n * From Neo4j Cypher Manual:\n * \"When these operators are applied to non-string values, they return `null`\n * instead of attempting type coercion.\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/expressions/predicates/string-operators/\n */\nfunction safeStringCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (a: string, b: string) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n // Return null if either is null or not a string (no type coercion)\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateValue(\n value: Value,\n graphItem: NodeData | RelData,\n): CypherValue {\n if (typeof value === 'object' && value !== null) {\n if ('property' in value) {\n if (value.property === null) {\n return null;\n }\n const prop = graphItem.properties[value.property];\n if (prop === undefined) {\n return null;\n }\n return extractPropertyValue(prop);\n }\n if ('label' in value) {\n if ('labelsSorted' in graphItem) {\n return (\n value.label === null || graphItem.labelsSorted.includes(value.label)\n );\n }\n return false;\n }\n if ('reltype' in value) {\n if ('type' in graphItem) {\n return (\n value.reltype === null ||\n (graphItem as RelData).type === value.reltype\n );\n }\n return false;\n }\n }\n\n return value;\n}\n\n// Default caption selection logic\nconst captionPriorityOrder = [\n /^name$/i,\n /^title$/i,\n /^label$/i,\n /name$/i,\n /description$/i,\n /^.+/,\n];\n\nfunction getDefaultNodeCaption(node: NodeData): Caption {\n const propertyKeys = Object.keys(node.properties);\n\n for (const regex of captionPriorityOrder) {\n const matchingKey = propertyKeys.find((key) => regex.test(key));\n if (matchingKey !== undefined) {\n const prop = node.properties[matchingKey];\n if (prop !== undefined) {\n return { value: { property: matchingKey } };\n }\n }\n }\n\n if (node.labelsSorted[0] !== undefined) {\n return { value: { useType: true } };\n }\n\n return { value: node.id };\n}\n\nfunction evaluateNodeStyle(\n apply: Style,\n node: NodeData,\n): EvaluatedNvlNodeStyle {\n const result: EvaluatedNvlNodeStyle = {\n ...apply,\n captions: (apply.captions ?? [getDefaultNodeCaption(node)]).map(\n (caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: node.labelsSorted[0] };\n }\n\n if ('property' in value) {\n const prop = node.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: node.labelsSorted[0] };\n },\n ),\n };\n\n if (apply.colorRange !== undefined) {\n const interpolated = getInterpolatedColor(apply.colorRange, node);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n return result;\n}\n\nfunction createRelStyleFunction(\n rules: StyleRule[],\n): (rel: RelData) => EvaluatedNvlRelationshipStyle {\n return (rel: RelData) => {\n const style: Style = {};\n\n // evaluateWhere uses Cypher-style three-valued logic (true/false/null).\n // Only `true` passes; both `false` and `null` (unknown) skip the rule.\n for (const rule of rules) {\n // Check if the rule applies to this relationship\n if ('reltype' in rule.match) {\n const isReltypeMatch =\n rule.match.reltype === null || rel.type === rule.match.reltype;\n\n if (isReltypeMatch && evaluateWhere(rel, rule.where) === true) {\n // Merge the style properties (later rules override earlier ones)\n Object.assign(style, rule.apply);\n }\n }\n }\n\n return evaluateRelStyle(style, rel);\n };\n}\n\nexport type CompiledStyleRules = {\n byType: (type: string) => (rel: RelData) => EvaluatedNvlRelationshipStyle;\n styleMatchers: StyleMatchers;\n byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;\n};\n\nexport const DEFAULT_REL_COLOR = tokens.palette.neutral['40'];\nconst NO_LABEL_FALLBACK_COLOR = tokens.palette.neutral['40'];\n\nfunction createByLabelSetFunction(\n styleMatchers: StyleMatchers,\n): (node: NodeData) => EvaluatedNvlNodeStyle {\n const defaultColorCache = new Map<string, string>();\n const sortedRulesCache = new Map<string, StyleRule[]>();\n const mergedStyleCache = new Map<string, Style>();\n\n return (node: NodeData) => {\n const labelSetKey = node.labelsSorted.join('\\0');\n\n // Fast path: if all rules for this label set are where-free,\n // the merged style is identical for every node with the same labels.\n const cachedStyle = mergedStyleCache.get(labelSetKey);\n if (cachedStyle !== undefined) {\n return evaluateNodeStyle(cachedStyle, node);\n }\n\n // Memoize default color by first label\n const labelForDefaultColor = node.labelsSorted[0] ?? null;\n let defaultColor: string;\n if (labelForDefaultColor === null) {\n defaultColor = NO_LABEL_FALLBACK_COLOR;\n } else {\n let cached = defaultColorCache.get(labelForDefaultColor);\n if (cached === undefined) {\n cached =\n calculateDefaultNodeColors(labelForDefaultColor).backgroundColor;\n defaultColorCache.set(labelForDefaultColor, cached);\n }\n defaultColor = cached;\n }\n\n // Cache sorted rules by label set (avoids repeated allocation + sort)\n let sortedRules = sortedRulesCache.get(labelSetKey);\n if (sortedRules === undefined) {\n const matchingRules: StyleRule[] = [...styleMatchers.globalLabelRules];\n for (const label of node.labelsSorted) {\n const labelRules = styleMatchers.rulesByLabel.get(label);\n if (labelRules) {\n matchingRules.push(...labelRules);\n }\n }\n sortedRules = matchingRules.toSorted(compareByPriorityAscending);\n sortedRulesCache.set(labelSetKey, sortedRules);\n }\n\n // Evaluate rules, tracking whether all are where-free\n const collectStyles: Style = { color: defaultColor };\n let isAllWhereFree = true;\n for (const rule of sortedRules) {\n if (rule.where !== undefined) {\n isAllWhereFree = false;\n if (evaluateWhere(node, rule.where) === true) {\n Object.assign(collectStyles, rule.apply);\n }\n } else {\n Object.assign(collectStyles, rule.apply);\n }\n }\n\n // When all rules are where-free, the merged style depends only on labels.\n // Cache it so subsequent nodes with the same label set skip rule iteration.\n if (isAllWhereFree) {\n mergedStyleCache.set(labelSetKey, collectStyles);\n }\n\n return evaluateNodeStyle(collectStyles, node);\n };\n}\n\nconst DEFAULT_REL_STYLE: StyleRule = {\n match: { reltype: null },\n apply: {\n color: DEFAULT_REL_COLOR,\n captions: [{ value: { useType: true } }],\n },\n};\n\nexport function compileStyleRules(\n styleRules: StyleRule[] | null | undefined,\n): CompiledStyleRules {\n const styleMatchers = collectStyleMatchers(styleRules);\n\n // Lazily build and cache a style function per relationship type\n const cache = new Map<\n string,\n (rel: RelData) => EvaluatedNvlRelationshipStyle\n >();\n const byType = (type: string) => {\n let fn = cache.get(type);\n if (fn === undefined) {\n const rules = styleMatchers.rulesByType.get(type) ?? [];\n fn = createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...styleMatchers.globalReltypeRules,\n ...rules,\n ]);\n cache.set(type, fn);\n }\n return fn;\n };\n\n const byLabelSet = createByLabelSetFunction(styleMatchers);\n\n return { byLabelSet, byType, styleMatchers };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compile-graph-styles.js","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;AAytBH,8CA2BC;AAlvBD,2DAAwE;AACxE,0CAAyC;AACzC,kDAA4E;AAO5E,+DAA6D;AAoB7D,SAAS,0BAA0B,CAAC,CAAY,EAAE,CAAY;IAC5D,OAAO,CAAC,CAAC,QAAS,GAAG,CAAC,CAAC,QAAS,CAAC;AACnC,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAsC;IAEtC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;IACnD,MAAM,gBAAgB,GAAgB,EAAE,CAAC;IACzC,MAAM,kBAAkB,GAAgB,EAAE,CAAC;IAE3C,0CAA0C;IAC1C,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,gBAAgB;YAChB,kBAAkB;YAClB,YAAY;YACZ,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,MAA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Aa,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAEvD,gEAAgE;IAChE,MAAM,KAAK,GAAG,IAAI,GAAG,EAGlB,CAAC;IACJ,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE;;QAC9B,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACrB,MAAM,KAAK,GAAG,MAAA,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;YACxD,EAAE,GAAG,sBAAsB,CAAC;gBAC1B,iBAAiB;gBACjB,GAAG,aAAa,CAAC,kBAAkB;gBACnC,GAAG,KAAK;aACT,CAAC,CAAC;YACH,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { calculateDefaultNodeColors } from '@neo4j-devtools/word-color';\nimport { tokens } from '@neo4j-ndl/base';\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n type NodeData,\n type PortableProperty,\n type RelData,\n} from '../graph-visualization-context';\nimport { getWeight, lerpColor } from './color-interpolation';\nimport {\n type Caption,\n type ColorRange,\n type CypherValue,\n type EvaluatedNvlNodeStyle,\n type EvaluatedNvlRelationshipStyle,\n type Style,\n type StyleRule,\n type Value,\n type Where,\n} from './style-types';\n\ntype StyleMatchers = {\n globalLabelRules: StyleRule[];\n globalReltypeRules: StyleRule[];\n rulesByLabel: Map<string, StyleRule[]>;\n rulesByType: Map<string, StyleRule[]>;\n};\n\nfunction compareByPriorityAscending(a: StyleRule, b: StyleRule): number {\n return a.priority! - b.priority!;\n}\n\nfunction collectStyleMatchers(\n styles: StyleRule[] | null | undefined,\n): StyleMatchers {\n const rulesByLabel = new Map<string, StyleRule[]>();\n const rulesByType = new Map<string, StyleRule[]>();\n const globalLabelRules: StyleRule[] = [];\n const globalReltypeRules: StyleRule[] = [];\n\n // Handle null/undefined styles gracefully\n if (!styles || styles.length === 0) {\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n }\n\n const totalRules = styles.length;\n\n styles.forEach((style, index) => {\n if (style.disabled ?? false) {\n return;\n }\n\n if (style.priority !== undefined && style.priority < 0) {\n throw new Error(\n `StyleRule priority must be >= 0, got ${style.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n // Fill in priority if not set (negative values preserve original order)\n const { priority, ...rest } = style;\n const ruleWithPriority: StyleRule = {\n ...rest,\n priority: priority ?? index - totalRules,\n };\n\n // style for nodes\n if ('label' in style.match) {\n // if the label is null, it's a global rule (matches any node)\n if (style.match.label === null) {\n globalLabelRules.push(ruleWithPriority);\n } else {\n // Specific label rule\n const existing = rulesByLabel.get(style.match.label) ?? [];\n rulesByLabel.set(style.match.label, [...existing, ruleWithPriority]);\n }\n }\n\n // style for relationships\n if ('reltype' in style.match) {\n if (style.match.reltype === null) {\n // Global reltype rule (matches any relationship)\n globalReltypeRules.push(ruleWithPriority);\n } else {\n // Specific reltype rule\n const existing = rulesByType.get(style.match.reltype) ?? [];\n rulesByType.set(style.match.reltype, [...existing, ruleWithPriority]);\n }\n }\n });\n\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n}\n\n/**\n * Interpolates a color from a ColorRange based on a graph item's property value.\n * Returns a #rrggbb hex string, or null if the colorRange config is invalid\n * (bad hex colors, invalid value range, missing/non-numeric property).\n */\nfunction getInterpolatedColor(\n colorRange: ColorRange,\n graphItem: NodeData | RelData,\n): string | null {\n const {\n onProperty,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n // min/max can be inverted, we need to now which one is bigger\n const actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n\n // Validate mid stop if provided\n let midRgb: RgbColor | undefined = undefined;\n if (midValue !== undefined && midColor !== undefined) {\n const isMidInRange =\n actualMinValue <= midValue && midValue <= actualMaxValue;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const prop = graphItem.properties[onProperty];\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number') {\n return null;\n }\n\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, rawValue),\n );\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && midValue !== undefined) {\n const t = getWeight(minValue, midValue, clampedValue);\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t = getWeight(midValue, maxValue, clampedValue);\n rgb = lerpColor(midRgb, maxRgb, t);\n }\n } else {\n const t = getWeight(minValue, maxValue, clampedValue);\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\n/**\n * Interpolates a numeric size/width from a range based on a graph item's property value.\n * Returns the interpolated number, or null if the property is missing or non-numeric.\n */\nfunction getInterpolatedSize(\n prop: PortableProperty | undefined,\n minValue: number,\n maxValue: number,\n minOut: number,\n maxOut: number,\n): number | null {\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number') {\n return null;\n }\n\n const actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, rawValue),\n );\n const t = getWeight(minValue, maxValue, clampedValue);\n return minOut * (1 - t) + maxOut * t;\n}\n\nfunction extractPropertyValue(\n prop: PortableProperty,\n): string | number | boolean | null {\n switch (prop.type) {\n case 'string':\n return JSON.parse(prop.stringified);\n case 'number':\n case 'integer':\n case 'float':\n return Number(prop.stringified);\n case 'boolean':\n case 'Boolean':\n return prop.stringified === 'true';\n case 'null':\n return null;\n default:\n return prop.stringified;\n }\n}\n\n/**\n * Three-valued logic type matching Cypher/SQL semantics.\n * - `true`: condition is satisfied\n * - `false`: condition is not satisfied\n * - `null`: condition is unknown (e.g., comparing with null/missing property)\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\ntype Ternary = boolean | null;\n\n/**\n * Evaluates a WHERE clause using three-valued logic matching Cypher semantics.\n *\n * From Neo4j Cypher Manual:\n * - Comparing any value to `null` results in `null`, not `true` or `false`\n * - Accessing a non-existent property returns `null`\n * - In WHERE clauses, only `true` passes; both `false` and `null` exclude the row\n *\n * Three-valued logic rules:\n * - NOT null → null\n * - true AND null → null, false AND null → false\n * - true OR null → true, false OR null → null\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction evaluateWhere(node: NodeData | RelData, where?: Where): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = evaluateValue(left, node);\n const rightVal = evaluateValue(right, node);\n // In Cypher, null = null → null (not true)\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n // Cypher: NOT null → null\n const isMatch = evaluateWhere(node, where.not);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n const [left, right] = where.lessThan;\n return safeCompare(left, right, node, (a, b) => a < b);\n }\n\n if ('lessThanOrEqual' in where) {\n const [left, right] = where.lessThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a <= b);\n }\n\n if ('greaterThan' in where) {\n const [left, right] = where.greaterThan;\n return safeCompare(left, right, node, (a, b) => a > b);\n }\n\n if ('greaterThanOrEqual' in where) {\n const [left, right] = where.greaterThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a >= b);\n }\n\n if ('contains' in where) {\n const [left, right] = where.contains;\n return safeStringCompare(left, right, node, (a, b) => a.includes(b));\n }\n\n if ('startsWith' in where) {\n const [left, right] = where.startsWith;\n return safeStringCompare(left, right, node, (a, b) => a.startsWith(b));\n }\n\n if ('endsWith' in where) {\n const [left, right] = where.endsWith;\n return safeStringCompare(left, right, node, (a, b) => a.endsWith(b));\n }\n\n if ('isNull' in where) {\n // IS NULL returns true/false (never null)\n const value = evaluateValue(where.isNull, node);\n return value === null;\n }\n\n if ('and' in where) {\n // Cypher three-valued AND:\n // - If any is false → false\n // - Else if any is null → null\n // - Else → true\n let hasNull = false;\n for (const r of where.and) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n // Cypher three-valued OR:\n // - If any is true → true\n // - Else if any is null → null\n // - Else → false\n let hasNull = false;\n for (const r of where.or) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n if ('label' in where) {\n if ('labelsSorted' in node) {\n return where.label === null || node.labelsSorted.includes(where.label);\n }\n return false;\n }\n\n if ('reltype' in where) {\n if ('type' in node) {\n return where.reltype === null || (node as RelData).type === where.reltype;\n }\n return false;\n }\n\n if ('property' in where) {\n return where.property === null || where.property in node.properties;\n }\n\n return false;\n}\n\nfunction evaluateRelStyle(\n apply: Style,\n rel: RelData,\n): EvaluatedNvlRelationshipStyle {\n const result: EvaluatedNvlRelationshipStyle = {\n ...apply,\n captions: apply.captions?.map((caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: rel.type };\n }\n\n if ('property' in value) {\n const prop = rel.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: rel.id };\n }),\n };\n\n if (apply.colorRange !== undefined) {\n const interpolated = getInterpolatedColor(apply.colorRange, rel);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n if (apply.relWidthRange !== undefined) {\n const { onProperty, minValue, maxValue, minWidth, maxWidth } =\n apply.relWidthRange;\n const interpolated = getInterpolatedSize(\n rel.properties[onProperty],\n minValue,\n maxValue,\n minWidth,\n maxWidth,\n );\n if (interpolated !== null) {\n result.width = interpolated;\n }\n }\n\n return result;\n}\n\n/**\n * Safely compare two values using Cypher's three-valued logic.\n * Returns `null` if either operand is null (matching Cypher semantics).\n *\n * From Neo4j Cypher Manual:\n * \"Comparing any value to `null` using `=` or `<>` results in `null`\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction safeCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (\n a: NonNullable<CypherValue>,\n b: NonNullable<CypherValue>,\n ) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\n/**\n * String comparison using Cypher semantics.\n * Returns `null` if either operand is null OR not a string.\n *\n * From Neo4j Cypher Manual:\n * \"When these operators are applied to non-string values, they return `null`\n * instead of attempting type coercion.\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/expressions/predicates/string-operators/\n */\nfunction safeStringCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (a: string, b: string) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n // Return null if either is null or not a string (no type coercion)\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateValue(\n value: Value,\n graphItem: NodeData | RelData,\n): CypherValue {\n if (typeof value === 'object' && value !== null) {\n if ('property' in value) {\n if (value.property === null) {\n return null;\n }\n const prop = graphItem.properties[value.property];\n if (prop === undefined) {\n return null;\n }\n return extractPropertyValue(prop);\n }\n if ('label' in value) {\n if ('labelsSorted' in graphItem) {\n return (\n value.label === null || graphItem.labelsSorted.includes(value.label)\n );\n }\n return false;\n }\n if ('reltype' in value) {\n if ('type' in graphItem) {\n return (\n value.reltype === null ||\n (graphItem as RelData).type === value.reltype\n );\n }\n return false;\n }\n }\n\n return value;\n}\n\n// Default caption selection logic\nconst captionPriorityOrder = [\n /^name$/i,\n /^title$/i,\n /^label$/i,\n /name$/i,\n /description$/i,\n /^.+/,\n];\n\nfunction getDefaultNodeCaption(node: NodeData): Caption {\n const propertyKeys = Object.keys(node.properties);\n\n for (const regex of captionPriorityOrder) {\n const matchingKey = propertyKeys.find((key) => regex.test(key));\n if (matchingKey !== undefined) {\n const prop = node.properties[matchingKey];\n if (prop !== undefined) {\n return { value: { property: matchingKey } };\n }\n }\n }\n\n if (node.labelsSorted[0] !== undefined) {\n return { value: { useType: true } };\n }\n\n return { value: node.id };\n}\n\nfunction evaluateNodeStyle(\n apply: Style,\n node: NodeData,\n): EvaluatedNvlNodeStyle {\n const result: EvaluatedNvlNodeStyle = {\n ...apply,\n captions: (apply.captions ?? [getDefaultNodeCaption(node)]).map(\n (caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: node.labelsSorted[0] };\n }\n\n if ('property' in value) {\n const prop = node.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: node.labelsSorted[0] };\n },\n ),\n };\n\n if (apply.colorRange !== undefined) {\n const interpolated = getInterpolatedColor(apply.colorRange, node);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n if (apply.nodeSizeRange !== undefined) {\n const { onProperty, minValue, maxValue, minSize, maxSize } =\n apply.nodeSizeRange;\n const interpolated = getInterpolatedSize(\n node.properties[onProperty],\n minValue,\n maxValue,\n minSize,\n maxSize,\n );\n if (interpolated !== null) {\n result.size = interpolated;\n }\n }\n\n return result;\n}\n\nfunction createRelStyleFunction(\n rules: StyleRule[],\n): (rel: RelData) => EvaluatedNvlRelationshipStyle {\n return (rel: RelData) => {\n const style: Style = {};\n\n // evaluateWhere uses Cypher-style three-valued logic (true/false/null).\n // Only `true` passes; both `false` and `null` (unknown) skip the rule.\n for (const rule of rules) {\n // Check if the rule applies to this relationship\n if ('reltype' in rule.match) {\n const isReltypeMatch =\n rule.match.reltype === null || rel.type === rule.match.reltype;\n\n if (isReltypeMatch && evaluateWhere(rel, rule.where) === true) {\n // Merge the style properties (later rules override earlier ones)\n Object.assign(style, rule.apply);\n }\n }\n }\n\n return evaluateRelStyle(style, rel);\n };\n}\n\nexport type CompiledStyleRules = {\n byType: (type: string) => (rel: RelData) => EvaluatedNvlRelationshipStyle;\n styleMatchers: StyleMatchers;\n byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;\n};\n\nexport const DEFAULT_REL_COLOR = tokens.palette.neutral['40'];\nconst NO_LABEL_FALLBACK_COLOR = tokens.palette.neutral['40'];\n\nfunction createByLabelSetFunction(\n styleMatchers: StyleMatchers,\n): (node: NodeData) => EvaluatedNvlNodeStyle {\n const defaultColorCache = new Map<string, string>();\n const sortedRulesCache = new Map<string, StyleRule[]>();\n const mergedStyleCache = new Map<string, Style>();\n\n return (node: NodeData) => {\n const labelSetKey = node.labelsSorted.join('\\0');\n\n // Fast path: if all rules for this label set are where-free,\n // the merged style is identical for every node with the same labels.\n const cachedStyle = mergedStyleCache.get(labelSetKey);\n if (cachedStyle !== undefined) {\n return evaluateNodeStyle(cachedStyle, node);\n }\n\n // Memoize default color by first label\n const labelForDefaultColor = node.labelsSorted[0] ?? null;\n let defaultColor: string;\n if (labelForDefaultColor === null) {\n defaultColor = NO_LABEL_FALLBACK_COLOR;\n } else {\n let cached = defaultColorCache.get(labelForDefaultColor);\n if (cached === undefined) {\n cached =\n calculateDefaultNodeColors(labelForDefaultColor).backgroundColor;\n defaultColorCache.set(labelForDefaultColor, cached);\n }\n defaultColor = cached;\n }\n\n // Cache sorted rules by label set (avoids repeated allocation + sort)\n let sortedRules = sortedRulesCache.get(labelSetKey);\n if (sortedRules === undefined) {\n const matchingRules: StyleRule[] = [...styleMatchers.globalLabelRules];\n for (const label of node.labelsSorted) {\n const labelRules = styleMatchers.rulesByLabel.get(label);\n if (labelRules) {\n matchingRules.push(...labelRules);\n }\n }\n sortedRules = matchingRules.toSorted(compareByPriorityAscending);\n sortedRulesCache.set(labelSetKey, sortedRules);\n }\n\n // Evaluate rules, tracking whether all are where-free\n const collectStyles: Style = { color: defaultColor };\n let isAllWhereFree = true;\n for (const rule of sortedRules) {\n if (rule.where !== undefined) {\n isAllWhereFree = false;\n if (evaluateWhere(node, rule.where) === true) {\n Object.assign(collectStyles, rule.apply);\n }\n } else {\n Object.assign(collectStyles, rule.apply);\n }\n }\n\n // When all rules are where-free, the merged style depends only on labels.\n // Cache it so subsequent nodes with the same label set skip rule iteration.\n if (isAllWhereFree) {\n mergedStyleCache.set(labelSetKey, collectStyles);\n }\n\n return evaluateNodeStyle(collectStyles, node);\n };\n}\n\nconst DEFAULT_REL_STYLE: StyleRule = {\n match: { reltype: null },\n apply: {\n color: DEFAULT_REL_COLOR,\n captions: [{ value: { useType: true } }],\n },\n};\n\nexport function compileStyleRules(\n styleRules: StyleRule[] | null | undefined,\n): CompiledStyleRules {\n const styleMatchers = collectStyleMatchers(styleRules);\n\n // Lazily build and cache a style function per relationship type\n const cache = new Map<\n string,\n (rel: RelData) => EvaluatedNvlRelationshipStyle\n >();\n const byType = (type: string) => {\n let fn = cache.get(type);\n if (fn === undefined) {\n const rules = styleMatchers.rulesByType.get(type) ?? [];\n fn = createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...styleMatchers.globalReltypeRules,\n ...rules,\n ]);\n cache.set(type, fn);\n }\n return fn;\n };\n\n const byLabelSet = createByLabelSetFunction(styleMatchers);\n\n return { byLabelSet, byType, styleMatchers };\n}\n"]}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
21
|
*/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.StyleRuleSchema = exports.StyleSchema = exports.ColorRangeSchema = exports.NvlCaptionSchema = exports.CaptionVariationSchema = exports.CaptionValueSchema = exports.WhereSchema = exports.ValueSchema = exports.CypherValueSchema = exports.MatchSchema = exports.SelectorSchema = void 0;
|
|
23
|
+
exports.StyleRuleSchema = exports.StyleSchema = exports.RelWidthRangeSchema = exports.NodeSizeRangeSchema = exports.ColorRangeSchema = exports.NvlCaptionSchema = exports.CaptionVariationSchema = exports.CaptionValueSchema = exports.WhereSchema = exports.ValueSchema = exports.CypherValueSchema = exports.MatchSchema = exports.SelectorSchema = void 0;
|
|
24
24
|
exports.pickConsumerNodeStyles = pickConsumerNodeStyles;
|
|
25
25
|
exports.pickConsumerRelationshipStyles = pickConsumerRelationshipStyles;
|
|
26
26
|
const zod_1 = require("zod");
|
|
@@ -116,6 +116,32 @@ exports.ColorRangeSchema = zod_1.z.object({
|
|
|
116
116
|
midValue: zod_1.z.number().optional(),
|
|
117
117
|
midColor: zod_1.z.string().optional(),
|
|
118
118
|
});
|
|
119
|
+
/**
|
|
120
|
+
* Size interpolation for nodes based on a continuous numeric property value.
|
|
121
|
+
* Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].
|
|
122
|
+
* If the property is missing or non-numeric, nodeSizeRange is silently ignored —
|
|
123
|
+
* other style properties still apply.
|
|
124
|
+
*/
|
|
125
|
+
exports.NodeSizeRangeSchema = zod_1.z.object({
|
|
126
|
+
onProperty: zod_1.z.string(),
|
|
127
|
+
minValue: zod_1.z.number(),
|
|
128
|
+
maxValue: zod_1.z.number(),
|
|
129
|
+
minSize: zod_1.z.number(),
|
|
130
|
+
maxSize: zod_1.z.number(),
|
|
131
|
+
});
|
|
132
|
+
/**
|
|
133
|
+
* Width interpolation for relationships based on a continuous numeric property value.
|
|
134
|
+
* Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].
|
|
135
|
+
* If the property is missing or non-numeric, relWidthRange is silently ignored —
|
|
136
|
+
* other style properties still apply.
|
|
137
|
+
*/
|
|
138
|
+
exports.RelWidthRangeSchema = zod_1.z.object({
|
|
139
|
+
onProperty: zod_1.z.string(),
|
|
140
|
+
minValue: zod_1.z.number(),
|
|
141
|
+
maxValue: zod_1.z.number(),
|
|
142
|
+
minWidth: zod_1.z.number(),
|
|
143
|
+
maxWidth: zod_1.z.number(),
|
|
144
|
+
});
|
|
119
145
|
exports.StyleSchema = zod_1.z.object({
|
|
120
146
|
captionAlign: zod_1.z.enum(['top', 'bottom', 'center']).optional(),
|
|
121
147
|
captionSize: zod_1.z.number().optional(),
|
|
@@ -123,7 +149,9 @@ exports.StyleSchema = zod_1.z.object({
|
|
|
123
149
|
color: zod_1.z.string().optional(),
|
|
124
150
|
colorRange: exports.ColorRangeSchema.optional(),
|
|
125
151
|
icon: zod_1.z.string().optional(),
|
|
152
|
+
nodeSizeRange: exports.NodeSizeRangeSchema.optional(),
|
|
126
153
|
overlayIcon: NvlOverlayIconSchema.optional(),
|
|
154
|
+
relWidthRange: exports.RelWidthRangeSchema.optional(),
|
|
127
155
|
size: zod_1.z.number().optional(),
|
|
128
156
|
width: zod_1.z.number().optional(),
|
|
129
157
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAyNH,wDAUC;AAOD,wEAUC;AAjPD,6BAAwB;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,OAAC,CAAC,KAAK,CAAC;IACpC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAGU,QAAA,WAAW,GAAG,OAAC,CAAC,KAAK,CAAC;IACjC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAEH,qGAAqG;AACxF,QAAA,iBAAiB,GAAG,OAAC,CAAC,KAAK,CAAC;IACvC,OAAC,CAAC,MAAM,EAAE;IACV,OAAC,CA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]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Node, type Relationship } from '@neo4j-nvl/base';\nimport { z } from 'zod';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n *\n * Some simple examples of rules:\n * - Match all nodes with label \"Person\" and apply red color\n * { match: { label: \"Person\" }, apply: { color: \"red\" } }\n *\n * - Match all relationships with type \"KNOWS\" which have the property \"name\" equal to \"John\" and apply width 10\n * { match: { reltype: \"KNOWS\" }, where: { equal: [{ property: \"name\" }, \"John\"] }, apply: { width: 10 } }\n */\n\n// Selector schemas. This is what can go under the `match` key.\nconst LabelSelectorSchema = z.object({\n label: z.string().nullable(),\n});\n\nconst ReltypeSelectorSchema = z.object({\n reltype: z.string().nullable(),\n});\n\nconst PropertySelectorSchema = z.object({\n property: z.string(),\n});\n\nexport const SelectorSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\ntype Selector = z.infer<typeof SelectorSchema>;\n\nexport const MatchSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\n\n// Schemas for the values that can go under the `where` key. Starts with defining the literal values.\nexport const CypherValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}) or a literal value (string, number, boolean, null).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\n\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous numeric property value.\n * Colors must be a standard hex string (#rrggbb).\n * If the property is missing, non-numeric, or any color is invalid, the\n * colorRange is silently ignored — other style properties still apply.\n */\nexport const ColorRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n minColor: z.string(),\n maxValue: z.number(),\n maxColor: z.string(),\n midValue: z.number().optional(),\n midColor: z.string().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\nexport const StyleSchema = z.object({\n captionAlign: z.enum(['top', 'bottom', 'center']).optional(),\n captionSize: z.number().optional(),\n captions: z.array(NvlCaptionSchema).optional(),\n color: z.string().optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: z.string().optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n size: z.number().optional(),\n width: z.number().optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\nexport const StyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n disabled: z.boolean().optional(),\n priority: z.number().optional(),\n});\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\n\n// Evaluated style values that NVL expects\ntype NodeStyleKey =\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign';\n\ntype RelStyleKey =\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon';\n\nexport type EvaluatedNvlNodeStyle = Pick<Node, NodeStyleKey>;\nexport type EvaluatedNvlRelationshipStyle = Pick<Relationship, RelStyleKey>;\n\nconst NODE_STYLE_KEYS: readonly NodeStyleKey[] = [\n 'color',\n 'size',\n 'icon',\n 'overlayIcon',\n 'captions',\n 'captionSize',\n 'captionAlign',\n];\n\nconst REL_STYLE_KEYS: readonly RelStyleKey[] = [\n 'color',\n 'width',\n 'captions',\n 'captionSize',\n 'captionAlign',\n 'overlayIcon',\n];\n\n/**\n * Extract consumer-set style properties from a node.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerNodeStyles(\n node: Partial<EvaluatedNvlNodeStyle>,\n): Partial<EvaluatedNvlNodeStyle> {\n const result: Record<string, unknown> = {};\n for (const key of NODE_STYLE_KEYS) {\n if (node[key] !== undefined) {\n result[key] = node[key];\n }\n }\n return result as Partial<EvaluatedNvlNodeStyle>;\n}\n\n/**\n * Extract consumer-set style properties from a relationship.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerRelationshipStyles(\n rel: Partial<EvaluatedNvlRelationshipStyle>,\n): Partial<EvaluatedNvlRelationshipStyle> {\n const result: Record<string, unknown> = {};\n for (const key of REL_STYLE_KEYS) {\n if (rel[key] !== undefined) {\n result[key] = rel[key];\n }\n }\n return result as Partial<EvaluatedNvlRelationshipStyle>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAyPH,wDAUC;AAOD,wEAUC;AAjRD,6BAAwB;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAA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) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Node, type Relationship } from '@neo4j-nvl/base';\nimport { z } from 'zod';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n *\n * Some simple examples of rules:\n * - Match all nodes with label \"Person\" and apply red color\n * { match: { label: \"Person\" }, apply: { color: \"red\" } }\n *\n * - Match all relationships with type \"KNOWS\" which have the property \"name\" equal to \"John\" and apply width 10\n * { match: { reltype: \"KNOWS\" }, where: { equal: [{ property: \"name\" }, \"John\"] }, apply: { width: 10 } }\n */\n\n// Selector schemas. This is what can go under the `match` key.\nconst LabelSelectorSchema = z.object({\n label: z.string().nullable(),\n});\n\nconst ReltypeSelectorSchema = z.object({\n reltype: z.string().nullable(),\n});\n\nconst PropertySelectorSchema = z.object({\n property: z.string(),\n});\n\nexport const SelectorSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\ntype Selector = z.infer<typeof SelectorSchema>;\n\nexport const MatchSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\n\n// Schemas for the values that can go under the `where` key. Starts with defining the literal values.\nexport const CypherValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}) or a literal value (string, number, boolean, null).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\n\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous numeric property value.\n * Colors must be a standard hex string (#rrggbb).\n * If the property is missing, non-numeric, or any color is invalid, the\n * colorRange is silently ignored — other style properties still apply.\n */\nexport const ColorRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n minColor: z.string(),\n maxValue: z.number(),\n maxColor: z.string(),\n midValue: z.number().optional(),\n midColor: z.string().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\n/**\n * Size interpolation for nodes based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].\n * If the property is missing or non-numeric, nodeSizeRange is silently ignored —\n * other style properties still apply.\n */\nexport const NodeSizeRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minSize: z.number(),\n maxSize: z.number(),\n});\nexport type NodeSizeRange = z.infer<typeof NodeSizeRangeSchema>;\n\n/**\n * Width interpolation for relationships based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].\n * If the property is missing or non-numeric, relWidthRange is silently ignored —\n * other style properties still apply.\n */\nexport const RelWidthRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minWidth: z.number(),\n maxWidth: z.number(),\n});\nexport type RelWidthRange = z.infer<typeof RelWidthRangeSchema>;\n\nexport const StyleSchema = z.object({\n captionAlign: z.enum(['top', 'bottom', 'center']).optional(),\n captionSize: z.number().optional(),\n captions: z.array(NvlCaptionSchema).optional(),\n color: z.string().optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: z.string().optional(),\n nodeSizeRange: NodeSizeRangeSchema.optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n relWidthRange: RelWidthRangeSchema.optional(),\n size: z.number().optional(),\n width: z.number().optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\nexport const StyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n disabled: z.boolean().optional(),\n priority: z.number().optional(),\n});\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\n\n// Evaluated style values that NVL expects\ntype NodeStyleKey =\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign';\n\ntype RelStyleKey =\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon';\n\nexport type EvaluatedNvlNodeStyle = Pick<Node, NodeStyleKey>;\nexport type EvaluatedNvlRelationshipStyle = Pick<Relationship, RelStyleKey>;\n\nconst NODE_STYLE_KEYS: readonly NodeStyleKey[] = [\n 'color',\n 'size',\n 'icon',\n 'overlayIcon',\n 'captions',\n 'captionSize',\n 'captionAlign',\n];\n\nconst REL_STYLE_KEYS: readonly RelStyleKey[] = [\n 'color',\n 'width',\n 'captions',\n 'captionSize',\n 'captionAlign',\n 'overlayIcon',\n];\n\n/**\n * Extract consumer-set style properties from a node.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerNodeStyles(\n node: Partial<EvaluatedNvlNodeStyle>,\n): Partial<EvaluatedNvlNodeStyle> {\n const result: Record<string, unknown> = {};\n for (const key of NODE_STYLE_KEYS) {\n if (node[key] !== undefined) {\n result[key] = node[key];\n }\n }\n return result as Partial<EvaluatedNvlNodeStyle>;\n}\n\n/**\n * Extract consumer-set style properties from a relationship.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerRelationshipStyles(\n rel: Partial<EvaluatedNvlRelationshipStyle>,\n): Partial<EvaluatedNvlRelationshipStyle> {\n const result: Record<string, unknown> = {};\n for (const key of REL_STYLE_KEYS) {\n if (rel[key] !== undefined) {\n result[key] = rel[key];\n }\n }\n return result as Partial<EvaluatedNvlRelationshipStyle>;\n}\n"]}
|
|
@@ -34,6 +34,13 @@ const pokemonRules = [
|
|
|
34
34
|
maxValue: 88,
|
|
35
35
|
maxColor: '#e74c3c',
|
|
36
36
|
},
|
|
37
|
+
nodeSizeRange: {
|
|
38
|
+
onProperty: 'level',
|
|
39
|
+
minValue: 1,
|
|
40
|
+
maxValue: 88,
|
|
41
|
+
minSize: 20,
|
|
42
|
+
maxSize: 50,
|
|
43
|
+
},
|
|
37
44
|
captions: [
|
|
38
45
|
{ value: { property: 'name' }, styles: ['bold'] },
|
|
39
46
|
{ value: ' Lv', styles: [] },
|
|
@@ -53,7 +60,13 @@ const caughtRelRules = [
|
|
|
53
60
|
maxValue: 40,
|
|
54
61
|
maxColor: '#ff2d78',
|
|
55
62
|
},
|
|
56
|
-
|
|
63
|
+
relWidthRange: {
|
|
64
|
+
onProperty: 'level',
|
|
65
|
+
minValue: 1,
|
|
66
|
+
maxValue: 40,
|
|
67
|
+
minWidth: 1,
|
|
68
|
+
maxWidth: 8,
|
|
69
|
+
},
|
|
57
70
|
captions: [
|
|
58
71
|
{ value: 'Caught @ Lv', styles: [] },
|
|
59
72
|
{ value: { property: 'level' }, styles: ['bold'] },
|
|
@@ -76,4 +89,4 @@ const Component = () => {
|
|
|
76
89
|
return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { nodes: advancedStoryGraph.nodes, rels: advancedStoryGraph.rels, className: containerClasses, nvlStyleRules: colorRangeStyleRules }) }));
|
|
77
90
|
};
|
|
78
91
|
export default Component;
|
|
79
|
-
//# sourceMappingURL=graph-visualization-
|
|
92
|
+
//# sourceMappingURL=graph-visualization-range-styling.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-visualization-range-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-range-styling.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,YAAY,GAAgB;IAChC;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;QAC3B,KAAK,EAAE;YACL,UAAU,EAAE;gBACV,UAAU,EAAE,OAAO;gBACnB,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,SAAS;gBACnB,QAAQ,EAAE,EAAE;gBACZ,QAAQ,EAAE,SAAS;gBACnB,QAAQ,EAAE,EAAE;gBACZ,QAAQ,EAAE,SAAS;aACpB;YACD,aAAa,EAAE;gBACb,UAAU,EAAE,OAAO;gBACnB,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,EAAE;aACZ;YACD,QAAQ,EAAE;gBACR,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE;gBACjD,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;gBAC5B,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;aAC7C;SACF;KACF;CACF,CAAC;AAEF,MAAM,cAAc,GAAgB;IAClC;QACE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC5B,KAAK,EAAE;YAC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aAAa,EAAE,oBAAoB,GACnC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { GraphVisualization } from '../graph-visualization';\nimport { type StyleRule } from '../styling/style-types';\nimport { advancedStoryGraph, containerClasses } from './story-data';\n\nconst pokemonRules: StyleRule[] = [\n {\n match: { label: 'Pokemon' },\n apply: {\n colorRange: {\n onProperty: 'level',\n minValue: 1,\n minColor: '#3498db',\n midValue: 45,\n midColor: '#f1c40f',\n maxValue: 88,\n maxColor: '#e74c3c',\n },\n nodeSizeRange: {\n onProperty: 'level',\n minValue: 1,\n maxValue: 88,\n minSize: 20,\n maxSize: 50,\n },\n captions: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' Lv', styles: [] },\n { value: { property: 'level' }, styles: [] },\n ],\n },\n },\n];\n\nconst caughtRelRules: StyleRule[] = [\n {\n match: { reltype: 'CAUGHT' },\n apply: {\n colorRange: {\n onProperty: 'level',\n minValue: 1,\n minColor: '#00d2ff',\n maxValue: 40,\n maxColor: '#ff2d78',\n },\n relWidthRange: {\n onProperty: 'level',\n minValue: 1,\n maxValue: 40,\n minWidth: 1,\n maxWidth: 8,\n },\n captions: [\n { value: 'Caught @ Lv', styles: [] },\n { value: { property: 'level' }, styles: ['bold'] },\n ],\n captionSize: 1.5,\n },\n },\n];\n\nconst otherNodeRules: StyleRule[] = [\n { match: { label: 'Trainer' }, apply: { color: '#95a5a6' } },\n { match: { label: 'Type' }, apply: { color: '#bdc3c7' } },\n { match: { label: 'Gym' }, apply: { color: '#bdc3c7' } },\n];\n\nexport const colorRangeStyleRules: StyleRule[] = [\n ...pokemonRules,\n ...caughtRelRules,\n ...otherNodeRules,\n];\n\nconst Component = () => {\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n nodes={advancedStoryGraph.nodes}\n rels={advancedStoryGraph.rels}\n className={containerClasses}\n nvlStyleRules={colorRangeStyleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
package/lib/esm/stories/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export { default as GraphVisualizationCustom } from './graph-visualization-custo
|
|
|
23
23
|
export { default as GraphVisualizationDefault } from './graph-visualization-default.story';
|
|
24
24
|
export { default as GraphVisualizationHighlighting } from './graph-visualization-highlighting.story';
|
|
25
25
|
export { default as GraphVisualizationMaximalist } from './graph-visualization-maximalist.story';
|
|
26
|
-
export { default as
|
|
26
|
+
export { default as GraphVisualizationRangeStyling } from './graph-visualization-range-styling.story';
|
|
27
27
|
export { default as GraphVisualizationRuleBasedStylingAdvanced } from './graph-visualization-rule-based-styling-advanced.story';
|
|
28
28
|
export { default as GraphVisualizationRuleBasedStyling } from './graph-visualization-rule-based-styling.story';
|
|
29
29
|
export { default as GraphVisualizationSearch } from './graph-visualization-search.story';
|
|
@@ -31,11 +31,11 @@ export { default as GraphVisualizationSimpleStyling } from './graph-visualizatio
|
|
|
31
31
|
export { default as PreviewGraphVisualization } from './preview-graph-visualization.story';
|
|
32
32
|
import { removeLicenseHeader } from '../utils';
|
|
33
33
|
import GraphVisualizationBarebonesSrcRaw from './graph-visualization-barebones.story?raw';
|
|
34
|
-
import GraphVisualizationColorRangeStylingRaw from './graph-visualization-color-range-styling.story?raw';
|
|
35
34
|
import GraphVisualizationCustomSrcRaw from './graph-visualization-custom.story?raw';
|
|
36
35
|
import GraphVisualizationDefaultSrcRaw from './graph-visualization-default.story?raw';
|
|
37
36
|
import GraphVisualizationHighlightingSrcRaw from './graph-visualization-highlighting.story?raw';
|
|
38
37
|
import GraphVisualizationMaximalistSrcRaw from './graph-visualization-maximalist.story?raw';
|
|
38
|
+
import GraphVisualizationRangeStylingRaw from './graph-visualization-range-styling.story?raw';
|
|
39
39
|
import GraphVisualizationRuleBasedStylingSrcRaw from './graph-visualization-rule-based-styling.story?raw';
|
|
40
40
|
import GraphVisualizationRuleBasedStylingAdvancedSrcRaw from './graph-visualization-rule-based-styling-advanced.story?raw';
|
|
41
41
|
import GraphVisualizationSearchSrcRaw from './graph-visualization-search.story?raw';
|
|
@@ -50,6 +50,6 @@ export const GraphVisualizationSimpleStylingSrc = removeLicenseHeader(GraphVisua
|
|
|
50
50
|
export const GraphVisualizationRuleBasedStylingSrc = removeLicenseHeader(GraphVisualizationRuleBasedStylingSrcRaw);
|
|
51
51
|
export const GraphVisualizationSearchSrc = removeLicenseHeader(GraphVisualizationSearchSrcRaw);
|
|
52
52
|
export const GraphVisualizationRuleBasedStylingAdvancedSrc = removeLicenseHeader(GraphVisualizationRuleBasedStylingAdvancedSrcRaw);
|
|
53
|
-
export const
|
|
53
|
+
export const GraphVisualizationRangeStylingSrc = removeLicenseHeader(GraphVisualizationRangeStylingRaw);
|
|
54
54
|
export const PreviewGraphVisualizationSrc = removeLicenseHeader(PreviewGraphVisualizationSrcRaw);
|
|
55
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAC/F,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;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M,4CAA4C,CAAC;AAC5F,OAAO,iCAAiC,MAAM,+CAA+C,CAAC;AAC9F,OAAO,wCAAwC,MAAM,oDAAoD,CAAC;AAC1G,OAAO,gDAAgD,MAAM,6DAA6D,CAAC;AAC3H,OAAO,8BAA8B,MAAM,wCAAwC,CAAC;AACpF,OAAO,qCAAqC,MAAM,gDAAgD,CAAC;AACnG,OAAO,+BAA+B,MAAM,yCAAyC,CAAC;AAEtF,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAC7D,+BAA+B,CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAC/D,iCAAiC,CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,mBAAmB,CAChE,kCAAkC,CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAC5D,8BAA8B,CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,mBAAmB,CAClE,oCAAoC,CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAG,mBAAmB,CACnE,qCAAqC,CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAG,mBAAmB,CACtE,wCAAwC,CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAC5D,8BAA8B,CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,6CAA6C,GACxD,mBAAmB,CAAC,gDAAgD,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,iCAAiC,GAAG,mBAAmB,CAClE,iCAAiC,CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAC7D,+BAA+B,CAChC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as GraphVisualizationBarebones } from './graph-visualization-barebones.story';\nexport { default as GraphVisualizationCustom } from './graph-visualization-custom.story';\nexport { default as GraphVisualizationDefault } from './graph-visualization-default.story';\nexport { default as GraphVisualizationHighlighting } from './graph-visualization-highlighting.story';\nexport { default as GraphVisualizationMaximalist } from './graph-visualization-maximalist.story';\nexport { default as GraphVisualizationRangeStyling } from './graph-visualization-range-styling.story';\nexport { default as GraphVisualizationRuleBasedStylingAdvanced } from './graph-visualization-rule-based-styling-advanced.story';\nexport { default as GraphVisualizationRuleBasedStyling } from './graph-visualization-rule-based-styling.story';\nexport { default as GraphVisualizationSearch } from './graph-visualization-search.story';\nexport { default as GraphVisualizationSimpleStyling } from './graph-visualization-simple-styling.story';\nexport { default as PreviewGraphVisualization } from './preview-graph-visualization.story';\n\nimport { removeLicenseHeader } from '../utils';\nimport GraphVisualizationBarebonesSrcRaw from './graph-visualization-barebones.story?raw';\nimport GraphVisualizationCustomSrcRaw from './graph-visualization-custom.story?raw';\nimport GraphVisualizationDefaultSrcRaw from './graph-visualization-default.story?raw';\nimport GraphVisualizationHighlightingSrcRaw from './graph-visualization-highlighting.story?raw';\nimport GraphVisualizationMaximalistSrcRaw from './graph-visualization-maximalist.story?raw';\nimport GraphVisualizationRangeStylingRaw from './graph-visualization-range-styling.story?raw';\nimport GraphVisualizationRuleBasedStylingSrcRaw from './graph-visualization-rule-based-styling.story?raw';\nimport GraphVisualizationRuleBasedStylingAdvancedSrcRaw from './graph-visualization-rule-based-styling-advanced.story?raw';\nimport GraphVisualizationSearchSrcRaw from './graph-visualization-search.story?raw';\nimport GraphVisualizationSimpleStylingSrcRaw from './graph-visualization-simple-styling.story?raw';\nimport PreviewGraphVisualizationSrcRaw from './preview-graph-visualization.story?raw';\n\nexport const GraphVisualizationDefaultSrc = removeLicenseHeader(\n GraphVisualizationDefaultSrcRaw,\n);\n\nexport const GraphVisualizationBarebonesSrc = removeLicenseHeader(\n GraphVisualizationBarebonesSrcRaw,\n);\n\nexport const GraphVisualizationMaximalistSrc = removeLicenseHeader(\n GraphVisualizationMaximalistSrcRaw,\n);\n\nexport const GraphVisualizationCustomSrc = removeLicenseHeader(\n GraphVisualizationCustomSrcRaw,\n);\n\nexport const GraphVisualizationHighlightingSrc = removeLicenseHeader(\n GraphVisualizationHighlightingSrcRaw,\n);\n\nexport const GraphVisualizationSimpleStylingSrc = removeLicenseHeader(\n GraphVisualizationSimpleStylingSrcRaw,\n);\n\nexport const GraphVisualizationRuleBasedStylingSrc = removeLicenseHeader(\n GraphVisualizationRuleBasedStylingSrcRaw,\n);\n\nexport const GraphVisualizationSearchSrc = removeLicenseHeader(\n GraphVisualizationSearchSrcRaw,\n);\n\nexport const GraphVisualizationRuleBasedStylingAdvancedSrc =\n removeLicenseHeader(GraphVisualizationRuleBasedStylingAdvancedSrcRaw);\n\nexport const GraphVisualizationRangeStylingSrc = removeLicenseHeader(\n GraphVisualizationRangeStylingRaw,\n);\n\nexport const PreviewGraphVisualizationSrc = removeLicenseHeader(\n PreviewGraphVisualizationSrcRaw,\n);\n"]}
|
|
@@ -145,6 +145,24 @@ function getInterpolatedColor(colorRange, graphItem) {
|
|
|
145
145
|
}
|
|
146
146
|
return rgbToHex(rgb);
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Interpolates a numeric size/width from a range based on a graph item's property value.
|
|
150
|
+
* Returns the interpolated number, or null if the property is missing or non-numeric.
|
|
151
|
+
*/
|
|
152
|
+
function getInterpolatedSize(prop, minValue, maxValue, minOut, maxOut) {
|
|
153
|
+
if (prop === undefined) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
const rawValue = extractPropertyValue(prop);
|
|
157
|
+
if (typeof rawValue !== 'number') {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const actualMinValue = Math.min(minValue, maxValue);
|
|
161
|
+
const actualMaxValue = Math.max(minValue, maxValue);
|
|
162
|
+
const clampedValue = Math.max(actualMinValue, Math.min(actualMaxValue, rawValue));
|
|
163
|
+
const t = getWeight(minValue, maxValue, clampedValue);
|
|
164
|
+
return minOut * (1 - t) + maxOut * t;
|
|
165
|
+
}
|
|
148
166
|
function extractPropertyValue(prop) {
|
|
149
167
|
switch (prop.type) {
|
|
150
168
|
case 'string':
|
|
@@ -308,6 +326,13 @@ function evaluateRelStyle(apply, rel) {
|
|
|
308
326
|
result.color = interpolated;
|
|
309
327
|
}
|
|
310
328
|
}
|
|
329
|
+
if (apply.relWidthRange !== undefined) {
|
|
330
|
+
const { onProperty, minValue, maxValue, minWidth, maxWidth } = apply.relWidthRange;
|
|
331
|
+
const interpolated = getInterpolatedSize(rel.properties[onProperty], minValue, maxValue, minWidth, maxWidth);
|
|
332
|
+
if (interpolated !== null) {
|
|
333
|
+
result.width = interpolated;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
311
336
|
return result;
|
|
312
337
|
}
|
|
313
338
|
/**
|
|
@@ -430,6 +455,13 @@ function evaluateNodeStyle(apply, node) {
|
|
|
430
455
|
result.color = interpolated;
|
|
431
456
|
}
|
|
432
457
|
}
|
|
458
|
+
if (apply.nodeSizeRange !== undefined) {
|
|
459
|
+
const { onProperty, minValue, maxValue, minSize, maxSize } = apply.nodeSizeRange;
|
|
460
|
+
const interpolated = getInterpolatedSize(node.properties[onProperty], minValue, maxValue, minSize, maxSize);
|
|
461
|
+
if (interpolated !== null) {
|
|
462
|
+
result.size = interpolated;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
433
465
|
return result;
|
|
434
466
|
}
|
|
435
467
|
function createRelStyleFunction(rules) {
|
|
@@ -1 +1 @@
|
|
|
1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n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { calculateDefaultNodeColors } from '@neo4j-devtools/word-color';\nimport { tokens } from '@neo4j-ndl/base';\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n type NodeData,\n type PortableProperty,\n type RelData,\n} from '../graph-visualization-context';\nimport { getWeight, lerpColor } from './color-interpolation';\nimport {\n type Caption,\n type ColorRange,\n type CypherValue,\n type EvaluatedNvlNodeStyle,\n type EvaluatedNvlRelationshipStyle,\n type Style,\n type StyleRule,\n type Value,\n type Where,\n} from './style-types';\n\ntype StyleMatchers = {\n globalLabelRules: StyleRule[];\n globalReltypeRules: StyleRule[];\n rulesByLabel: Map<string, StyleRule[]>;\n rulesByType: Map<string, StyleRule[]>;\n};\n\nfunction compareByPriorityAscending(a: StyleRule, b: StyleRule): number {\n return a.priority! - b.priority!;\n}\n\nfunction collectStyleMatchers(\n styles: StyleRule[] | null | undefined,\n): StyleMatchers {\n const rulesByLabel = new Map<string, StyleRule[]>();\n const rulesByType = new Map<string, StyleRule[]>();\n const globalLabelRules: StyleRule[] = [];\n const globalReltypeRules: StyleRule[] = [];\n\n // Handle null/undefined styles gracefully\n if (!styles || styles.length === 0) {\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n }\n\n const totalRules = styles.length;\n\n styles.forEach((style, index) => {\n if (style.disabled ?? false) {\n return;\n }\n\n if (style.priority !== undefined && style.priority < 0) {\n throw new Error(\n `StyleRule priority must be >= 0, got ${style.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n // Fill in priority if not set (negative values preserve original order)\n const { priority, ...rest } = style;\n const ruleWithPriority: StyleRule = {\n ...rest,\n priority: priority ?? index - totalRules,\n };\n\n // style for nodes\n if ('label' in style.match) {\n // if the label is null, it's a global rule (matches any node)\n if (style.match.label === null) {\n globalLabelRules.push(ruleWithPriority);\n } else {\n // Specific label rule\n const existing = rulesByLabel.get(style.match.label) ?? [];\n rulesByLabel.set(style.match.label, [...existing, ruleWithPriority]);\n }\n }\n\n // style for relationships\n if ('reltype' in style.match) {\n if (style.match.reltype === null) {\n // Global reltype rule (matches any relationship)\n globalReltypeRules.push(ruleWithPriority);\n } else {\n // Specific reltype rule\n const existing = rulesByType.get(style.match.reltype) ?? [];\n rulesByType.set(style.match.reltype, [...existing, ruleWithPriority]);\n }\n }\n });\n\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n}\n\n/**\n * Interpolates a color from a ColorRange based on a graph item's property value.\n * Returns a #rrggbb hex string, or null if the colorRange config is invalid\n * (bad hex colors, invalid value range, missing/non-numeric property).\n */\nfunction getInterpolatedColor(\n colorRange: ColorRange,\n graphItem: NodeData | RelData,\n): string | null {\n const {\n onProperty,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n // min/max can be inverted, we need to now which one is bigger\n const actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n\n // Validate mid stop if provided\n let midRgb: RgbColor | undefined = undefined;\n if (midValue !== undefined && midColor !== undefined) {\n const isMidInRange =\n actualMinValue <= midValue && midValue <= actualMaxValue;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const prop = graphItem.properties[onProperty];\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number') {\n return null;\n }\n\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, rawValue),\n );\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && midValue !== undefined) {\n const t = getWeight(minValue, midValue, clampedValue);\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t = getWeight(midValue, maxValue, clampedValue);\n rgb = lerpColor(midRgb, maxRgb, t);\n }\n } else {\n const t = getWeight(minValue, maxValue, clampedValue);\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\nfunction extractPropertyValue(\n prop: PortableProperty,\n): string | number | boolean | null {\n switch (prop.type) {\n case 'string':\n return JSON.parse(prop.stringified);\n case 'number':\n case 'integer':\n case 'float':\n return Number(prop.stringified);\n case 'boolean':\n case 'Boolean':\n return prop.stringified === 'true';\n case 'null':\n return null;\n default:\n return prop.stringified;\n }\n}\n\n/**\n * Three-valued logic type matching Cypher/SQL semantics.\n * - `true`: condition is satisfied\n * - `false`: condition is not satisfied\n * - `null`: condition is unknown (e.g., comparing with null/missing property)\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\ntype Ternary = boolean | null;\n\n/**\n * Evaluates a WHERE clause using three-valued logic matching Cypher semantics.\n *\n * From Neo4j Cypher Manual:\n * - Comparing any value to `null` results in `null`, not `true` or `false`\n * - Accessing a non-existent property returns `null`\n * - In WHERE clauses, only `true` passes; both `false` and `null` exclude the row\n *\n * Three-valued logic rules:\n * - NOT null → null\n * - true AND null → null, false AND null → false\n * - true OR null → true, false OR null → null\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction evaluateWhere(node: NodeData | RelData, where?: Where): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = evaluateValue(left, node);\n const rightVal = evaluateValue(right, node);\n // In Cypher, null = null → null (not true)\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n // Cypher: NOT null → null\n const isMatch = evaluateWhere(node, where.not);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n const [left, right] = where.lessThan;\n return safeCompare(left, right, node, (a, b) => a < b);\n }\n\n if ('lessThanOrEqual' in where) {\n const [left, right] = where.lessThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a <= b);\n }\n\n if ('greaterThan' in where) {\n const [left, right] = where.greaterThan;\n return safeCompare(left, right, node, (a, b) => a > b);\n }\n\n if ('greaterThanOrEqual' in where) {\n const [left, right] = where.greaterThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a >= b);\n }\n\n if ('contains' in where) {\n const [left, right] = where.contains;\n return safeStringCompare(left, right, node, (a, b) => a.includes(b));\n }\n\n if ('startsWith' in where) {\n const [left, right] = where.startsWith;\n return safeStringCompare(left, right, node, (a, b) => a.startsWith(b));\n }\n\n if ('endsWith' in where) {\n const [left, right] = where.endsWith;\n return safeStringCompare(left, right, node, (a, b) => a.endsWith(b));\n }\n\n if ('isNull' in where) {\n // IS NULL returns true/false (never null)\n const value = evaluateValue(where.isNull, node);\n return value === null;\n }\n\n if ('and' in where) {\n // Cypher three-valued AND:\n // - If any is false → false\n // - Else if any is null → null\n // - Else → true\n let hasNull = false;\n for (const r of where.and) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n // Cypher three-valued OR:\n // - If any is true → true\n // - Else if any is null → null\n // - Else → false\n let hasNull = false;\n for (const r of where.or) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n if ('label' in where) {\n if ('labelsSorted' in node) {\n return where.label === null || node.labelsSorted.includes(where.label);\n }\n return false;\n }\n\n if ('reltype' in where) {\n if ('type' in node) {\n return where.reltype === null || (node as RelData).type === where.reltype;\n }\n return false;\n }\n\n if ('property' in where) {\n return where.property === null || where.property in node.properties;\n }\n\n return false;\n}\n\nfunction evaluateRelStyle(\n apply: Style,\n rel: RelData,\n): EvaluatedNvlRelationshipStyle {\n const result: EvaluatedNvlRelationshipStyle = {\n ...apply,\n captions: apply.captions?.map((caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: rel.type };\n }\n\n if ('property' in value) {\n const prop = rel.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: rel.id };\n }),\n };\n\n if (apply.colorRange !== undefined) {\n const interpolated = getInterpolatedColor(apply.colorRange, rel);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n return result;\n}\n\n/**\n * Safely compare two values using Cypher's three-valued logic.\n * Returns `null` if either operand is null (matching Cypher semantics).\n *\n * From Neo4j Cypher Manual:\n * \"Comparing any value to `null` using `=` or `<>` results in `null`\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction safeCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (\n a: NonNullable<CypherValue>,\n b: NonNullable<CypherValue>,\n ) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\n/**\n * String comparison using Cypher semantics.\n * Returns `null` if either operand is null OR not a string.\n *\n * From Neo4j Cypher Manual:\n * \"When these operators are applied to non-string values, they return `null`\n * instead of attempting type coercion.\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/expressions/predicates/string-operators/\n */\nfunction safeStringCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (a: string, b: string) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n // Return null if either is null or not a string (no type coercion)\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateValue(\n value: Value,\n graphItem: NodeData | RelData,\n): CypherValue {\n if (typeof value === 'object' && value !== null) {\n if ('property' in value) {\n if (value.property === null) {\n return null;\n }\n const prop = graphItem.properties[value.property];\n if (prop === undefined) {\n return null;\n }\n return extractPropertyValue(prop);\n }\n if ('label' in value) {\n if ('labelsSorted' in graphItem) {\n return (\n value.label === null || graphItem.labelsSorted.includes(value.label)\n );\n }\n return false;\n }\n if ('reltype' in value) {\n if ('type' in graphItem) {\n return (\n value.reltype === null ||\n (graphItem as RelData).type === value.reltype\n );\n }\n return false;\n }\n }\n\n return value;\n}\n\n// Default caption selection logic\nconst captionPriorityOrder = [\n /^name$/i,\n /^title$/i,\n /^label$/i,\n /name$/i,\n /description$/i,\n /^.+/,\n];\n\nfunction getDefaultNodeCaption(node: NodeData): Caption {\n const propertyKeys = Object.keys(node.properties);\n\n for (const regex of captionPriorityOrder) {\n const matchingKey = propertyKeys.find((key) => regex.test(key));\n if (matchingKey !== undefined) {\n const prop = node.properties[matchingKey];\n if (prop !== undefined) {\n return { value: { property: matchingKey } };\n }\n }\n }\n\n if (node.labelsSorted[0] !== undefined) {\n return { value: { useType: true } };\n }\n\n return { value: node.id };\n}\n\nfunction evaluateNodeStyle(\n apply: Style,\n node: NodeData,\n): EvaluatedNvlNodeStyle {\n const result: EvaluatedNvlNodeStyle = {\n ...apply,\n captions: (apply.captions ?? [getDefaultNodeCaption(node)]).map(\n (caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: node.labelsSorted[0] };\n }\n\n if ('property' in value) {\n const prop = node.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: node.labelsSorted[0] };\n },\n ),\n };\n\n if (apply.colorRange !== undefined) {\n const interpolated = getInterpolatedColor(apply.colorRange, node);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n return result;\n}\n\nfunction createRelStyleFunction(\n rules: StyleRule[],\n): (rel: RelData) => EvaluatedNvlRelationshipStyle {\n return (rel: RelData) => {\n const style: Style = {};\n\n // evaluateWhere uses Cypher-style three-valued logic (true/false/null).\n // Only `true` passes; both `false` and `null` (unknown) skip the rule.\n for (const rule of rules) {\n // Check if the rule applies to this relationship\n if ('reltype' in rule.match) {\n const isReltypeMatch =\n rule.match.reltype === null || rel.type === rule.match.reltype;\n\n if (isReltypeMatch && evaluateWhere(rel, rule.where) === true) {\n // Merge the style properties (later rules override earlier ones)\n Object.assign(style, rule.apply);\n }\n }\n }\n\n return evaluateRelStyle(style, rel);\n };\n}\n\nexport type CompiledStyleRules = {\n byType: (type: string) => (rel: RelData) => EvaluatedNvlRelationshipStyle;\n styleMatchers: StyleMatchers;\n byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;\n};\n\nexport const DEFAULT_REL_COLOR = tokens.palette.neutral['40'];\nconst NO_LABEL_FALLBACK_COLOR = tokens.palette.neutral['40'];\n\nfunction createByLabelSetFunction(\n styleMatchers: StyleMatchers,\n): (node: NodeData) => EvaluatedNvlNodeStyle {\n const defaultColorCache = new Map<string, string>();\n const sortedRulesCache = new Map<string, StyleRule[]>();\n const mergedStyleCache = new Map<string, Style>();\n\n return (node: NodeData) => {\n const labelSetKey = node.labelsSorted.join('\\0');\n\n // Fast path: if all rules for this label set are where-free,\n // the merged style is identical for every node with the same labels.\n const cachedStyle = mergedStyleCache.get(labelSetKey);\n if (cachedStyle !== undefined) {\n return evaluateNodeStyle(cachedStyle, node);\n }\n\n // Memoize default color by first label\n const labelForDefaultColor = node.labelsSorted[0] ?? null;\n let defaultColor: string;\n if (labelForDefaultColor === null) {\n defaultColor = NO_LABEL_FALLBACK_COLOR;\n } else {\n let cached = defaultColorCache.get(labelForDefaultColor);\n if (cached === undefined) {\n cached =\n calculateDefaultNodeColors(labelForDefaultColor).backgroundColor;\n defaultColorCache.set(labelForDefaultColor, cached);\n }\n defaultColor = cached;\n }\n\n // Cache sorted rules by label set (avoids repeated allocation + sort)\n let sortedRules = sortedRulesCache.get(labelSetKey);\n if (sortedRules === undefined) {\n const matchingRules: StyleRule[] = [...styleMatchers.globalLabelRules];\n for (const label of node.labelsSorted) {\n const labelRules = styleMatchers.rulesByLabel.get(label);\n if (labelRules) {\n matchingRules.push(...labelRules);\n }\n }\n sortedRules = matchingRules.toSorted(compareByPriorityAscending);\n sortedRulesCache.set(labelSetKey, sortedRules);\n }\n\n // Evaluate rules, tracking whether all are where-free\n const collectStyles: Style = { color: defaultColor };\n let isAllWhereFree = true;\n for (const rule of sortedRules) {\n if (rule.where !== undefined) {\n isAllWhereFree = false;\n if (evaluateWhere(node, rule.where) === true) {\n Object.assign(collectStyles, rule.apply);\n }\n } else {\n Object.assign(collectStyles, rule.apply);\n }\n }\n\n // When all rules are where-free, the merged style depends only on labels.\n // Cache it so subsequent nodes with the same label set skip rule iteration.\n if (isAllWhereFree) {\n mergedStyleCache.set(labelSetKey, collectStyles);\n }\n\n return evaluateNodeStyle(collectStyles, node);\n };\n}\n\nconst DEFAULT_REL_STYLE: StyleRule = {\n match: { reltype: null },\n apply: {\n color: DEFAULT_REL_COLOR,\n captions: [{ value: { useType: true } }],\n },\n};\n\nexport function compileStyleRules(\n styleRules: StyleRule[] | null | undefined,\n): CompiledStyleRules {\n const styleMatchers = collectStyleMatchers(styleRules);\n\n // Lazily build and cache a style function per relationship type\n const cache = new Map<\n string,\n (rel: RelData) => EvaluatedNvlRelationshipStyle\n >();\n const byType = (type: string) => {\n let fn = cache.get(type);\n if (fn === undefined) {\n const rules = styleMatchers.rulesByType.get(type) ?? [];\n fn = createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...styleMatchers.globalReltypeRules,\n ...rules,\n ]);\n cache.set(type, fn);\n }\n return fn;\n };\n\n const byLabelSet = createByLabelSetFunction(styleMatchers);\n\n return { byLabelSet, byType, styleMatchers };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compile-graph-styles.js","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAiB,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAO5E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAoB7D,SAAS,0BAA0B,CAAC,CAAY,EAAE,CAAY;IAC5D,OAAO,CAAC,CAAC,QAAS,GAAG,CAAC,CAAC,QAAS,CAAC;AACnC,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAsC;IAEtC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;IACnD,MAAM,gBAAgB,GAAgB,EAAE,CAAC;IACzC,MAAM,kBAAkB,GAAgB,EAAE,CAAC;IAE3C,0CAA0C;IAC1C,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,gBAAgB;YAChB,kBAAkB;YAClB,YAAY;YACZ,WAAW;S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;IAEvD,gEAAgE;IAChE,MAAM,KAAK,GAAG,IAAI,GAAG,EAGlB,CAAC;IACJ,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE;;QAC9B,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACrB,MAAM,KAAK,GAAG,MAAA,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;YACxD,EAAE,GAAG,sBAAsB,CAAC;gBAC1B,iBAAiB;gBACjB,GAAG,aAAa,CAAC,kBAAkB;gBACnC,GAAG,KAAK;aACT,CAAC,CAAC;YACH,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { calculateDefaultNodeColors } from '@neo4j-devtools/word-color';\nimport { tokens } from '@neo4j-ndl/base';\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n type NodeData,\n type PortableProperty,\n type RelData,\n} from '../graph-visualization-context';\nimport { getWeight, lerpColor } from './color-interpolation';\nimport {\n type Caption,\n type ColorRange,\n type CypherValue,\n type EvaluatedNvlNodeStyle,\n type EvaluatedNvlRelationshipStyle,\n type Style,\n type StyleRule,\n type Value,\n type Where,\n} from './style-types';\n\ntype StyleMatchers = {\n globalLabelRules: StyleRule[];\n globalReltypeRules: StyleRule[];\n rulesByLabel: Map<string, StyleRule[]>;\n rulesByType: Map<string, StyleRule[]>;\n};\n\nfunction compareByPriorityAscending(a: StyleRule, b: StyleRule): number {\n return a.priority! - b.priority!;\n}\n\nfunction collectStyleMatchers(\n styles: StyleRule[] | null | undefined,\n): StyleMatchers {\n const rulesByLabel = new Map<string, StyleRule[]>();\n const rulesByType = new Map<string, StyleRule[]>();\n const globalLabelRules: StyleRule[] = [];\n const globalReltypeRules: StyleRule[] = [];\n\n // Handle null/undefined styles gracefully\n if (!styles || styles.length === 0) {\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n }\n\n const totalRules = styles.length;\n\n styles.forEach((style, index) => {\n if (style.disabled ?? false) {\n return;\n }\n\n if (style.priority !== undefined && style.priority < 0) {\n throw new Error(\n `StyleRule priority must be >= 0, got ${style.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n // Fill in priority if not set (negative values preserve original order)\n const { priority, ...rest } = style;\n const ruleWithPriority: StyleRule = {\n ...rest,\n priority: priority ?? index - totalRules,\n };\n\n // style for nodes\n if ('label' in style.match) {\n // if the label is null, it's a global rule (matches any node)\n if (style.match.label === null) {\n globalLabelRules.push(ruleWithPriority);\n } else {\n // Specific label rule\n const existing = rulesByLabel.get(style.match.label) ?? [];\n rulesByLabel.set(style.match.label, [...existing, ruleWithPriority]);\n }\n }\n\n // style for relationships\n if ('reltype' in style.match) {\n if (style.match.reltype === null) {\n // Global reltype rule (matches any relationship)\n globalReltypeRules.push(ruleWithPriority);\n } else {\n // Specific reltype rule\n const existing = rulesByType.get(style.match.reltype) ?? [];\n rulesByType.set(style.match.reltype, [...existing, ruleWithPriority]);\n }\n }\n });\n\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n}\n\n/**\n * Interpolates a color from a ColorRange based on a graph item's property value.\n * Returns a #rrggbb hex string, or null if the colorRange config is invalid\n * (bad hex colors, invalid value range, missing/non-numeric property).\n */\nfunction getInterpolatedColor(\n colorRange: ColorRange,\n graphItem: NodeData | RelData,\n): string | null {\n const {\n onProperty,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n // min/max can be inverted, we need to now which one is bigger\n const actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n\n // Validate mid stop if provided\n let midRgb: RgbColor | undefined = undefined;\n if (midValue !== undefined && midColor !== undefined) {\n const isMidInRange =\n actualMinValue <= midValue && midValue <= actualMaxValue;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const prop = graphItem.properties[onProperty];\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number') {\n return null;\n }\n\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, rawValue),\n );\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && midValue !== undefined) {\n const t = getWeight(minValue, midValue, clampedValue);\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t = getWeight(midValue, maxValue, clampedValue);\n rgb = lerpColor(midRgb, maxRgb, t);\n }\n } else {\n const t = getWeight(minValue, maxValue, clampedValue);\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\n/**\n * Interpolates a numeric size/width from a range based on a graph item's property value.\n * Returns the interpolated number, or null if the property is missing or non-numeric.\n */\nfunction getInterpolatedSize(\n prop: PortableProperty | undefined,\n minValue: number,\n maxValue: number,\n minOut: number,\n maxOut: number,\n): number | null {\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number') {\n return null;\n }\n\n const actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, rawValue),\n );\n const t = getWeight(minValue, maxValue, clampedValue);\n return minOut * (1 - t) + maxOut * t;\n}\n\nfunction extractPropertyValue(\n prop: PortableProperty,\n): string | number | boolean | null {\n switch (prop.type) {\n case 'string':\n return JSON.parse(prop.stringified);\n case 'number':\n case 'integer':\n case 'float':\n return Number(prop.stringified);\n case 'boolean':\n case 'Boolean':\n return prop.stringified === 'true';\n case 'null':\n return null;\n default:\n return prop.stringified;\n }\n}\n\n/**\n * Three-valued logic type matching Cypher/SQL semantics.\n * - `true`: condition is satisfied\n * - `false`: condition is not satisfied\n * - `null`: condition is unknown (e.g., comparing with null/missing property)\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\ntype Ternary = boolean | null;\n\n/**\n * Evaluates a WHERE clause using three-valued logic matching Cypher semantics.\n *\n * From Neo4j Cypher Manual:\n * - Comparing any value to `null` results in `null`, not `true` or `false`\n * - Accessing a non-existent property returns `null`\n * - In WHERE clauses, only `true` passes; both `false` and `null` exclude the row\n *\n * Three-valued logic rules:\n * - NOT null → null\n * - true AND null → null, false AND null → false\n * - true OR null → true, false OR null → null\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction evaluateWhere(node: NodeData | RelData, where?: Where): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = evaluateValue(left, node);\n const rightVal = evaluateValue(right, node);\n // In Cypher, null = null → null (not true)\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n // Cypher: NOT null → null\n const isMatch = evaluateWhere(node, where.not);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n const [left, right] = where.lessThan;\n return safeCompare(left, right, node, (a, b) => a < b);\n }\n\n if ('lessThanOrEqual' in where) {\n const [left, right] = where.lessThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a <= b);\n }\n\n if ('greaterThan' in where) {\n const [left, right] = where.greaterThan;\n return safeCompare(left, right, node, (a, b) => a > b);\n }\n\n if ('greaterThanOrEqual' in where) {\n const [left, right] = where.greaterThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a >= b);\n }\n\n if ('contains' in where) {\n const [left, right] = where.contains;\n return safeStringCompare(left, right, node, (a, b) => a.includes(b));\n }\n\n if ('startsWith' in where) {\n const [left, right] = where.startsWith;\n return safeStringCompare(left, right, node, (a, b) => a.startsWith(b));\n }\n\n if ('endsWith' in where) {\n const [left, right] = where.endsWith;\n return safeStringCompare(left, right, node, (a, b) => a.endsWith(b));\n }\n\n if ('isNull' in where) {\n // IS NULL returns true/false (never null)\n const value = evaluateValue(where.isNull, node);\n return value === null;\n }\n\n if ('and' in where) {\n // Cypher three-valued AND:\n // - If any is false → false\n // - Else if any is null → null\n // - Else → true\n let hasNull = false;\n for (const r of where.and) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n // Cypher three-valued OR:\n // - If any is true → true\n // - Else if any is null → null\n // - Else → false\n let hasNull = false;\n for (const r of where.or) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n if ('label' in where) {\n if ('labelsSorted' in node) {\n return where.label === null || node.labelsSorted.includes(where.label);\n }\n return false;\n }\n\n if ('reltype' in where) {\n if ('type' in node) {\n return where.reltype === null || (node as RelData).type === where.reltype;\n }\n return false;\n }\n\n if ('property' in where) {\n return where.property === null || where.property in node.properties;\n }\n\n return false;\n}\n\nfunction evaluateRelStyle(\n apply: Style,\n rel: RelData,\n): EvaluatedNvlRelationshipStyle {\n const result: EvaluatedNvlRelationshipStyle = {\n ...apply,\n captions: apply.captions?.map((caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: rel.type };\n }\n\n if ('property' in value) {\n const prop = rel.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: rel.id };\n }),\n };\n\n if (apply.colorRange !== undefined) {\n const interpolated = getInterpolatedColor(apply.colorRange, rel);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n if (apply.relWidthRange !== undefined) {\n const { onProperty, minValue, maxValue, minWidth, maxWidth } =\n apply.relWidthRange;\n const interpolated = getInterpolatedSize(\n rel.properties[onProperty],\n minValue,\n maxValue,\n minWidth,\n maxWidth,\n );\n if (interpolated !== null) {\n result.width = interpolated;\n }\n }\n\n return result;\n}\n\n/**\n * Safely compare two values using Cypher's three-valued logic.\n * Returns `null` if either operand is null (matching Cypher semantics).\n *\n * From Neo4j Cypher Manual:\n * \"Comparing any value to `null` using `=` or `<>` results in `null`\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction safeCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (\n a: NonNullable<CypherValue>,\n b: NonNullable<CypherValue>,\n ) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\n/**\n * String comparison using Cypher semantics.\n * Returns `null` if either operand is null OR not a string.\n *\n * From Neo4j Cypher Manual:\n * \"When these operators are applied to non-string values, they return `null`\n * instead of attempting type coercion.\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/expressions/predicates/string-operators/\n */\nfunction safeStringCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (a: string, b: string) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n // Return null if either is null or not a string (no type coercion)\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateValue(\n value: Value,\n graphItem: NodeData | RelData,\n): CypherValue {\n if (typeof value === 'object' && value !== null) {\n if ('property' in value) {\n if (value.property === null) {\n return null;\n }\n const prop = graphItem.properties[value.property];\n if (prop === undefined) {\n return null;\n }\n return extractPropertyValue(prop);\n }\n if ('label' in value) {\n if ('labelsSorted' in graphItem) {\n return (\n value.label === null || graphItem.labelsSorted.includes(value.label)\n );\n }\n return false;\n }\n if ('reltype' in value) {\n if ('type' in graphItem) {\n return (\n value.reltype === null ||\n (graphItem as RelData).type === value.reltype\n );\n }\n return false;\n }\n }\n\n return value;\n}\n\n// Default caption selection logic\nconst captionPriorityOrder = [\n /^name$/i,\n /^title$/i,\n /^label$/i,\n /name$/i,\n /description$/i,\n /^.+/,\n];\n\nfunction getDefaultNodeCaption(node: NodeData): Caption {\n const propertyKeys = Object.keys(node.properties);\n\n for (const regex of captionPriorityOrder) {\n const matchingKey = propertyKeys.find((key) => regex.test(key));\n if (matchingKey !== undefined) {\n const prop = node.properties[matchingKey];\n if (prop !== undefined) {\n return { value: { property: matchingKey } };\n }\n }\n }\n\n if (node.labelsSorted[0] !== undefined) {\n return { value: { useType: true } };\n }\n\n return { value: node.id };\n}\n\nfunction evaluateNodeStyle(\n apply: Style,\n node: NodeData,\n): EvaluatedNvlNodeStyle {\n const result: EvaluatedNvlNodeStyle = {\n ...apply,\n captions: (apply.captions ?? [getDefaultNodeCaption(node)]).map(\n (caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: node.labelsSorted[0] };\n }\n\n if ('property' in value) {\n const prop = node.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: node.labelsSorted[0] };\n },\n ),\n };\n\n if (apply.colorRange !== undefined) {\n const interpolated = getInterpolatedColor(apply.colorRange, node);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n if (apply.nodeSizeRange !== undefined) {\n const { onProperty, minValue, maxValue, minSize, maxSize } =\n apply.nodeSizeRange;\n const interpolated = getInterpolatedSize(\n node.properties[onProperty],\n minValue,\n maxValue,\n minSize,\n maxSize,\n );\n if (interpolated !== null) {\n result.size = interpolated;\n }\n }\n\n return result;\n}\n\nfunction createRelStyleFunction(\n rules: StyleRule[],\n): (rel: RelData) => EvaluatedNvlRelationshipStyle {\n return (rel: RelData) => {\n const style: Style = {};\n\n // evaluateWhere uses Cypher-style three-valued logic (true/false/null).\n // Only `true` passes; both `false` and `null` (unknown) skip the rule.\n for (const rule of rules) {\n // Check if the rule applies to this relationship\n if ('reltype' in rule.match) {\n const isReltypeMatch =\n rule.match.reltype === null || rel.type === rule.match.reltype;\n\n if (isReltypeMatch && evaluateWhere(rel, rule.where) === true) {\n // Merge the style properties (later rules override earlier ones)\n Object.assign(style, rule.apply);\n }\n }\n }\n\n return evaluateRelStyle(style, rel);\n };\n}\n\nexport type CompiledStyleRules = {\n byType: (type: string) => (rel: RelData) => EvaluatedNvlRelationshipStyle;\n styleMatchers: StyleMatchers;\n byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;\n};\n\nexport const DEFAULT_REL_COLOR = tokens.palette.neutral['40'];\nconst NO_LABEL_FALLBACK_COLOR = tokens.palette.neutral['40'];\n\nfunction createByLabelSetFunction(\n styleMatchers: StyleMatchers,\n): (node: NodeData) => EvaluatedNvlNodeStyle {\n const defaultColorCache = new Map<string, string>();\n const sortedRulesCache = new Map<string, StyleRule[]>();\n const mergedStyleCache = new Map<string, Style>();\n\n return (node: NodeData) => {\n const labelSetKey = node.labelsSorted.join('\\0');\n\n // Fast path: if all rules for this label set are where-free,\n // the merged style is identical for every node with the same labels.\n const cachedStyle = mergedStyleCache.get(labelSetKey);\n if (cachedStyle !== undefined) {\n return evaluateNodeStyle(cachedStyle, node);\n }\n\n // Memoize default color by first label\n const labelForDefaultColor = node.labelsSorted[0] ?? null;\n let defaultColor: string;\n if (labelForDefaultColor === null) {\n defaultColor = NO_LABEL_FALLBACK_COLOR;\n } else {\n let cached = defaultColorCache.get(labelForDefaultColor);\n if (cached === undefined) {\n cached =\n calculateDefaultNodeColors(labelForDefaultColor).backgroundColor;\n defaultColorCache.set(labelForDefaultColor, cached);\n }\n defaultColor = cached;\n }\n\n // Cache sorted rules by label set (avoids repeated allocation + sort)\n let sortedRules = sortedRulesCache.get(labelSetKey);\n if (sortedRules === undefined) {\n const matchingRules: StyleRule[] = [...styleMatchers.globalLabelRules];\n for (const label of node.labelsSorted) {\n const labelRules = styleMatchers.rulesByLabel.get(label);\n if (labelRules) {\n matchingRules.push(...labelRules);\n }\n }\n sortedRules = matchingRules.toSorted(compareByPriorityAscending);\n sortedRulesCache.set(labelSetKey, sortedRules);\n }\n\n // Evaluate rules, tracking whether all are where-free\n const collectStyles: Style = { color: defaultColor };\n let isAllWhereFree = true;\n for (const rule of sortedRules) {\n if (rule.where !== undefined) {\n isAllWhereFree = false;\n if (evaluateWhere(node, rule.where) === true) {\n Object.assign(collectStyles, rule.apply);\n }\n } else {\n Object.assign(collectStyles, rule.apply);\n }\n }\n\n // When all rules are where-free, the merged style depends only on labels.\n // Cache it so subsequent nodes with the same label set skip rule iteration.\n if (isAllWhereFree) {\n mergedStyleCache.set(labelSetKey, collectStyles);\n }\n\n return evaluateNodeStyle(collectStyles, node);\n };\n}\n\nconst DEFAULT_REL_STYLE: StyleRule = {\n match: { reltype: null },\n apply: {\n color: DEFAULT_REL_COLOR,\n captions: [{ value: { useType: true } }],\n },\n};\n\nexport function compileStyleRules(\n styleRules: StyleRule[] | null | undefined,\n): CompiledStyleRules {\n const styleMatchers = collectStyleMatchers(styleRules);\n\n // Lazily build and cache a style function per relationship type\n const cache = new Map<\n string,\n (rel: RelData) => EvaluatedNvlRelationshipStyle\n >();\n const byType = (type: string) => {\n let fn = cache.get(type);\n if (fn === undefined) {\n const rules = styleMatchers.rulesByType.get(type) ?? [];\n fn = createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...styleMatchers.globalReltypeRules,\n ...rules,\n ]);\n cache.set(type, fn);\n }\n return fn;\n };\n\n const byLabelSet = createByLabelSetFunction(styleMatchers);\n\n return { byLabelSet, byType, styleMatchers };\n}\n"]}
|
|
@@ -111,6 +111,32 @@ export const ColorRangeSchema = z.object({
|
|
|
111
111
|
midValue: z.number().optional(),
|
|
112
112
|
midColor: z.string().optional(),
|
|
113
113
|
});
|
|
114
|
+
/**
|
|
115
|
+
* Size interpolation for nodes based on a continuous numeric property value.
|
|
116
|
+
* Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].
|
|
117
|
+
* If the property is missing or non-numeric, nodeSizeRange is silently ignored —
|
|
118
|
+
* other style properties still apply.
|
|
119
|
+
*/
|
|
120
|
+
export const NodeSizeRangeSchema = z.object({
|
|
121
|
+
onProperty: z.string(),
|
|
122
|
+
minValue: z.number(),
|
|
123
|
+
maxValue: z.number(),
|
|
124
|
+
minSize: z.number(),
|
|
125
|
+
maxSize: z.number(),
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* Width interpolation for relationships based on a continuous numeric property value.
|
|
129
|
+
* Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].
|
|
130
|
+
* If the property is missing or non-numeric, relWidthRange is silently ignored —
|
|
131
|
+
* other style properties still apply.
|
|
132
|
+
*/
|
|
133
|
+
export const RelWidthRangeSchema = z.object({
|
|
134
|
+
onProperty: z.string(),
|
|
135
|
+
minValue: z.number(),
|
|
136
|
+
maxValue: z.number(),
|
|
137
|
+
minWidth: z.number(),
|
|
138
|
+
maxWidth: z.number(),
|
|
139
|
+
});
|
|
114
140
|
export const StyleSchema = z.object({
|
|
115
141
|
captionAlign: z.enum(['top', 'bottom', 'center']).optional(),
|
|
116
142
|
captionSize: z.number().optional(),
|
|
@@ -118,7 +144,9 @@ export const StyleSchema = z.object({
|
|
|
118
144
|
color: z.string().optional(),
|
|
119
145
|
colorRange: ColorRangeSchema.optional(),
|
|
120
146
|
icon: z.string().optional(),
|
|
147
|
+
nodeSizeRange: NodeSizeRangeSchema.optional(),
|
|
121
148
|
overlayIcon: NvlOverlayIconSchema.optional(),
|
|
149
|
+
relWidthRange: RelWidthRangeSchema.optional(),
|
|
122
150
|
size: z.number().optional(),
|
|
123
151
|
width: z.number().optional(),
|
|
124
152
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,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C,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,MAAwC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,GAA2C;IAE3C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,MAAgD,CAAC;AAC1D,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Node, type Relationship } from '@neo4j-nvl/base';\nimport { z } from 'zod';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n *\n * Some simple examples of rules:\n * - Match all nodes with label \"Person\" and apply red color\n * { match: { label: \"Person\" }, apply: { color: \"red\" } }\n *\n * - Match all relationships with type \"KNOWS\" which have the property \"name\" equal to \"John\" and apply width 10\n * { match: { reltype: \"KNOWS\" }, where: { equal: [{ property: \"name\" }, \"John\"] }, apply: { width: 10 } }\n */\n\n// Selector schemas. This is what can go under the `match` key.\nconst LabelSelectorSchema = z.object({\n label: z.string().nullable(),\n});\n\nconst ReltypeSelectorSchema = z.object({\n reltype: z.string().nullable(),\n});\n\nconst PropertySelectorSchema = z.object({\n property: z.string(),\n});\n\nexport const SelectorSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\ntype Selector = z.infer<typeof SelectorSchema>;\n\nexport const MatchSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\n\n// Schemas for the values that can go under the `where` key. Starts with defining the literal values.\nexport const CypherValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}) or a literal value (string, number, boolean, null).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\n\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous numeric property value.\n * Colors must be a standard hex string (#rrggbb).\n * If the property is missing, non-numeric, or any color is invalid, the\n * colorRange is silently ignored — other style properties still apply.\n */\nexport const ColorRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n minColor: z.string(),\n maxValue: z.number(),\n maxColor: z.string(),\n midValue: z.number().optional(),\n midColor: z.string().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\nexport const StyleSchema = z.object({\n captionAlign: z.enum(['top', 'bottom', 'center']).optional(),\n captionSize: z.number().optional(),\n captions: z.array(NvlCaptionSchema).optional(),\n color: z.string().optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: z.string().optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n size: z.number().optional(),\n width: z.number().optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\nexport const StyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n disabled: z.boolean().optional(),\n priority: z.number().optional(),\n});\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\n\n// Evaluated style values that NVL expects\ntype NodeStyleKey =\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign';\n\ntype RelStyleKey =\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon';\n\nexport type EvaluatedNvlNodeStyle = Pick<Node, NodeStyleKey>;\nexport type EvaluatedNvlRelationshipStyle = Pick<Relationship, RelStyleKey>;\n\nconst NODE_STYLE_KEYS: readonly NodeStyleKey[] = [\n 'color',\n 'size',\n 'icon',\n 'overlayIcon',\n 'captions',\n 'captionSize',\n 'captionAlign',\n];\n\nconst REL_STYLE_KEYS: readonly RelStyleKey[] = [\n 'color',\n 'width',\n 'captions',\n 'captionSize',\n 'captionAlign',\n 'overlayIcon',\n];\n\n/**\n * Extract consumer-set style properties from a node.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerNodeStyles(\n node: Partial<EvaluatedNvlNodeStyle>,\n): Partial<EvaluatedNvlNodeStyle> {\n const result: Record<string, unknown> = {};\n for (const key of NODE_STYLE_KEYS) {\n if (node[key] !== undefined) {\n result[key] = node[key];\n }\n }\n return result as Partial<EvaluatedNvlNodeStyle>;\n}\n\n/**\n * Extract consumer-set style properties from a relationship.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerRelationshipStyles(\n rel: Partial<EvaluatedNvlRelationshipStyle>,\n): Partial<EvaluatedNvlRelationshipStyle> {\n const result: Record<string, unknown> = {};\n for (const key of REL_STYLE_KEYS) {\n if (rel[key] !== undefined) {\n result[key] = rel[key];\n }\n }\n return result as Partial<EvaluatedNvlRelationshipStyle>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC;IACpC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC;IACjC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAEH,qGAAqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC;IACvC,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;CACT,CAAC,CAAC;AAGH,MAAM,CAAC,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CACpC,IAAoC;IAEpC,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,MAAwC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,GAA2C;IAE3C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,MAAgD,CAAC;AAC1D,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Node, type Relationship } from '@neo4j-nvl/base';\nimport { z } from 'zod';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n *\n * Some simple examples of rules:\n * - Match all nodes with label \"Person\" and apply red color\n * { match: { label: \"Person\" }, apply: { color: \"red\" } }\n *\n * - Match all relationships with type \"KNOWS\" which have the property \"name\" equal to \"John\" and apply width 10\n * { match: { reltype: \"KNOWS\" }, where: { equal: [{ property: \"name\" }, \"John\"] }, apply: { width: 10 } }\n */\n\n// Selector schemas. This is what can go under the `match` key.\nconst LabelSelectorSchema = z.object({\n label: z.string().nullable(),\n});\n\nconst ReltypeSelectorSchema = z.object({\n reltype: z.string().nullable(),\n});\n\nconst PropertySelectorSchema = z.object({\n property: z.string(),\n});\n\nexport const SelectorSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\ntype Selector = z.infer<typeof SelectorSchema>;\n\nexport const MatchSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\n\n// Schemas for the values that can go under the `where` key. Starts with defining the literal values.\nexport const CypherValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}) or a literal value (string, number, boolean, null).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\n\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous numeric property value.\n * Colors must be a standard hex string (#rrggbb).\n * If the property is missing, non-numeric, or any color is invalid, the\n * colorRange is silently ignored — other style properties still apply.\n */\nexport const ColorRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n minColor: z.string(),\n maxValue: z.number(),\n maxColor: z.string(),\n midValue: z.number().optional(),\n midColor: z.string().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\n/**\n * Size interpolation for nodes based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].\n * If the property is missing or non-numeric, nodeSizeRange is silently ignored —\n * other style properties still apply.\n */\nexport const NodeSizeRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minSize: z.number(),\n maxSize: z.number(),\n});\nexport type NodeSizeRange = z.infer<typeof NodeSizeRangeSchema>;\n\n/**\n * Width interpolation for relationships based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].\n * If the property is missing or non-numeric, relWidthRange is silently ignored —\n * other style properties still apply.\n */\nexport const RelWidthRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minWidth: z.number(),\n maxWidth: z.number(),\n});\nexport type RelWidthRange = z.infer<typeof RelWidthRangeSchema>;\n\nexport const StyleSchema = z.object({\n captionAlign: z.enum(['top', 'bottom', 'center']).optional(),\n captionSize: z.number().optional(),\n captions: z.array(NvlCaptionSchema).optional(),\n color: z.string().optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: z.string().optional(),\n nodeSizeRange: NodeSizeRangeSchema.optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n relWidthRange: RelWidthRangeSchema.optional(),\n size: z.number().optional(),\n width: z.number().optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\nexport const StyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n disabled: z.boolean().optional(),\n priority: z.number().optional(),\n});\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\n\n// Evaluated style values that NVL expects\ntype NodeStyleKey =\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign';\n\ntype RelStyleKey =\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon';\n\nexport type EvaluatedNvlNodeStyle = Pick<Node, NodeStyleKey>;\nexport type EvaluatedNvlRelationshipStyle = Pick<Relationship, RelStyleKey>;\n\nconst NODE_STYLE_KEYS: readonly NodeStyleKey[] = [\n 'color',\n 'size',\n 'icon',\n 'overlayIcon',\n 'captions',\n 'captionSize',\n 'captionAlign',\n];\n\nconst REL_STYLE_KEYS: readonly RelStyleKey[] = [\n 'color',\n 'width',\n 'captions',\n 'captionSize',\n 'captionAlign',\n 'overlayIcon',\n];\n\n/**\n * Extract consumer-set style properties from a node.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerNodeStyles(\n node: Partial<EvaluatedNvlNodeStyle>,\n): Partial<EvaluatedNvlNodeStyle> {\n const result: Record<string, unknown> = {};\n for (const key of NODE_STYLE_KEYS) {\n if (node[key] !== undefined) {\n result[key] = node[key];\n }\n }\n return result as Partial<EvaluatedNvlNodeStyle>;\n}\n\n/**\n * Extract consumer-set style properties from a relationship.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerRelationshipStyles(\n rel: Partial<EvaluatedNvlRelationshipStyle>,\n): Partial<EvaluatedNvlRelationshipStyle> {\n const result: Record<string, unknown> = {};\n for (const key of REL_STYLE_KEYS) {\n if (rel[key] !== undefined) {\n result[key] = rel[key];\n }\n }\n return result as Partial<EvaluatedNvlRelationshipStyle>;\n}\n"]}
|
|
@@ -22,4 +22,4 @@ import { type StyleRule } from '../styling/style-types';
|
|
|
22
22
|
export declare const colorRangeStyleRules: StyleRule[];
|
|
23
23
|
declare const Component: () => import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
export default Component;
|
|
25
|
-
//# sourceMappingURL=graph-visualization-
|
|
25
|
+
//# sourceMappingURL=graph-visualization-range-styling.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-visualization-range-styling.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-range-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAiExD,eAAO,MAAM,oBAAoB,EAAE,SAAS,EAI3C,CAAC;AAEF,QAAA,MAAM,SAAS,+CAWd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -23,7 +23,7 @@ export { default as GraphVisualizationCustom } from './graph-visualization-custo
|
|
|
23
23
|
export { default as GraphVisualizationDefault } from './graph-visualization-default.story';
|
|
24
24
|
export { default as GraphVisualizationHighlighting } from './graph-visualization-highlighting.story';
|
|
25
25
|
export { default as GraphVisualizationMaximalist } from './graph-visualization-maximalist.story';
|
|
26
|
-
export { default as
|
|
26
|
+
export { default as GraphVisualizationRangeStyling } from './graph-visualization-range-styling.story';
|
|
27
27
|
export { default as GraphVisualizationRuleBasedStylingAdvanced } from './graph-visualization-rule-based-styling-advanced.story';
|
|
28
28
|
export { default as GraphVisualizationRuleBasedStyling } from './graph-visualization-rule-based-styling.story';
|
|
29
29
|
export { default as GraphVisualizationSearch } from './graph-visualization-search.story';
|
|
@@ -38,6 +38,6 @@ export declare const GraphVisualizationSimpleStylingSrc: string;
|
|
|
38
38
|
export declare const GraphVisualizationRuleBasedStylingSrc: string;
|
|
39
39
|
export declare const GraphVisualizationSearchSrc: string;
|
|
40
40
|
export declare const GraphVisualizationRuleBasedStylingAdvancedSrc: string;
|
|
41
|
-
export declare const
|
|
41
|
+
export declare const GraphVisualizationRangeStylingSrc: string;
|
|
42
42
|
export declare const PreviewGraphVisualizationSrc: string;
|
|
43
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stories/index.ts"],"names":[],"mappings":"AA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AO,MAAM,4BAA4B,QAExC,CAAC;AAEF,eAAO,MAAM,8BAA8B,QAE1C,CAAC;AAEF,eAAO,MAAM,+BAA+B,QAE3C,CAAC;AAEF,eAAO,MAAM,2BAA2B,QAEvC,CAAC;AAEF,eAAO,MAAM,iCAAiC,QAE7C,CAAC;AAEF,eAAO,MAAM,kCAAkC,QAE9C,CAAC;AAEF,eAAO,MAAM,qCAAqC,QAEjD,CAAC;AAEF,eAAO,MAAM,2BAA2B,QAEvC,CAAC;AAEF,eAAO,MAAM,6CAA6C,QACa,CAAC;AAExE,eAAO,MAAM,iCAAiC,QAE7C,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAExC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-graph-styles.d.ts","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,OAAO,EACb,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAElC,KAAK,SAAS,EAGf,MAAM,eAAe,CAAC;AAEvB,KAAK,aAAa,GAAG;IACnB,gBAAgB,EAAE,SAAS,EAAE,CAAC;IAC9B,kBAAkB,EAAE,SAAS,EAAE,CAAC;IAChC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACvC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;CACvC,CAAC;
|
|
1
|
+
{"version":3,"file":"compile-graph-styles.d.ts","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,OAAO,EACb,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAElC,KAAK,SAAS,EAGf,MAAM,eAAe,CAAC;AAEvB,KAAK,aAAa,GAAG;IACnB,gBAAgB,EAAE,SAAS,EAAE,CAAC;IAC9B,kBAAkB,EAAE,SAAS,EAAE,CAAC;IAChC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACvC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;CACvC,CAAC;AAqmBF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,OAAO,KAAK,6BAA6B,CAAC;IAC1E,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,qBAAqB,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAA+B,CAAC;AAiF9D,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,SAAS,GACzC,kBAAkB,CAyBpB"}
|
|
@@ -113,6 +113,34 @@ export declare const ColorRangeSchema: z.ZodObject<{
|
|
|
113
113
|
midColor: z.ZodOptional<z.ZodString>;
|
|
114
114
|
}, z.core.$strip>;
|
|
115
115
|
export type ColorRange = z.infer<typeof ColorRangeSchema>;
|
|
116
|
+
/**
|
|
117
|
+
* Size interpolation for nodes based on a continuous numeric property value.
|
|
118
|
+
* Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].
|
|
119
|
+
* If the property is missing or non-numeric, nodeSizeRange is silently ignored —
|
|
120
|
+
* other style properties still apply.
|
|
121
|
+
*/
|
|
122
|
+
export declare const NodeSizeRangeSchema: z.ZodObject<{
|
|
123
|
+
onProperty: z.ZodString;
|
|
124
|
+
minValue: z.ZodNumber;
|
|
125
|
+
maxValue: z.ZodNumber;
|
|
126
|
+
minSize: z.ZodNumber;
|
|
127
|
+
maxSize: z.ZodNumber;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
export type NodeSizeRange = z.infer<typeof NodeSizeRangeSchema>;
|
|
130
|
+
/**
|
|
131
|
+
* Width interpolation for relationships based on a continuous numeric property value.
|
|
132
|
+
* Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].
|
|
133
|
+
* If the property is missing or non-numeric, relWidthRange is silently ignored —
|
|
134
|
+
* other style properties still apply.
|
|
135
|
+
*/
|
|
136
|
+
export declare const RelWidthRangeSchema: z.ZodObject<{
|
|
137
|
+
onProperty: z.ZodString;
|
|
138
|
+
minValue: z.ZodNumber;
|
|
139
|
+
maxValue: z.ZodNumber;
|
|
140
|
+
minWidth: z.ZodNumber;
|
|
141
|
+
maxWidth: z.ZodNumber;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
export type RelWidthRange = z.infer<typeof RelWidthRangeSchema>;
|
|
116
144
|
export declare const StyleSchema: z.ZodObject<{
|
|
117
145
|
captionAlign: z.ZodOptional<z.ZodEnum<{
|
|
118
146
|
top: "top";
|
|
@@ -140,11 +168,25 @@ export declare const StyleSchema: z.ZodObject<{
|
|
|
140
168
|
midColor: z.ZodOptional<z.ZodString>;
|
|
141
169
|
}, z.core.$strip>>;
|
|
142
170
|
icon: z.ZodOptional<z.ZodString>;
|
|
171
|
+
nodeSizeRange: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
onProperty: z.ZodString;
|
|
173
|
+
minValue: z.ZodNumber;
|
|
174
|
+
maxValue: z.ZodNumber;
|
|
175
|
+
minSize: z.ZodNumber;
|
|
176
|
+
maxSize: z.ZodNumber;
|
|
177
|
+
}, z.core.$strip>>;
|
|
143
178
|
overlayIcon: z.ZodOptional<z.ZodObject<{
|
|
144
179
|
url: z.ZodString;
|
|
145
180
|
position: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
146
181
|
size: z.ZodOptional<z.ZodNumber>;
|
|
147
182
|
}, z.core.$strip>>;
|
|
183
|
+
relWidthRange: z.ZodOptional<z.ZodObject<{
|
|
184
|
+
onProperty: z.ZodString;
|
|
185
|
+
minValue: z.ZodNumber;
|
|
186
|
+
maxValue: z.ZodNumber;
|
|
187
|
+
minWidth: z.ZodNumber;
|
|
188
|
+
maxWidth: z.ZodNumber;
|
|
189
|
+
}, z.core.$strip>>;
|
|
148
190
|
size: z.ZodOptional<z.ZodNumber>;
|
|
149
191
|
width: z.ZodOptional<z.ZodNumber>;
|
|
150
192
|
}, z.core.$strip>;
|
|
@@ -185,11 +227,25 @@ export declare const StyleRuleSchema: z.ZodObject<{
|
|
|
185
227
|
midColor: z.ZodOptional<z.ZodString>;
|
|
186
228
|
}, z.core.$strip>>;
|
|
187
229
|
icon: z.ZodOptional<z.ZodString>;
|
|
230
|
+
nodeSizeRange: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
onProperty: z.ZodString;
|
|
232
|
+
minValue: z.ZodNumber;
|
|
233
|
+
maxValue: z.ZodNumber;
|
|
234
|
+
minSize: z.ZodNumber;
|
|
235
|
+
maxSize: z.ZodNumber;
|
|
236
|
+
}, z.core.$strip>>;
|
|
188
237
|
overlayIcon: z.ZodOptional<z.ZodObject<{
|
|
189
238
|
url: z.ZodString;
|
|
190
239
|
position: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
191
240
|
size: z.ZodOptional<z.ZodNumber>;
|
|
192
241
|
}, z.core.$strip>>;
|
|
242
|
+
relWidthRange: z.ZodOptional<z.ZodObject<{
|
|
243
|
+
onProperty: z.ZodString;
|
|
244
|
+
minValue: z.ZodNumber;
|
|
245
|
+
maxValue: z.ZodNumber;
|
|
246
|
+
minWidth: z.ZodNumber;
|
|
247
|
+
maxWidth: z.ZodNumber;
|
|
248
|
+
}, z.core.$strip>>;
|
|
193
249
|
size: z.ZodOptional<z.ZodNumber>;
|
|
194
250
|
width: z.ZodOptional<z.ZodNumber>;
|
|
195
251
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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AAqB,GAAG,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAC7D,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;AAqB5E;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,OAAO,CAAC,qBAAqB,CAAC,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAQhC;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,OAAO,CAAC,6BAA6B,CAAC,GAC1C,OAAO,CAAC,6BAA6B,CAAC,CAQxC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react-graph",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.41",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of the graph visualization from Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@neo4j-nvl/base": "^1.0.0",
|
|
58
58
|
"@neo4j-nvl/interaction-handlers": "^1.0.0",
|
|
59
59
|
"@neo4j-nvl/react": "^1.0.0",
|
|
60
|
-
"@neo4j-ndl/
|
|
61
|
-
"@neo4j-ndl/
|
|
60
|
+
"@neo4j-ndl/react": "^4.13.0",
|
|
61
|
+
"@neo4j-ndl/base": "^4.13.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"classnames": "2.5.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-color-range-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-color-range-styling.story.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gEAA4D;AAE5D,6CAAoE;AAEpE,MAAM,YAAY,GAAgB;IAChC;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;Q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K,EAAE,SAAS,EAAE,EAAE;IACzD,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;CACzD,CAAC;AAEW,QAAA,oBAAoB,GAAgB;IAC/C,GAAG,YAAY;IACf,GAAG,cAAc;IACjB,GAAG,cAAc;CAClB,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,gCAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAC7B,uBAAC,wCAAkB,IACjB,KAAK,EAAE,+BAAkB,CAAC,KAAK,EAC/B,IAAI,EAAE,+BAAkB,CAAC,IAAI,EAC7B,SAAS,EAAE,6BAAgB,EAC3B,aAAa,EAAE,4BAAoB,GACnC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { GraphVisualization } from '../graph-visualization';\nimport { type StyleRule } from '../styling/style-types';\nimport { advancedStoryGraph, containerClasses } from './story-data';\n\nconst pokemonRules: StyleRule[] = [\n {\n match: { label: 'Pokemon' },\n apply: {\n colorRange: {\n onProperty: 'level',\n minValue: 1,\n minColor: '#3498db',\n midValue: 45,\n midColor: '#f1c40f',\n maxValue: 88,\n maxColor: '#e74c3c',\n },\n captions: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' Lv', styles: [] },\n { value: { property: 'level' }, styles: [] },\n ],\n },\n },\n];\n\nconst caughtRelRules: StyleRule[] = [\n {\n match: { reltype: 'CAUGHT' },\n apply: {\n colorRange: {\n onProperty: 'level',\n minValue: 1,\n minColor: '#00d2ff',\n maxValue: 40,\n maxColor: '#ff2d78',\n },\n width: 4,\n captions: [\n { value: 'Caught @ Lv', styles: [] },\n { value: { property: 'level' }, styles: ['bold'] },\n ],\n captionSize: 1.5,\n },\n },\n];\n\nconst otherNodeRules: StyleRule[] = [\n { match: { label: 'Trainer' }, apply: { color: '#95a5a6' } },\n { match: { label: 'Type' }, apply: { color: '#bdc3c7' } },\n { match: { label: 'Gym' }, apply: { color: '#bdc3c7' } },\n];\n\nexport const colorRangeStyleRules: StyleRule[] = [\n ...pokemonRules,\n ...caughtRelRules,\n ...otherNodeRules,\n];\n\nconst Component = () => {\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n nodes={advancedStoryGraph.nodes}\n rels={advancedStoryGraph.rels}\n className={containerClasses}\n nvlStyleRules={colorRangeStyleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-color-range-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-color-range-styling.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,YAAY,GAAgB;IAChC;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;QAC3B,KAAK,EAAE;YACL,UAAU,EAAE;gBACV,UAAU,EAAE,OAAO;gBACnB,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,SAAS;gBACnB,QAAQ,EAAE,EAAE;gBACZ,QAAQ,EAAE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M,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,GAAG,YAAY;IACf,GAAG,cAAc;IACjB,GAAG,cAAc;CAClB,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAC7B,KAAC,kBAAkB,IACjB,KAAK,EAAE,kBAAkB,CAAC,KAAK,EAC/B,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAC7B,SAAS,EAAE,gBAAgB,EAC3B,aAAa,EAAE,oBAAoB,GACnC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { GraphVisualization } from '../graph-visualization';\nimport { type StyleRule } from '../styling/style-types';\nimport { advancedStoryGraph, containerClasses } from './story-data';\n\nconst pokemonRules: StyleRule[] = [\n {\n match: { label: 'Pokemon' },\n apply: {\n colorRange: {\n onProperty: 'level',\n minValue: 1,\n minColor: '#3498db',\n midValue: 45,\n midColor: '#f1c40f',\n maxValue: 88,\n maxColor: '#e74c3c',\n },\n captions: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' Lv', styles: [] },\n { value: { property: 'level' }, styles: [] },\n ],\n },\n },\n];\n\nconst caughtRelRules: StyleRule[] = [\n {\n match: { reltype: 'CAUGHT' },\n apply: {\n colorRange: {\n onProperty: 'level',\n minValue: 1,\n minColor: '#00d2ff',\n maxValue: 40,\n maxColor: '#ff2d78',\n },\n width: 4,\n captions: [\n { value: 'Caught @ Lv', styles: [] },\n { value: { property: 'level' }, styles: ['bold'] },\n ],\n captionSize: 1.5,\n },\n },\n];\n\nconst otherNodeRules: StyleRule[] = [\n { match: { label: 'Trainer' }, apply: { color: '#95a5a6' } },\n { match: { label: 'Type' }, apply: { color: '#bdc3c7' } },\n { match: { label: 'Gym' }, apply: { color: '#bdc3c7' } },\n];\n\nexport const colorRangeStyleRules: StyleRule[] = [\n ...pokemonRules,\n ...caughtRelRules,\n ...otherNodeRules,\n];\n\nconst Component = () => {\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n nodes={advancedStoryGraph.nodes}\n rels={advancedStoryGraph.rels}\n className={containerClasses}\n nvlStyleRules={colorRangeStyleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-color-range-styling.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-color-range-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAoDxD,eAAO,MAAM,oBAAoB,EAAE,SAAS,EAI3C,CAAC;AAEF,QAAA,MAAM,SAAS,+CAWd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|