@neo4j-ndl/react-graph 1.5.5 → 2.0.0
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/graph-visualization-context.js.map +1 -1
- package/lib/cjs/graph-visualization.js +1 -1
- package/lib/cjs/graph-visualization.js.map +1 -1
- package/lib/cjs/index.js +5 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/stories/graph-visualization-range-styling.story.js +21 -16
- package/lib/cjs/stories/graph-visualization-range-styling.story.js.map +1 -1
- package/lib/cjs/stories/graph-visualization-rule-based-styling-advanced.story.js +105 -82
- package/lib/cjs/stories/graph-visualization-rule-based-styling-advanced.story.js.map +1 -1
- package/lib/cjs/stories/graph-visualization-rule-based-styling.story.js +15 -13
- package/lib/cjs/stories/graph-visualization-rule-based-styling.story.js.map +1 -1
- package/lib/cjs/stories/graph-visualization-simple-styling.story.js +12 -10
- package/lib/cjs/stories/graph-visualization-simple-styling.story.js.map +1 -1
- package/lib/cjs/stories/graph-visualization-unique-colors-styling.story.js +71 -0
- package/lib/cjs/stories/graph-visualization-unique-colors-styling.story.js.map +1 -0
- package/lib/cjs/stories/index.js +5 -1
- package/lib/cjs/stories/index.js.map +1 -1
- package/lib/cjs/styling/compile-graph-styles.js +143 -60
- package/lib/cjs/styling/compile-graph-styles.js.map +1 -1
- package/lib/cjs/styling/create-vis-data-structures.js.map +1 -1
- package/lib/cjs/styling/parse-style-rules.js +4 -4
- package/lib/cjs/styling/parse-style-rules.js.map +1 -1
- package/lib/cjs/styling/style-types.js +57 -16
- package/lib/cjs/styling/style-types.js.map +1 -1
- package/lib/cjs/styling/use-graph-data.js +1 -1
- package/lib/cjs/styling/use-graph-data.js.map +1 -1
- package/lib/esm/graph-visualization-context.js.map +1 -1
- package/lib/esm/graph-visualization.js +1 -1
- package/lib/esm/graph-visualization.js.map +1 -1
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/stories/graph-visualization-range-styling.story.js +21 -16
- package/lib/esm/stories/graph-visualization-range-styling.story.js.map +1 -1
- package/lib/esm/stories/graph-visualization-rule-based-styling-advanced.story.js +105 -82
- package/lib/esm/stories/graph-visualization-rule-based-styling-advanced.story.js.map +1 -1
- package/lib/esm/stories/graph-visualization-rule-based-styling.story.js +15 -13
- package/lib/esm/stories/graph-visualization-rule-based-styling.story.js.map +1 -1
- package/lib/esm/stories/graph-visualization-simple-styling.story.js +12 -10
- package/lib/esm/stories/graph-visualization-simple-styling.story.js.map +1 -1
- package/lib/esm/stories/graph-visualization-unique-colors-styling.story.js +69 -0
- package/lib/esm/stories/graph-visualization-unique-colors-styling.story.js.map +1 -0
- package/lib/esm/stories/index.js +3 -0
- package/lib/esm/stories/index.js.map +1 -1
- package/lib/esm/styling/compile-graph-styles.js +141 -58
- package/lib/esm/styling/compile-graph-styles.js.map +1 -1
- package/lib/esm/styling/create-vis-data-structures.js.map +1 -1
- package/lib/esm/styling/parse-style-rules.js +5 -5
- package/lib/esm/styling/parse-style-rules.js.map +1 -1
- package/lib/esm/styling/style-types.js +56 -15
- package/lib/esm/styling/style-types.js.map +1 -1
- package/lib/esm/styling/use-graph-data.js +2 -2
- package/lib/esm/styling/use-graph-data.js.map +1 -1
- package/lib/types/graph-visualization-context.d.ts +2 -2
- package/lib/types/graph-visualization-context.d.ts.map +1 -1
- package/lib/types/graph-visualization.d.ts +3 -3
- package/lib/types/graph-visualization.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/stories/graph-visualization-range-styling.story.d.ts +2 -2
- package/lib/types/stories/graph-visualization-range-styling.story.d.ts.map +1 -1
- package/lib/types/stories/graph-visualization-rule-based-styling-advanced.story.d.ts +10 -10
- package/lib/types/stories/graph-visualization-rule-based-styling-advanced.story.d.ts.map +1 -1
- package/lib/types/stories/graph-visualization-rule-based-styling.story.d.ts +2 -2
- package/lib/types/stories/graph-visualization-rule-based-styling.story.d.ts.map +1 -1
- package/lib/types/stories/graph-visualization-simple-styling.story.d.ts +2 -2
- package/lib/types/stories/graph-visualization-simple-styling.story.d.ts.map +1 -1
- package/lib/types/stories/graph-visualization-unique-colors-styling.story.d.ts +23 -0
- package/lib/types/stories/graph-visualization-unique-colors-styling.story.d.ts.map +1 -0
- package/lib/types/stories/index.d.ts +2 -0
- package/lib/types/stories/index.d.ts.map +1 -1
- package/lib/types/styling/compile-graph-styles.d.ts +9 -8
- package/lib/types/styling/compile-graph-styles.d.ts.map +1 -1
- package/lib/types/styling/create-vis-data-structures.d.ts +2 -2
- package/lib/types/styling/create-vis-data-structures.d.ts.map +1 -1
- package/lib/types/styling/parse-style-rules.d.ts +5 -5
- package/lib/types/styling/parse-style-rules.d.ts.map +1 -1
- package/lib/types/styling/style-types.d.ts +113 -51
- package/lib/types/styling/style-types.d.ts.map +1 -1
- package/lib/types/styling/use-graph-data.d.ts +3 -3
- package/lib/types/styling/use-graph-data.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -24,7 +24,7 @@ import { advancedStoryGraph, containerClasses } from './story-data';
|
|
|
24
24
|
export const defaultNodeRules = [
|
|
25
25
|
{
|
|
26
26
|
match: { label: null },
|
|
27
|
-
apply: { size: 10 },
|
|
27
|
+
apply: { size: { value: 10 } },
|
|
28
28
|
},
|
|
29
29
|
];
|
|
30
30
|
export const trainerRules = [
|
|
@@ -33,14 +33,16 @@ export const trainerRules = [
|
|
|
33
33
|
where: { equal: [{ property: 'reputation' }, 'Gym Leader'] },
|
|
34
34
|
priority: 20, // Gym Leaders are special - should override level-based styling
|
|
35
35
|
apply: {
|
|
36
|
-
color: '#9b59b6',
|
|
37
|
-
captions:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
color: { value: '#9b59b6' },
|
|
37
|
+
captions: {
|
|
38
|
+
text: [
|
|
39
|
+
{ value: { property: 'name' }, styles: ['bold'] },
|
|
40
|
+
{ value: ' 🏆', styles: [] },
|
|
41
|
+
{ value: ' Gym Leader', styles: ['italic'] },
|
|
42
|
+
],
|
|
43
|
+
align: 'bottom',
|
|
44
|
+
},
|
|
45
|
+
size: { value: 45 },
|
|
44
46
|
},
|
|
45
47
|
},
|
|
46
48
|
{
|
|
@@ -48,14 +50,16 @@ export const trainerRules = [
|
|
|
48
50
|
where: { greaterThanOrEqual: [{ property: 'level' }, 85] },
|
|
49
51
|
priority: 10, // Base high-level styling
|
|
50
52
|
apply: {
|
|
51
|
-
size: 30,
|
|
52
|
-
captions:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
size: { value: 30 },
|
|
54
|
+
captions: {
|
|
55
|
+
text: [
|
|
56
|
+
{ value: { property: 'name' }, styles: ['bold'] },
|
|
57
|
+
{ value: ' (Lv ', styles: [] },
|
|
58
|
+
{ value: { property: 'level' }, styles: [] },
|
|
59
|
+
{ value: ')', styles: [] },
|
|
60
|
+
],
|
|
61
|
+
size: 2,
|
|
62
|
+
},
|
|
59
63
|
},
|
|
60
64
|
},
|
|
61
65
|
];
|
|
@@ -66,23 +70,27 @@ export const pokemonRules = [
|
|
|
66
70
|
where: { endsWith: [{ property: 'name' }, 'saur'] },
|
|
67
71
|
priority: 50,
|
|
68
72
|
apply: {
|
|
69
|
-
color: '#2ecc71',
|
|
70
|
-
captions:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
color: { value: '#2ecc71' },
|
|
74
|
+
captions: {
|
|
75
|
+
text: [
|
|
76
|
+
{ value: '🌿 ', styles: [] },
|
|
77
|
+
{ value: { property: 'name' }, styles: ['bold', 'italic'] },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
74
80
|
},
|
|
75
81
|
},
|
|
76
82
|
{
|
|
77
83
|
match: { label: 'Pokemon' },
|
|
78
84
|
where: { equal: [{ property: 'is_starter' }, true] },
|
|
79
85
|
apply: {
|
|
80
|
-
color: '#f39c12',
|
|
81
|
-
captions:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
color: { value: '#f39c12' },
|
|
87
|
+
captions: {
|
|
88
|
+
text: [
|
|
89
|
+
{ value: { property: 'name' }, styles: ['bold'] },
|
|
90
|
+
{ value: ' ⭐', styles: [] },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
size: { value: 40 },
|
|
86
94
|
},
|
|
87
95
|
},
|
|
88
96
|
{
|
|
@@ -90,14 +98,16 @@ export const pokemonRules = [
|
|
|
90
98
|
where: { greaterThanOrEqual: [{ property: 'level' }, 85] },
|
|
91
99
|
priority: 30, // High-level Pokemon override starter styling
|
|
92
100
|
apply: {
|
|
93
|
-
color: '#c0392b',
|
|
94
|
-
captions:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
color: { value: '#c0392b' },
|
|
102
|
+
captions: {
|
|
103
|
+
text: [
|
|
104
|
+
{ value: '💪 ', styles: [] },
|
|
105
|
+
{ value: { property: 'name' }, styles: ['bold'] },
|
|
106
|
+
{ value: ' Lv', styles: [] },
|
|
107
|
+
{ value: { property: 'level' }, styles: [] },
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
size: { value: 42 },
|
|
101
111
|
},
|
|
102
112
|
},
|
|
103
113
|
{
|
|
@@ -105,10 +115,12 @@ export const pokemonRules = [
|
|
|
105
115
|
where: { lessThan: [{ property: 'catch_rate' }, 50] },
|
|
106
116
|
priority: 40, // Rare caption is our second highest priority
|
|
107
117
|
apply: {
|
|
108
|
-
captions:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
captions: {
|
|
119
|
+
text: [
|
|
120
|
+
{ value: { property: 'name' }, styles: ['bold'] },
|
|
121
|
+
{ value: ' (Rare)', styles: ['italic'] },
|
|
122
|
+
],
|
|
123
|
+
},
|
|
112
124
|
},
|
|
113
125
|
},
|
|
114
126
|
{
|
|
@@ -121,12 +133,14 @@ export const pokemonRules = [
|
|
|
121
133
|
},
|
|
122
134
|
priority: 15, // Baby Pokemon get special styling
|
|
123
135
|
apply: {
|
|
124
|
-
size: 25,
|
|
125
|
-
color: '#95a5a6',
|
|
126
|
-
captions:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
size: { value: 25 },
|
|
137
|
+
color: { value: '#95a5a6' },
|
|
138
|
+
captions: {
|
|
139
|
+
text: [
|
|
140
|
+
{ value: { property: 'name' }, styles: ['italic'] },
|
|
141
|
+
{ value: ' (Smol)', styles: [] },
|
|
142
|
+
],
|
|
143
|
+
},
|
|
130
144
|
},
|
|
131
145
|
},
|
|
132
146
|
];
|
|
@@ -140,7 +154,7 @@ export const typeRules = [
|
|
|
140
154
|
],
|
|
141
155
|
},
|
|
142
156
|
apply: {
|
|
143
|
-
color: '#27ae60',
|
|
157
|
+
color: { value: '#27ae60' },
|
|
144
158
|
},
|
|
145
159
|
},
|
|
146
160
|
];
|
|
@@ -148,13 +162,15 @@ export const gymRules = [
|
|
|
148
162
|
{
|
|
149
163
|
match: { label: 'Gym' },
|
|
150
164
|
apply: {
|
|
151
|
-
color: '#8e44ad',
|
|
152
|
-
size: 48,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
color: { value: '#8e44ad' },
|
|
166
|
+
size: { value: 48 },
|
|
167
|
+
captions: {
|
|
168
|
+
text: [
|
|
169
|
+
{ value: '🏛️ ', styles: [] },
|
|
170
|
+
{ value: { property: 'name' }, styles: ['bold', 'underline'] },
|
|
171
|
+
],
|
|
172
|
+
align: 'top',
|
|
173
|
+
},
|
|
158
174
|
},
|
|
159
175
|
},
|
|
160
176
|
];
|
|
@@ -163,20 +179,21 @@ export const battledRelRules = [
|
|
|
163
179
|
match: { reltype: 'BATTLED' },
|
|
164
180
|
where: { equal: [{ property: 'won' }, true] },
|
|
165
181
|
apply: {
|
|
166
|
-
color: '#27ae60',
|
|
167
|
-
width: 4,
|
|
168
|
-
captions: [{ value: 'WON BATTLE', styles: ['bold'] }],
|
|
169
|
-
captionSize: 2,
|
|
182
|
+
color: { value: '#27ae60' },
|
|
183
|
+
width: { value: 4 },
|
|
184
|
+
captions: { text: [{ value: 'WON BATTLE', styles: ['bold'] }], size: 2 },
|
|
170
185
|
},
|
|
171
186
|
},
|
|
172
187
|
{
|
|
173
188
|
match: { reltype: 'BATTLED' },
|
|
174
189
|
where: { equal: [{ property: 'won' }, false] },
|
|
175
190
|
apply: {
|
|
176
|
-
color: '#e74c3c',
|
|
177
|
-
width: 2,
|
|
178
|
-
captions:
|
|
179
|
-
|
|
191
|
+
color: { value: '#e74c3c' },
|
|
192
|
+
width: { value: 2 },
|
|
193
|
+
captions: {
|
|
194
|
+
text: [{ value: 'LOST BATTLE', styles: ['italic'] }],
|
|
195
|
+
size: 2,
|
|
196
|
+
},
|
|
180
197
|
},
|
|
181
198
|
},
|
|
182
199
|
];
|
|
@@ -184,13 +201,15 @@ export const caughtRelRules = [
|
|
|
184
201
|
{
|
|
185
202
|
match: { reltype: 'CAUGHT' },
|
|
186
203
|
apply: {
|
|
187
|
-
color: '#e91e63',
|
|
188
|
-
width: 3,
|
|
189
|
-
captions:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
color: { value: '#e91e63' },
|
|
205
|
+
width: { value: 3 },
|
|
206
|
+
captions: {
|
|
207
|
+
text: [
|
|
208
|
+
{ value: 'Caught @ Lv', styles: [] },
|
|
209
|
+
{ value: { property: 'level' }, styles: ['bold'] },
|
|
210
|
+
],
|
|
211
|
+
size: 1.5,
|
|
212
|
+
},
|
|
194
213
|
},
|
|
195
214
|
},
|
|
196
215
|
];
|
|
@@ -198,9 +217,9 @@ export const evolvesToRelRules = [
|
|
|
198
217
|
{
|
|
199
218
|
match: { reltype: 'EVOLVES_TO' },
|
|
200
219
|
apply: {
|
|
201
|
-
color: '#16a085',
|
|
202
|
-
width: 2,
|
|
203
|
-
captions: [{ value: '→', styles: ['bold'] }],
|
|
220
|
+
color: { value: '#16a085' },
|
|
221
|
+
width: { value: 2 },
|
|
222
|
+
captions: { text: [{ value: '→', styles: ['bold'] }] },
|
|
204
223
|
},
|
|
205
224
|
},
|
|
206
225
|
{
|
|
@@ -208,10 +227,12 @@ export const evolvesToRelRules = [
|
|
|
208
227
|
where: { equal: [{ property: 'method' }, 'Level'] },
|
|
209
228
|
priority: 1,
|
|
210
229
|
apply: {
|
|
211
|
-
captions:
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
230
|
+
captions: {
|
|
231
|
+
text: [
|
|
232
|
+
{ value: '→ Lv', styles: [] },
|
|
233
|
+
{ value: { property: 'level' }, styles: ['bold'] },
|
|
234
|
+
],
|
|
235
|
+
},
|
|
215
236
|
},
|
|
216
237
|
},
|
|
217
238
|
{
|
|
@@ -219,11 +240,13 @@ export const evolvesToRelRules = [
|
|
|
219
240
|
where: { not: { equal: [{ property: 'method' }, 'Level'] } },
|
|
220
241
|
priority: 1,
|
|
221
242
|
apply: {
|
|
222
|
-
color: '#8e44ad',
|
|
223
|
-
captions:
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
243
|
+
color: { value: '#8e44ad' },
|
|
244
|
+
captions: {
|
|
245
|
+
text: [
|
|
246
|
+
{ value: '→ ', styles: [] },
|
|
247
|
+
{ value: { property: 'method' }, styles: ['italic'] },
|
|
248
|
+
],
|
|
249
|
+
},
|
|
227
250
|
},
|
|
228
251
|
},
|
|
229
252
|
];
|
|
@@ -238,7 +261,7 @@ export const advancedStyleRules = [
|
|
|
238
261
|
...evolvesToRelRules,
|
|
239
262
|
];
|
|
240
263
|
const Component = () => {
|
|
241
|
-
return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { nodes: advancedStoryGraph.nodes, rels: advancedStoryGraph.rels, className: containerClasses,
|
|
264
|
+
return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { nodes: advancedStoryGraph.nodes, rels: advancedStoryGraph.rels, className: containerClasses, styleRules: advancedStyleRules }) }));
|
|
242
265
|
};
|
|
243
266
|
export default Component;
|
|
244
267
|
//# sourceMappingURL=graph-visualization-rule-based-styling-advanced.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-rule-based-styling-advanced.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-rule-based-styling-advanced.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,CAAC,MAAM,gBAAgB,GAAgB;IAC3C;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;QACtB,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;KACpB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;QAC3B,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,YAAY,CAAC,EAAE;QAC5D,QAAQ,EAAE,EAAE,EAAE,gEAAgE;QAC9E,KAAK,EAAE;YACL,KAAK,EAAE,SAAS;YAChB,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,aAAa,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE;aAC7C;YACD,IAAI,EAAE,EAAE;YACR,YAAY,EAAE,QAAQ;SACvB;KAC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kB,GAAgB;IAC7C,GAAG,gBAAgB;IACnB,GAAG,YAAY;IACf,GAAG,YAAY;IACf,GAAG,SAAS;IACZ,GAAG,QAAQ;IACX,GAAG,eAAe;IAClB,GAAG,cAAc;IACjB,GAAG,iBAAiB;CACrB,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,kBAAkB,GACjC,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\nexport const defaultNodeRules: StyleRule[] = [\n {\n match: { label: null },\n apply: { size: 10 },\n },\n];\n\nexport const trainerRules: StyleRule[] = [\n {\n match: { label: 'Trainer' },\n where: { equal: [{ property: 'reputation' }, 'Gym Leader'] },\n priority: 20, // Gym Leaders are special - should override level-based styling\n apply: {\n color: '#9b59b6',\n captions: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' 🏆', styles: [] },\n { value: ' Gym Leader', styles: ['italic'] },\n ],\n size: 45,\n captionAlign: 'bottom',\n },\n },\n {\n match: { label: 'Trainer' },\n where: { greaterThanOrEqual: [{ property: 'level' }, 85] },\n priority: 10, // Base high-level styling\n apply: {\n size: 30,\n captions: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' (Lv ', styles: [] },\n { value: { property: 'level' }, styles: [] },\n { value: ')', styles: [] },\n ],\n captionSize: 2,\n },\n },\n];\n\nexport const pokemonRules: StyleRule[] = [\n // Make the 'saur family green is our highest priority\n {\n match: { label: 'Pokemon' },\n where: { endsWith: [{ property: 'name' }, 'saur'] },\n priority: 50,\n apply: {\n color: '#2ecc71',\n captions: [\n { value: '🌿 ', styles: [] },\n { value: { property: 'name' }, styles: ['bold', 'italic'] },\n ],\n },\n },\n {\n match: { label: 'Pokemon' },\n where: { equal: [{ property: 'is_starter' }, true] },\n apply: {\n color: '#f39c12',\n captions: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' ⭐', styles: [] },\n ],\n size: 40,\n },\n },\n {\n match: { label: 'Pokemon' },\n where: { greaterThanOrEqual: [{ property: 'level' }, 85] },\n priority: 30, // High-level Pokemon override starter styling\n apply: {\n color: '#c0392b',\n captions: [\n { value: '💪 ', styles: [] },\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' Lv', styles: [] },\n { value: { property: 'level' }, styles: [] },\n ],\n size: 42,\n },\n },\n {\n match: { label: 'Pokemon' },\n where: { lessThan: [{ property: 'catch_rate' }, 50] },\n priority: 40, // Rare caption is our second highest priority\n apply: {\n captions: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' (Rare)', styles: ['italic'] },\n ],\n },\n },\n {\n match: { label: 'Pokemon' },\n where: {\n and: [\n { lessThan: [{ property: 'level' }, 10] },\n { not: { equal: [{ property: 'is_starter' }, true] } },\n ],\n },\n priority: 15, // Baby Pokemon get special styling\n apply: {\n size: 25,\n color: '#95a5a6',\n captions: [\n { value: { property: 'name' }, styles: ['italic'] },\n { value: ' (Smol)', styles: [] },\n ],\n },\n },\n];\n\nexport const typeRules: StyleRule[] = [\n {\n match: { label: 'Type' },\n where: {\n or: [\n { equal: [{ property: 'name' }, 'Grass'] },\n { equal: [{ property: 'name' }, 'Poison'] },\n ],\n },\n apply: {\n color: '#27ae60',\n },\n },\n];\n\nexport const gymRules: StyleRule[] = [\n {\n match: { label: 'Gym' },\n apply: {\n color: '#8e44ad',\n size: 48,\n captionAlign: 'top',\n captions: [\n { value: '🏛️ ', styles: [] },\n { value: { property: 'name' }, styles: ['bold', 'underline'] },\n ],\n },\n },\n];\n\nexport const battledRelRules: StyleRule[] = [\n {\n match: { reltype: 'BATTLED' },\n where: { equal: [{ property: 'won' }, true] },\n apply: {\n color: '#27ae60',\n width: 4,\n captions: [{ value: 'WON BATTLE', styles: ['bold'] }],\n captionSize: 2,\n },\n },\n {\n match: { reltype: 'BATTLED' },\n where: { equal: [{ property: 'won' }, false] },\n apply: {\n color: '#e74c3c',\n width: 2,\n captions: [{ value: 'LOST BATTLE', styles: ['italic'] }],\n captionSize: 2,\n },\n },\n];\n\nexport const caughtRelRules: StyleRule[] = [\n {\n match: { reltype: 'CAUGHT' },\n apply: {\n color: '#e91e63',\n width: 3,\n captions: [\n { value: 'Caught @ Lv', styles: [] },\n { value: { property: 'level' }, styles: ['bold'] },\n ],\n captionSize: 1.5,\n },\n },\n];\n\nexport const evolvesToRelRules: StyleRule[] = [\n {\n match: { reltype: 'EVOLVES_TO' },\n apply: {\n color: '#16a085',\n width: 2,\n captions: [{ value: '→', styles: ['bold'] }],\n },\n },\n {\n match: { reltype: 'EVOLVES_TO' },\n where: { equal: [{ property: 'method' }, 'Level'] },\n priority: 1,\n apply: {\n captions: [\n { value: '→ Lv', styles: [] },\n { value: { property: 'level' }, styles: ['bold'] },\n ],\n },\n },\n {\n match: { reltype: 'EVOLVES_TO' },\n where: { not: { equal: [{ property: 'method' }, 'Level'] } },\n priority: 1,\n apply: {\n color: '#8e44ad',\n captions: [\n { value: '→ ', styles: [] },\n { value: { property: 'method' }, styles: ['italic'] },\n ],\n },\n },\n];\n\nexport const advancedStyleRules: StyleRule[] = [\n ...defaultNodeRules,\n ...trainerRules,\n ...pokemonRules,\n ...typeRules,\n ...gymRules,\n ...battledRelRules,\n ...caughtRelRules,\n ...evolvesToRelRules,\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={advancedStyleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
1
|
+
{"version":3,"file":"graph-visualization-rule-based-styling-advanced.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-rule-based-styling-advanced.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,CAAC,MAAM,gBAAgB,GAAqB;IAChD;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;QACtB,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;KAC/B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC5C;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;QAC3B,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,YAAY,CAAC,EAAE;QAC5D,QAAQ,EAAE,EAAE,EAAE,gEAAgE;QAC9E,KAAK,EAAE;YACL,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;YAC3B,QAAQ,EAAE;gBACR,IAAI,EAAE;oBACJ,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM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;IACjB,GAAG,iBAAiB;CACrB,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,UAAU,EAAE,kBAAkB,GAC9B,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 GraphStyleRule } from '../styling/style-types';\nimport { advancedStoryGraph, containerClasses } from './story-data';\n\nexport const defaultNodeRules: GraphStyleRule[] = [\n {\n match: { label: null },\n apply: { size: { value: 10 } },\n },\n];\n\nexport const trainerRules: GraphStyleRule[] = [\n {\n match: { label: 'Trainer' },\n where: { equal: [{ property: 'reputation' }, 'Gym Leader'] },\n priority: 20, // Gym Leaders are special - should override level-based styling\n apply: {\n color: { value: '#9b59b6' },\n captions: {\n text: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' 🏆', styles: [] },\n { value: ' Gym Leader', styles: ['italic'] },\n ],\n align: 'bottom',\n },\n size: { value: 45 },\n },\n },\n {\n match: { label: 'Trainer' },\n where: { greaterThanOrEqual: [{ property: 'level' }, 85] },\n priority: 10, // Base high-level styling\n apply: {\n size: { value: 30 },\n captions: {\n text: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' (Lv ', styles: [] },\n { value: { property: 'level' }, styles: [] },\n { value: ')', styles: [] },\n ],\n size: 2,\n },\n },\n },\n];\n\nexport const pokemonRules: GraphStyleRule[] = [\n // Make the 'saur family green is our highest priority\n {\n match: { label: 'Pokemon' },\n where: { endsWith: [{ property: 'name' }, 'saur'] },\n priority: 50,\n apply: {\n color: { value: '#2ecc71' },\n captions: {\n text: [\n { value: '🌿 ', styles: [] },\n { value: { property: 'name' }, styles: ['bold', 'italic'] },\n ],\n },\n },\n },\n {\n match: { label: 'Pokemon' },\n where: { equal: [{ property: 'is_starter' }, true] },\n apply: {\n color: { value: '#f39c12' },\n captions: {\n text: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' ⭐', styles: [] },\n ],\n },\n size: { value: 40 },\n },\n },\n {\n match: { label: 'Pokemon' },\n where: { greaterThanOrEqual: [{ property: 'level' }, 85] },\n priority: 30, // High-level Pokemon override starter styling\n apply: {\n color: { value: '#c0392b' },\n captions: {\n text: [\n { value: '💪 ', styles: [] },\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' Lv', styles: [] },\n { value: { property: 'level' }, styles: [] },\n ],\n },\n size: { value: 42 },\n },\n },\n {\n match: { label: 'Pokemon' },\n where: { lessThan: [{ property: 'catch_rate' }, 50] },\n priority: 40, // Rare caption is our second highest priority\n apply: {\n captions: {\n text: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' (Rare)', styles: ['italic'] },\n ],\n },\n },\n },\n {\n match: { label: 'Pokemon' },\n where: {\n and: [\n { lessThan: [{ property: 'level' }, 10] },\n { not: { equal: [{ property: 'is_starter' }, true] } },\n ],\n },\n priority: 15, // Baby Pokemon get special styling\n apply: {\n size: { value: 25 },\n color: { value: '#95a5a6' },\n captions: {\n text: [\n { value: { property: 'name' }, styles: ['italic'] },\n { value: ' (Smol)', styles: [] },\n ],\n },\n },\n },\n];\n\nexport const typeRules: GraphStyleRule[] = [\n {\n match: { label: 'Type' },\n where: {\n or: [\n { equal: [{ property: 'name' }, 'Grass'] },\n { equal: [{ property: 'name' }, 'Poison'] },\n ],\n },\n apply: {\n color: { value: '#27ae60' },\n },\n },\n];\n\nexport const gymRules: GraphStyleRule[] = [\n {\n match: { label: 'Gym' },\n apply: {\n color: { value: '#8e44ad' },\n size: { value: 48 },\n captions: {\n text: [\n { value: '🏛️ ', styles: [] },\n { value: { property: 'name' }, styles: ['bold', 'underline'] },\n ],\n align: 'top',\n },\n },\n },\n];\n\nexport const battledRelRules: GraphStyleRule[] = [\n {\n match: { reltype: 'BATTLED' },\n where: { equal: [{ property: 'won' }, true] },\n apply: {\n color: { value: '#27ae60' },\n width: { value: 4 },\n captions: { text: [{ value: 'WON BATTLE', styles: ['bold'] }], size: 2 },\n },\n },\n {\n match: { reltype: 'BATTLED' },\n where: { equal: [{ property: 'won' }, false] },\n apply: {\n color: { value: '#e74c3c' },\n width: { value: 2 },\n captions: {\n text: [{ value: 'LOST BATTLE', styles: ['italic'] }],\n size: 2,\n },\n },\n },\n];\n\nexport const caughtRelRules: GraphStyleRule[] = [\n {\n match: { reltype: 'CAUGHT' },\n apply: {\n color: { value: '#e91e63' },\n width: { value: 3 },\n captions: {\n text: [\n { value: 'Caught @ Lv', styles: [] },\n { value: { property: 'level' }, styles: ['bold'] },\n ],\n size: 1.5,\n },\n },\n },\n];\n\nexport const evolvesToRelRules: GraphStyleRule[] = [\n {\n match: { reltype: 'EVOLVES_TO' },\n apply: {\n color: { value: '#16a085' },\n width: { value: 2 },\n captions: { text: [{ value: '→', styles: ['bold'] }] },\n },\n },\n {\n match: { reltype: 'EVOLVES_TO' },\n where: { equal: [{ property: 'method' }, 'Level'] },\n priority: 1,\n apply: {\n captions: {\n text: [\n { value: '→ Lv', styles: [] },\n { value: { property: 'level' }, styles: ['bold'] },\n ],\n },\n },\n },\n {\n match: { reltype: 'EVOLVES_TO' },\n where: { not: { equal: [{ property: 'method' }, 'Level'] } },\n priority: 1,\n apply: {\n color: { value: '#8e44ad' },\n captions: {\n text: [\n { value: '→ ', styles: [] },\n { value: { property: 'method' }, styles: ['italic'] },\n ],\n },\n },\n },\n];\n\nexport const advancedStyleRules: GraphStyleRule[] = [\n ...defaultNodeRules,\n ...trainerRules,\n ...pokemonRules,\n ...typeRules,\n ...gymRules,\n ...battledRelRules,\n ...caughtRelRules,\n ...evolvesToRelRules,\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 styleRules={advancedStyleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -25,13 +25,13 @@ export const styleRules = [
|
|
|
25
25
|
{
|
|
26
26
|
// Nodes are teal by default
|
|
27
27
|
match: { label: null },
|
|
28
|
-
apply: { color: 'teal' },
|
|
28
|
+
apply: { color: { value: 'teal' } },
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
// Type named dragon becomes purple
|
|
32
32
|
match: { label: 'Type' },
|
|
33
33
|
where: { equal: [{ property: 'name' }, 'Dragon'] },
|
|
34
|
-
apply: { color: '#9b59b6' },
|
|
34
|
+
apply: { color: { value: '#9b59b6' } },
|
|
35
35
|
},
|
|
36
36
|
// Awesome and heavy Pokemon become larger
|
|
37
37
|
{
|
|
@@ -43,18 +43,20 @@ export const styleRules = [
|
|
|
43
43
|
],
|
|
44
44
|
},
|
|
45
45
|
apply: {
|
|
46
|
-
size: 50,
|
|
46
|
+
size: { value: 50 },
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
// Pokemon are red by default
|
|
50
50
|
{
|
|
51
51
|
match: { label: 'Pokemon' },
|
|
52
52
|
apply: {
|
|
53
|
-
color: '#ff6b6b',
|
|
54
|
-
captions:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
color: { value: '#ff6b6b' },
|
|
54
|
+
captions: {
|
|
55
|
+
text: [
|
|
56
|
+
{ value: 'Pokemon', styles: ['bold'] },
|
|
57
|
+
{ value: { property: 'name' } },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
58
60
|
},
|
|
59
61
|
},
|
|
60
62
|
{
|
|
@@ -62,15 +64,15 @@ export const styleRules = [
|
|
|
62
64
|
match: { label: 'Pokemon' },
|
|
63
65
|
where: { label: 'Legendary' },
|
|
64
66
|
apply: {
|
|
65
|
-
color: 'gold',
|
|
66
|
-
captions:
|
|
67
|
-
{ value: { property: 'name' }, styles: ['bold', 'underline'] },
|
|
68
|
-
|
|
67
|
+
color: { value: 'gold' },
|
|
68
|
+
captions: {
|
|
69
|
+
text: [{ value: { property: 'name' }, styles: ['bold', 'underline'] }],
|
|
70
|
+
},
|
|
69
71
|
},
|
|
70
72
|
},
|
|
71
73
|
];
|
|
72
74
|
const Component = () => {
|
|
73
|
-
return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { nodes: StoryGraph.nodes, rels: StoryGraph.rels, className: containerClasses,
|
|
75
|
+
return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { nodes: StoryGraph.nodes, rels: StoryGraph.rels, className: containerClasses, styleRules: styleRules }) }));
|
|
74
76
|
};
|
|
75
77
|
export default Component;
|
|
76
78
|
//# sourceMappingURL=graph-visualization-rule-based-styling.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-rule-based-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-rule-based-styling.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,CAAC,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"graph-visualization-rule-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AAM,EAAE,CAAC,MAAM,CAAC,EAAE;oBACtC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;iBAChC;aACF;SACF;KACF;IACD;QACE,qEAAqE;QACrE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;QAC3B,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE;QAC7B,KAAK,EAAE;YACL,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;YACxB,QAAQ,EAAE;gBACR,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC;aACvE;SACF;KACF;CACF,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAC7B,KAAC,kBAAkB,IACjB,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,IAAI,EAAE,UAAU,CAAC,IAAI,EACrB,SAAS,EAAE,gBAAgB,EAC3B,UAAU,EAAE,UAAU,GACtB,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 GraphStyleRule } from '../styling/style-types';\nimport { containerClasses, StoryGraph } from './story-data';\n\nexport const styleRules: GraphStyleRule[] = [\n {\n // Nodes are teal by default\n match: { label: null },\n apply: { color: { value: 'teal' } },\n },\n {\n // Type named dragon becomes purple\n match: { label: 'Type' },\n where: { equal: [{ property: 'name' }, 'Dragon'] },\n apply: { color: { value: '#9b59b6' } },\n },\n // Awesome and heavy Pokemon become larger\n {\n match: { label: 'Pokemon' },\n where: {\n and: [\n { equal: [{ property: 'isAwesome' }, true] },\n { greaterThan: [{ property: 'weight' }, 300] },\n ],\n },\n apply: {\n size: { value: 50 },\n },\n },\n // Pokemon are red by default\n {\n match: { label: 'Pokemon' },\n apply: {\n color: { value: '#ff6b6b' },\n captions: {\n text: [\n { value: 'Pokemon', styles: ['bold'] },\n { value: { property: 'name' } },\n ],\n },\n },\n },\n {\n // Pokemon that are also have the label Legendary become gold instead\n match: { label: 'Pokemon' },\n where: { label: 'Legendary' },\n apply: {\n color: { value: 'gold' },\n captions: {\n text: [{ value: { property: 'name' }, styles: ['bold', 'underline'] }],\n },\n },\n },\n];\n\nconst Component = () => {\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n nodes={StoryGraph.nodes}\n rels={StoryGraph.rels}\n className={containerClasses}\n styleRules={styleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -25,30 +25,32 @@ export const simpleStyleRules = [
|
|
|
25
25
|
{
|
|
26
26
|
match: { label: 'Pokemon' },
|
|
27
27
|
apply: {
|
|
28
|
-
color: 'red', // Red for Pokemon
|
|
29
|
-
captions:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
color: { value: 'red' }, // Red for Pokemon
|
|
29
|
+
captions: {
|
|
30
|
+
text: [
|
|
31
|
+
{ value: 'Pokemon', styles: ['bold'] },
|
|
32
|
+
{ value: { property: 'name' } },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
33
35
|
},
|
|
34
36
|
},
|
|
35
37
|
{
|
|
36
38
|
match: { label: 'Type' },
|
|
37
39
|
apply: {
|
|
38
|
-
color: '#4ecdc4', // Teal for Types
|
|
40
|
+
color: { value: '#4ecdc4' }, // Teal for Types
|
|
39
41
|
},
|
|
40
42
|
},
|
|
41
43
|
{
|
|
42
44
|
match: { reltype: 'HAS_TYPE' },
|
|
43
45
|
apply: {
|
|
44
|
-
color: '#95a5a6', // Gray for relationships
|
|
45
|
-
captions: [{ value: 'has type' }],
|
|
46
|
-
width: 2,
|
|
46
|
+
color: { value: '#95a5a6' }, // Gray for relationships
|
|
47
|
+
captions: { text: [{ value: 'has type' }] },
|
|
48
|
+
width: { value: 2 },
|
|
47
49
|
},
|
|
48
50
|
},
|
|
49
51
|
];
|
|
50
52
|
const Component = () => {
|
|
51
|
-
return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { nodes: StoryGraph.nodes, rels: StoryGraph.rels, className: containerClasses,
|
|
53
|
+
return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { nodes: StoryGraph.nodes, rels: StoryGraph.rels, className: containerClasses, styleRules: simpleStyleRules }) }));
|
|
52
54
|
};
|
|
53
55
|
export default Component;
|
|
54
56
|
//# sourceMappingURL=graph-visualization-simple-styling.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-simple-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-simple-styling.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,CAAC,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"graph-visualization-simple-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-simple-styling.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,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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 GraphStyleRule } from '../styling/style-types';\nimport { containerClasses, StoryGraph } from './story-data';\n\nexport const simpleStyleRules: GraphStyleRule[] = [\n {\n match: { label: 'Pokemon' },\n apply: {\n color: { value: 'red' }, // Red for Pokemon\n captions: {\n text: [\n { value: 'Pokemon', styles: ['bold'] },\n { value: { property: 'name' } },\n ],\n },\n },\n },\n {\n match: { label: 'Type' },\n apply: {\n color: { value: '#4ecdc4' }, // Teal for Types\n },\n },\n {\n match: { reltype: 'HAS_TYPE' },\n apply: {\n color: { value: '#95a5a6' }, // Gray for relationships\n captions: { text: [{ value: 'has type' }] },\n width: { value: 2 },\n },\n },\n];\n\nconst Component = () => {\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n nodes={StoryGraph.nodes}\n rels={StoryGraph.rels}\n className={containerClasses}\n styleRules={simpleStyleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import { GraphVisualization } from '../graph-visualization';
|
|
23
|
+
import { advancedStoryGraph, containerClasses } from './story-data';
|
|
24
|
+
/**
|
|
25
|
+
* Uses the Pokémon advancedStoryGraph to demonstrate uniqueColors styling.
|
|
26
|
+
* All nodes and relationships default to gray; Trainer nodes are then colored
|
|
27
|
+
* by their `reputation` property (Champion, Gym Leader, Rival, Breeder) and
|
|
28
|
+
* EVOLVES_TO relationships are colored by their `method` property (Level,
|
|
29
|
+
* Friendship, Thunder Stone, etc.).
|
|
30
|
+
*/
|
|
31
|
+
const styleRules = [
|
|
32
|
+
{
|
|
33
|
+
match: { label: null },
|
|
34
|
+
apply: { color: { value: '#aaaaaa' } },
|
|
35
|
+
priority: 0,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
match: { reltype: null },
|
|
39
|
+
apply: { color: { value: '#aaaaaa' } },
|
|
40
|
+
priority: 0,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
match: { label: 'Trainer' },
|
|
44
|
+
apply: {
|
|
45
|
+
uniqueColors: { onProperty: 'reputation' },
|
|
46
|
+
captions: {
|
|
47
|
+
text: [
|
|
48
|
+
{ value: { property: 'name' }, styles: ['bold'] },
|
|
49
|
+
{ value: ' · ', styles: [] },
|
|
50
|
+
{ value: { property: 'reputation' }, styles: ['italic'] },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
priority: 1,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
match: { reltype: 'EVOLVES_TO' },
|
|
58
|
+
apply: {
|
|
59
|
+
uniqueColors: { onProperty: 'method' },
|
|
60
|
+
captions: { text: [{ value: { property: 'method' } }] },
|
|
61
|
+
},
|
|
62
|
+
priority: 1,
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
const Component = () => {
|
|
66
|
+
return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { nodes: advancedStoryGraph.nodes, rels: advancedStoryGraph.rels, className: containerClasses, styleRules: styleRules }) }));
|
|
67
|
+
};
|
|
68
|
+
export default Component;
|
|
69
|
+
//# sourceMappingURL=graph-visualization-unique-colors-styling.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-visualization-unique-colors-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-unique-colors-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;;;;;;GAMG;AACH,MAAM,UAAU,GAAqB;IACnC;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;QACtB,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;QACtC,QAAQ,EAAE,CAAC;KACZ;IACD;QACE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QACxB,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;QACtC,QAAQ,EAAE,CAAC;KACZ;IACD;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;QAC3B,KAAK,EAAE;YACL,YAAY,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE;YAC1C,QAAQ,EAAE;gBACR,IAAI,EAAE;oBACJ,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE;oBACjD,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;oBAC5B,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE;iBAC1D;aACF;SACF;QACD,QAAQ,EAAE,CAAC;KACZ;IACD;QACE,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE;QAChC,KAAK,EAAE;YACL,YAAY,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;YACtC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE;SACxD;QACD,QAAQ,EAAE,CAAC;KACZ;CACF,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,UAAU,EAAE,UAAU,GACtB,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 GraphStyleRule } from '../styling/style-types';\nimport { advancedStoryGraph, containerClasses } from './story-data';\n\n/**\n * Uses the Pokémon advancedStoryGraph to demonstrate uniqueColors styling.\n * All nodes and relationships default to gray; Trainer nodes are then colored\n * by their `reputation` property (Champion, Gym Leader, Rival, Breeder) and\n * EVOLVES_TO relationships are colored by their `method` property (Level,\n * Friendship, Thunder Stone, etc.).\n */\nconst styleRules: GraphStyleRule[] = [\n {\n match: { label: null },\n apply: { color: { value: '#aaaaaa' } },\n priority: 0,\n },\n {\n match: { reltype: null },\n apply: { color: { value: '#aaaaaa' } },\n priority: 0,\n },\n {\n match: { label: 'Trainer' },\n apply: {\n uniqueColors: { onProperty: 'reputation' },\n captions: {\n text: [\n { value: { property: 'name' }, styles: ['bold'] },\n { value: ' · ', styles: [] },\n { value: { property: 'reputation' }, styles: ['italic'] },\n ],\n },\n },\n priority: 1,\n },\n {\n match: { reltype: 'EVOLVES_TO' },\n apply: {\n uniqueColors: { onProperty: 'method' },\n captions: { text: [{ value: { property: 'method' } }] },\n },\n priority: 1,\n },\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 styleRules={styleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
package/lib/esm/stories/index.js
CHANGED
|
@@ -28,6 +28,7 @@ export { default as GraphVisualizationRuleBasedStylingAdvanced } from './graph-v
|
|
|
28
28
|
export { default as GraphVisualizationRuleBasedStyling } from './graph-visualization-rule-based-styling.story';
|
|
29
29
|
export { default as GraphVisualizationSearch } from './graph-visualization-search.story';
|
|
30
30
|
export { default as GraphVisualizationSimpleStyling } from './graph-visualization-simple-styling.story';
|
|
31
|
+
export { default as GraphVisualizationUniqueColorsStyling } from './graph-visualization-unique-colors-styling.story';
|
|
31
32
|
export { default as PreviewGraphVisualization } from './preview-graph-visualization.story';
|
|
32
33
|
import { removeLicenseHeader } from '../utils';
|
|
33
34
|
import GraphVisualizationBarebonesSrcRaw from './graph-visualization-barebones.story?raw';
|
|
@@ -40,6 +41,7 @@ import GraphVisualizationRuleBasedStylingSrcRaw from './graph-visualization-rule
|
|
|
40
41
|
import GraphVisualizationRuleBasedStylingAdvancedSrcRaw from './graph-visualization-rule-based-styling-advanced.story?raw';
|
|
41
42
|
import GraphVisualizationSearchSrcRaw from './graph-visualization-search.story?raw';
|
|
42
43
|
import GraphVisualizationSimpleStylingSrcRaw from './graph-visualization-simple-styling.story?raw';
|
|
44
|
+
import GraphVisualizationUniqueColorsStylingRaw from './graph-visualization-unique-colors-styling.story?raw';
|
|
43
45
|
import PreviewGraphVisualizationSrcRaw from './preview-graph-visualization.story?raw';
|
|
44
46
|
export const GraphVisualizationDefaultSrc = removeLicenseHeader(GraphVisualizationDefaultSrcRaw);
|
|
45
47
|
export const GraphVisualizationBarebonesSrc = removeLicenseHeader(GraphVisualizationBarebonesSrcRaw);
|
|
@@ -51,5 +53,6 @@ export const GraphVisualizationRuleBasedStylingSrc = removeLicenseHeader(GraphVi
|
|
|
51
53
|
export const GraphVisualizationSearchSrc = removeLicenseHeader(GraphVisualizationSearchSrcRaw);
|
|
52
54
|
export const GraphVisualizationRuleBasedStylingAdvancedSrc = removeLicenseHeader(GraphVisualizationRuleBasedStylingAdvancedSrcRaw);
|
|
53
55
|
export const GraphVisualizationRangeStylingSrc = removeLicenseHeader(GraphVisualizationRangeStylingRaw);
|
|
56
|
+
export const GraphVisualizationUniqueColorsStylingRawSrc = removeLicenseHeader(GraphVisualizationUniqueColorsStylingRaw);
|
|
54
57
|
export const PreviewGraphVisualizationSrc = removeLicenseHeader(PreviewGraphVisualizationSrcRaw);
|
|
55
58
|
//# sourceMappingURL=index.js.map
|