@neo4j-ndl/react-graph 1.2.23 → 1.2.25
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/styling/compile-graph-styles.js +482 -0
- package/lib/cjs/styling/compile-graph-styles.js.map +1 -0
- package/lib/cjs/styling/parse-style-rules.js +69 -0
- package/lib/cjs/styling/parse-style-rules.js.map +1 -0
- package/lib/cjs/styling/style-types.js +119 -0
- package/lib/cjs/styling/style-types.js.map +1 -0
- package/lib/esm/styling/compile-graph-styles.js +478 -0
- package/lib/esm/styling/compile-graph-styles.js.map +1 -0
- package/lib/esm/styling/parse-style-rules.js +63 -0
- package/lib/esm/styling/parse-style-rules.js.map +1 -0
- package/lib/esm/styling/style-types.js +116 -0
- package/lib/esm/styling/style-types.js.map +1 -0
- package/lib/types/styling/compile-graph-styles.d.ts +40 -0
- package/lib/types/styling/compile-graph-styles.d.ts.map +1 -0
- package/lib/types/styling/parse-style-rules.d.ts +49 -0
- package/lib/types/styling/parse-style-rules.d.ts.map +1 -0
- package/lib/types/styling/style-types.d.ts +169 -0
- package/lib/types/styling/style-types.d.ts.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-graph-styles.js","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAyBzC,SAAS,0BAA0B,CAAC,CAAY,EAAE,CAAY;IAC5D,OAAO,CAAC,CAAC,QAAS,GAAG,CAAC,CAAC,QAAS,CAAC;AACnC,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAsC;IAEtC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;IACpD,MAAM,WAAW,GAAG,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BAAiB;YACjB,GAAG,aAAa,CAAC,kBAAkB;YACnC,GAAG,KAAK;SACT,CAAC,CACH,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { calculateDefaultNodeColors } from '@neo4j-devtools/word-color';\nimport { tokens } from '@neo4j-ndl/base';\n\nimport {\n type NodeData,\n type PortableProperty,\n type RelData,\n} from '../graph-visualization-context';\nimport {\n type Caption,\n type CypherValue,\n type EvaluatedNvlNodeStyle,\n type EvaluatedNvlRelationshipStyle,\n type Style,\n type StyleRule,\n type Value,\n type Where,\n} from './style-types';\n\ntype StyleMatchers = {\n globalLabelRules: StyleRule[];\n globalReltypeRules: StyleRule[];\n rulesByLabel: Map<string, StyleRule[]>;\n rulesByType: Map<string, StyleRule[]>;\n};\n\nfunction compareByPriorityAscending(a: StyleRule, b: StyleRule): number {\n return a.priority! - b.priority!;\n}\n\nfunction collectStyleMatchers(\n styles: StyleRule[] | null | undefined,\n): StyleMatchers {\n const rulesByLabel = new Map<string, StyleRule[]>();\n const rulesByType = new Map<string, StyleRule[]>();\n const globalLabelRules: StyleRule[] = [];\n const globalReltypeRules: StyleRule[] = [];\n\n // Handle null/undefined styles gracefully\n if (!styles || styles.length === 0) {\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n }\n\n const totalRules = styles.length;\n\n styles.forEach((style, index) => {\n if (style.disabled ?? false) {\n return;\n }\n\n if (style.priority !== undefined && style.priority < 0) {\n throw new Error(\n `StyleRule priority must be >= 0, got ${style.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n // Fill in priority if not set (negative values preserve original order)\n const { priority, ...rest } = style;\n const ruleWithPriority: StyleRule = {\n ...rest,\n priority: priority ?? index - totalRules,\n };\n\n // style for nodes\n if ('label' in style.match) {\n // if the label is null/undefined, it's a global rule (matches any node)\n if (style.match.label == null) {\n globalLabelRules.push(ruleWithPriority);\n } else {\n // Specific label rule\n const existing = rulesByLabel.get(style.match.label) ?? [];\n rulesByLabel.set(style.match.label, [...existing, ruleWithPriority]);\n }\n }\n\n // style for relationships\n if ('reltype' in style.match) {\n if (style.match.reltype === null) {\n // Global reltype rule (matches any relationship)\n globalReltypeRules.push(ruleWithPriority);\n } else {\n // Specific reltype rule\n const existing = rulesByType.get(style.match.reltype) || [];\n rulesByType.set(style.match.reltype, [...existing, ruleWithPriority]);\n }\n }\n });\n\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n}\n\nfunction extractPropertyValue(\n prop: PortableProperty,\n): string | number | boolean | null {\n switch (prop.type) {\n case 'string':\n return JSON.parse(prop.stringified);\n case 'number':\n case 'integer':\n case 'float':\n return Number(prop.stringified);\n case 'boolean':\n case 'Boolean':\n return prop.stringified === 'true';\n case 'null':\n return null;\n default:\n return prop.stringified;\n }\n}\n\n/**\n * Three-valued logic type matching Cypher/SQL semantics.\n * - `true`: condition is satisfied\n * - `false`: condition is not satisfied\n * - `null`: condition is unknown (e.g., comparing with null/missing property)\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\ntype Ternary = boolean | null;\n\n/**\n * Evaluates a WHERE clause using three-valued logic matching Cypher semantics.\n *\n * From Neo4j Cypher Manual:\n * - Comparing any value to `null` results in `null`, not `true` or `false`\n * - Accessing a non-existent property returns `null`\n * - In WHERE clauses, only `true` passes; both `false` and `null` exclude the row\n *\n * Three-valued logic rules:\n * - NOT null → null\n * - true AND null → null, false AND null → false\n * - true OR null → true, false OR null → null\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction evaluateWhere(node: NodeData | RelData, where?: Where): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = evaluateValue(left, node);\n const rightVal = evaluateValue(right, node);\n // In Cypher, null = null → null (not true)\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n // Cypher: NOT null → null\n const isMatch = evaluateWhere(node, where.not);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n const [left, right] = where.lessThan;\n return safeCompare(left, right, node, (a, b) => a < b);\n }\n\n if ('lessThanOrEqual' in where) {\n const [left, right] = where.lessThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a <= b);\n }\n\n if ('greaterThan' in where) {\n const [left, right] = where.greaterThan;\n return safeCompare(left, right, node, (a, b) => a > b);\n }\n\n if ('greaterThanOrEqual' in where) {\n const [left, right] = where.greaterThanOrEqual;\n return safeCompare(left, right, node, (a, b) => a >= b);\n }\n\n if ('contains' in where) {\n const [left, right] = where.contains;\n return safeStringCompare(left, right, node, (a, b) => a.includes(b));\n }\n\n if ('startsWith' in where) {\n const [left, right] = where.startsWith;\n return safeStringCompare(left, right, node, (a, b) => a.startsWith(b));\n }\n\n if ('endsWith' in where) {\n const [left, right] = where.endsWith;\n return safeStringCompare(left, right, node, (a, b) => a.endsWith(b));\n }\n\n if ('isNull' in where) {\n // IS NULL returns true/false (never null)\n const value = evaluateValue(where.isNull, node);\n return value === null;\n }\n\n if ('and' in where) {\n // Cypher three-valued AND:\n // - If any is false → false\n // - Else if any is null → null\n // - Else → true\n let hasNull = false;\n for (const r of where.and) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n // Cypher three-valued OR:\n // - If any is true → true\n // - Else if any is null → null\n // - Else → false\n let hasNull = false;\n for (const r of where.or) {\n const isMatch = evaluateWhere(node, r);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n if ('label' in where) {\n if ('labelsSorted' in node) {\n return where.label === null || node.labelsSorted.includes(where.label);\n }\n return false;\n }\n\n if ('reltype' in where) {\n if ('type' in node) {\n return where.reltype === null || (node as RelData).type === where.reltype;\n }\n return false;\n }\n\n if ('property' in where) {\n return where.property === null || where.property in node.properties;\n }\n\n return false;\n}\n\nfunction evaluateRelStyle(\n apply: Style,\n rel: RelData,\n): EvaluatedNvlRelationshipStyle {\n return {\n ...apply,\n captions: apply.captions?.map((caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: rel.type };\n }\n\n if ('property' in value) {\n const prop = rel.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: rel.id };\n }),\n };\n}\n\n/**\n * Safely compare two values using Cypher's three-valued logic.\n * Returns `null` if either operand is null (matching Cypher semantics).\n *\n * From Neo4j Cypher Manual:\n * \"Comparing any value to `null` using `=` or `<>` results in `null`\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction safeCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (\n a: NonNullable<CypherValue>,\n b: NonNullable<CypherValue>,\n ) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\n/**\n * String comparison using Cypher semantics.\n * Returns `null` if either operand is null OR not a string.\n *\n * From Neo4j Cypher Manual:\n * \"When these operators are applied to non-string values, they return `null`\n * instead of attempting type coercion.\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/expressions/predicates/string-operators/\n */\nfunction safeStringCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (a: string, b: string) => boolean,\n): Ternary {\n const leftVal = evaluateValue(left, graphItem);\n const rightVal = evaluateValue(right, graphItem);\n // Return null if either is null or not a string (no type coercion)\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateValue(\n value: Value,\n graphItem: NodeData | RelData,\n): CypherValue {\n if (typeof value === 'object' && value !== null) {\n if ('property' in value) {\n if (value.property === null) {\n return null;\n }\n const prop = graphItem.properties[value.property];\n if (prop === undefined) {\n return null;\n }\n return extractPropertyValue(prop);\n }\n if ('label' in value) {\n if ('labelsSorted' in graphItem) {\n return (\n value.label === null || graphItem.labelsSorted.includes(value.label)\n );\n }\n return false;\n }\n if ('reltype' in value) {\n if ('type' in graphItem) {\n return (\n value.reltype === null ||\n (graphItem as RelData).type === value.reltype\n );\n }\n return false;\n }\n }\n\n return value;\n}\n\n// Default caption selection logic\nconst captionPriorityOrder = [\n /^name$/i,\n /^title$/i,\n /^label$/i,\n /name$/i,\n /description$/i,\n /^.+/,\n];\n\nfunction getDefaultNodeCaption(node: NodeData): Caption {\n const propertyKeys = Object.keys(node.properties);\n\n for (const regex of captionPriorityOrder) {\n const matchingKey = propertyKeys.find((key) => regex.test(key));\n if (matchingKey !== undefined) {\n const prop = node.properties[matchingKey];\n if (prop !== undefined) {\n return { value: { property: matchingKey } };\n }\n }\n }\n\n if (node.labelsSorted[0] !== undefined) {\n return { value: { useType: true } };\n }\n\n return { value: { property: node.id } };\n}\n\nfunction evaluateNodeStyle(\n apply: Style,\n node: NodeData,\n): EvaluatedNvlNodeStyle {\n return {\n ...apply,\n captions: (apply.captions ?? [getDefaultNodeCaption(node)]).map(\n (caption) => {\n const { value, styles } = caption;\n\n if (typeof value === 'string' || value === undefined) {\n return { styles, value };\n }\n\n if ('useType' in value) {\n return { styles, value: node.labelsSorted[0] };\n }\n\n if ('property' in value) {\n const prop = node.properties[value.property];\n if (prop === undefined) {\n return { styles, value: '' };\n }\n\n const resolvedValue =\n prop.type === 'string'\n ? prop.stringified.slice(1, -1)\n : prop.stringified;\n\n return { styles, value: resolvedValue };\n }\n\n return { styles, value: node.labelsSorted[0] };\n },\n ),\n };\n}\n\nfunction createRelStyleFunction(\n rules: StyleRule[],\n): (rel: RelData) => EvaluatedNvlRelationshipStyle {\n return (rel: RelData) => {\n const style: Style = {};\n\n // evaluateWhere uses Cypher-style three-valued logic (true/false/null).\n // Only `true` passes; both `false` and `null` (unknown) skip the rule.\n for (const rule of rules) {\n // Check if the rule applies to this relationship\n if ('reltype' in rule.match) {\n const isReltypeMatch =\n rule.match.reltype === null || rel.type === rule.match.reltype;\n\n if (isReltypeMatch && evaluateWhere(rel, rule.where) === true) {\n // Merge the style properties (later rules override earlier ones)\n Object.assign(style, rule.apply);\n }\n }\n }\n\n return evaluateRelStyle(style, rel);\n };\n}\n\nexport type CompiledStyleRules = {\n byType: Map<string, (rel: RelData) => EvaluatedNvlRelationshipStyle>;\n styleMatchers: StyleMatchers;\n byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;\n};\n\nexport const DEFAULT_REL_COLOR = tokens.palette.neutral['40'];\nconst NO_LABEL_FALLBACK_COLOR = tokens.palette.neutral['40'];\n\nfunction createByLabelSetFunction(\n styleMatchers: StyleMatchers,\n): (node: NodeData) => EvaluatedNvlNodeStyle {\n // Memoize default color by label string (idea 2: avoid recalculating per node)\n const defaultColorCache = new Map<string, string>();\n // Cache sorted rules by label set key (idea 1: avoid allocation + sort per node)\n const sortedRulesCache = new Map<string, StyleRule[]>();\n // Cache merged Style for where-free rule sets (idea 3: skip rule iteration entirely)\n const mergedStyleCache = new Map<string, Style>();\n\n return (node: NodeData) => {\n const labelSetKey = node.labelsSorted.join('\\0');\n\n // Fast path: if all rules for this label set are where-free,\n // the merged style is identical for every node with the same labels.\n const cachedStyle = mergedStyleCache.get(labelSetKey);\n if (cachedStyle !== undefined) {\n return evaluateNodeStyle(cachedStyle, node);\n }\n\n // Memoize default color by first label\n const labelForDefaultColor = node.labelsSorted[0] ?? null;\n let defaultColor: string;\n if (labelForDefaultColor === null) {\n defaultColor = NO_LABEL_FALLBACK_COLOR;\n } else {\n let cached = defaultColorCache.get(labelForDefaultColor);\n if (cached === undefined) {\n cached =\n calculateDefaultNodeColors(labelForDefaultColor).backgroundColor;\n defaultColorCache.set(labelForDefaultColor, cached);\n }\n defaultColor = cached;\n }\n\n // Cache sorted rules by label set (avoids repeated allocation + sort)\n let sortedRules = sortedRulesCache.get(labelSetKey);\n if (sortedRules === undefined) {\n const matchingRules: StyleRule[] = [...styleMatchers.globalLabelRules];\n for (const label of node.labelsSorted) {\n const labelRules = styleMatchers.rulesByLabel.get(label);\n if (labelRules) {\n matchingRules.push(...labelRules);\n }\n }\n sortedRules = matchingRules.toSorted(compareByPriorityAscending);\n sortedRulesCache.set(labelSetKey, sortedRules);\n }\n\n // Evaluate rules, tracking whether all are where-free\n const collectStyles: Style = { color: defaultColor };\n let isAllWhereFree = true;\n for (const rule of sortedRules) {\n if (rule.where !== undefined) {\n isAllWhereFree = false;\n if (evaluateWhere(node, rule.where) === true) {\n Object.assign(collectStyles, rule.apply);\n }\n } else {\n Object.assign(collectStyles, rule.apply);\n }\n }\n\n // When all rules are where-free, the merged style depends only on labels.\n // Cache it so subsequent nodes with the same label set skip rule iteration.\n if (isAllWhereFree) {\n mergedStyleCache.set(labelSetKey, collectStyles);\n }\n\n return evaluateNodeStyle(collectStyles, node);\n };\n}\n\nconst DEFAULT_REL_STYLE: StyleRule = {\n match: { reltype: null },\n apply: {\n color: DEFAULT_REL_COLOR,\n captions: [{ value: { useType: true } }],\n },\n};\n\nexport function compileStyleRules({\n reltypes,\n styleRules,\n}: {\n reltypes: string[];\n styleRules: StyleRule[] | null | undefined;\n}): CompiledStyleRules {\n const styleMatchers = collectStyleMatchers(styleRules);\n // as relationships can only have one type, we can use a map to store the style function for each type\n const byType = new Map<\n string,\n (rel: RelData) => EvaluatedNvlRelationshipStyle\n >();\n\n // Compile relationship type-based rules\n for (const reltype of reltypes) {\n const rules = styleMatchers.rulesByType.get(reltype) ?? [];\n byType.set(\n reltype,\n createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...styleMatchers.globalReltypeRules,\n ...rules,\n ]),\n );\n }\n\n const byLabelSet = createByLabelSetFunction(styleMatchers);\n\n return { byLabelSet, byType, styleMatchers };\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
import z from 'zod';
|
|
22
|
+
import { StyleRuleSchema } from './style-types';
|
|
23
|
+
const StyleRulesArraySchema = z.array(StyleRuleSchema);
|
|
24
|
+
/**
|
|
25
|
+
* Parse and validate a JSON string as an array of StyleRules.
|
|
26
|
+
*
|
|
27
|
+
* Useful for importing style rules from JSON. Uses Zod for runtime validation and returns
|
|
28
|
+
* a discriminated result:
|
|
29
|
+
*
|
|
30
|
+
* - On success: `{ success: true, data: StyleRule[] }`
|
|
31
|
+
* - On failure: `{ success: false, error: ZodError }`
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const result = parseStyleRules('[{"match": {"label": "Person"}, "apply": {"color": "red"}}]');
|
|
36
|
+
* if (result.success) {
|
|
37
|
+
* console.log(result.data); // StyleRule[]
|
|
38
|
+
* } else {
|
|
39
|
+
* console.error(result.error.issues);
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export function parseStyleRules(jsonString) {
|
|
44
|
+
let parsed;
|
|
45
|
+
try {
|
|
46
|
+
parsed = JSON.parse(jsonString);
|
|
47
|
+
}
|
|
48
|
+
catch (_a) {
|
|
49
|
+
return {
|
|
50
|
+
error: new z.ZodError([
|
|
51
|
+
{
|
|
52
|
+
code: 'invalid_format',
|
|
53
|
+
message: 'Invalid JSON string',
|
|
54
|
+
path: [],
|
|
55
|
+
format: 'json',
|
|
56
|
+
},
|
|
57
|
+
]),
|
|
58
|
+
success: false,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return StyleRulesArraySchema.safeParse(parsed);
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=parse-style-rules.js.map
|
|
@@ -0,0 +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,EAAkB,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;AAEvD;;;;;;;;;;;;;;;;;;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 StyleRule, StyleRuleSchema } from './style-types';\nconst StyleRulesArraySchema = z.array(StyleRuleSchema);\n\n/**\n * Parse and validate a JSON string as an array of StyleRules.\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: StyleRule[] }`\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); // StyleRule[]\n * } else {\n * console.error(result.error.issues);\n * }\n * ```\n */\nexport function parseStyleRules(\n jsonString: string,\n):\n | { data: StyleRule[]; 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"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
import { z } from 'zod';
|
|
22
|
+
/*
|
|
23
|
+
* Style types defined in Zod, so that we can use the schemas to generate JSON Schema.
|
|
24
|
+
* This is useful for generating documentation, importing and for future integration into editors.
|
|
25
|
+
*
|
|
26
|
+
* Some simple examples of rules:
|
|
27
|
+
* - Match all nodes with label "Person" and apply red color
|
|
28
|
+
* { match: { label: "Person" }, apply: { color: "red" } }
|
|
29
|
+
*
|
|
30
|
+
* - Match all relationships with type "KNOWS" which have the property "name" equal to "John" and apply width 10
|
|
31
|
+
* { match: { reltype: "KNOWS" }, where: { equal: [{ property: "name" }, "John"] }, apply: { width: 10 } }
|
|
32
|
+
*/
|
|
33
|
+
// Selector schemas. This is what can go under the `match` key.
|
|
34
|
+
const LabelSelectorSchema = z.object({
|
|
35
|
+
label: z.string().nullable(),
|
|
36
|
+
});
|
|
37
|
+
const ReltypeSelectorSchema = z.object({
|
|
38
|
+
reltype: z.string().nullable(),
|
|
39
|
+
});
|
|
40
|
+
const PropertySelectorSchema = z.object({
|
|
41
|
+
property: z.string(),
|
|
42
|
+
});
|
|
43
|
+
export const SelectorSchema = z.union([
|
|
44
|
+
LabelSelectorSchema,
|
|
45
|
+
ReltypeSelectorSchema,
|
|
46
|
+
PropertySelectorSchema,
|
|
47
|
+
]);
|
|
48
|
+
export const MatchSchema = z.union([
|
|
49
|
+
LabelSelectorSchema,
|
|
50
|
+
ReltypeSelectorSchema,
|
|
51
|
+
PropertySelectorSchema,
|
|
52
|
+
]);
|
|
53
|
+
// Schemas for the values that can go under the `where` key. Starts with defining the literal values.
|
|
54
|
+
export const CypherValueSchema = z.union([
|
|
55
|
+
z.string(),
|
|
56
|
+
z.number(),
|
|
57
|
+
z.boolean(),
|
|
58
|
+
z.null(),
|
|
59
|
+
]);
|
|
60
|
+
export const ValueSchema = z
|
|
61
|
+
.union([SelectorSchema, CypherValueSchema])
|
|
62
|
+
.describe('Either a property/label/reltype selector (e.g., {property: "name"}) or a literal value (string, number, boolean, null).');
|
|
63
|
+
export const WhereSchema = z.lazy(() => z.union([
|
|
64
|
+
SelectorSchema,
|
|
65
|
+
z.object({ not: WhereSchema }),
|
|
66
|
+
z.object({ and: z.array(WhereSchema) }),
|
|
67
|
+
z.object({ or: z.array(WhereSchema) }),
|
|
68
|
+
z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),
|
|
69
|
+
z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),
|
|
70
|
+
z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),
|
|
71
|
+
z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),
|
|
72
|
+
z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),
|
|
73
|
+
z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),
|
|
74
|
+
z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),
|
|
75
|
+
z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),
|
|
76
|
+
z.object({ isNull: ValueSchema }),
|
|
77
|
+
]));
|
|
78
|
+
// Schemas that go under the `apply` key.
|
|
79
|
+
export const CaptionValueSchema = z.union([
|
|
80
|
+
z.string(),
|
|
81
|
+
z.object({ property: z.string() }),
|
|
82
|
+
z.object({ useType: z.literal(true) }),
|
|
83
|
+
]);
|
|
84
|
+
export const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);
|
|
85
|
+
export const NvlCaptionSchema = z.object({
|
|
86
|
+
styles: z.array(z.string()).optional(),
|
|
87
|
+
value: CaptionValueSchema.optional(),
|
|
88
|
+
key: z.string().optional(),
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* OverlayIcon from NVL - icon displayed on top of a graph element
|
|
92
|
+
* @see @neo4j-nvl/base Node.overlayIcon
|
|
93
|
+
*/
|
|
94
|
+
const NvlOverlayIconSchema = z.object({
|
|
95
|
+
url: z.string(),
|
|
96
|
+
position: z.array(z.number()).optional(),
|
|
97
|
+
size: z.number().optional(),
|
|
98
|
+
});
|
|
99
|
+
export const StyleSchema = z.object({
|
|
100
|
+
captionAlign: z.enum(['top', 'bottom', 'center']).optional(),
|
|
101
|
+
captionSize: z.number().optional(),
|
|
102
|
+
captions: z.array(NvlCaptionSchema).optional(),
|
|
103
|
+
color: z.string().optional(),
|
|
104
|
+
icon: z.string().optional(),
|
|
105
|
+
overlayIcon: NvlOverlayIconSchema.optional(),
|
|
106
|
+
size: z.number().optional(),
|
|
107
|
+
width: z.number().optional(),
|
|
108
|
+
});
|
|
109
|
+
export const StyleRuleSchema = z.object({
|
|
110
|
+
match: MatchSchema,
|
|
111
|
+
where: WhereSchema.optional(),
|
|
112
|
+
apply: StyleSchema,
|
|
113
|
+
disabled: z.boolean().optional(),
|
|
114
|
+
priority: z.number().optional(),
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=style-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC;IACpC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC;IACjC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAEH,qGAAqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KA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\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Node, type Relationship } from '@neo4j-nvl/base';\nimport { z } from 'zod';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n *\n * Some simple examples of rules:\n * - Match all nodes with label \"Person\" and apply red color\n * { match: { label: \"Person\" }, apply: { color: \"red\" } }\n *\n * - Match all relationships with type \"KNOWS\" which have the property \"name\" equal to \"John\" and apply width 10\n * { match: { reltype: \"KNOWS\" }, where: { equal: [{ property: \"name\" }, \"John\"] }, apply: { width: 10 } }\n */\n\n// Selector schemas. This is what can go under the `match` key.\nconst LabelSelectorSchema = z.object({\n label: z.string().nullable(),\n});\n\nconst ReltypeSelectorSchema = z.object({\n reltype: z.string().nullable(),\n});\n\nconst PropertySelectorSchema = z.object({\n property: z.string(),\n});\n\nexport const SelectorSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\ntype Selector = z.infer<typeof SelectorSchema>;\n\nexport const MatchSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\n\n// Schemas for the values that can go under the `where` key. Starts with defining the literal values.\nexport const CypherValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}) or a literal value (string, number, boolean, null).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\n\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n});\n\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 icon: z.string().optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n size: z.number().optional(),\n width: z.number().optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\nexport const StyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n disabled: z.boolean().optional(),\n priority: z.number().optional(),\n});\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\n\n// Evaluated style values that NVL expects\nexport type EvaluatedNvlNodeStyle = Pick<\n Node,\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n>;\nexport type EvaluatedNvlRelationshipStyle = Pick<\n Relationship,\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon'\n>;\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import { type NodeData, type RelData } from '../graph-visualization-context';
|
|
22
|
+
import { type EvaluatedNvlNodeStyle, type EvaluatedNvlRelationshipStyle, type StyleRule } from './style-types';
|
|
23
|
+
type StyleMatchers = {
|
|
24
|
+
globalLabelRules: StyleRule[];
|
|
25
|
+
globalReltypeRules: StyleRule[];
|
|
26
|
+
rulesByLabel: Map<string, StyleRule[]>;
|
|
27
|
+
rulesByType: Map<string, StyleRule[]>;
|
|
28
|
+
};
|
|
29
|
+
export type CompiledStyleRules = {
|
|
30
|
+
byType: Map<string, (rel: RelData) => EvaluatedNvlRelationshipStyle>;
|
|
31
|
+
styleMatchers: StyleMatchers;
|
|
32
|
+
byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;
|
|
33
|
+
};
|
|
34
|
+
export declare const DEFAULT_REL_COLOR: string;
|
|
35
|
+
export declare function compileStyleRules({ reltypes, styleRules, }: {
|
|
36
|
+
reltypes: string[];
|
|
37
|
+
styleRules: StyleRule[] | null | undefined;
|
|
38
|
+
}): CompiledStyleRules;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=compile-graph-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-graph-styles.d.ts","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,OAAO,EACb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAElC,KAAK,SAAS,EAGf,MAAM,eAAe,CAAC;AAEvB,KAAK,aAAa,GAAG;IACnB,gBAAgB,EAAE,SAAS,EAAE,CAAC;IAC9B,kBAAkB,EAAE,SAAS,EAAE,CAAC;IAChC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACvC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;CACvC,CAAC;AAgdF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,6BAA6B,CAAC,CAAC;IACrE,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,qBAAqB,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAA+B,CAAC;AAoF9D,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;CAC5C,GAAG,kBAAkB,CAwBrB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
import z from 'zod';
|
|
22
|
+
import { type StyleRule } from './style-types';
|
|
23
|
+
/**
|
|
24
|
+
* Parse and validate a JSON string as an array of StyleRules.
|
|
25
|
+
*
|
|
26
|
+
* Useful for importing style rules from JSON. Uses Zod for runtime validation and returns
|
|
27
|
+
* a discriminated result:
|
|
28
|
+
*
|
|
29
|
+
* - On success: `{ success: true, data: StyleRule[] }`
|
|
30
|
+
* - On failure: `{ success: false, error: ZodError }`
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const result = parseStyleRules('[{"match": {"label": "Person"}, "apply": {"color": "red"}}]');
|
|
35
|
+
* if (result.success) {
|
|
36
|
+
* console.log(result.data); // StyleRule[]
|
|
37
|
+
* } else {
|
|
38
|
+
* console.error(result.error.issues);
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseStyleRules(jsonString: string): {
|
|
43
|
+
data: StyleRule[];
|
|
44
|
+
success: true;
|
|
45
|
+
} | {
|
|
46
|
+
error: z.ZodError;
|
|
47
|
+
success: false;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=parse-style-rules.d.ts.map
|
|
@@ -0,0 +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,SAAS,EAAmB,MAAM,eAAe,CAAC;AAGhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,GAEhB;IAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GACpC;IAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAmBxC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
import { type Node, type Relationship } from '@neo4j-nvl/base';
|
|
22
|
+
import { z } from 'zod';
|
|
23
|
+
export declare const SelectorSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
24
|
+
label: z.ZodNullable<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
26
|
+
reltype: z.ZodNullable<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
+
property: z.ZodString;
|
|
29
|
+
}, z.core.$strip>]>;
|
|
30
|
+
type Selector = z.infer<typeof SelectorSchema>;
|
|
31
|
+
export declare const MatchSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
32
|
+
label: z.ZodNullable<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
reltype: z.ZodNullable<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
property: z.ZodString;
|
|
37
|
+
}, z.core.$strip>]>;
|
|
38
|
+
export declare const CypherValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
39
|
+
export type CypherValue = z.infer<typeof CypherValueSchema>;
|
|
40
|
+
export declare const ValueSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
|
|
41
|
+
label: z.ZodNullable<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
reltype: z.ZodNullable<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
property: z.ZodString;
|
|
46
|
+
}, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>]>;
|
|
47
|
+
export type Value = z.infer<typeof ValueSchema>;
|
|
48
|
+
/**
|
|
49
|
+
* Where clause - recursive type for conditional expressions
|
|
50
|
+
* The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.
|
|
51
|
+
*/
|
|
52
|
+
export type Where = Selector | {
|
|
53
|
+
not: Where;
|
|
54
|
+
} | {
|
|
55
|
+
and: Where[];
|
|
56
|
+
} | {
|
|
57
|
+
or: Where[];
|
|
58
|
+
} | {
|
|
59
|
+
equal: [Value, Value];
|
|
60
|
+
} | {
|
|
61
|
+
lessThan: [Value, Value];
|
|
62
|
+
} | {
|
|
63
|
+
lessThanOrEqual: [Value, Value];
|
|
64
|
+
} | {
|
|
65
|
+
greaterThan: [Value, Value];
|
|
66
|
+
} | {
|
|
67
|
+
greaterThanOrEqual: [Value, Value];
|
|
68
|
+
} | {
|
|
69
|
+
contains: [Value, Value];
|
|
70
|
+
} | {
|
|
71
|
+
startsWith: [Value, Value];
|
|
72
|
+
} | {
|
|
73
|
+
endsWith: [Value, Value];
|
|
74
|
+
} | {
|
|
75
|
+
isNull: Value;
|
|
76
|
+
};
|
|
77
|
+
export declare const WhereSchema: z.ZodType<Where>;
|
|
78
|
+
export declare const CaptionValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
79
|
+
property: z.ZodString;
|
|
80
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
useType: z.ZodLiteral<true>;
|
|
82
|
+
}, z.core.$strip>]>;
|
|
83
|
+
export type CaptionValue = z.infer<typeof CaptionValueSchema>;
|
|
84
|
+
export declare const CaptionVariationSchema: z.ZodEnum<{
|
|
85
|
+
bold: "bold";
|
|
86
|
+
italic: "italic";
|
|
87
|
+
underline: "underline";
|
|
88
|
+
}>;
|
|
89
|
+
export type CaptionVariation = z.infer<typeof CaptionVariationSchema>;
|
|
90
|
+
export declare const NvlCaptionSchema: z.ZodObject<{
|
|
91
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
93
|
+
property: z.ZodString;
|
|
94
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
+
useType: z.ZodLiteral<true>;
|
|
96
|
+
}, z.core.$strip>]>>;
|
|
97
|
+
key: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export type Caption = z.infer<typeof NvlCaptionSchema>;
|
|
100
|
+
export declare const StyleSchema: z.ZodObject<{
|
|
101
|
+
captionAlign: z.ZodOptional<z.ZodEnum<{
|
|
102
|
+
center: "center";
|
|
103
|
+
top: "top";
|
|
104
|
+
bottom: "bottom";
|
|
105
|
+
}>>;
|
|
106
|
+
captionSize: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
captions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
108
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
110
|
+
property: z.ZodString;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
useType: z.ZodLiteral<true>;
|
|
113
|
+
}, z.core.$strip>]>>;
|
|
114
|
+
key: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>>>;
|
|
116
|
+
color: z.ZodOptional<z.ZodString>;
|
|
117
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
118
|
+
overlayIcon: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
url: z.ZodString;
|
|
120
|
+
position: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
121
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
export type Style = z.infer<typeof StyleSchema>;
|
|
127
|
+
export declare const StyleRuleSchema: z.ZodObject<{
|
|
128
|
+
match: z.ZodUnion<readonly [z.ZodObject<{
|
|
129
|
+
label: z.ZodNullable<z.ZodString>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
reltype: z.ZodNullable<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
133
|
+
property: z.ZodString;
|
|
134
|
+
}, z.core.$strip>]>;
|
|
135
|
+
where: z.ZodOptional<z.ZodType<Where, unknown, z.core.$ZodTypeInternals<Where, unknown>>>;
|
|
136
|
+
apply: z.ZodObject<{
|
|
137
|
+
captionAlign: z.ZodOptional<z.ZodEnum<{
|
|
138
|
+
center: "center";
|
|
139
|
+
top: "top";
|
|
140
|
+
bottom: "bottom";
|
|
141
|
+
}>>;
|
|
142
|
+
captionSize: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
captions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
144
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
145
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
146
|
+
property: z.ZodString;
|
|
147
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
148
|
+
useType: z.ZodLiteral<true>;
|
|
149
|
+
}, z.core.$strip>]>>;
|
|
150
|
+
key: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strip>>>;
|
|
152
|
+
color: z.ZodOptional<z.ZodString>;
|
|
153
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
154
|
+
overlayIcon: z.ZodOptional<z.ZodObject<{
|
|
155
|
+
url: z.ZodString;
|
|
156
|
+
position: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
157
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
}, z.core.$strip>>;
|
|
159
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
160
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export type StyleRule = z.infer<typeof StyleRuleSchema>;
|
|
166
|
+
export type EvaluatedNvlNodeStyle = Pick<Node, 'icon' | 'overlayIcon' | 'color' | 'size' | 'captions' | 'captionSize' | 'captionAlign'>;
|
|
167
|
+
export type EvaluatedNvlRelationshipStyle = Pick<Relationship, 'width' | 'color' | 'captions' | 'captionSize' | 'captionAlign' | 'overlayIcon'>;
|
|
168
|
+
export {};
|
|
169
|
+
//# sourceMappingURL=style-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react-graph",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.25",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of the graph visualization from Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -55,12 +55,13 @@
|
|
|
55
55
|
"@neo4j-nvl/base": "^1.0.0",
|
|
56
56
|
"@neo4j-nvl/interaction-handlers": "^1.0.0",
|
|
57
57
|
"@neo4j-nvl/react": "^1.0.0",
|
|
58
|
-
"@neo4j-ndl/base": "^4.9.
|
|
59
|
-
"@neo4j-ndl/react": "^4.9.
|
|
58
|
+
"@neo4j-ndl/base": "^4.9.2",
|
|
59
|
+
"@neo4j-ndl/react": "^4.9.7"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"classnames": "2.5.1",
|
|
63
|
-
"re-resizable": "6.11.2"
|
|
63
|
+
"re-resizable": "6.11.2",
|
|
64
|
+
"zod": "^4.3.6"
|
|
64
65
|
},
|
|
65
66
|
"scripts": {
|
|
66
67
|
"test": "pnpm run test:unit && pnpm run test:playwright",
|