@neo4j-ndl/react-graph 2.1.7 → 2.1.9

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.
@@ -114,7 +114,8 @@ function parseTimeString(s) {
114
114
  * e.g. `"2024-01-01"`, `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
115
115
  *
116
116
  * Strings with a time component that lack `Z`, an offset, or an IANA bracket are
117
- * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).
117
+ * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be
118
+ * parsed with {@link parseLocalDateString}, in the browser's local timezone.)
118
119
  */
119
120
  function parseDateString(s) {
120
121
  // RFC 9557 / ZonedDateTime with IANA bracket notation
@@ -1 +1 @@
1
- {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA6DH,0CAyCC;AAmBD,0CA0BC;AAqBD,oDAqCC;AA3MD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yDAA6C;AAE7C,MAAM,UAAU,GAAG,QAAU,CAAC;AAE9B,SAAS,aAAa,CAAC,EAAsB;IAC3C,OAAO,CACL,EAAE,CAAC,IAAI,GAAG,OAAS;QACnB,EAAE,CAAC,MAAM,GAAG,KAAM;QAClB,EAAE,CAAC,MAAM,GAAG,IAAK;QACjB,EAAE,CAAC,WAAW,CACf,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB;IACtC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,CACL,IAAI;Q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E,+DAA+D;IAC/D,EAAE;IACF,uEAAuE;IACvE,wEAAwE;IACxE,6BAA6B;IAC7B,IAAI,CAAC;QACH,4BAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,qCAAqC;IACvC,CAAC;IAED,IAAI,CAAC;QACH,4BAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,yCAAyC;IAC3C,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,4BAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACjD,IAAI,CAAC;QACH,OAAO,4BAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC;IAC9E,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,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 { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(s: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (s.includes('T') || s.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = s.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = s.slice(0, s.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).\n */\nexport function parseDateString(s: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\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 * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n s: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(s);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(s);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/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,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC;IAC9E,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,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 { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(s: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (s.includes('T') || s.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = s.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = s.slice(0, s.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be\n * parsed with {@link parseLocalDateString}, in the browser's local timezone.)\n */\nexport function parseDateString(s: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\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 * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n s: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(s);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(s);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
@@ -237,14 +237,19 @@ function extractPropertyValue(prop) {
237
237
  // null (treated as missing) rather than leaking a raw string into numeric
238
238
  // comparisons, matching Cypher null semantics.
239
239
  //
240
- // DateTime / LocalDateTime → Unix milliseconds (epoch ms)
241
- // LocalDateTime has no timezone; treated as UTC, same as date-only strings.
240
+ // DateTime / Date → Unix milliseconds (epoch ms), UTC-based.
242
241
  case 'DateTime':
243
- case 'LocalDateTime':
244
242
  case 'Date': {
245
243
  const s = JSON.parse(prop.stringified);
246
244
  return (0, style_rules_1.parseDateString)(s);
247
245
  }
246
+ // LocalDateTime → Unix milliseconds in the browser's local timezone,
247
+ // matching { localdatetime } rule literals. Zoned strings are rejected
248
+ // (resolve to null), as LocalDateTime has no associated timezone.
249
+ case 'LocalDateTime': {
250
+ const s = JSON.parse(prop.stringified);
251
+ return (0, style_rules_1.parseLocalDateString)(s);
252
+ }
248
253
  // Time (ZonedTime) / LocalTime → UTC-normalised ms since midnight
249
254
  // LocalTime has no offset; treated as UTC.
250
255
  case 'Time':
@@ -765,10 +770,12 @@ function compileGraphStyleRules(styleRules) {
765
770
  let fn = cache.get(type);
766
771
  if (fn === undefined) {
767
772
  const rules = (_a = styleMatchers.rulesByType.get(type)) !== null && _a !== void 0 ? _a : [];
773
+ // Sort global and type-specific rules together by priority, mirroring
774
+ // the node path. The default style carries no priority and always
775
+ // applies first.
768
776
  fn = createRelStyleFunction([
769
777
  DEFAULT_REL_STYLE,
770
- ...styleMatchers.globalReltypeRules,
771
- ...rules,
778
+ ...[...styleMatchers.globalReltypeRules, ...rules].toSorted(compareByPriorityAscending),
772
779
  ]);
773
780
  cache.set(type, fn);
774
781
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compile-graph-styles.js","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;AAofH,0DA8BC;AAwdD,wDA2BC;AAngCD,2DAAwE;AACxE,0CAAyC;AACzC,kDAA4E;AAE5E,2DAamC;AAmBtB,QAAA,iBAAiB,GAAG,aAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,MAAM,uBAAuB,GAAG,aAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEhD,QAAA,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,aAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CACrE,sBAAQ,CACT,CAAC;AASF,SAAS,0BAA0B,CACjC,CAAiB,EACjB,CAAiB;IAEjB,OAAO,CAAC,CAAC,QAAS,GAAG,CAAC,CAAC,QAAS,CAAC;AACnC,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAA2C;IAE3C,MAAM,YAAY,GAAG,IAAI,GAAG,EAA4B,CAAC;IACzD,MAAM,WAAW,GAAG,IAAI,GAAG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AAG,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"]}
1
+ {"version":3,"file":"compile-graph-styles.js","sourceRoot":"","sources":["../../../src/styling/compile-graph-styles.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;AAyfH,0DA8BC;AAwdD,wDA+BC;AA5gCD,2DAAwE;AACxE,0CAAyC;AACzC,kDAA4E;AAE5E,2DAamC;AAmBtB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AC;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 / Date → Unix milliseconds (epoch ms), UTC-based.\n case 'DateTime':\n case 'Date': {\n const s = JSON.parse(prop.stringified) as string;\n return parseDateString(s);\n }\n // LocalDateTime → Unix milliseconds in the browser's local timezone,\n // matching { localdatetime } rule literals. Zoned strings are rejected\n // (resolve to null), as LocalDateTime has no associated timezone.\n case 'LocalDateTime': {\n const s = JSON.parse(prop.stringified) as string;\n return parseLocalDateString(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 // Sort global and type-specific rules together by priority, mirroring\n // the node path. The default style carries no priority and always\n // applies first.\n fn = createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...[...styleMatchers.globalReltypeRules, ...rules].toSorted(\n compareByPriorityAscending,\n ),\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"]}
@@ -109,7 +109,8 @@ export function parseTimeString(s) {
109
109
  * e.g. `"2024-01-01"`, `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
110
110
  *
111
111
  * Strings with a time component that lack `Z`, an offset, or an IANA bracket are
112
- * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).
112
+ * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be
113
+ * parsed with {@link parseLocalDateString}, in the browser's local timezone.)
113
114
  */
114
115
  export function parseDateString(s) {
115
116
  // RFC 9557 / ZonedDateTime with IANA bracket notation
@@ -1 +1 @@
1
- {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;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B,CAAC;IAC9E,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,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 { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(s: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (s.includes('T') || s.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = s.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = s.slice(0, s.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).\n */\nexport function parseDateString(s: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\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 * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n s: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(s);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(s);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,UAAU,GAAG,QAAU,CAAC;AAE9B,SAAS,aAAa,CAAC,EAAsB;IAC3C,OAAO,CACL,EAAE,CAAC,IAAI,GAAG,OAAS;QACnB,EAAE,CAAC,MAAM,GAAG,KAAM;QAClB,EAAE,CAAC,MAAM,GAAG,IAAK;QACjB,EAAE,CAAC,WAAW,CACf,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB;IACtC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC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EAA4E;IAC5E,wEAAwE;IACxE,2CAA2C;IAC3C,EAAE;IACF,uEAAuE;IACvE,2EAA2E;IAC3E,+DAA+D;IAC/D,EAAE;IACF,uEAAuE;IACvE,wEAAwE;IACxE,6BAA6B;IAC7B,IAAI,CAAC;QACH,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,qCAAqC;IACvC,CAAC;IAED,IAAI,CAAC;QACH,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,yCAAyC;IAC3C,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACjD,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC;IAC9E,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,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 { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(s: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (s.includes('T') || s.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = s.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = s.slice(0, s.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be\n * parsed with {@link parseLocalDateString}, in the browser's local timezone.)\n */\nexport function parseDateString(s: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\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 * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n s: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(s);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(s);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
@@ -232,14 +232,19 @@ function extractPropertyValue(prop) {
232
232
  // null (treated as missing) rather than leaking a raw string into numeric
233
233
  // comparisons, matching Cypher null semantics.
234
234
  //
235
- // DateTime / LocalDateTime → Unix milliseconds (epoch ms)
236
- // LocalDateTime has no timezone; treated as UTC, same as date-only strings.
235
+ // DateTime / Date → Unix milliseconds (epoch ms), UTC-based.
237
236
  case 'DateTime':
238
- case 'LocalDateTime':
239
237
  case 'Date': {
240
238
  const s = JSON.parse(prop.stringified);
241
239
  return parseDateString(s);
242
240
  }
241
+ // LocalDateTime → Unix milliseconds in the browser's local timezone,
242
+ // matching { localdatetime } rule literals. Zoned strings are rejected
243
+ // (resolve to null), as LocalDateTime has no associated timezone.
244
+ case 'LocalDateTime': {
245
+ const s = JSON.parse(prop.stringified);
246
+ return parseLocalDateString(s);
247
+ }
243
248
  // Time (ZonedTime) / LocalTime → UTC-normalised ms since midnight
244
249
  // LocalTime has no offset; treated as UTC.
245
250
  case 'Time':
@@ -760,10 +765,12 @@ export function compileGraphStyleRules(styleRules) {
760
765
  let fn = cache.get(type);
761
766
  if (fn === undefined) {
762
767
  const rules = (_a = styleMatchers.rulesByType.get(type)) !== null && _a !== void 0 ? _a : [];
768
+ // Sort global and type-specific rules together by priority, mirroring
769
+ // the node path. The default style carries no priority and always
770
+ // applies first.
763
771
  fn = createRelStyleFunction([
764
772
  DEFAULT_REL_STYLE,
765
- ...styleMatchers.globalReltypeRules,
766
- ...rules,
773
+ ...[...styleMatchers.globalReltypeRules, ...rules].toSorted(compareByPriorityAscending),
767
774
  ]);
768
775
  cache.set(type, fn);
769
776
  }
@@ -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,0BA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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"]}
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,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,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CACrE,QAAQ,C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AAE;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,sEAAsE;YACtE,kEAAkE;YAClE,iBAAiB;YACjB,EAAE,GAAG,sBAAsB,CAAC;gBAC1B,iBAAiB;gBACjB,GAAG,CAAC,GAAG,aAAa,CAAC,kBAAkB,EAAE,GAAG,KAAK,CAAC,CAAC,QAAQ,CACzD,0BAA0B,CAC3B;aACF,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 / Date → Unix milliseconds (epoch ms), UTC-based.\n case 'DateTime':\n case 'Date': {\n const s = JSON.parse(prop.stringified) as string;\n return parseDateString(s);\n }\n // LocalDateTime → Unix milliseconds in the browser's local timezone,\n // matching { localdatetime } rule literals. Zoned strings are rejected\n // (resolve to null), as LocalDateTime has no associated timezone.\n case 'LocalDateTime': {\n const s = JSON.parse(prop.stringified) as string;\n return parseLocalDateString(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 // Sort global and type-specific rules together by priority, mirroring\n // the node path. The default style carries no priority and always\n // applies first.\n fn = createRelStyleFunction([\n DEFAULT_REL_STYLE,\n ...[...styleMatchers.globalReltypeRules, ...rules].toSorted(\n compareByPriorityAscending,\n ),\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"]}
@@ -48,7 +48,8 @@ export declare function parseTimeString(s: string): number | null;
48
48
  * e.g. `"2024-01-01"`, `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
49
49
  *
50
50
  * Strings with a time component that lack `Z`, an offset, or an IANA bracket are
51
- * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).
51
+ * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be
52
+ * parsed with {@link parseLocalDateString}, in the browser's local timezone.)
52
53
  */
53
54
  export declare function parseDateString(s: string): number | null;
54
55
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyCxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0BxD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,CAAC,EAAE,MAAM,EACT,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAkCf"}
1
+ {"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react-graph",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of the graph visualization from Neo4j Design System",
6
6
  "keywords": [
@@ -49,7 +49,7 @@
49
49
  "react": "19.2.5",
50
50
  "react-dom": "19.2.5",
51
51
  "typescript": "5.9.3",
52
- "vitest": "3.2.4"
52
+ "vitest": "4.1.10"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "react": ">=19.0.0",
@@ -57,8 +57,8 @@
57
57
  "@neo4j-nvl/base": "^1.2.0",
58
58
  "@neo4j-nvl/interaction-handlers": "^1.2.0",
59
59
  "@neo4j-nvl/react": "^1.2.0",
60
- "@neo4j-ndl/react": "^4.18.7",
61
- "@neo4j-ndl/base": "^4.17.4"
60
+ "@neo4j-ndl/base": "^4.17.5",
61
+ "@neo4j-ndl/react": "^4.18.8"
62
62
  },
63
63
  "dependencies": {
64
64
  "classnames": "2.5.1",