@neo4j-ndl/react-graph 2.1.6 → 2.1.7

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.
Files changed (34) hide show
  1. package/lib/cjs/_generated/style-rules/index.js +7 -1
  2. package/lib/cjs/_generated/style-rules/index.js.map +1 -1
  3. package/lib/cjs/_generated/style-rules/literal-schemas.js +32 -1
  4. package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
  5. package/lib/cjs/_generated/style-rules/range-utils.js +46 -0
  6. package/lib/cjs/_generated/style-rules/range-utils.js.map +1 -0
  7. package/lib/cjs/index.js.map +1 -1
  8. package/lib/cjs/styling/compile-graph-styles.js +14 -5
  9. package/lib/cjs/styling/compile-graph-styles.js.map +1 -1
  10. package/lib/cjs/styling/style-types.js +19 -19
  11. package/lib/cjs/styling/style-types.js.map +1 -1
  12. package/lib/esm/_generated/style-rules/index.js +2 -1
  13. package/lib/esm/_generated/style-rules/index.js.map +1 -1
  14. package/lib/esm/_generated/style-rules/literal-schemas.js +28 -0
  15. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
  16. package/lib/esm/_generated/style-rules/range-utils.js +43 -0
  17. package/lib/esm/_generated/style-rules/range-utils.js.map +1 -0
  18. package/lib/esm/index.js.map +1 -1
  19. package/lib/esm/styling/compile-graph-styles.js +15 -6
  20. package/lib/esm/styling/compile-graph-styles.js.map +1 -1
  21. package/lib/esm/styling/style-types.js +19 -19
  22. package/lib/esm/styling/style-types.js.map +1 -1
  23. package/lib/types/_generated/style-rules/index.d.ts +3 -2
  24. package/lib/types/_generated/style-rules/index.d.ts.map +1 -1
  25. package/lib/types/_generated/style-rules/literal-schemas.d.ts +20 -0
  26. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
  27. package/lib/types/_generated/style-rules/range-utils.d.ts +26 -0
  28. package/lib/types/_generated/style-rules/range-utils.d.ts.map +1 -0
  29. package/lib/types/index.d.ts +1 -1
  30. package/lib/types/index.d.ts.map +1 -1
  31. package/lib/types/styling/compile-graph-styles.d.ts.map +1 -1
  32. package/lib/types/styling/style-types.d.ts +168 -33
  33. package/lib/types/styling/style-types.d.ts.map +1 -1
  34. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAoWH,wDAUC;AAOD,wEAUC;AA5XD,6BAAwB;AAExB,2DAWmC;AAEnC;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,OAAC,CAAC,KAAK,CAAC;IACpC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAGU,QAAA,WAAW,GAAG,OAAC,CAAC,KAAK,CAAC;IACjC,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC,CAAC;AAEH,qGAAqG;AACxF,QAAA,iBAAiB,GAAG,OAAC,CAAC,KAAK,CAAC;IACvC,OAAC,CAAC,MAAM,EAAE;IACV,kCAAoB;IACpB,OAAC,CAAC,OAAO,EAAE;IACX,OAAC,CAAC,IAAI,EAAE;IACR,mCAAqB;IACrB,wCAA0B;IAC1B,+BAAiB;CAClB,CAAC,CAAC;AAEH,yEAAyE;AAC5D,QAAA,wBAAwB,GAAG,iCAAm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AADnC,QAAA,gBAAgB,oBACmB;AA6BhD,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,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\nimport {\n type BigintLiteral,\n BigintLiteralSchema,\n type DatetimeLiteral,\n DatetimeLiteralSchema,\n type LocalDatetimeLiteral,\n LocalDatetimeLiteralSchema,\n type NumericLiteral,\n NumericLiteralSchema,\n type TimeLiteral,\n TimeLiteralSchema,\n} from '../_generated/style-rules';\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 NumericLiteralSchema,\n z.boolean(),\n z.null(),\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n/** A JSON-safe bigint literal represented by a signed decimal string. */\nexport const GraphBigintLiteralSchema = BigintLiteralSchema;\n/** A number, native bigint, or JSON-safe bigint literal. */\nexport const GraphNumericLiteralSchema = NumericLiteralSchema;\nexport type GraphBigintLiteral = BigintLiteral;\nexport type GraphNumericLiteral = NumericLiteral;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}), a literal value (string, number, bigint, {bigint: \"42\"}, boolean, null), or a datetime/time literal (e.g., {datetime: \"2024-01-01T00:00:00Z\"}, {time: \"14:30:00\"}).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\nexport type { DatetimeLiteral, LocalDatetimeLiteral, TimeLiteral };\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\nconst CaptionsSchema = z.object({\n text: z.array(NvlCaptionSchema).optional(),\n align: z.enum(['top', 'bottom', 'center']).optional(),\n size: z.number().optional(),\n isDisabled: z.boolean().optional(),\n});\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n isDisabled: z.boolean().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous numeric property value. Range\n * boundaries accept numbers, native bigints, and JSON-safe bigint literals.\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: GraphNumericLiteralSchema,\n minColor: z.string(),\n maxValue: GraphNumericLiteralSchema,\n maxColor: z.string(),\n midValue: GraphNumericLiteralSchema.optional(),\n midColor: z.string().optional(),\n isDisabled: z.boolean().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\n/**\n * Size interpolation for nodes based on a continuous numeric property value.\n * Range boundaries accept numbers, native bigints, and JSON-safe bigint\n * literals.\n * Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].\n * If the property is missing or non-numeric, sizeRange is silently ignored —\n * other style properties still apply.\n */\nexport const SizeRangeSchema = z.object({\n onProperty: z.string(),\n minValue: GraphNumericLiteralSchema,\n maxValue: GraphNumericLiteralSchema,\n minSize: z.number(),\n maxSize: z.number(),\n isDisabled: z.boolean().optional(),\n});\nexport type SizeRange = z.infer<typeof SizeRangeSchema>;\n\n/**\n * Width interpolation for relationships based on a continuous numeric property\n * value. Range boundaries accept numbers, native bigints, and JSON-safe bigint\n * literals.\n * Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].\n * If the property is missing or non-numeric, widthRange is silently ignored —\n * other style properties still apply.\n */\nexport const WidthRangeSchema = z.object({\n onProperty: z.string(),\n minValue: GraphNumericLiteralSchema,\n maxValue: GraphNumericLiteralSchema,\n minWidth: z.number(),\n maxWidth: z.number(),\n isDisabled: z.boolean().optional(),\n});\nexport type WidthRange = z.infer<typeof WidthRangeSchema>;\n\n/**\n * Assigns a unique color per distinct value of a property.\n * Colors are assigned in first-come, first-served order from a categorical palette.\n * If the property is missing or null, uniqueColors is silently ignored —\n * other style properties still apply.\n */\nexport const UniqueColorsSchema = z.object({\n onProperty: z.string(),\n isDisabled: z.boolean().optional(),\n});\nexport type UniqueColors = z.infer<typeof UniqueColorsSchema>;\n\nconst ColorSchema = z.object({\n value: z.string(),\n isDisabled: z.boolean().optional(),\n});\n\nconst IconSchema = z.object({\n value: z.string(),\n isDisabled: z.boolean().optional(),\n});\n\nconst SizeSchema = z.object({\n value: z.number(),\n isDisabled: z.boolean().optional(),\n});\n\nconst WidthSchema = z.object({\n value: z.number(),\n isDisabled: z.boolean().optional(),\n});\n\nexport const StyleSchema = z.object({\n captions: CaptionsSchema.optional(),\n color: ColorSchema.optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: IconSchema.optional(),\n sizeRange: SizeRangeSchema.optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n widthRange: WidthRangeSchema.optional(),\n size: SizeSchema.optional(),\n uniqueColors: UniqueColorsSchema.optional(),\n width: WidthSchema.optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\n/**\n * metaData is an free-form object that can be used to store additional information about a style rule.\n * The data is not taken into account when evaluationg the rule.\n */\nconst metaDataSchema = z.record(z.string(), z.unknown());\n\nexport const GraphStyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n isDisabled: z.boolean().optional(),\n priority: z.number().nonnegative().optional(),\n metaData: metaDataSchema.optional(),\n});\n// exporting this type with the graph prefix for clarity when used in the same context as other rules (grid, chart)\nexport type GraphStyleRule = z.infer<typeof GraphStyleRuleSchema>;\n\n/**\n * Runtime type guard for {@link GraphStyleRule}, backed by the internal Zod\n * schema. Narrows an `unknown` value to `GraphStyleRule` when it is a valid\n * style rule.\n *\n * This lets consumers validate values without taking a dependency on Zod or on\n * our schema export. For example, it can be passed to another validation\n * library's custom check:\n *\n * @example\n * ```ts\n * import { z } from 'zod';\n * import { isGraphStyleRule, type GraphStyleRule } from '@neo4j-ndl/react-graph';\n *\n * const formSchema = z.object({\n * rule: z.custom<GraphStyleRule>(isGraphStyleRule),\n * notes: z.string(),\n * });\n * ```\n */\nexport const isGraphStyleRule = (value: unknown): value is GraphStyleRule =>\n GraphStyleRuleSchema.safeParse(value).success;\n\nexport type NonStaticStyles =\n | 'captions'\n | 'colorRange'\n | 'sizeRange'\n | 'widthRange'\n | 'uniqueColors';\n\ntype NodeStyleKey =\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign';\n\ntype RelStyleKey =\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon';\n\nexport type EvaluatedNvlNodeStyle = Pick<Node, NodeStyleKey>;\nexport type EvaluatedNvlRelationshipStyle = Pick<Relationship, RelStyleKey>;\n\nconst NODE_STYLE_KEYS: readonly NodeStyleKey[] = [\n 'color',\n 'size',\n 'icon',\n 'overlayIcon',\n 'captions',\n 'captionSize',\n 'captionAlign',\n];\n\nconst REL_STYLE_KEYS: readonly RelStyleKey[] = [\n 'color',\n 'width',\n 'captions',\n 'captionSize',\n 'captionAlign',\n 'overlayIcon',\n];\n\n/**\n * Extract consumer-set style properties from a node.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerNodeStyles(\n node: Partial<EvaluatedNvlNodeStyle>,\n): Partial<EvaluatedNvlNodeStyle> {\n const result: Record<string, unknown> = {};\n for (const key of NODE_STYLE_KEYS) {\n if (node[key] !== undefined) {\n result[key] = node[key];\n }\n }\n return result as Partial<EvaluatedNvlNodeStyle>;\n}\n\n/**\n * Extract consumer-set style properties from a relationship.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerRelationshipStyles(\n rel: Partial<EvaluatedNvlRelationshipStyle>,\n): Partial<EvaluatedNvlRelationshipStyle> {\n const result: Record<string, unknown> = {};\n for (const key of REL_STYLE_KEYS) {\n if (rel[key] !== undefined) {\n result[key] = rel[key];\n }\n }\n return result as Partial<EvaluatedNvlRelationshipStyle>;\n}\n"]}
1
+ {"version":3,"file":"style-types.js","sourceRoot":"","sources":["../../../src/styling/style-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAuWH,wDAUC;AAOD,wEAUC;AA/XD,6BAAwB;AAExB,2DAamC;AAEnC;;;;;;;;;;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,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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\nimport {\n type BigintLiteral,\n BigintLiteralSchema,\n type DatetimeLiteral,\n DatetimeLiteralSchema,\n type LocalDatetimeLiteral,\n LocalDatetimeLiteralSchema,\n type NumericLiteral,\n NumericLiteralSchema,\n type RangeLiteral,\n RangeLiteralSchema,\n type TimeLiteral,\n TimeLiteralSchema,\n} from '../_generated/style-rules';\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 NumericLiteralSchema,\n z.boolean(),\n z.null(),\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type CypherValue = z.infer<typeof CypherValueSchema>;\n/** A JSON-safe bigint literal represented by a signed decimal string. */\nexport const GraphBigintLiteralSchema = BigintLiteralSchema;\n/** A number, native bigint, or JSON-safe bigint literal. */\nexport const GraphNumericLiteralSchema = NumericLiteralSchema;\n/** A numeric, datetime, localdatetime, or time literal used as a range boundary. */\nexport const GraphRangeLiteralSchema = RangeLiteralSchema;\nexport type GraphBigintLiteral = BigintLiteral;\nexport type GraphNumericLiteral = NumericLiteral;\nexport type GraphRangeLiteral = RangeLiteral;\n\nexport const ValueSchema = z\n .union([SelectorSchema, CypherValueSchema])\n .describe(\n 'Either a property/label/reltype selector (e.g., {property: \"name\"}), a literal value (string, number, bigint, {bigint: \"42\"}, boolean, null), or a datetime/time literal (e.g., {datetime: \"2024-01-01T00:00:00Z\"}, {time: \"14:30:00\"}).',\n );\nexport type Value = z.infer<typeof ValueSchema>;\n\nexport type { DatetimeLiteral, LocalDatetimeLiteral, TimeLiteral };\n\n/**\n * Where clause - recursive type for conditional expressions\n * The type is manually defined for the export, since zod doesn't support exporting inferred recursive types.\n */\nexport type Where =\n // Selector is useful for finding nodes with multiple labels.\n // for example: {match: {label: \"Person\"}, where: {label: \"Actor\"}}\n // matches nodes with label Person AND Actor\n | Selector\n | { not: Where }\n | { and: Where[] }\n | { or: Where[] }\n | { equal: [Value, Value] }\n | { lessThan: [Value, Value] }\n | { lessThanOrEqual: [Value, Value] }\n | { greaterThan: [Value, Value] }\n | { greaterThanOrEqual: [Value, Value] }\n | { contains: [Value, Value] }\n | { startsWith: [Value, Value] }\n | { endsWith: [Value, Value] }\n\n // Null check matching Cypher's IS NULL\n // Returns true/false (not null), making it safe for null checking\n // Use { not: { isNull: ... } } for IS NOT NULL\n // @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n | { isNull: Value };\n\nexport const WhereSchema: z.ZodType<Where> = z.lazy(() =>\n z.union([\n SelectorSchema,\n z.object({ not: WhereSchema }),\n z.object({ and: z.array(WhereSchema) }),\n z.object({ or: z.array(WhereSchema) }),\n z.object({ equal: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ lessThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThan: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ greaterThanOrEqual: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ contains: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ startsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ endsWith: z.tuple([ValueSchema, ValueSchema]) }),\n z.object({ isNull: ValueSchema }),\n ]),\n);\n\n// Schemas that go under the `apply` key.\nexport const CaptionValueSchema = z.union([\n z.string(),\n z.object({ property: z.string() }),\n z.object({ useType: z.literal(true) }),\n]);\nexport type CaptionValue = z.infer<typeof CaptionValueSchema>;\n\nexport const CaptionVariationSchema = z.enum(['bold', 'italic', 'underline']);\nexport type CaptionVariation = z.infer<typeof CaptionVariationSchema>;\n\nexport const NvlCaptionSchema = z.object({\n styles: z.array(z.string()).optional(),\n value: CaptionValueSchema.optional(),\n key: z.string().optional(),\n});\nexport type Caption = z.infer<typeof NvlCaptionSchema>;\n\nconst CaptionsSchema = z.object({\n text: z.array(NvlCaptionSchema).optional(),\n align: z.enum(['top', 'bottom', 'center']).optional(),\n size: z.number().optional(),\n isDisabled: z.boolean().optional(),\n});\n\n/**\n * OverlayIcon from NVL - icon displayed on top of a graph element\n * @see @neo4j-nvl/base Node.overlayIcon\n */\nconst NvlOverlayIconSchema = z.object({\n url: z.string(),\n position: z.array(z.number()).optional(),\n size: z.number().optional(),\n isDisabled: z.boolean().optional(),\n});\n\n/**\n * Gradient coloring based on a continuous orderable property value. Range\n * boundaries accept numeric and temporal literals.\n * Colors must be a standard hex string (#rrggbb).\n * If the property is missing, non-orderable, 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: GraphRangeLiteralSchema,\n minColor: z.string(),\n maxValue: GraphRangeLiteralSchema,\n maxColor: z.string(),\n midValue: GraphRangeLiteralSchema.optional(),\n midColor: z.string().optional(),\n isDisabled: z.boolean().optional(),\n});\nexport type ColorRange = z.infer<typeof ColorRangeSchema>;\n\n/**\n * Size interpolation for nodes based on a continuous orderable property value.\n * Range boundaries accept numeric and temporal literals.\n * Maps a property value in [minValue, maxValue] to a size in [minSize, maxSize].\n * If the property is missing or non-orderable, sizeRange is silently ignored —\n * other style properties still apply.\n */\nexport const SizeRangeSchema = z.object({\n onProperty: z.string(),\n minValue: GraphRangeLiteralSchema,\n maxValue: GraphRangeLiteralSchema,\n minSize: z.number(),\n maxSize: z.number(),\n isDisabled: z.boolean().optional(),\n});\nexport type SizeRange = z.infer<typeof SizeRangeSchema>;\n\n/**\n * Width interpolation for relationships based on a continuous orderable\n * property value. Range boundaries accept numeric and temporal literals.\n * Maps a property value in [minValue, maxValue] to a width in [minWidth, maxWidth].\n * If the property is missing or non-orderable, widthRange is silently ignored —\n * other style properties still apply.\n */\nexport const WidthRangeSchema = z.object({\n onProperty: z.string(),\n minValue: GraphRangeLiteralSchema,\n maxValue: GraphRangeLiteralSchema,\n minWidth: z.number(),\n maxWidth: z.number(),\n isDisabled: z.boolean().optional(),\n});\nexport type WidthRange = z.infer<typeof WidthRangeSchema>;\n\n/**\n * Assigns a unique color per distinct value of a property.\n * Colors are assigned in first-come, first-served order from a categorical palette.\n * If the property is missing or null, uniqueColors is silently ignored —\n * other style properties still apply.\n */\nexport const UniqueColorsSchema = z.object({\n onProperty: z.string(),\n isDisabled: z.boolean().optional(),\n});\nexport type UniqueColors = z.infer<typeof UniqueColorsSchema>;\n\nconst ColorSchema = z.object({\n value: z.string(),\n isDisabled: z.boolean().optional(),\n});\n\nconst IconSchema = z.object({\n value: z.string(),\n isDisabled: z.boolean().optional(),\n});\n\nconst SizeSchema = z.object({\n value: z.number(),\n isDisabled: z.boolean().optional(),\n});\n\nconst WidthSchema = z.object({\n value: z.number(),\n isDisabled: z.boolean().optional(),\n});\n\nexport const StyleSchema = z.object({\n captions: CaptionsSchema.optional(),\n color: ColorSchema.optional(),\n colorRange: ColorRangeSchema.optional(),\n icon: IconSchema.optional(),\n sizeRange: SizeRangeSchema.optional(),\n overlayIcon: NvlOverlayIconSchema.optional(),\n widthRange: WidthRangeSchema.optional(),\n size: SizeSchema.optional(),\n uniqueColors: UniqueColorsSchema.optional(),\n width: WidthSchema.optional(),\n});\nexport type Style = z.infer<typeof StyleSchema>;\n\n/**\n * metaData is an free-form object that can be used to store additional information about a style rule.\n * The data is not taken into account when evaluationg the rule.\n */\nconst metaDataSchema = z.record(z.string(), z.unknown());\n\nexport const GraphStyleRuleSchema = z.object({\n match: MatchSchema,\n where: WhereSchema.optional(),\n apply: StyleSchema,\n isDisabled: z.boolean().optional(),\n priority: z.number().nonnegative().optional(),\n metaData: metaDataSchema.optional(),\n});\n// exporting this type with the graph prefix for clarity when used in the same context as other rules (grid, chart)\nexport type GraphStyleRule = z.infer<typeof GraphStyleRuleSchema>;\n\n/**\n * Runtime type guard for {@link GraphStyleRule}, backed by the internal Zod\n * schema. Narrows an `unknown` value to `GraphStyleRule` when it is a valid\n * style rule.\n *\n * This lets consumers validate values without taking a dependency on Zod or on\n * our schema export. For example, it can be passed to another validation\n * library's custom check:\n *\n * @example\n * ```ts\n * import { z } from 'zod';\n * import { isGraphStyleRule, type GraphStyleRule } from '@neo4j-ndl/react-graph';\n *\n * const formSchema = z.object({\n * rule: z.custom<GraphStyleRule>(isGraphStyleRule),\n * notes: z.string(),\n * });\n * ```\n */\nexport const isGraphStyleRule = (value: unknown): value is GraphStyleRule =>\n GraphStyleRuleSchema.safeParse(value).success;\n\nexport type NonStaticStyles =\n | 'captions'\n | 'colorRange'\n | 'sizeRange'\n | 'widthRange'\n | 'uniqueColors';\n\ntype NodeStyleKey =\n | 'icon'\n | 'overlayIcon'\n | 'color'\n | 'size'\n | 'captions'\n | 'captionSize'\n | 'captionAlign';\n\ntype RelStyleKey =\n | 'width'\n | 'color'\n | 'captions'\n | 'captionSize'\n | 'captionAlign'\n | 'overlayIcon';\n\nexport type EvaluatedNvlNodeStyle = Pick<Node, NodeStyleKey>;\nexport type EvaluatedNvlRelationshipStyle = Pick<Relationship, RelStyleKey>;\n\nconst NODE_STYLE_KEYS: readonly NodeStyleKey[] = [\n 'color',\n 'size',\n 'icon',\n 'overlayIcon',\n 'captions',\n 'captionSize',\n 'captionAlign',\n];\n\nconst REL_STYLE_KEYS: readonly RelStyleKey[] = [\n 'color',\n 'width',\n 'captions',\n 'captionSize',\n 'captionAlign',\n 'overlayIcon',\n];\n\n/**\n * Extract consumer-set style properties from a node.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerNodeStyles(\n node: Partial<EvaluatedNvlNodeStyle>,\n): Partial<EvaluatedNvlNodeStyle> {\n const result: Record<string, unknown> = {};\n for (const key of NODE_STYLE_KEYS) {\n if (node[key] !== undefined) {\n result[key] = node[key];\n }\n }\n return result as Partial<EvaluatedNvlNodeStyle>;\n}\n\n/**\n * Extract consumer-set style properties from a relationship.\n * Only includes properties that are explicitly defined (not undefined),\n * so they can be spread over rule-derived styles to take precedence.\n */\nexport function pickConsumerRelationshipStyles(\n rel: Partial<EvaluatedNvlRelationshipStyle>,\n): Partial<EvaluatedNvlRelationshipStyle> {\n const result: Record<string, unknown> = {};\n for (const key of REL_STYLE_KEYS) {\n if (rel[key] !== undefined) {\n result[key] = rel[key];\n }\n }\n return result as Partial<EvaluatedNvlRelationshipStyle>;\n}\n"]}
@@ -25,6 +25,7 @@
25
25
  */
26
26
  export { getWeight, lerpColor } from './color-utils';
27
27
  export { parseDateString, parseLocalDateString, parseTimeString, } from './date-utils';
28
- export { BigintLiteralSchema, DatetimeLiteralSchema, LocalDatetimeLiteralSchema, NumericLiteralSchema, TimeLiteralSchema, } from './literal-schemas';
28
+ export { BigintLiteralSchema, DatetimeLiteralSchema, isDatetimeLiteral, isLocalDatetimeLiteral, isTimeLiteral, LocalDatetimeLiteralSchema, NumericLiteralSchema, RangeLiteralSchema, TimeLiteralSchema, } from './literal-schemas';
29
29
  export { clampNumericValue, compareNumericValues, getNumericWeight, isBigintLiteral, numericValuesEqual, resolveNumericLiteral, } from './numeric-utils';
30
+ export { resolveRangeLiteral } from './range-utils';
30
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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 */\nexport { getWeight, lerpColor } from './color-utils';\nexport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\nexport {\n BigintLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n NumericLiteralSchema,\n TimeLiteralSchema,\n} from './literal-schemas';\nexport type {\n BigintLiteral,\n DatetimeLiteral,\n LocalDatetimeLiteral,\n NumericLiteral,\n TimeLiteral,\n} from './literal-schemas';\nexport {\n clampNumericValue,\n compareNumericValues,\n getNumericWeight,\n isBigintLiteral,\n numericValuesEqual,\n resolveNumericLiteral,\n} from './numeric-utils';\nexport type { NumericValue } from './numeric-utils';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EACb,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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 */\nexport { getWeight, lerpColor } from './color-utils';\nexport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\nexport {\n BigintLiteralSchema,\n DatetimeLiteralSchema,\n isDatetimeLiteral,\n isLocalDatetimeLiteral,\n isTimeLiteral,\n LocalDatetimeLiteralSchema,\n NumericLiteralSchema,\n RangeLiteralSchema,\n TimeLiteralSchema,\n} from './literal-schemas';\nexport type {\n BigintLiteral,\n DatetimeLiteral,\n LocalDatetimeLiteral,\n NumericLiteral,\n RangeLiteral,\n TimeLiteral,\n} from './literal-schemas';\nexport {\n clampNumericValue,\n compareNumericValues,\n getNumericWeight,\n isBigintLiteral,\n numericValuesEqual,\n resolveNumericLiteral,\n} from './numeric-utils';\nexport type { NumericValue } from './numeric-utils';\nexport { resolveRangeLiteral } from './range-utils';\n"]}
@@ -91,4 +91,32 @@ export const TimeLiteralSchema = z.object({
91
91
  message: 'time must be a valid ISO 8601 time string (e.g. "14:30:00" or "14:30:00+02:00")',
92
92
  }),
93
93
  });
94
+ function isObjectWithStringKey(value, key) {
95
+ return (typeof value === 'object' &&
96
+ value !== null &&
97
+ key in value &&
98
+ typeof value[key] === 'string');
99
+ }
100
+ /** Returns whether a value is a `{ datetime: string }` wrapper. Does not validate the string. */
101
+ export function isDatetimeLiteral(value) {
102
+ return isObjectWithStringKey(value, 'datetime');
103
+ }
104
+ /** Returns whether a value is a `{ localdatetime: string }` wrapper. Does not validate the string. */
105
+ export function isLocalDatetimeLiteral(value) {
106
+ return isObjectWithStringKey(value, 'localdatetime');
107
+ }
108
+ /** Returns whether a value is a `{ time: string }` wrapper. Does not validate the string. */
109
+ export function isTimeLiteral(value) {
110
+ return isObjectWithStringKey(value, 'time');
111
+ }
112
+ /**
113
+ * A continuous, orderable literal that can be used as a range boundary.
114
+ * Temporal literals resolve to numbers before range interpolation.
115
+ */
116
+ export const RangeLiteralSchema = z.union([
117
+ NumericLiteralSchema,
118
+ DatetimeLiteralSchema,
119
+ LocalDatetimeLiteralSchema,
120
+ TimeLiteralSchema,
121
+ ]);
94
122
  //# sourceMappingURL=literal-schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,MAAM,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-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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 {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\n\n/**\n * A JSON-safe bigint literal. Native bigint values cannot be serialized as\n * JSON, so persisted style rules can use a signed decimal string instead.\n */\nexport const BigintLiteralSchema = z.object({\n bigint: z.string().regex(/^[+-]?\\d+$/, {\n message: 'bigint must be a signed decimal integer string',\n }),\n});\nexport type BigintLiteral = z.infer<typeof BigintLiteralSchema>;\n\n/** A numeric style-rule literal, including native and JSON-safe bigints. */\nexport const NumericLiteralSchema = z.union([\n z.number(),\n z.bigint(),\n BigintLiteralSchema,\n]);\nexport type NumericLiteral = z.infer<typeof NumericLiteralSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((s) => parseDateString(s) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z.string().refine((s) => parseLocalDateString(s) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((s) => parseTimeString(s) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n"]}
1
+ {"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE;QACrC,OAAO,EAAE,gDAAgD;KAC1D,CAAC;CACH,CAAC,CAAC;AAGH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC1C,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,mBAAmB;CACpB,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC9D,OAAO,EACL,sEAAsE;KACzE,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QACxE,OAAO,EACL,kGAAkG;KACrG,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC1D,OAAO,EACL,iFAAiF;KACpF,CAAC;CACH,CAAC,CAAC;AAGH,SAAS,qBAAqB,CAC5B,KAAc,EACd,GAAM;IAEN,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,GAAG,IAAI,KAAK;QACZ,OAAQ,KAAiC,CAAC,GAAG,CAAC,KAAK,QAAQ,CAC5D,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAClD,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC;IACxC,oBAAoB;IACpB,qBAAqB;IACrB,0BAA0B;IAC1B,iBAAiB;CAClB,CAAC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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 {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\n\n/**\n * A JSON-safe bigint literal. Native bigint values cannot be serialized as\n * JSON, so persisted style rules can use a signed decimal string instead.\n */\nexport const BigintLiteralSchema = z.object({\n bigint: z.string().regex(/^[+-]?\\d+$/, {\n message: 'bigint must be a signed decimal integer string',\n }),\n});\nexport type BigintLiteral = z.infer<typeof BigintLiteralSchema>;\n\n/** A numeric style-rule literal, including native and JSON-safe bigints. */\nexport const NumericLiteralSchema = z.union([\n z.number(),\n z.bigint(),\n BigintLiteralSchema,\n]);\nexport type NumericLiteral = z.infer<typeof NumericLiteralSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((s) => parseDateString(s) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z.string().refine((s) => parseLocalDateString(s) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((s) => parseTimeString(s) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n\nfunction isObjectWithStringKey<K extends string>(\n value: unknown,\n key: K,\n): value is Record<K, string> {\n return (\n typeof value === 'object' &&\n value !== null &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === 'string'\n );\n}\n\n/** Returns whether a value is a `{ datetime: string }` wrapper. Does not validate the string. */\nexport function isDatetimeLiteral(value: unknown): value is DatetimeLiteral {\n return isObjectWithStringKey(value, 'datetime');\n}\n\n/** Returns whether a value is a `{ localdatetime: string }` wrapper. Does not validate the string. */\nexport function isLocalDatetimeLiteral(\n value: unknown,\n): value is LocalDatetimeLiteral {\n return isObjectWithStringKey(value, 'localdatetime');\n}\n\n/** Returns whether a value is a `{ time: string }` wrapper. Does not validate the string. */\nexport function isTimeLiteral(value: unknown): value is TimeLiteral {\n return isObjectWithStringKey(value, 'time');\n}\n\n/**\n * A continuous, orderable literal that can be used as a range boundary.\n * Temporal literals resolve to numbers before range interpolation.\n */\nexport const RangeLiteralSchema = z.union([\n NumericLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type RangeLiteral = z.infer<typeof RangeLiteralSchema>;\n"]}
@@ -0,0 +1,43 @@
1
+ /*
2
+ * AUTO-GENERATED FILE — DO NOT EDIT.
3
+ * Source of truth: packages/style-rules/src/
4
+ * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
5
+ */
6
+ /**
7
+ *
8
+ * Copyright (c) "Neo4j"
9
+ * Neo4j Sweden AB [http://neo4j.com]
10
+ *
11
+ * This file is part of Neo4j.
12
+ *
13
+ * Neo4j is free software: you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License as published by
15
+ * the Free Software Foundation, either version 3 of the License, or
16
+ * (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
+ */
26
+ import { parseDateString, parseLocalDateString, parseTimeString, } from './date-utils';
27
+ import { resolveNumericLiteral } from './numeric-utils';
28
+ /** Resolves a range literal to the numeric representation used for interpolation. */
29
+ export function resolveRangeLiteral(value) {
30
+ if (typeof value === 'object' && value !== null) {
31
+ if ('datetime' in value) {
32
+ return parseDateString(value.datetime);
33
+ }
34
+ if ('localdatetime' in value) {
35
+ return parseLocalDateString(value.localdatetime);
36
+ }
37
+ if ('time' in value) {
38
+ return parseTimeString(value.time);
39
+ }
40
+ }
41
+ return resolveNumericLiteral(value);
42
+ }
43
+ //# sourceMappingURL=range-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"range-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/range-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAqB,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,qFAAqF;AACrF,MAAM,UAAU,mBAAmB,CAAC,KAAmB;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,IAAI,UAAU,IAAI,KAAK,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,eAAe,IAAI,KAAK,EAAE,CAAC;YAC7B,OAAO,oBAAoB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;YACpB,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IACD,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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 {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\nimport type { RangeLiteral } from './literal-schemas';\nimport { type NumericValue, resolveNumericLiteral } from './numeric-utils';\n\n/** Resolves a range literal to the numeric representation used for interpolation. */\nexport function resolveRangeLiteral(value: RangeLiteral): NumericValue | null {\n if (typeof value === 'object' && value !== null) {\n if ('datetime' in value) {\n return parseDateString(value.datetime);\n }\n if ('localdatetime' in value) {\n return parseLocalDateString(value.localdatetime);\n }\n if ('time' in value) {\n return parseTimeString(value.time);\n }\n }\n return resolveNumericLiteral(value);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,4BAA4B,GAe7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoBzD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { GraphVisualization } from './graph-visualization';\nexport {\n useGraphVisualizationContext,\n type ColorCount,\n type Gesture,\n type GraphItemMetaData,\n type GraphSelection,\n type GraphVisualizationContextData,\n type InteractionMode,\n type MetadataLookupTable,\n type NeoNode,\n type NeoRel,\n type NodeData,\n type NvlGraph,\n type PortableProperty,\n type RelData,\n type Sidepanel,\n} from './graph-visualization-context';\nexport { isGraphStyleRule } from './styling/style-types';\nexport type {\n GraphStyleRule,\n GraphBigintLiteral,\n GraphNumericLiteral,\n Style as GraphStyle,\n Where as GraphWhere,\n Value as GraphValue,\n CypherValue as GraphCypherValue,\n Caption as GraphCaption,\n CaptionValue as GraphCaptionValue,\n CaptionVariation as GraphCaptionVariation,\n ColorRange as GraphColorRange,\n SizeRange as GraphSizeRange,\n WidthRange as GraphWidthRange,\n UniqueColors as GraphUniqueColors,\n DatetimeLiteral as GraphDatetimeLiteral,\n LocalDatetimeLiteral as GraphLocalDatetimeLiteral,\n TimeLiteral as GraphTimeLiteral,\n} from './styling/style-types';\nexport {\n compileGraphStyleRules,\n doesGraphStyleRuleMatch,\n} from './styling/compile-graph-styles';\nexport { parseStyleRules } from './styling/parse-style-rules';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,4BAA4B,GAe7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAqBzD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { GraphVisualization } from './graph-visualization';\nexport {\n useGraphVisualizationContext,\n type ColorCount,\n type Gesture,\n type GraphItemMetaData,\n type GraphSelection,\n type GraphVisualizationContextData,\n type InteractionMode,\n type MetadataLookupTable,\n type NeoNode,\n type NeoRel,\n type NodeData,\n type NvlGraph,\n type PortableProperty,\n type RelData,\n type Sidepanel,\n} from './graph-visualization-context';\nexport { isGraphStyleRule } from './styling/style-types';\nexport type {\n GraphStyleRule,\n GraphBigintLiteral,\n GraphNumericLiteral,\n GraphRangeLiteral,\n Style as GraphStyle,\n Where as GraphWhere,\n Value as GraphValue,\n CypherValue as GraphCypherValue,\n Caption as GraphCaption,\n CaptionValue as GraphCaptionValue,\n CaptionVariation as GraphCaptionVariation,\n ColorRange as GraphColorRange,\n SizeRange as GraphSizeRange,\n WidthRange as GraphWidthRange,\n UniqueColors as GraphUniqueColors,\n DatetimeLiteral as GraphDatetimeLiteral,\n LocalDatetimeLiteral as GraphLocalDatetimeLiteral,\n TimeLiteral as GraphTimeLiteral,\n} from './styling/style-types';\nexport {\n compileGraphStyleRules,\n doesGraphStyleRuleMatch,\n} from './styling/compile-graph-styles';\nexport { parseStyleRules } from './styling/parse-style-rules';\n"]}
@@ -32,7 +32,7 @@ var __rest = (this && this.__rest) || function (s, e) {
32
32
  import { calculateDefaultNodeColors } from '@neo4j-devtools/word-color';
33
33
  import { tokens } from '@neo4j-ndl/base';
34
34
  import { color, rgbToHex, validHex } from '@uiw/react-color';
35
- import { clampNumericValue, compareNumericValues, getNumericWeight, isBigintLiteral, lerpColor, numericValuesEqual, parseDateString, parseLocalDateString, parseTimeString, resolveNumericLiteral, } from '../_generated/style-rules';
35
+ import { clampNumericValue, compareNumericValues, getNumericWeight, isBigintLiteral, lerpColor, numericValuesEqual, parseDateString, parseLocalDateString, parseTimeString, resolveNumericLiteral, resolveRangeLiteral, } from '../_generated/style-rules';
36
36
  export const DEFAULT_REL_COLOR = tokens.palette.neutral['40'];
37
37
  const NO_LABEL_FALLBACK_COLOR = tokens.palette.neutral['40'];
38
38
  export const UNIQUE_COLORS_PALETTE = Object.values(tokens.graph).filter(validHex);
@@ -109,8 +109,11 @@ function getInterpolatedColor(colorRange, graphItem) {
109
109
  }
110
110
  const minRgb = color(minColor).rgb;
111
111
  const maxRgb = color(maxColor).rgb;
112
- const resolvedMinValue = resolveNumericLiteral(minValue);
113
- const resolvedMaxValue = resolveNumericLiteral(maxValue);
112
+ const resolvedMinValue = resolveRangeLiteral(minValue);
113
+ const resolvedMaxValue = resolveRangeLiteral(maxValue);
114
+ if (resolvedMinValue === null || resolvedMaxValue === null) {
115
+ return null;
116
+ }
114
117
  const boundsOrder = compareNumericValues(resolvedMinValue, resolvedMaxValue);
115
118
  if (boundsOrder === null) {
116
119
  return null;
@@ -119,7 +122,10 @@ function getInterpolatedColor(colorRange, graphItem) {
119
122
  const actualMaxValue = boundsOrder <= 0 ? resolvedMaxValue : resolvedMinValue;
120
123
  // Validate mid stop if provided
121
124
  let midRgb = undefined;
122
- const resolvedMidValue = midValue === undefined ? undefined : resolveNumericLiteral(midValue);
125
+ const resolvedMidValue = midValue === undefined ? undefined : resolveRangeLiteral(midValue);
126
+ if (resolvedMidValue === null) {
127
+ return null;
128
+ }
123
129
  if (midValue !== undefined && midColor !== undefined) {
124
130
  const minToMid = compareNumericValues(actualMinValue, resolvedMidValue);
125
131
  const midToMax = compareNumericValues(resolvedMidValue, actualMaxValue);
@@ -180,8 +186,11 @@ function getInterpolatedSize(prop, minValue, maxValue, minOut, maxOut) {
180
186
  if (typeof rawValue !== 'number' && typeof rawValue !== 'bigint') {
181
187
  return null;
182
188
  }
183
- const resolvedMinValue = resolveNumericLiteral(minValue);
184
- const resolvedMaxValue = resolveNumericLiteral(maxValue);
189
+ const resolvedMinValue = resolveRangeLiteral(minValue);
190
+ const resolvedMaxValue = resolveRangeLiteral(maxValue);
191
+ if (resolvedMinValue === null || resolvedMaxValue === null) {
192
+ return null;
193
+ }
185
194
  const clampedValue = clampNumericValue(rawValue, resolvedMinValue, resolvedMaxValue);
186
195
  if (clampedValue === null) {
187
196
  return null;
@@ -1 +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;AACzC,OAAO,EAAE,KAAK,EAAiB,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,SAAS,EAET,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAmBnC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,qBAAqB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E,CAAC;YACrB,MAAM,KAAK,GAAG,MAAA,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;YACxD,EAAE,GAAG,sBAAsB,CAAC;gBAC1B,iBAAiB;gBACjB,GAAG,aAAa,CAAC,kBAAkB;gBACnC,GAAG,KAAK;aACT,CAAC,CAAC;YACH,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { calculateDefaultNodeColors } from '@neo4j-devtools/word-color';\nimport { tokens } from '@neo4j-ndl/base';\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n clampNumericValue,\n compareNumericValues,\n getNumericWeight,\n isBigintLiteral,\n lerpColor,\n type NumericLiteral,\n numericValuesEqual,\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n resolveNumericLiteral,\n} from '../_generated/style-rules';\nimport {\n type NodeData,\n type PortableProperty,\n type RelData,\n} from '../graph-visualization-context';\nimport {\n type Caption,\n type ColorRange,\n type EvaluatedNvlNodeStyle,\n type EvaluatedNvlRelationshipStyle,\n type GraphStyleRule,\n type NonStaticStyles,\n type Style,\n type UniqueColors,\n type Value,\n type Where,\n} from './style-types';\n\nexport const DEFAULT_REL_COLOR = tokens.palette.neutral['40'];\nconst NO_LABEL_FALLBACK_COLOR = tokens.palette.neutral['40'];\n\nexport const UNIQUE_COLORS_PALETTE = Object.values(tokens.graph).filter(\n validHex,\n);\n\ntype StyleMatchers = {\n globalLabelRules: GraphStyleRule[];\n globalReltypeRules: GraphStyleRule[];\n rulesByLabel: Map<string, GraphStyleRule[]>;\n rulesByType: Map<string, GraphStyleRule[]>;\n};\n\nfunction compareByPriorityAscending(\n a: GraphStyleRule,\n b: GraphStyleRule,\n): number {\n return a.priority! - b.priority!;\n}\n\nfunction collectStyleMatchers(\n styles: GraphStyleRule[] | null | undefined,\n): StyleMatchers {\n const rulesByLabel = new Map<string, GraphStyleRule[]>();\n const rulesByType = new Map<string, GraphStyleRule[]>();\n const globalLabelRules: GraphStyleRule[] = [];\n const globalReltypeRules: GraphStyleRule[] = [];\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.isDisabled ?? false) {\n return;\n }\n\n if (style.priority !== undefined && style.priority < 0) {\n throw new Error(\n `GraphStyleRule 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: GraphStyleRule = {\n ...rest,\n priority: priority ?? index - totalRules,\n };\n\n // style for nodes\n if ('label' in style.match) {\n // if the label is null, it's a global rule (matches any node)\n if (style.match.label === null) {\n globalLabelRules.push(ruleWithPriority);\n } else {\n // Specific label rule\n const existing = rulesByLabel.get(style.match.label) ?? [];\n rulesByLabel.set(style.match.label, [...existing, ruleWithPriority]);\n }\n }\n\n // style for relationships\n if ('reltype' in style.match) {\n if (style.match.reltype === null) {\n // Global reltype rule (matches any relationship)\n globalReltypeRules.push(ruleWithPriority);\n } else {\n // Specific reltype rule\n const existing = rulesByType.get(style.match.reltype) ?? [];\n rulesByType.set(style.match.reltype, [...existing, ruleWithPriority]);\n }\n }\n });\n\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n}\n\n/**\n * Interpolates a color from a ColorRange based on a graph item's property value.\n * Returns a #rrggbb hex string, or null if the colorRange config is invalid\n * (bad hex colors, invalid value range, missing/non-numeric property).\n */\nfunction getInterpolatedColor(\n colorRange: ColorRange,\n graphItem: NodeData | RelData,\n): string | null {\n const {\n onProperty,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n const resolvedMinValue = resolveNumericLiteral(minValue);\n const resolvedMaxValue = resolveNumericLiteral(maxValue);\n const boundsOrder = compareNumericValues(resolvedMinValue, resolvedMaxValue);\n if (boundsOrder === null) {\n return null;\n }\n const actualMinValue = boundsOrder <= 0 ? resolvedMinValue : resolvedMaxValue;\n const actualMaxValue = boundsOrder <= 0 ? resolvedMaxValue : resolvedMinValue;\n\n // Validate mid stop if provided\n let midRgb: RgbColor | undefined = undefined;\n const resolvedMidValue =\n midValue === undefined ? undefined : resolveNumericLiteral(midValue);\n if (midValue !== undefined && midColor !== undefined) {\n const minToMid = compareNumericValues(actualMinValue, resolvedMidValue!);\n const midToMax = compareNumericValues(resolvedMidValue!, actualMaxValue);\n const isMidInRange =\n minToMid !== null && midToMax !== null && minToMid <= 0 && midToMax <= 0;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const prop = graphItem.properties[onProperty];\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number' && typeof rawValue !== 'bigint') {\n return null;\n }\n\n const clampedValue = clampNumericValue(\n rawValue,\n actualMinValue,\n actualMaxValue,\n );\n if (clampedValue === null) {\n return null;\n }\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && resolvedMidValue !== undefined) {\n const weight = getNumericWeight(\n resolvedMinValue,\n resolvedMidValue,\n clampedValue,\n );\n if (weight === null) {\n return null;\n }\n const isBetweenMinAndMid = weight <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, weight);\n } else {\n const secondWeight = getNumericWeight(\n resolvedMidValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (secondWeight === null) {\n return null;\n }\n rgb = lerpColor(midRgb, maxRgb, secondWeight);\n }\n } else {\n const weight = getNumericWeight(\n resolvedMinValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (weight === null) {\n return null;\n }\n rgb = lerpColor(minRgb, maxRgb, weight);\n }\n\n return rgbToHex(rgb);\n}\n\n/**\n * Interpolates a numeric size/width from a range based on a graph item's property value.\n * Returns the interpolated number, or null if the property is missing or non-numeric.\n */\nfunction getInterpolatedSize(\n prop: PortableProperty | undefined,\n minValue: NumericLiteral,\n maxValue: NumericLiteral,\n minOut: number,\n maxOut: number,\n): number | null {\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number' && typeof rawValue !== 'bigint') {\n return null;\n }\n\n const resolvedMinValue = resolveNumericLiteral(minValue);\n const resolvedMaxValue = resolveNumericLiteral(maxValue);\n const clampedValue = clampNumericValue(\n rawValue,\n resolvedMinValue,\n resolvedMaxValue,\n );\n if (clampedValue === null) {\n return null;\n }\n const weight = getNumericWeight(\n resolvedMinValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (weight === null) {\n return null;\n }\n return minOut * (1 - weight) + maxOut * weight;\n}\n\nfunction extractPropertyValue(\n prop: PortableProperty,\n): string | number | bigint | boolean | null {\n switch (prop.type) {\n case 'string':\n return JSON.parse(prop.stringified);\n case 'number':\n case 'integer':\n case 'Integer':\n case 'float':\n return Number(prop.stringified);\n case 'bigint':\n case 'BigInt': {\n try {\n const value = prop.stringified.startsWith('\"')\n ? (JSON.parse(prop.stringified) as string)\n : prop.stringified;\n return BigInt(value);\n } catch {\n return null;\n }\n }\n case 'boolean':\n case 'Boolean':\n return prop.stringified === 'true';\n case 'null':\n return null;\n // Neo4j temporal types — parse to a number for comparison with\n // { datetime } and { time } rule literals. An unparseable value resolves to\n // null (treated as missing) rather than leaking a raw string into numeric\n // comparisons, matching Cypher null semantics.\n //\n // DateTime / LocalDateTime → Unix milliseconds (epoch ms)\n // LocalDateTime has no timezone; treated as UTC, same as date-only strings.\n case 'DateTime':\n case 'LocalDateTime':\n case 'Date': {\n const s = JSON.parse(prop.stringified) as string;\n return parseDateString(s);\n }\n // Time (ZonedTime) / LocalTime → UTC-normalised ms since midnight\n // LocalTime has no offset; treated as UTC.\n case 'Time':\n case 'LocalTime': {\n const s = JSON.parse(prop.stringified) as string;\n return parseTimeString(s);\n }\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;\ntype ResolvedCypherValue = string | number | bigint | 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 if (\n (typeof leftVal === 'number' || typeof leftVal === 'bigint') &&\n (typeof rightVal === 'number' || typeof rightVal === 'bigint')\n ) {\n return numericValuesEqual(leftVal, rightVal);\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\n/**\n * Returns whether a graph item is targeted by a single style rule.\n *\n * This evaluates both the rule's node label or relationship type selector and\n * its optional `where` clause. Disabled rules never match. Cypher-style\n * three-valued logic is reduced to a boolean: only `true` matches, while\n * `false` and `null` do not.\n *\n * Use {@link compileGraphStyleRules} to evaluate the final style produced by a\n * cascade of rules.\n */\nexport function doesGraphStyleRuleMatch(\n item: NodeData | RelData,\n rule: GraphStyleRule,\n): boolean {\n if (rule.isDisabled === true) {\n return false;\n }\n\n if ('label' in rule.match) {\n if (!('labelsSorted' in item)) {\n return false;\n }\n if (\n rule.match.label !== null &&\n !item.labelsSorted.includes(rule.match.label)\n ) {\n return false;\n }\n } else if ('reltype' in rule.match) {\n if (!('type' in item)) {\n return false;\n }\n if (rule.match.reltype !== null && item.type !== rule.match.reltype) {\n return false;\n }\n } else {\n return false;\n }\n\n return evaluateWhere(item, rule.where) === true;\n}\n\n/**\n * Resolves a color for the given property value, using the uniqueColors object\n * reference as the per-rule key in uniqueColorsCache. Assigns a new palette color\n * on first encounter (first-come, first-served). Returns null if the property is\n * missing or null.\n */\nfunction resolveUniqueColor(\n uniqueColors: UniqueColors,\n properties: Record<string, PortableProperty | undefined>,\n uniqueColorsCache: Map<UniqueColors, Map<string, string>>,\n): string | null {\n const prop = properties[uniqueColors.onProperty];\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (rawValue === null) {\n return null;\n }\n const valueKey = String(rawValue);\n\n let valueMap = uniqueColorsCache.get(uniqueColors);\n if (valueMap === undefined) {\n valueMap = new Map();\n uniqueColorsCache.set(uniqueColors, valueMap);\n }\n\n let assignedColor = valueMap.get(valueKey);\n if (assignedColor === undefined) {\n assignedColor =\n UNIQUE_COLORS_PALETTE[valueMap.size % UNIQUE_COLORS_PALETTE.length]!;\n valueMap.set(valueKey, assignedColor);\n }\n\n return assignedColor;\n}\n\nfunction shouldUseProperty(\n prop: { isDisabled?: boolean } | undefined,\n): boolean {\n return prop !== undefined && prop.isDisabled !== true;\n}\n\nfunction evaluateStaticStyle({\n overlayIcon,\n ...scalarStyle\n}: Omit<Style, NonStaticStyles>) {\n const result: Record<string, unknown> = {};\n\n for (const [key, prop] of Object.entries(scalarStyle)) {\n if (shouldUseProperty(prop)) {\n result[key] = prop.value;\n }\n }\n\n if (shouldUseProperty(overlayIcon)) {\n const { ...overlayIconProps } = overlayIcon!;\n result.overlayIcon = overlayIconProps;\n }\n\n return result;\n}\n\nfunction evaluateRelStyle(\n style: Style,\n rel: RelData,\n uniqueColorsCache: Map<UniqueColors, Map<string, string>>,\n): EvaluatedNvlRelationshipStyle {\n const { captions, colorRange, widthRange, uniqueColors, ...staticStyle } =\n style;\n const result: EvaluatedNvlRelationshipStyle =\n evaluateStaticStyle(staticStyle);\n\n if (shouldUseProperty(captions) && captions!.text) {\n result.captions = captions!.text.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 if (captions?.align !== undefined) {\n result.captionAlign = captions.align;\n }\n if (captions?.size !== undefined) {\n result.captionSize = captions.size;\n }\n }\n\n if (shouldUseProperty(colorRange)) {\n const interpolated = getInterpolatedColor(colorRange!, rel);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n if (shouldUseProperty(widthRange)) {\n const { onProperty, minValue, maxValue, minWidth, maxWidth } = widthRange!;\n const interpolated = getInterpolatedSize(\n rel.properties[onProperty],\n minValue,\n maxValue,\n minWidth,\n maxWidth,\n );\n if (interpolated !== null) {\n result.width = interpolated;\n }\n }\n\n if (shouldUseProperty(uniqueColors)) {\n const color = resolveUniqueColor(\n uniqueColors!,\n rel.properties,\n uniqueColorsCache,\n );\n if (color !== null) {\n result.color = color;\n }\n }\n\n return result;\n}\n\n/**\n * Safely compare two values using Cypher's three-valued logic.\n * Returns `null` if either operand is null (matching Cypher semantics).\n *\n * From Neo4j Cypher Manual:\n * \"Comparing any value to `null` using `=` or `<>` results in `null`\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction safeCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (\n a: NonNullable<ResolvedCypherValue>,\n b: NonNullable<ResolvedCypherValue>,\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): ResolvedCypherValue {\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 if ('datetime' in value) {\n return parseDateString(value.datetime);\n }\n if ('localdatetime' in value) {\n return parseLocalDateString(value.localdatetime);\n }\n if ('time' in value) {\n return parseTimeString(value.time);\n }\n if (isBigintLiteral(value)) {\n return resolveNumericLiteral(value);\n }\n }\n\n return value as ResolvedCypherValue;\n}\n\n// Default caption selection logic\nconst captionPriorityOrder = [\n /^name$/i,\n /^title$/i,\n /^label$/i,\n /name$/i,\n /description$/i,\n /^.+/,\n];\n\nfunction getDefaultNodeCaption(node: NodeData): Caption {\n const propertyKeys = Object.keys(node.properties);\n\n for (const regex of captionPriorityOrder) {\n const matchingKey = propertyKeys.find((key) => regex.test(key));\n if (matchingKey !== undefined) {\n const prop = node.properties[matchingKey];\n if (prop !== undefined) {\n return { value: { property: matchingKey } };\n }\n }\n }\n\n if (node.labelsSorted[0] !== undefined) {\n return { value: { useType: true } };\n }\n\n return { value: node.id };\n}\n\nfunction evaluateNodeStyle(\n style: Style,\n node: NodeData,\n uniqueColorsCache: Map<UniqueColors, Map<string, string>>,\n): EvaluatedNvlNodeStyle {\n const { captions, colorRange, sizeRange, uniqueColors, ...staticStyle } =\n style;\n const result: EvaluatedNvlNodeStyle = evaluateStaticStyle(staticStyle);\n\n const captionSource =\n shouldUseProperty(captions) && captions!.text\n ? captions!.text\n : [getDefaultNodeCaption(node)];\n\n result.captions = captionSource.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: 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 if (shouldUseProperty(captions)) {\n if (captions?.align !== undefined) {\n result.captionAlign = captions.align;\n }\n if (captions?.size !== undefined) {\n result.captionSize = captions.size;\n }\n }\n\n if (shouldUseProperty(colorRange)) {\n const interpolated = getInterpolatedColor(colorRange!, node);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n if (shouldUseProperty(sizeRange)) {\n const { onProperty, minValue, maxValue, minSize, maxSize } = sizeRange!;\n const interpolated = getInterpolatedSize(\n node.properties[onProperty],\n minValue,\n maxValue,\n minSize,\n maxSize,\n );\n if (interpolated !== null) {\n result.size = interpolated;\n }\n }\n\n if (shouldUseProperty(uniqueColors)) {\n const color = resolveUniqueColor(\n uniqueColors!,\n node.properties,\n uniqueColorsCache,\n );\n if (color !== null) {\n result.color = color;\n }\n }\n\n return result;\n}\n\nfunction createRelStyleFunction(\n rules: GraphStyleRule[],\n): (rel: RelData) => EvaluatedNvlRelationshipStyle {\n const uniqueColorsCache = new Map<UniqueColors, Map<string, string>>();\n return (rel: RelData) => {\n const style: Style = {};\n\n for (const rule of rules) {\n if (doesGraphStyleRuleMatch(rel, rule)) {\n // Merge the style properties (later rules override earlier ones)\n Object.assign(style, rule.apply);\n }\n }\n\n return evaluateRelStyle(style, rel, uniqueColorsCache);\n };\n}\n\nexport type CompiledGraphStyleRules = {\n byType: (type: string) => (rel: RelData) => EvaluatedNvlRelationshipStyle;\n styleMatchers: StyleMatchers;\n byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;\n};\n\nfunction createByLabelSetFunction(\n styleMatchers: StyleMatchers,\n): (node: NodeData) => EvaluatedNvlNodeStyle {\n const defaultColorCache = new Map<string, string>();\n const sortedRulesCache = new Map<string, GraphStyleRule[]>();\n const mergedStyleCache = new Map<string, Style>();\n const uniqueColorsCache = new Map<UniqueColors, Map<string, string>>();\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 and none use\n // uniqueColors, 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, uniqueColorsCache);\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: GraphStyleRule[] = [\n ...styleMatchers.globalLabelRules,\n ];\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 and uniqueColors-free.\n const collectStyles: Style = { color: { value: defaultColor } };\n let isCacheable = true;\n for (const rule of sortedRules) {\n if (rule.where !== undefined || rule.apply.uniqueColors !== undefined) {\n isCacheable = false;\n }\n if (doesGraphStyleRuleMatch(node, rule)) {\n Object.assign(collectStyles, rule.apply);\n }\n }\n\n // When all rules are where-free and uniqueColors-free, the merged style\n // depends only on labels. Cache it so subsequent nodes with the same label\n // set skip rule iteration.\n if (isCacheable) {\n mergedStyleCache.set(labelSetKey, collectStyles);\n }\n\n return evaluateNodeStyle(collectStyles, node, uniqueColorsCache);\n };\n}\n\nconst DEFAULT_REL_STYLE: GraphStyleRule = {\n apply: {\n captions: { text: [{ value: { useType: true } }] },\n color: { value: DEFAULT_REL_COLOR },\n },\n match: { reltype: null },\n};\n\nexport function compileGraphStyleRules(\n styleRules: GraphStyleRule[] | null | undefined,\n): CompiledGraphStyleRules {\n const styleMatchers = collectStyleMatchers(styleRules);\n\n // Lazily build and cache a style function per relationship type\n const cache = new Map<\n string,\n (rel: RelData) => EvaluatedNvlRelationshipStyle\n >();\n const byType = (type: string) => {\n let fn = cache.get(type);\n if (fn === undefined) {\n const rules = styleMatchers.rulesByType.get(type) ?? [];\n fn = createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...styleMatchers.globalReltypeRules,\n ...rules,\n ]);\n cache.set(type, fn);\n }\n return fn;\n };\n\n const byLabelSet = createByLabelSetFunction(styleMatchers);\n\n return { byLabelSet, byType, styleMatchers };\n}\n"]}
1
+ {"version":3,"file":"compile-graph-styles.js","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAiB,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EAEf,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AAmBnC,MAAM,CAAC,MAAM,iBAAiB,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,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE;QAClD,KAAK,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE;KACpC;IACD,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CACzB,CAAC;AAEF,MAAM,UAAU,sBAAsB,CACpC,UAA+C;IAE/C,MAAM,aAAa,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAEvD,gEAAgE;IAChE,MAAM,KAAK,GAAG,IAAI,GAAG,EAGlB,CAAC;IACJ,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE;;QAC9B,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACrB,MAAM,KAAK,GAAG,MAAA,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;YACxD,EAAE,GAAG,sBAAsB,CAAC;gBAC1B,iBAAiB;gBACjB,GAAG,aAAa,CAAC,kBAAkB;gBACnC,GAAG,KAAK;aACT,CAAC,CAAC;YACH,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { calculateDefaultNodeColors } from '@neo4j-devtools/word-color';\nimport { tokens } from '@neo4j-ndl/base';\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n clampNumericValue,\n compareNumericValues,\n getNumericWeight,\n isBigintLiteral,\n lerpColor,\n numericValuesEqual,\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n type RangeLiteral,\n resolveNumericLiteral,\n resolveRangeLiteral,\n} from '../_generated/style-rules';\nimport {\n type NodeData,\n type PortableProperty,\n type RelData,\n} from '../graph-visualization-context';\nimport {\n type Caption,\n type ColorRange,\n type EvaluatedNvlNodeStyle,\n type EvaluatedNvlRelationshipStyle,\n type GraphStyleRule,\n type NonStaticStyles,\n type Style,\n type UniqueColors,\n type Value,\n type Where,\n} from './style-types';\n\nexport const DEFAULT_REL_COLOR = tokens.palette.neutral['40'];\nconst NO_LABEL_FALLBACK_COLOR = tokens.palette.neutral['40'];\n\nexport const UNIQUE_COLORS_PALETTE = Object.values(tokens.graph).filter(\n validHex,\n);\n\ntype StyleMatchers = {\n globalLabelRules: GraphStyleRule[];\n globalReltypeRules: GraphStyleRule[];\n rulesByLabel: Map<string, GraphStyleRule[]>;\n rulesByType: Map<string, GraphStyleRule[]>;\n};\n\nfunction compareByPriorityAscending(\n a: GraphStyleRule,\n b: GraphStyleRule,\n): number {\n return a.priority! - b.priority!;\n}\n\nfunction collectStyleMatchers(\n styles: GraphStyleRule[] | null | undefined,\n): StyleMatchers {\n const rulesByLabel = new Map<string, GraphStyleRule[]>();\n const rulesByType = new Map<string, GraphStyleRule[]>();\n const globalLabelRules: GraphStyleRule[] = [];\n const globalReltypeRules: GraphStyleRule[] = [];\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.isDisabled ?? false) {\n return;\n }\n\n if (style.priority !== undefined && style.priority < 0) {\n throw new Error(\n `GraphStyleRule 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: GraphStyleRule = {\n ...rest,\n priority: priority ?? index - totalRules,\n };\n\n // style for nodes\n if ('label' in style.match) {\n // if the label is null, it's a global rule (matches any node)\n if (style.match.label === null) {\n globalLabelRules.push(ruleWithPriority);\n } else {\n // Specific label rule\n const existing = rulesByLabel.get(style.match.label) ?? [];\n rulesByLabel.set(style.match.label, [...existing, ruleWithPriority]);\n }\n }\n\n // style for relationships\n if ('reltype' in style.match) {\n if (style.match.reltype === null) {\n // Global reltype rule (matches any relationship)\n globalReltypeRules.push(ruleWithPriority);\n } else {\n // Specific reltype rule\n const existing = rulesByType.get(style.match.reltype) ?? [];\n rulesByType.set(style.match.reltype, [...existing, ruleWithPriority]);\n }\n }\n });\n\n return {\n globalLabelRules,\n globalReltypeRules,\n rulesByLabel,\n rulesByType,\n };\n}\n\n/**\n * Interpolates a color from a ColorRange based on a graph item's property value.\n * Returns a #rrggbb hex string, or null if the colorRange config is invalid\n * (bad hex colors, invalid value range, missing/non-numeric property).\n */\nfunction getInterpolatedColor(\n colorRange: ColorRange,\n graphItem: NodeData | RelData,\n): string | null {\n const {\n onProperty,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n const resolvedMinValue = resolveRangeLiteral(minValue);\n const resolvedMaxValue = resolveRangeLiteral(maxValue);\n if (resolvedMinValue === null || resolvedMaxValue === null) {\n return null;\n }\n const boundsOrder = compareNumericValues(resolvedMinValue, resolvedMaxValue);\n if (boundsOrder === null) {\n return null;\n }\n const actualMinValue = boundsOrder <= 0 ? resolvedMinValue : resolvedMaxValue;\n const actualMaxValue = boundsOrder <= 0 ? resolvedMaxValue : resolvedMinValue;\n\n // Validate mid stop if provided\n let midRgb: RgbColor | undefined = undefined;\n const resolvedMidValue =\n midValue === undefined ? undefined : resolveRangeLiteral(midValue);\n if (resolvedMidValue === null) {\n return null;\n }\n if (midValue !== undefined && midColor !== undefined) {\n const minToMid = compareNumericValues(actualMinValue, resolvedMidValue!);\n const midToMax = compareNumericValues(resolvedMidValue!, actualMaxValue);\n const isMidInRange =\n minToMid !== null && midToMax !== null && minToMid <= 0 && midToMax <= 0;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const prop = graphItem.properties[onProperty];\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number' && typeof rawValue !== 'bigint') {\n return null;\n }\n\n const clampedValue = clampNumericValue(\n rawValue,\n actualMinValue,\n actualMaxValue,\n );\n if (clampedValue === null) {\n return null;\n }\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && resolvedMidValue !== undefined) {\n const weight = getNumericWeight(\n resolvedMinValue,\n resolvedMidValue,\n clampedValue,\n );\n if (weight === null) {\n return null;\n }\n const isBetweenMinAndMid = weight <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, weight);\n } else {\n const secondWeight = getNumericWeight(\n resolvedMidValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (secondWeight === null) {\n return null;\n }\n rgb = lerpColor(midRgb, maxRgb, secondWeight);\n }\n } else {\n const weight = getNumericWeight(\n resolvedMinValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (weight === null) {\n return null;\n }\n rgb = lerpColor(minRgb, maxRgb, weight);\n }\n\n return rgbToHex(rgb);\n}\n\n/**\n * Interpolates a numeric size/width from a range based on a graph item's property value.\n * Returns the interpolated number, or null if the property is missing or non-numeric.\n */\nfunction getInterpolatedSize(\n prop: PortableProperty | undefined,\n minValue: RangeLiteral,\n maxValue: RangeLiteral,\n minOut: number,\n maxOut: number,\n): number | null {\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (typeof rawValue !== 'number' && typeof rawValue !== 'bigint') {\n return null;\n }\n\n const resolvedMinValue = resolveRangeLiteral(minValue);\n const resolvedMaxValue = resolveRangeLiteral(maxValue);\n if (resolvedMinValue === null || resolvedMaxValue === null) {\n return null;\n }\n const clampedValue = clampNumericValue(\n rawValue,\n resolvedMinValue,\n resolvedMaxValue,\n );\n if (clampedValue === null) {\n return null;\n }\n const weight = getNumericWeight(\n resolvedMinValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (weight === null) {\n return null;\n }\n return minOut * (1 - weight) + maxOut * weight;\n}\n\nfunction extractPropertyValue(\n prop: PortableProperty,\n): string | number | bigint | boolean | null {\n switch (prop.type) {\n case 'string':\n return JSON.parse(prop.stringified);\n case 'number':\n case 'integer':\n case 'Integer':\n case 'float':\n return Number(prop.stringified);\n case 'bigint':\n case 'BigInt': {\n try {\n const value = prop.stringified.startsWith('\"')\n ? (JSON.parse(prop.stringified) as string)\n : prop.stringified;\n return BigInt(value);\n } catch {\n return null;\n }\n }\n case 'boolean':\n case 'Boolean':\n return prop.stringified === 'true';\n case 'null':\n return null;\n // Neo4j temporal types — parse to a number for comparison with\n // { datetime } and { time } rule literals. An unparseable value resolves to\n // null (treated as missing) rather than leaking a raw string into numeric\n // comparisons, matching Cypher null semantics.\n //\n // DateTime / LocalDateTime → Unix milliseconds (epoch ms)\n // LocalDateTime has no timezone; treated as UTC, same as date-only strings.\n case 'DateTime':\n case 'LocalDateTime':\n case 'Date': {\n const s = JSON.parse(prop.stringified) as string;\n return parseDateString(s);\n }\n // Time (ZonedTime) / LocalTime → UTC-normalised ms since midnight\n // LocalTime has no offset; treated as UTC.\n case 'Time':\n case 'LocalTime': {\n const s = JSON.parse(prop.stringified) as string;\n return parseTimeString(s);\n }\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;\ntype ResolvedCypherValue = string | number | bigint | 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 if (\n (typeof leftVal === 'number' || typeof leftVal === 'bigint') &&\n (typeof rightVal === 'number' || typeof rightVal === 'bigint')\n ) {\n return numericValuesEqual(leftVal, rightVal);\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\n/**\n * Returns whether a graph item is targeted by a single style rule.\n *\n * This evaluates both the rule's node label or relationship type selector and\n * its optional `where` clause. Disabled rules never match. Cypher-style\n * three-valued logic is reduced to a boolean: only `true` matches, while\n * `false` and `null` do not.\n *\n * Use {@link compileGraphStyleRules} to evaluate the final style produced by a\n * cascade of rules.\n */\nexport function doesGraphStyleRuleMatch(\n item: NodeData | RelData,\n rule: GraphStyleRule,\n): boolean {\n if (rule.isDisabled === true) {\n return false;\n }\n\n if ('label' in rule.match) {\n if (!('labelsSorted' in item)) {\n return false;\n }\n if (\n rule.match.label !== null &&\n !item.labelsSorted.includes(rule.match.label)\n ) {\n return false;\n }\n } else if ('reltype' in rule.match) {\n if (!('type' in item)) {\n return false;\n }\n if (rule.match.reltype !== null && item.type !== rule.match.reltype) {\n return false;\n }\n } else {\n return false;\n }\n\n return evaluateWhere(item, rule.where) === true;\n}\n\n/**\n * Resolves a color for the given property value, using the uniqueColors object\n * reference as the per-rule key in uniqueColorsCache. Assigns a new palette color\n * on first encounter (first-come, first-served). Returns null if the property is\n * missing or null.\n */\nfunction resolveUniqueColor(\n uniqueColors: UniqueColors,\n properties: Record<string, PortableProperty | undefined>,\n uniqueColorsCache: Map<UniqueColors, Map<string, string>>,\n): string | null {\n const prop = properties[uniqueColors.onProperty];\n if (prop === undefined) {\n return null;\n }\n const rawValue = extractPropertyValue(prop);\n if (rawValue === null) {\n return null;\n }\n const valueKey = String(rawValue);\n\n let valueMap = uniqueColorsCache.get(uniqueColors);\n if (valueMap === undefined) {\n valueMap = new Map();\n uniqueColorsCache.set(uniqueColors, valueMap);\n }\n\n let assignedColor = valueMap.get(valueKey);\n if (assignedColor === undefined) {\n assignedColor =\n UNIQUE_COLORS_PALETTE[valueMap.size % UNIQUE_COLORS_PALETTE.length]!;\n valueMap.set(valueKey, assignedColor);\n }\n\n return assignedColor;\n}\n\nfunction shouldUseProperty(\n prop: { isDisabled?: boolean } | undefined,\n): boolean {\n return prop !== undefined && prop.isDisabled !== true;\n}\n\nfunction evaluateStaticStyle({\n overlayIcon,\n ...scalarStyle\n}: Omit<Style, NonStaticStyles>) {\n const result: Record<string, unknown> = {};\n\n for (const [key, prop] of Object.entries(scalarStyle)) {\n if (shouldUseProperty(prop)) {\n result[key] = prop.value;\n }\n }\n\n if (shouldUseProperty(overlayIcon)) {\n const { ...overlayIconProps } = overlayIcon!;\n result.overlayIcon = overlayIconProps;\n }\n\n return result;\n}\n\nfunction evaluateRelStyle(\n style: Style,\n rel: RelData,\n uniqueColorsCache: Map<UniqueColors, Map<string, string>>,\n): EvaluatedNvlRelationshipStyle {\n const { captions, colorRange, widthRange, uniqueColors, ...staticStyle } =\n style;\n const result: EvaluatedNvlRelationshipStyle =\n evaluateStaticStyle(staticStyle);\n\n if (shouldUseProperty(captions) && captions!.text) {\n result.captions = captions!.text.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 if (captions?.align !== undefined) {\n result.captionAlign = captions.align;\n }\n if (captions?.size !== undefined) {\n result.captionSize = captions.size;\n }\n }\n\n if (shouldUseProperty(colorRange)) {\n const interpolated = getInterpolatedColor(colorRange!, rel);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n if (shouldUseProperty(widthRange)) {\n const { onProperty, minValue, maxValue, minWidth, maxWidth } = widthRange!;\n const interpolated = getInterpolatedSize(\n rel.properties[onProperty],\n minValue,\n maxValue,\n minWidth,\n maxWidth,\n );\n if (interpolated !== null) {\n result.width = interpolated;\n }\n }\n\n if (shouldUseProperty(uniqueColors)) {\n const color = resolveUniqueColor(\n uniqueColors!,\n rel.properties,\n uniqueColorsCache,\n );\n if (color !== null) {\n result.color = color;\n }\n }\n\n return result;\n}\n\n/**\n * Safely compare two values using Cypher's three-valued logic.\n * Returns `null` if either operand is null (matching Cypher semantics).\n *\n * From Neo4j Cypher Manual:\n * \"Comparing any value to `null` using `=` or `<>` results in `null`\"\n *\n * @see https://neo4j.com/docs/cypher-manual/current/values-and-types/working-with-null/\n */\nfunction safeCompare(\n left: Value,\n right: Value,\n graphItem: NodeData | RelData,\n compareFn: (\n a: NonNullable<ResolvedCypherValue>,\n b: NonNullable<ResolvedCypherValue>,\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): ResolvedCypherValue {\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 if ('datetime' in value) {\n return parseDateString(value.datetime);\n }\n if ('localdatetime' in value) {\n return parseLocalDateString(value.localdatetime);\n }\n if ('time' in value) {\n return parseTimeString(value.time);\n }\n if (isBigintLiteral(value)) {\n return resolveNumericLiteral(value);\n }\n }\n\n return value as ResolvedCypherValue;\n}\n\n// Default caption selection logic\nconst captionPriorityOrder = [\n /^name$/i,\n /^title$/i,\n /^label$/i,\n /name$/i,\n /description$/i,\n /^.+/,\n];\n\nfunction getDefaultNodeCaption(node: NodeData): Caption {\n const propertyKeys = Object.keys(node.properties);\n\n for (const regex of captionPriorityOrder) {\n const matchingKey = propertyKeys.find((key) => regex.test(key));\n if (matchingKey !== undefined) {\n const prop = node.properties[matchingKey];\n if (prop !== undefined) {\n return { value: { property: matchingKey } };\n }\n }\n }\n\n if (node.labelsSorted[0] !== undefined) {\n return { value: { useType: true } };\n }\n\n return { value: node.id };\n}\n\nfunction evaluateNodeStyle(\n style: Style,\n node: NodeData,\n uniqueColorsCache: Map<UniqueColors, Map<string, string>>,\n): EvaluatedNvlNodeStyle {\n const { captions, colorRange, sizeRange, uniqueColors, ...staticStyle } =\n style;\n const result: EvaluatedNvlNodeStyle = evaluateStaticStyle(staticStyle);\n\n const captionSource =\n shouldUseProperty(captions) && captions!.text\n ? captions!.text\n : [getDefaultNodeCaption(node)];\n\n result.captions = captionSource.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: 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 if (shouldUseProperty(captions)) {\n if (captions?.align !== undefined) {\n result.captionAlign = captions.align;\n }\n if (captions?.size !== undefined) {\n result.captionSize = captions.size;\n }\n }\n\n if (shouldUseProperty(colorRange)) {\n const interpolated = getInterpolatedColor(colorRange!, node);\n if (interpolated !== null) {\n result.color = interpolated;\n }\n }\n\n if (shouldUseProperty(sizeRange)) {\n const { onProperty, minValue, maxValue, minSize, maxSize } = sizeRange!;\n const interpolated = getInterpolatedSize(\n node.properties[onProperty],\n minValue,\n maxValue,\n minSize,\n maxSize,\n );\n if (interpolated !== null) {\n result.size = interpolated;\n }\n }\n\n if (shouldUseProperty(uniqueColors)) {\n const color = resolveUniqueColor(\n uniqueColors!,\n node.properties,\n uniqueColorsCache,\n );\n if (color !== null) {\n result.color = color;\n }\n }\n\n return result;\n}\n\nfunction createRelStyleFunction(\n rules: GraphStyleRule[],\n): (rel: RelData) => EvaluatedNvlRelationshipStyle {\n const uniqueColorsCache = new Map<UniqueColors, Map<string, string>>();\n return (rel: RelData) => {\n const style: Style = {};\n\n for (const rule of rules) {\n if (doesGraphStyleRuleMatch(rel, rule)) {\n // Merge the style properties (later rules override earlier ones)\n Object.assign(style, rule.apply);\n }\n }\n\n return evaluateRelStyle(style, rel, uniqueColorsCache);\n };\n}\n\nexport type CompiledGraphStyleRules = {\n byType: (type: string) => (rel: RelData) => EvaluatedNvlRelationshipStyle;\n styleMatchers: StyleMatchers;\n byLabelSet: (node: NodeData) => EvaluatedNvlNodeStyle;\n};\n\nfunction createByLabelSetFunction(\n styleMatchers: StyleMatchers,\n): (node: NodeData) => EvaluatedNvlNodeStyle {\n const defaultColorCache = new Map<string, string>();\n const sortedRulesCache = new Map<string, GraphStyleRule[]>();\n const mergedStyleCache = new Map<string, Style>();\n const uniqueColorsCache = new Map<UniqueColors, Map<string, string>>();\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 and none use\n // uniqueColors, 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, uniqueColorsCache);\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: GraphStyleRule[] = [\n ...styleMatchers.globalLabelRules,\n ];\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 and uniqueColors-free.\n const collectStyles: Style = { color: { value: defaultColor } };\n let isCacheable = true;\n for (const rule of sortedRules) {\n if (rule.where !== undefined || rule.apply.uniqueColors !== undefined) {\n isCacheable = false;\n }\n if (doesGraphStyleRuleMatch(node, rule)) {\n Object.assign(collectStyles, rule.apply);\n }\n }\n\n // When all rules are where-free and uniqueColors-free, the merged style\n // depends only on labels. Cache it so subsequent nodes with the same label\n // set skip rule iteration.\n if (isCacheable) {\n mergedStyleCache.set(labelSetKey, collectStyles);\n }\n\n return evaluateNodeStyle(collectStyles, node, uniqueColorsCache);\n };\n}\n\nconst DEFAULT_REL_STYLE: GraphStyleRule = {\n apply: {\n captions: { text: [{ value: { useType: true } }] },\n color: { value: DEFAULT_REL_COLOR },\n },\n match: { reltype: null },\n};\n\nexport function compileGraphStyleRules(\n styleRules: GraphStyleRule[] | null | undefined,\n): CompiledGraphStyleRules {\n const styleMatchers = collectStyleMatchers(styleRules);\n\n // Lazily build and cache a style function per relationship type\n const cache = new Map<\n string,\n (rel: RelData) => EvaluatedNvlRelationshipStyle\n >();\n const byType = (type: string) => {\n let fn = cache.get(type);\n if (fn === undefined) {\n const rules = styleMatchers.rulesByType.get(type) ?? [];\n fn = createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...styleMatchers.globalReltypeRules,\n ...rules,\n ]);\n cache.set(type, fn);\n }\n return fn;\n };\n\n const byLabelSet = createByLabelSetFunction(styleMatchers);\n\n return { byLabelSet, byType, styleMatchers };\n}\n"]}