@neo4j-ndl/react-graph 1.5.6 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-style-rules.js","sourceRoot":"","sources":["../../../src/styling/parse-style-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,
|
|
1
|
+
{"version":3,"file":"parse-style-rules.js","sourceRoot":"","sources":["../../../src/styling/parse-style-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAuB,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1E,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAkB;IAIlB,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAAC,WAAM,CAAC;QACP,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC;gBACpB;oBACE,IAAI,EAAE,gBAAgB;oBACtB,OAAO,EAAE,qBAAqB;oBAC9B,IAAI,EAAE,EAAE;oBACR,MAAM,EAAE,MAAM;iBACf;aACF,CAAC;YACF,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAED,OAAO,qBAAqB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACjD,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 z from 'zod';\n\nimport { type GraphStyleRule, GraphStyleRuleSchema } from './style-types';\nconst StyleRulesArraySchema = z.array(GraphStyleRuleSchema);\n\n/**\n * Parse and validate a JSON string as an array of GraphStyleRules.\n *\n * Useful for importing style rules from JSON. Uses Zod for runtime validation and returns\n * a discriminated result:\n *\n * - On success: `{ success: true, data: GraphStyleRule[] }`\n * - On failure: `{ success: false, error: ZodError }`\n *\n * @example\n * ```ts\n * const result = parseStyleRules('[{\"match\": {\"label\": \"Person\"}, \"apply\": {\"color\": \"red\"}}]');\n * if (result.success) {\n * console.log(result.data); // GraphStyleRule[]\n * } else {\n * console.error(result.error.issues);\n * }\n * ```\n */\nexport function parseStyleRules(\n jsonString: string,\n):\n | { data: GraphStyleRule[]; success: true }\n | { error: z.ZodError; success: false } {\n let parsed: unknown;\n try {\n parsed = JSON.parse(jsonString);\n } catch {\n return {\n error: new z.ZodError([\n {\n code: 'invalid_format',\n message: 'Invalid JSON string',\n path: [],\n format: 'json',\n },\n ]),\n success: false,\n };\n }\n\n return StyleRulesArraySchema.safeParse(parsed);\n}\n"]}
|
|
@@ -87,6 +87,12 @@ export const NvlCaptionSchema = z.object({
|
|
|
87
87
|
value: CaptionValueSchema.optional(),
|
|
88
88
|
key: z.string().optional(),
|
|
89
89
|
});
|
|
90
|
+
const CaptionsSchema = z.object({
|
|
91
|
+
text: z.array(NvlCaptionSchema).optional(),
|
|
92
|
+
align: z.enum(['top', 'bottom', 'center']).optional(),
|
|
93
|
+
size: z.number().optional(),
|
|
94
|
+
isDisabled: z.boolean().optional(),
|
|
95
|
+
});
|
|
90
96
|
/**
|
|
91
97
|
* OverlayIcon from NVL - icon displayed on top of a graph element
|
|
92
98
|
* @see @neo4j-nvl/base Node.overlayIcon
|
|
@@ -95,6 +101,7 @@ const NvlOverlayIconSchema = z.object({
|
|
|
95
101
|
url: z.string(),
|
|
96
102
|
position: z.array(z.number()).optional(),
|
|
97
103
|
size: z.number().optional(),
|
|
104
|
+
isDisabled: z.boolean().optional(),
|
|
98
105
|
});
|
|
99
106
|
/**
|
|
100
107
|
* Gradient coloring based on a continuous numeric property value.
|
|
@@ -110,52 +117,86 @@ export const ColorRangeSchema = z.object({
|
|
|
110
117
|
maxColor: z.string(),
|
|
111
118
|
midValue: z.number().optional(),
|
|
112
119
|
midColor: z.string().optional(),
|
|
120
|
+
isDisabled: z.boolean().optional(),
|
|
113
121
|
});
|
|
114
122
|
/**
|
|
115
123
|
* Size interpolation for nodes based on a continuous numeric property value.
|
|
116
124
|
* Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].
|
|
117
|
-
* If the property is missing or non-numeric,
|
|
125
|
+
* If the property is missing or non-numeric, sizeRange is silently ignored —
|
|
118
126
|
* other style properties still apply.
|
|
119
127
|
*/
|
|
120
|
-
export const
|
|
128
|
+
export const SizeRangeSchema = z.object({
|
|
121
129
|
onProperty: z.string(),
|
|
122
130
|
minValue: z.number(),
|
|
123
131
|
maxValue: z.number(),
|
|
124
132
|
minSize: z.number(),
|
|
125
133
|
maxSize: z.number(),
|
|
134
|
+
isDisabled: z.boolean().optional(),
|
|
126
135
|
});
|
|
127
136
|
/**
|
|
128
137
|
* Width interpolation for relationships based on a continuous numeric property value.
|
|
129
138
|
* Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].
|
|
130
|
-
* If the property is missing or non-numeric,
|
|
139
|
+
* If the property is missing or non-numeric, widthRange is silently ignored —
|
|
131
140
|
* other style properties still apply.
|
|
132
141
|
*/
|
|
133
|
-
export const
|
|
142
|
+
export const WidthRangeSchema = z.object({
|
|
134
143
|
onProperty: z.string(),
|
|
135
144
|
minValue: z.number(),
|
|
136
145
|
maxValue: z.number(),
|
|
137
146
|
minWidth: z.number(),
|
|
138
147
|
maxWidth: z.number(),
|
|
148
|
+
isDisabled: z.boolean().optional(),
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* Assigns a unique color per distinct value of a property.
|
|
152
|
+
* Colors are assigned in first-come, first-served order from a categorical palette.
|
|
153
|
+
* If the property is missing or null, uniqueColors is silently ignored —
|
|
154
|
+
* other style properties still apply.
|
|
155
|
+
*/
|
|
156
|
+
export const UniqueColorsSchema = z.object({
|
|
157
|
+
onProperty: z.string(),
|
|
158
|
+
isDisabled: z.boolean().optional(),
|
|
159
|
+
});
|
|
160
|
+
const ColorSchema = z.object({
|
|
161
|
+
value: z.string(),
|
|
162
|
+
isDisabled: z.boolean().optional(),
|
|
163
|
+
});
|
|
164
|
+
const IconSchema = z.object({
|
|
165
|
+
value: z.string(),
|
|
166
|
+
isDisabled: z.boolean().optional(),
|
|
167
|
+
});
|
|
168
|
+
const SizeSchema = z.object({
|
|
169
|
+
value: z.number(),
|
|
170
|
+
isDisabled: z.boolean().optional(),
|
|
171
|
+
});
|
|
172
|
+
const WidthSchema = z.object({
|
|
173
|
+
value: z.number(),
|
|
174
|
+
isDisabled: z.boolean().optional(),
|
|
139
175
|
});
|
|
140
176
|
export const StyleSchema = z.object({
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
captions: z.array(NvlCaptionSchema).optional(),
|
|
144
|
-
color: z.string().optional(),
|
|
177
|
+
captions: CaptionsSchema.optional(),
|
|
178
|
+
color: ColorSchema.optional(),
|
|
145
179
|
colorRange: ColorRangeSchema.optional(),
|
|
146
|
-
icon:
|
|
147
|
-
|
|
180
|
+
icon: IconSchema.optional(),
|
|
181
|
+
sizeRange: SizeRangeSchema.optional(),
|
|
148
182
|
overlayIcon: NvlOverlayIconSchema.optional(),
|
|
149
|
-
|
|
150
|
-
size:
|
|
151
|
-
|
|
183
|
+
widthRange: WidthRangeSchema.optional(),
|
|
184
|
+
size: SizeSchema.optional(),
|
|
185
|
+
uniqueColors: UniqueColorsSchema.optional(),
|
|
186
|
+
width: WidthSchema.optional(),
|
|
152
187
|
});
|
|
153
|
-
|
|
188
|
+
/**
|
|
189
|
+
* metaData is an free-form object that can be used to store additional information about a style rule.
|
|
190
|
+
* The data is not taken into account when evaluationg the rule.
|
|
191
|
+
*/
|
|
192
|
+
const metaDataSchema = z.record(z.string(), z.unknown());
|
|
193
|
+
export const GraphStyleRuleSchema = z.object({
|
|
154
194
|
match: MatchSchema,
|
|
155
195
|
where: WhereSchema.optional(),
|
|
156
196
|
apply: StyleSchema,
|
|
157
|
-
|
|
197
|
+
isDisabled: z.boolean().optional(),
|
|
158
198
|
priority: z.number().nonnegative().optional(),
|
|
199
|
+
metaData: metaDataSchema.optional(),
|
|
159
200
|
});
|
|
160
201
|
const NODE_STYLE_KEYS = [
|
|
161
202
|
'color',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAG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AAC;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().nonnegative().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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AC;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 */\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\nconst CaptionsSchema = z.object({\n text: z.array(NvlCaptionSchema).optional(),\n align: z.enum(['top', 'bottom', 'center']).optional(),\n size: z.number().optional(),\n isDisabled: z.boolean().optional(),\n});\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 isDisabled: z.boolean().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 isDisabled: z.boolean().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, sizeRange is silently ignored —\n * other style properties still apply.\n */\nexport const SizeRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minSize: z.number(),\n maxSize: z.number(),\n isDisabled: z.boolean().optional(),\n});\nexport type SizeRange = z.infer<typeof SizeRangeSchema>;\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, widthRange is silently ignored —\n * other style properties still apply.\n */\nexport const WidthRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minWidth: z.number(),\n maxWidth: z.number(),\n isDisabled: z.boolean().optional(),\n});\nexport type WidthRange = z.infer<typeof WidthRangeSchema>;\n\n/**\n * Assigns a unique color per distinct value of a property.\n * Colors are assigned in first-come, first-served order from a categorical palette.\n * If the property is missing or null, uniqueColors is silently ignored —\n * other style properties still apply.\n */\nexport const UniqueColorsSchema = z.object({\n onProperty: z.string(),\n isDisabled: z.boolean().optional(),\n});\nexport type UniqueColors = z.infer<typeof UniqueColorsSchema>;\n\nconst ColorSchema = z.object({\n value: z.string(),\n isDisabled: z.boolean().optional(),\n});\n\nconst IconSchema = z.object({\n value: z.string(),\n isDisabled: z.boolean().optional(),\n});\n\nconst SizeSchema = z.object({\n value: z.number(),\n isDisabled: z.boolean().optional(),\n});\n\nconst WidthSchema = z.object({\n value: z.number(),\n isDisabled: z.boolean().optional(),\n});\n\nexport const StyleSchema = z.object({\n captions: CaptionsSchema.optional(),\n color: ColorSchema.optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: IconSchema.optional(),\n sizeRange: SizeRangeSchema.optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n widthRange: WidthRangeSchema.optional(),\n size: SizeSchema.optional(),\n uniqueColors: UniqueColorsSchema.optional(),\n width: WidthSchema.optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\n/**\n * metaData is an free-form object that can be used to store additional information about a style rule.\n * The data is not taken into account when evaluationg the rule.\n */\nconst metaDataSchema = z.record(z.string(), z.unknown());\n\nexport const GraphStyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n isDisabled: z.boolean().optional(),\n priority: z.number().nonnegative().optional(),\n metaData: metaDataSchema.optional(),\n});\n// exporting this type with the graph prefix for clarity when used in the same context as other rules (grid, chart)\nexport type GraphStyleRule = z.infer<typeof GraphStyleRuleSchema>;\n\nexport type NonStaticStyles =\n | 'captions'\n | 'colorRange'\n | 'sizeRange'\n | 'widthRange'\n | 'uniqueColors';\n\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"]}
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import { useMemo } from 'react';
|
|
22
|
-
import {
|
|
22
|
+
import { compileGraphStyleRules } from './compile-graph-styles';
|
|
23
23
|
import { createVisualizationDataStructures } from './create-vis-data-structures';
|
|
24
24
|
export function useGraphData(rawNodes, rawRels, styleRules) {
|
|
25
25
|
// Compile style rules — only re-runs when styleRules changes.
|
|
26
26
|
// Per-type relationship functions are built lazily on first access.
|
|
27
|
-
const compiledStyleRules = useMemo(() =>
|
|
27
|
+
const compiledStyleRules = useMemo(() => compileGraphStyleRules(styleRules), [styleRules]);
|
|
28
28
|
// Apply styles and build metadata — runs on every data change.
|
|
29
29
|
const { styledGraph, metadataLookup } = useMemo(() => createVisualizationDataStructures(rawNodes, rawRels, compiledStyleRules), [rawNodes, rawRels, compiledStyleRules]);
|
|
30
30
|
return { styledGraph, metadataLookup, compiledStyleRules };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-graph-data.js","sourceRoot":"","sources":["../../../src/styling/use-graph-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-graph-data.js","sourceRoot":"","sources":["../../../src/styling/use-graph-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AAGjF,MAAM,UAAU,YAAY,CAC1B,QAAmB,EACnB,OAAiB,EACjB,UAA6B;IAE7B,8DAA8D;IAC9D,oEAAoE;IACpE,MAAM,kBAAkB,GAAG,OAAO,CAChC,GAAG,EAAE,CAAC,sBAAsB,CAAC,UAAU,CAAC,EACxC,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,+DAA+D;IAC/D,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,OAAO,CAC7C,GAAG,EAAE,CACH,iCAAiC,CAAC,QAAQ,EAAE,OAAO,EAAE,kBAAkB,CAAC,EAC1E,CAAC,QAAQ,EAAE,OAAO,EAAE,kBAAkB,CAAC,CACxC,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;AAC7D,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 { useMemo } from 'react';\n\nimport type { NeoNode, NeoRel } from '../graph-visualization-context';\nimport { compileGraphStyleRules } from './compile-graph-styles';\nimport { createVisualizationDataStructures } from './create-vis-data-structures';\nimport type { GraphStyleRule } from './style-types';\n\nexport function useGraphData(\n rawNodes: NeoNode[],\n rawRels: NeoRel[],\n styleRules?: GraphStyleRule[],\n) {\n // Compile style rules — only re-runs when styleRules changes.\n // Per-type relationship functions are built lazily on first access.\n const compiledStyleRules = useMemo(\n () => compileGraphStyleRules(styleRules),\n [styleRules],\n );\n\n // Apply styles and build metadata — runs on every data change.\n const { styledGraph, metadataLookup } = useMemo(\n () =>\n createVisualizationDataStructures(rawNodes, rawRels, compiledStyleRules),\n [rawNodes, rawRels, compiledStyleRules],\n );\n\n return { styledGraph, metadataLookup, compiledStyleRules };\n}\n"]}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type NVL from '@neo4j-nvl/base';
|
|
22
22
|
import { type Layout, type Node, type Relationship } from '@neo4j-nvl/base';
|
|
23
|
-
import { type
|
|
23
|
+
import { type CompiledGraphStyleRules } from './styling/compile-graph-styles';
|
|
24
24
|
export type GraphSelection = {
|
|
25
25
|
nodeIds: string[];
|
|
26
26
|
relationshipIds: string[];
|
|
@@ -93,7 +93,7 @@ export type GraphVisualizationContextData = {
|
|
|
93
93
|
nvlGraph: NvlGraph;
|
|
94
94
|
selected: GraphSelection;
|
|
95
95
|
metadataLookup: MetadataLookupTable;
|
|
96
|
-
compiledStyleRules:
|
|
96
|
+
compiledStyleRules: CompiledGraphStyleRules;
|
|
97
97
|
layout: Layout;
|
|
98
98
|
setLayout?: (layout: Layout) => void;
|
|
99
99
|
portalTarget?: HTMLElement | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-context.d.ts","sourceRoot":"","sources":["../../src/graph-visualization-context.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG5E,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"graph-visualization-context.d.ts","sourceRoot":"","sources":["../../src/graph-visualization-context.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAAK,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AmB,CAAC;IACpC,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,yBAAyB,oEAE1B,CAAC;AAEb;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,4BAA4B,qCAQxC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AAEjD,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,MAAM,GACN,WAAW,GACX,KAAK,GACL,MAAM,GACN,MAAM,CAAC"}
|
|
@@ -23,7 +23,7 @@ import { type Layout } from '@neo4j-nvl/base';
|
|
|
23
23
|
import { type InteractiveNvlWrapperProps } from '@neo4j-nvl/react';
|
|
24
24
|
import React from 'react';
|
|
25
25
|
import { type Gesture, type GraphSelection, type InteractionMode, type NeoNode, type NeoRel, type Sidepanel } from './graph-visualization-context';
|
|
26
|
-
import { type
|
|
26
|
+
import { type GraphStyleRule } from './styling/style-types';
|
|
27
27
|
export declare const DEFAULT_NVL_OPTIONS: {
|
|
28
28
|
disableTelemetry: boolean;
|
|
29
29
|
disableWebGL: boolean;
|
|
@@ -46,7 +46,7 @@ export type GraphVisualizationProps<T extends React.ElementType = 'div'> = {
|
|
|
46
46
|
* Consumer-set `color` on individual `NeoNode`/`NeoRel` objects takes precedence over rules.
|
|
47
47
|
* Compared by reference — memoize the array to avoid recompiling on every render.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
styleRules?: GraphStyleRule[];
|
|
50
50
|
gesture?: Gesture;
|
|
51
51
|
setGesture?: (gesture: Gesture) => void;
|
|
52
52
|
selected?: GraphSelection;
|
|
@@ -122,7 +122,7 @@ export type GraphVisualizationProps<T extends React.ElementType = 'div'> = {
|
|
|
122
122
|
*
|
|
123
123
|
* @alpha
|
|
124
124
|
*/
|
|
125
|
-
export declare function GraphVisualization<T extends React.ElementType = 'div'>({ nvlRef: rawNvlRef, nvlCallbacks, nvlOptions, sidepanel: rawSidepanel, nodes: rawNodes, rels: rawRels, highlightedNodeIds, highlightedRelationshipIds, topLeftIsland, topRightIsland, bottomLeftIsland, bottomCenterIsland, bottomRightIsland, gesture, setGesture, layout: rawLayout, setLayout: rawSetLayout, portalTarget, selected: rawSelected, setSelected: rawSetSelected, interactionMode: rawInteractionMode, setInteractionMode: rawSetInteractionMode, mouseEventCallbacks, className, style, htmlAttributes, ref, as,
|
|
125
|
+
export declare function GraphVisualization<T extends React.ElementType = 'div'>({ nvlRef: rawNvlRef, nvlCallbacks, nvlOptions, sidepanel: rawSidepanel, nodes: rawNodes, rels: rawRels, highlightedNodeIds, highlightedRelationshipIds, topLeftIsland, topRightIsland, bottomLeftIsland, bottomCenterIsland, bottomRightIsland, gesture, setGesture, layout: rawLayout, setLayout: rawSetLayout, portalTarget, selected: rawSelected, setSelected: rawSetSelected, interactionMode: rawInteractionMode, setInteractionMode: rawSetInteractionMode, mouseEventCallbacks, className, style, htmlAttributes, ref, as, styleRules, ...restProps }: GraphVisualizationProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
126
126
|
export declare namespace GraphVisualization {
|
|
127
127
|
var ZoomInButton: ({ className, style, htmlAttributes, tooltipPlacement, }: {
|
|
128
128
|
tooltipPlacement?: import("@floating-ui/react").Placement | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization.d.ts","sourceRoot":"","sources":["../../src/graph-visualization.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,kBAAkB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,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,OAAO,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,aAAgD,EAChD,cAAkD,EAClD,gBAAsD,EACtD,kBAA0D,EAC1D,iBAAwD,EACxD,OAAkB,EAClB,UAAU,EACV,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,YAAY,EACvB,YAAY,EACZ,QAAQ,EAAE,WAAW,EACrB,WAAW,EAAE,cAAc,EAC3B,eAAe,EAAE,kBAAkB,EACnC,kBAAkB,EAAE,qBAAqB,EACzC,mBAAwB,EACxB,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,EACH,EAAE,EACF,UAAU,EACV,GAAG,SAAS,EACb,EAAE,uBAAuB,CAAC,CAAC,CAAC,2CA+K5B;yBA9Me,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAyTM,CAAC;qBAI1B,CAAC;;;;;;;;;qBA+B43B,CAAC;sBAAkE,CAAC"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,5 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
export { GraphVisualization } from './graph-visualization';
|
|
22
22
|
export { useGraphVisualizationContext, type ColorCount, type Gesture, type GraphItemMetaData, type GraphSelection, type GraphVisualizationContextData, type InteractionMode, type MetadataLookupTable, type NeoNode, type NeoRel, type NodeData, type NvlGraph, type PortableProperty, type RelData, type Sidepanel, } from './graph-visualization-context';
|
|
23
|
-
export { type
|
|
23
|
+
export { type GraphStyleRule } from './styling/style-types';
|
|
24
|
+
export { compileGraphStyleRules } from './styling/compile-graph-styles';
|
|
25
|
+
export { parseStyleRules } from './styling/parse-style-rules';
|
|
24
26
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,4BAA4B,EAC5B,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,SAAS,GACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,4BAA4B,EAC5B,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,SAAS,GACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* You should have received a copy of the GNU General Public License
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
import { type
|
|
22
|
-
export declare const colorRangeStyleRules:
|
|
21
|
+
import { type GraphStyleRule } from '../styling/style-types';
|
|
22
|
+
export declare const colorRangeStyleRules: GraphStyleRule[];
|
|
23
23
|
declare const Component: () => import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
export default Component;
|
|
25
25
|
//# sourceMappingURL=graph-visualization-range-styling.story.d.ts.map
|
|
@@ -1 +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,
|
|
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,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAsE7D,eAAO,MAAM,oBAAoB,EAAE,cAAc,EAIhD,CAAC;AAEF,QAAA,MAAM,SAAS,+CAWd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
* You should have received a copy of the GNU General Public License
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
import { type
|
|
22
|
-
export declare const defaultNodeRules:
|
|
23
|
-
export declare const trainerRules:
|
|
24
|
-
export declare const pokemonRules:
|
|
25
|
-
export declare const typeRules:
|
|
26
|
-
export declare const gymRules:
|
|
27
|
-
export declare const battledRelRules:
|
|
28
|
-
export declare const caughtRelRules:
|
|
29
|
-
export declare const evolvesToRelRules:
|
|
30
|
-
export declare const advancedStyleRules:
|
|
21
|
+
import { type GraphStyleRule } from '../styling/style-types';
|
|
22
|
+
export declare const defaultNodeRules: GraphStyleRule[];
|
|
23
|
+
export declare const trainerRules: GraphStyleRule[];
|
|
24
|
+
export declare const pokemonRules: GraphStyleRule[];
|
|
25
|
+
export declare const typeRules: GraphStyleRule[];
|
|
26
|
+
export declare const gymRules: GraphStyleRule[];
|
|
27
|
+
export declare const battledRelRules: GraphStyleRule[];
|
|
28
|
+
export declare const caughtRelRules: GraphStyleRule[];
|
|
29
|
+
export declare const evolvesToRelRules: GraphStyleRule[];
|
|
30
|
+
export declare const advancedStyleRules: GraphStyleRule[];
|
|
31
31
|
declare const Component: () => import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export default Component;
|
|
33
33
|
//# sourceMappingURL=graph-visualization-rule-based-styling-advanced.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-rule-based-styling-advanced.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-rule-based-styling-advanced.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"graph-visualization-rule-based-styling-advanced.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-rule-based-styling-advanced.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAK5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAAc,EAmCxC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAAc,EAgFxC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAAc,EAarC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,cAAc,EAepC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,EAsB3C,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAAc,EAe1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAoC7C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAS9C,CAAC;AAEF,QAAA,MAAM,SAAS,+CAWd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* You should have received a copy of the GNU General Public License
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
import { type
|
|
22
|
-
export declare const styleRules:
|
|
21
|
+
import { type GraphStyleRule } from '../styling/style-types';
|
|
22
|
+
export declare const styleRules: GraphStyleRule[];
|
|
23
23
|
declare const Component: () => import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
export default Component;
|
|
25
25
|
//# sourceMappingURL=graph-visualization-rule-based-styling.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-rule-based-styling.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-rule-based-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"graph-visualization-rule-based-styling.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-rule-based-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,eAAO,MAAM,UAAU,EAAE,cAAc,EAiDtC,CAAC;AAEF,QAAA,MAAM,SAAS,+CAWd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* You should have received a copy of the GNU General Public License
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
import { type
|
|
22
|
-
export declare const simpleStyleRules:
|
|
21
|
+
import { type GraphStyleRule } from '../styling/style-types';
|
|
22
|
+
export declare const simpleStyleRules: GraphStyleRule[];
|
|
23
23
|
declare const Component: () => import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
export default Component;
|
|
25
25
|
//# sourceMappingURL=graph-visualization-simple-styling.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-simple-styling.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-simple-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"graph-visualization-simple-styling.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-simple-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA2B5C,CAAC;AAEF,QAAA,MAAM,SAAS,+CAWd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
declare const Component: () => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export default Component;
|
|
23
|
+
//# sourceMappingURL=graph-visualization-unique-colors-styling.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-visualization-unique-colors-styling.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-unique-colors-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAgDH,QAAA,MAAM,SAAS,+CAWd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -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
|
export declare const GraphVisualizationDefaultSrc: string;
|
|
33
34
|
export declare const GraphVisualizationBarebonesSrc: string;
|
|
@@ -39,5 +40,6 @@ export declare const GraphVisualizationRuleBasedStylingSrc: string;
|
|
|
39
40
|
export declare const GraphVisualizationSearchSrc: string;
|
|
40
41
|
export declare const GraphVisualizationRuleBasedStylingAdvancedSrc: string;
|
|
41
42
|
export declare const GraphVisualizationRangeStylingSrc: string;
|
|
43
|
+
export declare const GraphVisualizationUniqueColorsStylingRawSrc: string;
|
|
42
44
|
export declare const PreviewGraphVisualizationSrc: string;
|
|
43
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GA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tG,OAAO,EAAE,OAAO,IAAI,0CAA0C,EAAE,MAAM,yDAAyD,CAAC;AAChI,OAAO,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,gDAAgD,CAAC;AAC/G,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AACrH,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAgB3F,eAAO,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,2CAA2C,QAEvD,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAExC,CAAC"}
|
|
@@ -19,19 +19,20 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import { type NodeData, type RelData } from '../graph-visualization-context';
|
|
22
|
-
import { type EvaluatedNvlNodeStyle, type EvaluatedNvlRelationshipStyle, type
|
|
22
|
+
import { type EvaluatedNvlNodeStyle, type EvaluatedNvlRelationshipStyle, type GraphStyleRule } from './style-types';
|
|
23
|
+
export declare const DEFAULT_REL_COLOR: string;
|
|
24
|
+
export declare const UNIQUE_COLORS_PALETTE: `#${string}`[];
|
|
23
25
|
type StyleMatchers = {
|
|
24
|
-
globalLabelRules:
|
|
25
|
-
globalReltypeRules:
|
|
26
|
-
rulesByLabel: Map<string,
|
|
27
|
-
rulesByType: Map<string,
|
|
26
|
+
globalLabelRules: GraphStyleRule[];
|
|
27
|
+
globalReltypeRules: GraphStyleRule[];
|
|
28
|
+
rulesByLabel: Map<string, GraphStyleRule[]>;
|
|
29
|
+
rulesByType: Map<string, GraphStyleRule[]>;
|
|
28
30
|
};
|
|
29
|
-
export type
|
|
31
|
+
export type CompiledGraphStyleRules = {
|
|
30
32
|
byType: (type: string) => (rel: RelData) => EvaluatedNvlRelationshipStyle;
|
|
31
33
|
styleMatchers: StyleMatchers;
|
|
32
34
|
byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;
|
|
33
35
|
};
|
|
34
|
-
export declare
|
|
35
|
-
export declare function compileStyleRules(styleRules: StyleRule[] | null | undefined): CompiledStyleRules;
|
|
36
|
+
export declare function compileGraphStyleRules(styleRules: GraphStyleRule[] | null | undefined): CompiledGraphStyleRules;
|
|
36
37
|
export {};
|
|
37
38
|
//# sourceMappingURL=compile-graph-styles.d.ts.map
|
|
@@ -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,
|
|
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,EAClC,KAAK,cAAc,EAMpB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,iBAAiB,QAA+B,CAAC;AAG9D,eAAO,MAAM,qBAAqB,gBAEjC,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,kBAAkB,EAAE,cAAc,EAAE,CAAC;IACrC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IAC5C,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;CAC5C,CAAC;AAkuBF,MAAM,MAAM,uBAAuB,GAAG;IACpC,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;AAoFF,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,cAAc,EAAE,GAAG,IAAI,GAAG,SAAS,GAC9C,uBAAuB,CAyBzB"}
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import type { MetadataLookupTable, NeoNode, NeoRel, NvlGraph } from '../graph-visualization-context';
|
|
22
|
-
import type {
|
|
22
|
+
import type { CompiledGraphStyleRules } from './compile-graph-styles';
|
|
23
23
|
export declare const NO_LABEL = "(no label)";
|
|
24
|
-
export declare function createVisualizationDataStructures(rawNodes: NeoNode[], rawRels: NeoRel[], compiledStyleRules:
|
|
24
|
+
export declare function createVisualizationDataStructures(rawNodes: NeoNode[], rawRels: NeoRel[], compiledStyleRules: CompiledGraphStyleRules): {
|
|
25
25
|
styledGraph: NvlGraph;
|
|
26
26
|
metadataLookup: MetadataLookupTable;
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-vis-data-structures.d.ts","sourceRoot":"","sources":["../../../src/styling/create-vis-data-structures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAGV,mBAAmB,EACnB,OAAO,EACP,MAAM,EAEN,QAAQ,EAET,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"create-vis-data-structures.d.ts","sourceRoot":"","sources":["../../../src/styling/create-vis-data-structures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAGV,mBAAmB,EACnB,OAAO,EACP,MAAM,EAEN,QAAQ,EAET,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAMtE,eAAO,MAAM,QAAQ,eAAe,CAAC;AAUrC,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,kBAAkB,EAAE,uBAAuB,GAC1C;IACD,WAAW,EAAE,QAAQ,CAAC;IACtB,cAAc,EAAE,mBAAmB,CAAC;CACrC,CA6HA"}
|
|
@@ -19,28 +19,28 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import z from 'zod';
|
|
22
|
-
import { type
|
|
22
|
+
import { type GraphStyleRule } from './style-types';
|
|
23
23
|
/**
|
|
24
|
-
* Parse and validate a JSON string as an array of
|
|
24
|
+
* Parse and validate a JSON string as an array of GraphStyleRules.
|
|
25
25
|
*
|
|
26
26
|
* Useful for importing style rules from JSON. Uses Zod for runtime validation and returns
|
|
27
27
|
* a discriminated result:
|
|
28
28
|
*
|
|
29
|
-
* - On success: `{ success: true, data:
|
|
29
|
+
* - On success: `{ success: true, data: GraphStyleRule[] }`
|
|
30
30
|
* - On failure: `{ success: false, error: ZodError }`
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```ts
|
|
34
34
|
* const result = parseStyleRules('[{"match": {"label": "Person"}, "apply": {"color": "red"}}]');
|
|
35
35
|
* if (result.success) {
|
|
36
|
-
* console.log(result.data); //
|
|
36
|
+
* console.log(result.data); // GraphStyleRule[]
|
|
37
37
|
* } else {
|
|
38
38
|
* console.error(result.error.issues);
|
|
39
39
|
* }
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
export declare function parseStyleRules(jsonString: string): {
|
|
43
|
-
data:
|
|
43
|
+
data: GraphStyleRule[];
|
|
44
44
|
success: true;
|
|
45
45
|
} | {
|
|
46
46
|
error: z.ZodError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-style-rules.d.ts","sourceRoot":"","sources":["../../../src/styling/parse-style-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"parse-style-rules.d.ts","sourceRoot":"","sources":["../../../src/styling/parse-style-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,eAAe,CAAC;AAG1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,GAEhB;IAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GACzC;IAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAmBxC"}
|