@neo4j-ndl/react-graph 1.5.0 → 1.5.2

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.
@@ -160,7 +160,7 @@ exports.StyleRuleSchema = zod_1.z.object({
160
160
  where: exports.WhereSchema.optional(),
161
161
  apply: exports.StyleSchema,
162
162
  disabled: zod_1.z.boolean().optional(),
163
- priority: zod_1.z.number().optional(),
163
+ priority: zod_1.z.number().nonnegative().optional(),
164
164
  });
165
165
  const NODE_STYLE_KEYS = [
166
166
  'color',
@@ -1 +1 @@
1
- {"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAyPH,wDAUC;AAOD,wEAUC;AAjRD,6BAAwB;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,OAAC,CAAC,KAAK,CAAC;IACpC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAGU,QAAA,WAAW,GAAG,OAAC,CAAC,KAAK,CAAC;IACjC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAEH,qGAAqG;AACxF,QAAA,iBAAiB,GAAG,OAAC,CAAC,KAAK,CAAC;IACvC,OAAC,CAAC,MAAM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EF;;;;GAIG;AACH,SAAgB,sBAAsB,CACpC,IAAoC;IAEpC,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,MAAwC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,SAAgB,8BAA8B,CAC5C,GAA2C;IAE3C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,MAAgD,CAAC;AAC1D,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Node, type Relationship } from '@neo4j-nvl/base';\nimport { z } from 'zod';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n *\n * Some simple examples of rules:\n * - Match all nodes with label \"Person\" and apply red color\n * { match: { label: \"Person\" }, apply: { color: \"red\" } }\n *\n * - Match all relationships with type \"KNOWS\" which have the property \"name\" equal to \"John\" and apply width 10\n * { match: { reltype: \"KNOWS\" }, where: { equal: [{ property: \"name\" }, \"John\"] }, apply: { width: 10 } }\n */\n\n// Selector schemas. This is what can go under the `match` key.\nconst LabelSelectorSchema = z.object({\n label: z.string().nullable(),\n});\n\nconst ReltypeSelectorSchema = z.object({\n reltype: z.string().nullable(),\n});\n\nconst PropertySelectorSchema = z.object({\n property: z.string(),\n});\n\nexport const SelectorSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\ntype Selector = z.infer<typeof SelectorSchema>;\n\nexport const MatchSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\n\n// Schemas for the values that can go under the `where` key. Starts with defining the literal values.\nexport const CypherValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}) or a literal value (string, number, boolean, null).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\n\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous numeric property value.\n * Colors must be a standard hex string (#rrggbb).\n * If the property is missing, non-numeric, or any color is invalid, the\n * colorRange is silently ignored — other style properties still apply.\n */\nexport const ColorRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n minColor: z.string(),\n maxValue: z.number(),\n maxColor: z.string(),\n midValue: z.number().optional(),\n midColor: z.string().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\n/**\n * Size interpolation for nodes based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].\n * If the property is missing or non-numeric, nodeSizeRange is silently ignored —\n * other style properties still apply.\n */\nexport const NodeSizeRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minSize: z.number(),\n maxSize: z.number(),\n});\nexport type NodeSizeRange = z.infer<typeof NodeSizeRangeSchema>;\n\n/**\n * Width interpolation for relationships based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].\n * If the property is missing or non-numeric, relWidthRange is silently ignored —\n * other style properties still apply.\n */\nexport const RelWidthRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minWidth: z.number(),\n maxWidth: z.number(),\n});\nexport type RelWidthRange = z.infer<typeof RelWidthRangeSchema>;\n\nexport const StyleSchema = z.object({\n captionAlign: z.enum(['top', 'bottom', 'center']).optional(),\n captionSize: z.number().optional(),\n captions: z.array(NvlCaptionSchema).optional(),\n color: z.string().optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: z.string().optional(),\n nodeSizeRange: NodeSizeRangeSchema.optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n relWidthRange: RelWidthRangeSchema.optional(),\n size: z.number().optional(),\n width: z.number().optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\nexport const StyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n disabled: z.boolean().optional(),\n priority: z.number().optional(),\n});\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\n\n// Evaluated style values that NVL expects\ntype NodeStyleKey =\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign';\n\ntype RelStyleKey =\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon';\n\nexport type EvaluatedNvlNodeStyle = Pick<Node, NodeStyleKey>;\nexport type EvaluatedNvlRelationshipStyle = Pick<Relationship, RelStyleKey>;\n\nconst NODE_STYLE_KEYS: readonly NodeStyleKey[] = [\n 'color',\n 'size',\n 'icon',\n 'overlayIcon',\n 'captions',\n 'captionSize',\n 'captionAlign',\n];\n\nconst REL_STYLE_KEYS: readonly RelStyleKey[] = [\n 'color',\n 'width',\n 'captions',\n 'captionSize',\n 'captionAlign',\n 'overlayIcon',\n];\n\n/**\n * Extract consumer-set style properties from a node.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerNodeStyles(\n node: Partial<EvaluatedNvlNodeStyle>,\n): Partial<EvaluatedNvlNodeStyle> {\n const result: Record<string, unknown> = {};\n for (const key of NODE_STYLE_KEYS) {\n if (node[key] !== undefined) {\n result[key] = node[key];\n }\n }\n return result as Partial<EvaluatedNvlNodeStyle>;\n}\n\n/**\n * Extract consumer-set style properties from a relationship.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerRelationshipStyles(\n rel: Partial<EvaluatedNvlRelationshipStyle>,\n): Partial<EvaluatedNvlRelationshipStyle> {\n const result: Record<string, unknown> = {};\n for (const key of REL_STYLE_KEYS) {\n if (rel[key] !== undefined) {\n result[key] = rel[key];\n }\n }\n return result as Partial<EvaluatedNvlRelationshipStyle>;\n}\n"]}
1
+ {"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAyPH,wDAUC;AAOD,wEAUC;AAjRD,6BAAwB;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,OAAC,CA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C,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"]}
@@ -155,7 +155,7 @@ export const StyleRuleSchema = z.object({
155
155
  where: WhereSchema.optional(),
156
156
  apply: StyleSchema,
157
157
  disabled: z.boolean().optional(),
158
- priority: z.number().optional(),
158
+ priority: z.number().nonnegative().optional(),
159
159
  });
160
160
  const NODE_STYLE_KEYS = [
161
161
  'color',
@@ -1 +1 @@
1
- {"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEH,MA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AK,EAAE,WAAW,CAAC,QAAQ,EAAE;IAC7B,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAwBH,MAAM,eAAe,GAA4B;IAC/C,OAAO;IACP,MAAM;IACN,MAAM;IACN,aAAa;IACb,UAAU;IACV,aAAa;IACb,cAAc;CACf,CAAC;AAEF,MAAM,cAAc,GAA2B;IAC7C,OAAO;IACP,OAAO;IACP,UAAU;IACV,aAAa;IACb,cAAc;IACd,aAAa;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAoC;IAEpC,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,MAAwC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,GAA2C;IAE3C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,MAAgD,CAAC;AAC1D,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Node, type Relationship } from '@neo4j-nvl/base';\nimport { z } from 'zod';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n *\n * Some simple examples of rules:\n * - Match all nodes with label \"Person\" and apply red color\n * { match: { label: \"Person\" }, apply: { color: \"red\" } }\n *\n * - Match all relationships with type \"KNOWS\" which have the property \"name\" equal to \"John\" and apply width 10\n * { match: { reltype: \"KNOWS\" }, where: { equal: [{ property: \"name\" }, \"John\"] }, apply: { width: 10 } }\n */\n\n// Selector schemas. This is what can go under the `match` key.\nconst LabelSelectorSchema = z.object({\n label: z.string().nullable(),\n});\n\nconst ReltypeSelectorSchema = z.object({\n reltype: z.string().nullable(),\n});\n\nconst PropertySelectorSchema = z.object({\n property: z.string(),\n});\n\nexport const SelectorSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\ntype Selector = z.infer<typeof SelectorSchema>;\n\nexport const MatchSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\n\n// Schemas for the values that can go under the `where` key. Starts with defining the literal values.\nexport const CypherValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}) or a literal value (string, number, boolean, null).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\n\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous numeric property value.\n * Colors must be a standard hex string (#rrggbb).\n * If the property is missing, non-numeric, or any color is invalid, the\n * colorRange is silently ignored — other style properties still apply.\n */\nexport const ColorRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n minColor: z.string(),\n maxValue: z.number(),\n maxColor: z.string(),\n midValue: z.number().optional(),\n midColor: z.string().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\n/**\n * Size interpolation for nodes based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].\n * If the property is missing or non-numeric, nodeSizeRange is silently ignored —\n * other style properties still apply.\n */\nexport const NodeSizeRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minSize: z.number(),\n maxSize: z.number(),\n});\nexport type NodeSizeRange = z.infer<typeof NodeSizeRangeSchema>;\n\n/**\n * Width interpolation for relationships based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].\n * If the property is missing or non-numeric, relWidthRange is silently ignored —\n * other style properties still apply.\n */\nexport const RelWidthRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minWidth: z.number(),\n maxWidth: z.number(),\n});\nexport type RelWidthRange = z.infer<typeof RelWidthRangeSchema>;\n\nexport const StyleSchema = z.object({\n captionAlign: z.enum(['top', 'bottom', 'center']).optional(),\n captionSize: z.number().optional(),\n captions: z.array(NvlCaptionSchema).optional(),\n color: z.string().optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: z.string().optional(),\n nodeSizeRange: NodeSizeRangeSchema.optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n relWidthRange: RelWidthRangeSchema.optional(),\n size: z.number().optional(),\n width: z.number().optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\nexport const StyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n disabled: z.boolean().optional(),\n priority: z.number().optional(),\n});\nexport type StyleRule = z.infer<typeof StyleRuleSchema>;\n\n// Evaluated style values that NVL expects\ntype NodeStyleKey =\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign';\n\ntype RelStyleKey =\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon';\n\nexport type EvaluatedNvlNodeStyle = Pick<Node, NodeStyleKey>;\nexport type EvaluatedNvlRelationshipStyle = Pick<Relationship, RelStyleKey>;\n\nconst NODE_STYLE_KEYS: readonly NodeStyleKey[] = [\n 'color',\n 'size',\n 'icon',\n 'overlayIcon',\n 'captions',\n 'captionSize',\n 'captionAlign',\n];\n\nconst REL_STYLE_KEYS: readonly RelStyleKey[] = [\n 'color',\n 'width',\n 'captions',\n 'captionSize',\n 'captionAlign',\n 'overlayIcon',\n];\n\n/**\n * Extract consumer-set style properties from a node.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerNodeStyles(\n node: Partial<EvaluatedNvlNodeStyle>,\n): Partial<EvaluatedNvlNodeStyle> {\n const result: Record<string, unknown> = {};\n for (const key of NODE_STYLE_KEYS) {\n if (node[key] !== undefined) {\n result[key] = node[key];\n }\n }\n return result as Partial<EvaluatedNvlNodeStyle>;\n}\n\n/**\n * Extract consumer-set style properties from a relationship.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerRelationshipStyles(\n rel: Partial<EvaluatedNvlRelationshipStyle>,\n): Partial<EvaluatedNvlRelationshipStyle> {\n const result: Record<string, unknown> = {};\n for (const key of REL_STYLE_KEYS) {\n if (rel[key] !== undefined) {\n result[key] = rel[key];\n }\n }\n return result as Partial<EvaluatedNvlRelationshipStyle>;\n}\n"]}
1
+ {"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC;IACpC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC;IACjC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAEH,qGAAqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC;IACvC,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;CACT,CAAC,CAAC;AA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;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAoC;IAEpC,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,MAAwC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,GAA2C;IAE3C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,MAAgD,CAAC;AAC1D,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Node, type Relationship } from '@neo4j-nvl/base';\nimport { z } from 'zod';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n *\n * Some simple examples of rules:\n * - Match all nodes with label \"Person\" and apply red color\n * { match: { label: \"Person\" }, apply: { color: \"red\" } }\n *\n * - Match all relationships with type \"KNOWS\" which have the property \"name\" equal to \"John\" and apply width 10\n * { match: { reltype: \"KNOWS\" }, where: { equal: [{ property: \"name\" }, \"John\"] }, apply: { width: 10 } }\n */\n\n// Selector schemas. This is what can go under the `match` key.\nconst LabelSelectorSchema = z.object({\n label: z.string().nullable(),\n});\n\nconst ReltypeSelectorSchema = z.object({\n reltype: z.string().nullable(),\n});\n\nconst PropertySelectorSchema = z.object({\n property: z.string(),\n});\n\nexport const SelectorSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\ntype Selector = z.infer<typeof SelectorSchema>;\n\nexport const MatchSchema = z.union([\n LabelSelectorSchema,\n ReltypeSelectorSchema,\n PropertySelectorSchema,\n]);\n\n// Schemas for the values that can go under the `where` key. Starts with defining the literal values.\nexport const CypherValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}) or a literal value (string, number, boolean, null).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\n\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous numeric property value.\n * Colors must be a standard hex string (#rrggbb).\n * If the property is missing, non-numeric, or any color is invalid, the\n * colorRange is silently ignored — other style properties still apply.\n */\nexport const ColorRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n minColor: z.string(),\n maxValue: z.number(),\n maxColor: z.string(),\n midValue: z.number().optional(),\n midColor: z.string().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\n/**\n * Size interpolation for nodes based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].\n * If the property is missing or non-numeric, nodeSizeRange is silently ignored —\n * other style properties still apply.\n */\nexport const NodeSizeRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minSize: z.number(),\n maxSize: z.number(),\n});\nexport type NodeSizeRange = z.infer<typeof NodeSizeRangeSchema>;\n\n/**\n * Width interpolation for relationships based on a continuous numeric property value.\n * Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].\n * If the property is missing or non-numeric, relWidthRange is silently ignored —\n * other style properties still apply.\n */\nexport const RelWidthRangeSchema = z.object({\n onProperty: z.string(),\n minValue: z.number(),\n maxValue: z.number(),\n minWidth: z.number(),\n maxWidth: z.number(),\n});\nexport type RelWidthRange = z.infer<typeof RelWidthRangeSchema>;\n\nexport const StyleSchema = z.object({\n captionAlign: z.enum(['top', 'bottom', 'center']).optional(),\n captionSize: z.number().optional(),\n captions: z.array(NvlCaptionSchema).optional(),\n color: z.string().optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: z.string().optional(),\n nodeSizeRange: NodeSizeRangeSchema.optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n relWidthRange: RelWidthRangeSchema.optional(),\n size: z.number().optional(),\n width: z.number().optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\nexport const StyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n disabled: z.boolean().optional(),\n priority: z.number().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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react-graph",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of the graph visualization from Neo4j Design System",
6
6
  "keywords": [
@@ -57,13 +57,13 @@
57
57
  "@neo4j-nvl/base": "^1.0.0",
58
58
  "@neo4j-nvl/interaction-handlers": "^1.0.0",
59
59
  "@neo4j-nvl/react": "^1.0.0",
60
- "@neo4j-ndl/react": "^4.14.0",
60
+ "@neo4j-ndl/react": "^4.14.2",
61
61
  "@neo4j-ndl/base": "^4.14.0"
62
62
  },
63
63
  "dependencies": {
64
64
  "classnames": "2.5.1",
65
65
  "re-resizable": "6.11.2",
66
- "zod": "^4.3.6"
66
+ "zod": "4.3.6"
67
67
  },
68
68
  "scripts": {
69
69
  "test": "pnpm run test:unit && pnpm run test:playwright",