@neo4j-ndl/react-graph 2.1.17 → 2.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/_generated/style-rules/color-utils.js +3 -0
- package/lib/cjs/_generated/style-rules/color-utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/date-utils.js +14 -13
- package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js +5 -3
- package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/cjs/graph-visualization-buttons.js +10 -9
- package/lib/cjs/graph-visualization-buttons.js.map +1 -1
- package/lib/cjs/sidepanel-components/button-group.js +1 -1
- package/lib/cjs/sidepanel-components/button-group.js.map +1 -1
- package/lib/cjs/sidepanel-components/clickable-urls.js +2 -2
- package/lib/cjs/sidepanel-components/clickable-urls.js.map +1 -1
- package/lib/cjs/sidepanel-components/show-all.js +3 -3
- package/lib/cjs/sidepanel-components/show-all.js.map +1 -1
- package/lib/cjs/styling/compile-graph-styles.js +19 -19
- package/lib/cjs/styling/compile-graph-styles.js.map +1 -1
- package/lib/cjs/styling/create-vis-data-structures.js +1 -1
- package/lib/cjs/styling/create-vis-data-structures.js.map +1 -1
- package/lib/cjs/styling/parse-style-rules.js.map +1 -1
- package/lib/cjs/styling/style-types.js +2 -2
- package/lib/cjs/styling/style-types.js.map +1 -1
- package/lib/cjs/use-managed-node-state.js +13 -11
- package/lib/cjs/use-managed-node-state.js.map +1 -1
- package/lib/cjs/utils.js +8 -8
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/color-utils.js +3 -0
- package/lib/esm/_generated/style-rules/color-utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/date-utils.js +14 -13
- package/lib/esm/_generated/style-rules/date-utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/literal-schemas.js +5 -3
- package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/esm/graph-visualization-buttons.js +10 -9
- package/lib/esm/graph-visualization-buttons.js.map +1 -1
- package/lib/esm/sidepanel-components/button-group.js +1 -1
- package/lib/esm/sidepanel-components/button-group.js.map +1 -1
- package/lib/esm/sidepanel-components/clickable-urls.js +2 -2
- package/lib/esm/sidepanel-components/clickable-urls.js.map +1 -1
- package/lib/esm/sidepanel-components/show-all.js +3 -3
- package/lib/esm/sidepanel-components/show-all.js.map +1 -1
- package/lib/esm/styling/compile-graph-styles.js +19 -19
- package/lib/esm/styling/compile-graph-styles.js.map +1 -1
- package/lib/esm/styling/create-vis-data-structures.js +1 -1
- package/lib/esm/styling/create-vis-data-structures.js.map +1 -1
- package/lib/esm/styling/parse-style-rules.js +3 -3
- package/lib/esm/styling/parse-style-rules.js.map +1 -1
- package/lib/esm/styling/style-types.js +2 -2
- package/lib/esm/styling/style-types.js.map +1 -1
- package/lib/esm/use-managed-node-state.js +13 -11
- package/lib/esm/use-managed-node-state.js.map +1 -1
- package/lib/esm/utils.js +8 -8
- package/lib/esm/utils.js.map +1 -1
- package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/date-utils.d.ts +3 -3
- package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
- package/lib/types/graph-visualization-buttons.d.ts.map +1 -1
- package/lib/types/graph-visualization.d.ts.map +1 -1
- package/lib/types/styling/compile-graph-styles.d.ts.map +1 -1
- package/lib/types/styling/parse-style-rules.d.ts +2 -2
- package/lib/types/styling/parse-style-rules.d.ts.map +1 -1
- package/lib/types/use-managed-node-state.d.ts.map +1 -1
- package/lib/types/utils.d.ts +2 -2
- package/lib/types/utils.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -42,8 +42,11 @@ function getWeight(startValue, endValue, value) {
|
|
|
42
42
|
*/
|
|
43
43
|
function lerpColor(startColor, endColor, weight) {
|
|
44
44
|
return {
|
|
45
|
+
// oxlint-disable-next-line id-length
|
|
45
46
|
b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),
|
|
47
|
+
// oxlint-disable-next-line id-length
|
|
46
48
|
g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),
|
|
49
|
+
// oxlint-disable-next-line id-length
|
|
47
50
|
r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),
|
|
48
51
|
};
|
|
49
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA8BH,8BAMC;AAMD,
|
|
1
|
+
{"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA8BH,8BAMC;AAMD,8BAaC;AA9BD;;;;GAIG;AACH,SAAgB,SAAS,CACvB,UAAkB,EAClB,QAAgB,EAChB,KAAa;IAEb,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,SAAgB,SAAS,CACvB,UAAoB,EACpB,QAAkB,EAClB,MAAc;IAEd,OAAO;QACL,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;KACjE,CAAC;AACJ,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 type { RgbColor } from '@uiw/react-color';\n\n/**\n * Computes a linear interpolation weight in [0, 1] for `value` between\n * `startValue` and `endValue`. Values outside the range produce weights\n * outside [0, 1] — callers are responsible for clamping if needed.\n */\nexport function getWeight(\n startValue: number,\n endValue: number,\n value: number,\n): number {\n return (value - startValue) / (endValue - startValue);\n}\n\n/**\n * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).\n * Each channel is rounded to the nearest integer.\n */\nexport function lerpColor(\n startColor: RgbColor,\n endColor: RgbColor,\n weight: number,\n): RgbColor {\n return {\n // oxlint-disable-next-line id-length\n b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),\n // oxlint-disable-next-line id-length\n g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),\n // oxlint-disable-next-line id-length\n r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),\n };\n}\n"]}
|
|
@@ -58,21 +58,21 @@ function parseOffsetMs(offsetStr) {
|
|
|
58
58
|
*
|
|
59
59
|
* Values wrap around midnight: `"00:00:00+01:00"` → 82,800,000 (23:00 UTC).
|
|
60
60
|
*/
|
|
61
|
-
function parseTimeString(
|
|
61
|
+
function parseTimeString(input) {
|
|
62
62
|
// Reject datetime strings and anything with an IANA timezone bracket.
|
|
63
63
|
// Temporal.PlainTime.from silently extracts the time portion from strings
|
|
64
64
|
// containing a 'T' separator. IANA brackets are meaningless for time-only
|
|
65
65
|
// values (there is no date to anchor DST to), so they are also rejected.
|
|
66
|
-
if (
|
|
66
|
+
if (input.includes('T') || input.includes('[')) {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
// Offset time: detect "+HH:MM" or "-HH:MM" suffix first. Temporal.PlainTime.from
|
|
70
70
|
// silently strips offsets and returns the clock-face time, so we must handle
|
|
71
71
|
// offset strings explicitly before falling through to the plain parse.
|
|
72
|
-
const offsetMatch =
|
|
72
|
+
const offsetMatch = input.match(/([+-]\d{2}:\d{2})(\[.*\])?$/);
|
|
73
73
|
if (offsetMatch) {
|
|
74
74
|
const offsetStr = offsetMatch[1];
|
|
75
|
-
const timeStr =
|
|
75
|
+
const timeStr = input.slice(0, input.indexOf(offsetStr));
|
|
76
76
|
const offsetMs = parseOffsetMs(offsetStr);
|
|
77
77
|
if (offsetMs !== null) {
|
|
78
78
|
try {
|
|
@@ -89,7 +89,7 @@ function parseTimeString(s) {
|
|
|
89
89
|
// UTC time with Z suffix (e.g. "14:30:00Z") — strip Z and treat as local (UTC) time.
|
|
90
90
|
// Only apply when there is no 'T' in the string; a datetime string like
|
|
91
91
|
// "2024-06-15T14:30:00Z" must not be accepted here.
|
|
92
|
-
const normalized =
|
|
92
|
+
const normalized = input.endsWith('Z') && !input.includes('T') ? input.slice(0, -1) : input;
|
|
93
93
|
// Local time (no offset) — treated as UTC
|
|
94
94
|
try {
|
|
95
95
|
return plainTimeToMs(temporal_polyfill_1.Temporal.PlainTime.from(normalized));
|
|
@@ -117,17 +117,17 @@ function parseTimeString(s) {
|
|
|
117
117
|
* parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be
|
|
118
118
|
* parsed with {@link parseLocalDateString}, in the browser's local timezone.)
|
|
119
119
|
*/
|
|
120
|
-
function parseDateString(
|
|
120
|
+
function parseDateString(input) {
|
|
121
121
|
// RFC 9557 / ZonedDateTime with IANA bracket notation
|
|
122
122
|
try {
|
|
123
|
-
return temporal_polyfill_1.Temporal.ZonedDateTime.from(
|
|
123
|
+
return temporal_polyfill_1.Temporal.ZonedDateTime.from(input).epochMilliseconds;
|
|
124
124
|
}
|
|
125
125
|
catch (_a) {
|
|
126
126
|
/* empty */
|
|
127
127
|
}
|
|
128
128
|
// UTC or fixed-offset datetime (no IANA name)
|
|
129
129
|
try {
|
|
130
|
-
return temporal_polyfill_1.Temporal.Instant.from(
|
|
130
|
+
return temporal_polyfill_1.Temporal.Instant.from(input).epochMilliseconds;
|
|
131
131
|
}
|
|
132
132
|
catch (_b) {
|
|
133
133
|
/* empty */
|
|
@@ -136,7 +136,7 @@ function parseDateString(s) {
|
|
|
136
136
|
// Also covers date-only strings like "2024-01-01" (PlainDateTime.from parses
|
|
137
137
|
// them as midnight), so a separate PlainDate path is not needed.
|
|
138
138
|
try {
|
|
139
|
-
return temporal_polyfill_1.Temporal.PlainDateTime.from(
|
|
139
|
+
return temporal_polyfill_1.Temporal.PlainDateTime.from(input).toZonedDateTime('UTC')
|
|
140
140
|
.epochMilliseconds;
|
|
141
141
|
}
|
|
142
142
|
catch (_c) {
|
|
@@ -163,7 +163,7 @@ function parseDateString(s) {
|
|
|
163
163
|
* The optional `timeZone` parameter overrides the browser's local timezone,
|
|
164
164
|
* which is useful for deterministic testing.
|
|
165
165
|
*/
|
|
166
|
-
function parseLocalDateString(
|
|
166
|
+
function parseLocalDateString(input, timeZone) {
|
|
167
167
|
// Reject strings that carry explicit timezone information. This mirrors the
|
|
168
168
|
// cascade in parseDateString but uses successful parsing as a rejection
|
|
169
169
|
// signal rather than an acceptance signal:
|
|
@@ -176,14 +176,14 @@ function parseLocalDateString(s, timeZone) {
|
|
|
176
176
|
// instead of throwing, so these two pre-checks are necessary to enforce
|
|
177
177
|
// the plain-only constraint.
|
|
178
178
|
try {
|
|
179
|
-
temporal_polyfill_1.Temporal.ZonedDateTime.from(
|
|
179
|
+
temporal_polyfill_1.Temporal.ZonedDateTime.from(input);
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
182
|
catch (_a) {
|
|
183
183
|
/* not a zoned datetime — continue */
|
|
184
184
|
}
|
|
185
185
|
try {
|
|
186
|
-
temporal_polyfill_1.Temporal.Instant.from(
|
|
186
|
+
temporal_polyfill_1.Temporal.Instant.from(input);
|
|
187
187
|
return null;
|
|
188
188
|
}
|
|
189
189
|
catch (_b) {
|
|
@@ -191,7 +191,8 @@ function parseLocalDateString(s, timeZone) {
|
|
|
191
191
|
}
|
|
192
192
|
const tz = timeZone !== null && timeZone !== void 0 ? timeZone : temporal_polyfill_1.Temporal.Now.timeZoneId();
|
|
193
193
|
try {
|
|
194
|
-
return temporal_polyfill_1.Temporal.PlainDateTime.from(
|
|
194
|
+
return temporal_polyfill_1.Temporal.PlainDateTime.from(input).toZonedDateTime(tz)
|
|
195
|
+
.epochMilliseconds;
|
|
195
196
|
}
|
|
196
197
|
catch (_c) {
|
|
197
198
|
/* empty */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA6DH,0CAyCC;AAoBD,0CA0BC;AAqBD,oDAqCC;AA5MD;;;;;;;;;;;;;;;;;;;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,GA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B,CAAC;IACvB,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,oBAAoB,CAClC,CAAS,EACT,QAAiB;IAEjB,4EAA4E;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,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. (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"]}
|
|
1
|
+
{"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA6DH,0CA0CC;AAoBD,0CA0BC;AAqBD,oDAsCC;AA9MD;;;;;;;;;;;;;;;;;;;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;QACJ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,OAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAM,CAAC,CACvE,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,eAAe,CAA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C;IAED,IAAI,CAAC;QACH,4BAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,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,KAAK,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC;aAC1D,iBAAiB,CAAC;IACvB,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(input: 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 (input.includes('T') || input.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 = input.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = input.slice(0, input.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 =\n input.endsWith('Z') && !input.includes('T') ? input.slice(0, -1) : input;\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(input: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(input).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(input).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(input).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 input: 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(input);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(input);\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(input).toZonedDateTime(tz)\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
|
|
@@ -57,7 +57,7 @@ exports.NumericLiteralSchema = zod_1.z.union([
|
|
|
57
57
|
* - Date-only (treated as UTC midnight): `"2024-01-01"`
|
|
58
58
|
*/
|
|
59
59
|
exports.DatetimeLiteralSchema = zod_1.z.object({
|
|
60
|
-
datetime: zod_1.z.string().refine((
|
|
60
|
+
datetime: zod_1.z.string().refine((input) => (0, date_utils_1.parseDateString)(input) !== null, {
|
|
61
61
|
message: 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',
|
|
62
62
|
}),
|
|
63
63
|
});
|
|
@@ -75,7 +75,9 @@ exports.DatetimeLiteralSchema = zod_1.z.object({
|
|
|
75
75
|
* timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.
|
|
76
76
|
*/
|
|
77
77
|
exports.LocalDatetimeLiteralSchema = zod_1.z.object({
|
|
78
|
-
localdatetime: zod_1.z
|
|
78
|
+
localdatetime: zod_1.z
|
|
79
|
+
.string()
|
|
80
|
+
.refine((input) => (0, date_utils_1.parseLocalDateString)(input) !== null, {
|
|
79
81
|
message: 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',
|
|
80
82
|
}),
|
|
81
83
|
});
|
|
@@ -93,7 +95,7 @@ exports.LocalDatetimeLiteralSchema = zod_1.z.object({
|
|
|
93
95
|
* Full datetime strings (containing `T`) are rejected.
|
|
94
96
|
*/
|
|
95
97
|
exports.TimeLiteralSchema = zod_1.z.object({
|
|
96
|
-
time: zod_1.z.string().refine((
|
|
98
|
+
time: zod_1.z.string().refine((input) => (0, date_utils_1.parseTimeString)(input) !== null, {
|
|
97
99
|
message: 'time must be a valid ISO 8601 time string (e.g. "14:30:00" or "14:30:00+02:00")',
|
|
98
100
|
}),
|
|
99
101
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;
|
|
1
|
+
{"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA6HH,8CAEC;AAGD,wDAIC;AAGD,sCAEC;AAzID;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6BAAwB;AAExB,6CAIsB;AAEtB;;;GAGG;AACU,QAA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K,IAAI;QACd,GAAG,IAAI,KAAK;QACZ,OAAQ,KAAiC,CAAC,GAAG,CAAC,KAAK,QAAQ,CAC5D,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,OAAO,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAClD,CAAC;AAED,sGAAsG;AACtG,SAAgB,sBAAsB,CACpC,KAAc;IAEd,OAAO,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED,6FAA6F;AAC7F,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACU,QAAA,kBAAkB,GAAG,OAAC,CAAC,KAAK,CAAC;IACxC,4BAAoB;IACpB,6BAAqB;IACrB,kCAA0B;IAC1B,yBAAiB;CAClB,CAAC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\n\n/**\n * A JSON-safe bigint literal. Native bigint values cannot be serialized as\n * JSON, so persisted style rules can use a signed decimal string instead.\n */\nexport const BigintLiteralSchema = z.object({\n bigint: z.string().regex(/^[+-]?\\d+$/, {\n message: 'bigint must be a signed decimal integer string',\n }),\n});\nexport type BigintLiteral = z.infer<typeof BigintLiteralSchema>;\n\n/** A numeric style-rule literal, including native and JSON-safe bigints. */\nexport const NumericLiteralSchema = z.union([\n z.number(),\n z.bigint(),\n BigintLiteralSchema,\n]);\nexport type NumericLiteral = z.infer<typeof NumericLiteralSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((input) => parseDateString(input) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z\n .string()\n .refine((input) => parseLocalDateString(input) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((input) => parseTimeString(input) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n\nfunction isObjectWithStringKey<K extends string>(\n value: unknown,\n key: K,\n): value is Record<K, string> {\n return (\n typeof value === 'object' &&\n value !== null &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === 'string'\n );\n}\n\n/** Returns whether a value is a `{ datetime: string }` wrapper. Does not validate the string. */\nexport function isDatetimeLiteral(value: unknown): value is DatetimeLiteral {\n return isObjectWithStringKey(value, 'datetime');\n}\n\n/** Returns whether a value is a `{ localdatetime: string }` wrapper. Does not validate the string. */\nexport function isLocalDatetimeLiteral(\n value: unknown,\n): value is LocalDatetimeLiteral {\n return isObjectWithStringKey(value, 'localdatetime');\n}\n\n/** Returns whether a value is a `{ time: string }` wrapper. Does not validate the string. */\nexport function isTimeLiteral(value: unknown): value is TimeLiteral {\n return isObjectWithStringKey(value, 'time');\n}\n\n/**\n * A continuous, orderable literal that can be used as a range boundary.\n * Temporal literals resolve to numbers before range interpolation.\n */\nexport const RangeLiteralSchema = z.union([\n NumericLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type RangeLiteral = z.infer<typeof RangeLiteralSchema>;\n"]}
|
|
@@ -46,8 +46,8 @@ const targetIsTextInput = (target) => {
|
|
|
46
46
|
}
|
|
47
47
|
return (target.isContentEditable || ['INPUT', 'TEXTAREA'].includes(target.tagName));
|
|
48
48
|
};
|
|
49
|
-
const isEditingText = (
|
|
50
|
-
return targetIsTextInput(
|
|
49
|
+
const isEditingText = (event) => {
|
|
50
|
+
return targetIsTextInput(event.target);
|
|
51
51
|
};
|
|
52
52
|
const GESTURE_KEYS_DEFAULT = {
|
|
53
53
|
box: 'B',
|
|
@@ -170,14 +170,15 @@ const ZoomToFitButton = ({ className, style, htmlAttributes, tooltipPlacement, }
|
|
|
170
170
|
const selectedRels = instance.getSelectedRelationships();
|
|
171
171
|
const nodeIds = new Set();
|
|
172
172
|
if (selectedNodes.length || selectedRels.length) {
|
|
173
|
-
selectedNodes.forEach((
|
|
174
|
-
selectedRels.forEach((
|
|
173
|
+
selectedNodes.forEach((node) => nodeIds.add(node.id));
|
|
174
|
+
selectedRels.forEach((relationship) => nodeIds.add(relationship.from).add(relationship.to));
|
|
175
175
|
return [...nodeIds];
|
|
176
176
|
}
|
|
177
177
|
const allNodes = instance.getNodes();
|
|
178
178
|
const allRels = instance.getRelationships();
|
|
179
|
-
allNodes.forEach((
|
|
180
|
-
allRels.forEach((
|
|
179
|
+
allNodes.forEach((node) => node.disabled !== true && nodeIds.add(node.id));
|
|
180
|
+
allRels.forEach((relationship) => relationship.disabled !== true &&
|
|
181
|
+
nodeIds.add(relationship.from).add(relationship.to));
|
|
181
182
|
if (nodeIds.size > 0) {
|
|
182
183
|
return [...nodeIds];
|
|
183
184
|
}
|
|
@@ -233,14 +234,14 @@ const SearchButton = ({ className, style, htmlAttributes, tooltipPlacement, open
|
|
|
233
234
|
var _a;
|
|
234
235
|
handleSearchChange('');
|
|
235
236
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
236
|
-
}, description: "Clear search", children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) }), placeholder: "Search...", value: searchTerm, onChange: (
|
|
237
|
+
}, description: "Clear search", children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) }), placeholder: "Search...", value: searchTerm, onChange: (event) => handleSearchChange(event.target.value), htmlAttributes: {
|
|
237
238
|
autoFocus: true,
|
|
238
239
|
onBlur: () => {
|
|
239
240
|
if (searchTerm === '') {
|
|
240
241
|
setIsOpen(false);
|
|
241
242
|
}
|
|
242
243
|
},
|
|
243
|
-
} })) : ((0, jsx_runtime_1.jsx)(react_1.IconButton, { size: "small", isFloating: true, onClick: () => setIsOpen((
|
|
244
|
+
} })) : ((0, jsx_runtime_1.jsx)(react_1.IconButton, { size: "small", isFloating: true, onClick: () => setIsOpen((open) => !open), description: "Search", className: className, style: style, htmlAttributes: htmlAttributes, tooltipProps: {
|
|
244
245
|
root: {
|
|
245
246
|
isPortaled: false,
|
|
246
247
|
placement: tooltipPlacement !== null && tooltipPlacement !== void 0 ? tooltipPlacement : 'bottom',
|
|
@@ -253,7 +254,7 @@ const DownloadButton = ({ className, style, htmlAttributes, tooltipPlacement, })
|
|
|
253
254
|
const [isDownloadMenuOpen, setOpen] = (0, react_2.useState)(false);
|
|
254
255
|
const closeFileMenu = () => setOpen(false);
|
|
255
256
|
const downloadButtonRef = (0, react_2.useRef)(null);
|
|
256
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.IconButton, { ref: downloadButtonRef, size: "small", isFloating: true, onClick: () => setOpen((
|
|
257
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.IconButton, { ref: downloadButtonRef, size: "small", isFloating: true, onClick: () => setOpen((open) => !open), description: "Download", tooltipProps: {
|
|
257
258
|
root: { isPortaled: false, placement: tooltipPlacement !== null && tooltipPlacement !== void 0 ? tooltipPlacement : 'bottom' },
|
|
258
259
|
}, className: className, style: style, htmlAttributes: htmlAttributes, children: (0, jsx_runtime_1.jsx)(icons_1.ArrowDownTrayIconOutline, {}) }), (0, jsx_runtime_1.jsxs)(react_1.Menu, { isOpen: isDownloadMenuOpen, onClose: closeFileMenu, anchorRef: downloadButtonRef, portalTarget: portalTarget, children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Download as PNG", onClick: () => {
|
|
259
260
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-buttons.js","sourceRoot":"","sources":["../../src/graph-visualization-buttons.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAQ0B;AAC1B,kDAagC;AAEhC,4DAA2C;AAE3C,iCAMe;AAEf,+EAGuC;AACvC,2EAAqE;AACrE,mCAAkD;AA2C3C,MAAM,WAAW,GAAG,CAAC,KAAoC,EAAE,EAAE;IAClE,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,UAAU,EACV,WAAW,EACX,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,cAAc,EACd,QAAQ,EACR,mBAAmB,GACpB,GAAG,KAAK,CAAC;IACV,OAAO,CACL,uBAAC,uBAAe,IACd,WAAW,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,SAAS,EACrC,YAAY,EAAE;YACZ,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE;YAC5C,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE;SACzD,EACD,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EACl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vD,EAEJ,SAAS,EAAE,GAAG,KAAK,OAAO,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,GAAc,CAAC,IAVtC,GAAG,CAWR,CACH,CAAA;iBAAA,CAAC,GACG,IACN,CACJ,CAAC;AACJ,CAAC,CAAC;AAjEW,QAAA,mBAAmB,uBAiE9B","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 {\n CleanIconButton,\n IconButton,\n Kbd,\n Menu,\n SelectIconButton,\n TextInput,\n type Tooltip,\n} from '@neo4j-ndl/react';\nimport {\n ArrowDownTrayIconOutline,\n DocumentTextIconOutline,\n ExploreIcon,\n FitToScreenIcon,\n HierarchyTwoIcon,\n LassoIcon,\n MagnifyingGlassIconOutline,\n MagnifyingGlassMinusIconOutline,\n MagnifyingGlassPlusIconOutline,\n SelectIcon,\n SquareDashIcon,\n XMarkIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { type Layout } from '@neo4j-nvl/base';\nimport { default as cx } from 'classnames';\nimport type React from 'react';\nimport {\n type PropsWithChildren,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type Gesture,\n useGraphVisualizationContext,\n} from './graph-visualization-context';\nimport { useSemicontrolledState } from './use-semi-controlled-state';\nimport { searchNodes, searchRels } from './utils';\n\ntype GraphVisualizationButtonProps = {\n tooltipPlacement?: React.ComponentProps<typeof Tooltip>['placement'];\n className?: string;\n /**\n * Additional css styling. Will be applied to the root element.\n */\n style?: React.CSSProperties;\n\n /**\n * Html attributes to apply to the root element. This will override any default html attributes, use with caution.\n */\n htmlAttributes?: React.ComponentPropsWithRef<\n typeof CleanIconButton\n >['htmlAttributes'];\n\n /**\n * A ref to apply to the root element.\n */\n ref?: React.ComponentPropsWithRef<'button'>['ref'];\n shortcutKey?: {\n keys: string[];\n isMetaKey: boolean;\n isShiftKey: boolean;\n };\n};\n\ntype BaseProperties = GraphVisualizationButtonProps & {\n description: string;\n testid?: string;\n ariaLabel?: string;\n isActive?: boolean;\n isDisabled?: boolean;\n onClick?: () => void;\n onMouseDown?: () => void;\n descriptionKbdProps?: React.ComponentPropsWithRef<\n typeof CleanIconButton\n >['descriptionKbdProps'];\n};\n\nexport type GraphVisualizationGroupButton = PropsWithChildren<BaseProperties>;\n\nexport const GroupButton = (props: GraphVisualizationGroupButton) => {\n const {\n isActive,\n ariaLabel,\n isDisabled,\n description,\n onClick,\n onMouseDown,\n tooltipPlacement,\n className,\n style,\n htmlAttributes,\n children,\n descriptionKbdProps,\n } = props;\n return (\n <CleanIconButton\n description={description ?? ariaLabel}\n tooltipProps={{\n content: { style: { whiteSpace: 'nowrap' } },\n root: { isPortaled: false, placement: tooltipPlacement },\n }}\n size=\"small\"\n className={className}\n style={style}\n isActive={isActive}\n isDisabled={isDisabled}\n descriptionKbdProps={descriptionKbdProps}\n onClick={onClick}\n htmlAttributes={{\n onMouseDown,\n ...htmlAttributes,\n }}\n >\n {children}\n </CleanIconButton>\n );\n};\n\nconst targetIsTextInput = (target: EventTarget | null): boolean => {\n if (!(target instanceof HTMLElement)) {\n return false;\n }\n return (\n target.isContentEditable || ['INPUT', 'TEXTAREA'].includes(target.tagName)\n );\n};\n\nconst isEditingText = (e: KeyboardEvent): boolean => {\n return targetIsTextInput(e.target);\n};\n\nconst GESTURE_KEYS_DEFAULT: Record<Gesture, string> = {\n box: 'B',\n lasso: 'L',\n single: 'S',\n};\n\nconst GESTURE_KEYS_DEFAULT_ICONS: Record<Gesture, React.ReactNode> = {\n box: <SquareDashIcon />,\n lasso: <LassoIcon />,\n single: <SelectIcon />,\n};\n\nconst GESTURE_KEYS_DEFAULT_TITLES: Record<Gesture, string> = {\n box: 'Box',\n lasso: 'Lasso',\n single: 'Single',\n};\n\ntype ShortcutKey = NonNullable<GraphVisualizationButtonProps['shortcutKey']>;\n\nconst getShortcutModifierKeys = (\n shortcutKey: Pick<ShortcutKey, 'isMetaKey' | 'isShiftKey'> | undefined,\n): NonNullable<React.ComponentProps<typeof Kbd>['modifierKeys']> => [\n ...(shortcutKey?.isMetaKey ? (['meta'] as const) : []),\n ...(shortcutKey?.isShiftKey ? (['shift'] as const) : []),\n];\n\nconst isShortcutMatch = (\n evt: KeyboardEvent,\n shortcutKey: GraphVisualizationButtonProps['shortcutKey'],\n): boolean => {\n if (shortcutKey === undefined || shortcutKey.keys.length !== 1) {\n return false;\n }\n\n return (\n evt.key.toUpperCase() === shortcutKey.keys[0].toUpperCase() &&\n evt.metaKey === shortcutKey.isMetaKey &&\n evt.shiftKey === shortcutKey.isShiftKey &&\n !evt.altKey &&\n !evt.ctrlKey\n );\n};\n\nconst useRegisterKeyboardGestureSwitcher = (\n gestureShortcuts: ReadonlyArray<{\n gesture: Gesture;\n shortcutKey: GraphVisualizationButtonProps['shortcutKey'];\n }>,\n) => {\n const { setGesture } = useGraphVisualizationContext();\n const handleKeyDown = useCallback(\n (evt: KeyboardEvent) => {\n if (!isEditingText(evt) && setGesture !== undefined) {\n for (const { gesture, shortcutKey } of gestureShortcuts) {\n if (isShortcutMatch(evt, shortcutKey)) {\n setGesture(gesture);\n }\n }\n }\n },\n [gestureShortcuts, setGesture],\n );\n\n useEffect(() => {\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [handleKeyDown]);\n};\n\nexport const SingleSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n shortcutKey = {\n keys: [GESTURE_KEYS_DEFAULT.single],\n isMetaKey: false,\n isShiftKey: false,\n },\n}: GraphVisualizationButtonProps) => {\n const { gesture, setGesture, interactionMode } =\n useGraphVisualizationContext();\n useRegisterKeyboardGestureSwitcher([{ gesture: 'single', shortcutKey }]);\n\n return (\n <GroupButton\n isActive={gesture === 'single'}\n isDisabled={interactionMode !== 'select'}\n ariaLabel=\"Individual Select Button\"\n description=\"Individual Select\"\n descriptionKbdProps={{\n keys: shortcutKey.keys,\n modifierKeys: getShortcutModifierKeys(shortcutKey),\n }}\n onClick={() => {\n setGesture?.('single');\n }}\n tooltipPlacement={tooltipPlacement ?? 'right'}\n htmlAttributes={{\n 'data-testid': 'gesture-individual-select',\n ...htmlAttributes,\n }}\n className={className}\n style={style}\n >\n <SelectIcon aria-label=\"Individual Select\" />\n </GroupButton>\n );\n};\n\nexport const BoxSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n shortcutKey = {\n keys: [GESTURE_KEYS_DEFAULT.box],\n isMetaKey: false,\n isShiftKey: false,\n },\n}: GraphVisualizationButtonProps) => {\n const { gesture, setGesture, interactionMode } =\n useGraphVisualizationContext();\n useRegisterKeyboardGestureSwitcher([{ gesture: 'box', shortcutKey }]);\n\n return (\n <GroupButton\n isDisabled={interactionMode !== 'select' || setGesture === undefined}\n isActive={gesture === 'box'}\n ariaLabel=\"Box Select Button\"\n description=\"Box Select\"\n descriptionKbdProps={{\n keys: shortcutKey.keys,\n modifierKeys: getShortcutModifierKeys(shortcutKey),\n }}\n onClick={() => {\n setGesture?.('box');\n }}\n tooltipPlacement={tooltipPlacement ?? 'right'}\n htmlAttributes={{\n 'data-testid': 'gesture-box-select',\n ...htmlAttributes,\n }}\n className={className}\n style={style}\n >\n <SquareDashIcon aria-label=\"Box select\" />\n </GroupButton>\n );\n};\n\nexport const LassoSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n shortcutKey = {\n keys: [GESTURE_KEYS_DEFAULT.lasso],\n isMetaKey: false,\n isShiftKey: false,\n },\n}: GraphVisualizationButtonProps) => {\n const { gesture, setGesture, interactionMode } =\n useGraphVisualizationContext();\n useRegisterKeyboardGestureSwitcher([{ gesture: 'lasso', shortcutKey }]);\n\n return (\n <GroupButton\n isDisabled={interactionMode !== 'select' || setGesture === undefined}\n isActive={gesture === 'lasso'}\n ariaLabel=\"Lasso Select Button\"\n description=\"Lasso Select\"\n descriptionKbdProps={{\n keys: shortcutKey.keys,\n modifierKeys: getShortcutModifierKeys(shortcutKey),\n }}\n onClick={() => {\n setGesture?.('lasso');\n }}\n tooltipPlacement={tooltipPlacement ?? 'right'}\n htmlAttributes={{\n 'data-testid': 'gesture-lasso-select',\n ...htmlAttributes,\n }}\n className={className}\n style={style}\n >\n <LassoIcon aria-label=\"Lasso select\" />\n </GroupButton>\n );\n};\n\nexport const ZoomInButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { nvlInstance } = useGraphVisualizationContext();\n\n const handleZoomIn = useCallback(() => {\n nvlInstance.current?.setZoom(nvlInstance.current?.getScale() * 1.3);\n }, [nvlInstance]);\n\n return (\n <GroupButton\n onClick={handleZoomIn}\n description=\"Zoom in\"\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n tooltipPlacement={tooltipPlacement ?? 'left'}\n >\n <MagnifyingGlassPlusIconOutline />\n </GroupButton>\n );\n};\n\nexport const ZoomOutButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { nvlInstance } = useGraphVisualizationContext();\n\n const handleZoomOut = useCallback(() => {\n nvlInstance.current?.setZoom(nvlInstance.current?.getScale() * 0.7);\n }, [nvlInstance]);\n\n return (\n <GroupButton\n onClick={handleZoomOut}\n description=\"Zoom out\"\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n tooltipPlacement={tooltipPlacement ?? 'left'}\n >\n <MagnifyingGlassMinusIconOutline />\n </GroupButton>\n );\n};\n\nexport const ZoomToFitButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { nvlInstance } = useGraphVisualizationContext();\n\n const getNodesToFit = useCallback(() => {\n const instance = nvlInstance.current;\n if (!instance) {\n return [];\n }\n\n const selectedNodes = instance.getSelectedNodes();\n const selectedRels = instance.getSelectedRelationships();\n const nodeIds = new Set<string>();\n\n if (selectedNodes.length || selectedRels.length) {\n selectedNodes.forEach((n) => nodeIds.add(n.id));\n selectedRels.forEach((r) => nodeIds.add(r.from).add(r.to));\n return [...nodeIds];\n }\n\n const allNodes = instance.getNodes();\n const allRels = instance.getRelationships();\n\n allNodes.forEach((n) => n.disabled !== true && nodeIds.add(n.id));\n allRels.forEach(\n (r) => r.disabled !== true && nodeIds.add(r.from).add(r.to),\n );\n\n if (nodeIds.size > 0) {\n return [...nodeIds];\n }\n\n return allNodes.map((node) => node.id);\n }, [nvlInstance]);\n\n const handleZoomToFit = useCallback(() => {\n nvlInstance.current?.fit(getNodesToFit());\n }, [getNodesToFit, nvlInstance]);\n\n return (\n <GroupButton\n onClick={handleZoomToFit}\n description=\"Zoom to fit\"\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n tooltipPlacement={tooltipPlacement ?? 'left'}\n >\n <FitToScreenIcon />\n </GroupButton>\n );\n};\n\nexport const ToggleSidePanelButton = ({\n className,\n htmlAttributes,\n style,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { sidepanel } = useGraphVisualizationContext();\n if (!sidepanel) {\n throw new Error(\n 'Using the ToggleSidePanelButton requires having a sidepanel',\n );\n }\n const { isSidePanelOpen, setIsSidePanelOpen } = sidepanel;\n return (\n <IconButton\n size=\"small\"\n onClick={() => setIsSidePanelOpen?.(!isSidePanelOpen)}\n isFloating\n description=\"Details\"\n isActive={isSidePanelOpen}\n tooltipProps={{\n content: { style: { whiteSpace: 'nowrap' } },\n root: {\n isPortaled: false,\n placement: tooltipPlacement ?? 'bottom',\n shouldCloseOnReferenceClick: true,\n },\n }}\n className={cx('ndl-graph-visualization-toggle-sidepanel', className)}\n style={style}\n htmlAttributes={{\n 'aria-label': 'Toggle graph details panel',\n ...htmlAttributes,\n }}\n >\n <DocumentTextIconOutline className=\"ndl-graph-visualization-toggle-icon\" />\n </IconButton>\n );\n};\n\ntype SearchButtonProps = GraphVisualizationButtonProps & {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n open?: boolean;\n setOpen?: React.Dispatch<React.SetStateAction<boolean>>;\n searchTerm?: string;\n setSearchTerm?: React.Dispatch<React.SetStateAction<string>>;\n onSearch?: (\n nodeIds: string[] | undefined,\n relationshipIds: string[] | undefined,\n ) => void;\n};\n\nexport const SearchButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n open: rawOpen,\n setOpen: rawSetOpen,\n searchTerm: rawSearchTerm,\n setSearchTerm: rawSetSearchTerm,\n onSearch = () => {\n // no-op\n },\n}: SearchButtonProps) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOpen, setIsOpen] = useSemicontrolledState({\n isControlled: rawOpen !== undefined,\n onChange: rawSetOpen,\n state: rawOpen ?? false,\n });\n const [searchTerm, setSearchTerm] = useSemicontrolledState({\n isControlled: rawSearchTerm !== undefined,\n onChange: rawSetSearchTerm,\n state: rawSearchTerm ?? '',\n });\n const { nvlGraph } = useGraphVisualizationContext();\n\n const handleSearchChange = (newValue: string) => {\n setSearchTerm(newValue);\n if (newValue === '') {\n onSearch(undefined, undefined);\n return;\n }\n\n onSearch(searchNodes(nvlGraph, newValue), searchRels(nvlGraph, newValue));\n };\n\n return (\n <>\n {isOpen ? (\n <TextInput\n ref={inputRef}\n size=\"small\"\n leadingElement={<MagnifyingGlassIconOutline />}\n trailingElement={\n <CleanIconButton\n onClick={() => {\n handleSearchChange('');\n inputRef.current?.focus();\n }}\n description=\"Clear search\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n }\n placeholder=\"Search...\"\n value={searchTerm}\n onChange={(e) => handleSearchChange(e.target.value)}\n htmlAttributes={{\n autoFocus: true,\n onBlur: () => {\n if (searchTerm === '') {\n setIsOpen(false);\n }\n },\n }}\n />\n ) : (\n <IconButton\n size=\"small\"\n isFloating\n onClick={() => setIsOpen((o) => !o)}\n description=\"Search\"\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n tooltipProps={{\n root: {\n isPortaled: false,\n placement: tooltipPlacement ?? 'bottom',\n },\n }}\n >\n <MagnifyingGlassIconOutline />\n </IconButton>\n )}\n </>\n );\n};\n\nexport const DownloadButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { nvlInstance, portalTarget } = useGraphVisualizationContext();\n\n const [isDownloadMenuOpen, setOpen] = useState(false);\n const closeFileMenu = () => setOpen(false);\n const downloadButtonRef = useRef<HTMLButtonElement>(null);\n return (\n <>\n <IconButton\n ref={downloadButtonRef}\n size=\"small\"\n isFloating\n onClick={() => setOpen((o) => !o)}\n description=\"Download\"\n tooltipProps={{\n root: { isPortaled: false, placement: tooltipPlacement ?? 'bottom' },\n }}\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n >\n <ArrowDownTrayIconOutline />\n </IconButton>\n\n <Menu\n isOpen={isDownloadMenuOpen}\n onClose={closeFileMenu}\n anchorRef={downloadButtonRef}\n portalTarget={portalTarget}\n >\n <Menu.Item\n title=\"Download as PNG\"\n onClick={() => {\n nvlInstance.current?.saveToFile({});\n closeFileMenu();\n }}\n />\n <Menu.Item\n title=\"Download as SVG\"\n onClick={() => {\n nvlInstance.current?.saveToSvg({});\n closeFileMenu();\n }}\n />\n </Menu>\n </>\n );\n};\n\nexport type LayoutSelectOption = Record<\n Layout,\n {\n icon: React.ReactNode;\n title: string;\n }\n>;\n\nconst DEFAULT_LAYOUT_OPTIONS: Partial<LayoutSelectOption> = {\n d3Force: {\n icon: <ExploreIcon />,\n title: 'Force-based layout',\n },\n hierarchical: {\n icon: <HierarchyTwoIcon />,\n title: 'Hierarchical layout',\n },\n};\n\nexport const LayoutSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n menuPlacement,\n layoutOptions = DEFAULT_LAYOUT_OPTIONS,\n}: GraphVisualizationButtonProps & {\n menuPlacement?: React.ComponentProps<typeof Menu>['placement'];\n layoutOptions?: Partial<LayoutSelectOption>;\n}) => {\n const anchorRef = useRef<HTMLButtonElement | null>(null);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const { layout, setLayout, portalTarget } = useGraphVisualizationContext();\n\n return (\n <>\n <SelectIconButton\n description=\"Select layout\"\n isOpen={isMenuOpen}\n onClick={() => setIsMenuOpen((old) => !old)}\n ref={anchorRef}\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n size=\"small\"\n tooltipProps={{\n root: { isPortaled: false, placement: tooltipPlacement ?? 'bottom' },\n }}\n >\n {layoutOptions[layout]?.icon ?? <SelectIcon />}\n </SelectIconButton>\n <Menu\n isOpen={isMenuOpen}\n anchorRef={anchorRef}\n onClose={() => setIsMenuOpen(false)}\n placement={menuPlacement}\n portalTarget={portalTarget}\n >\n {Object.entries(layoutOptions).map(([key, item]) => (\n <Menu.RadioItem\n key={key}\n title={item.title}\n leadingVisual={item.icon}\n isChecked={key === layout}\n onClick={() => setLayout?.(key as Layout)}\n />\n ))}\n </Menu>\n </>\n );\n};\n\nexport type GestureSelectOption = Record<\n Gesture,\n {\n icon?: React.ReactNode;\n title?: string;\n shortcutKey?: GraphVisualizationButtonProps['shortcutKey'];\n }\n>;\n\n// oxlint-disable-next-line sort-keys\nconst DEFAULT_GESTURE_OPTIONS: Partial<GestureSelectOption> = {\n single: {\n icon: <SelectIcon />,\n shortcutKey: {\n keys: [GESTURE_KEYS_DEFAULT.single],\n isMetaKey: false,\n isShiftKey: false,\n },\n title: 'Individual',\n },\n box: {\n icon: <SquareDashIcon />,\n shortcutKey: {\n keys: [GESTURE_KEYS_DEFAULT.box],\n isMetaKey: false,\n isShiftKey: false,\n },\n title: 'Box',\n },\n lasso: {\n icon: <LassoIcon />,\n shortcutKey: {\n keys: [GESTURE_KEYS_DEFAULT.lasso],\n isMetaKey: false,\n isShiftKey: false,\n },\n title: 'Lasso',\n },\n};\n\nexport const GestureSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n menuPlacement,\n gestureOptions = DEFAULT_GESTURE_OPTIONS,\n}: GraphVisualizationButtonProps & {\n menuPlacement?: React.ComponentProps<typeof Menu>['placement'];\n gestureOptions?: Partial<GestureSelectOption>;\n}) => {\n const anchorRef = useRef<HTMLButtonElement | null>(null);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const { gesture, setGesture, portalTarget } = useGraphVisualizationContext();\n useRegisterKeyboardGestureSwitcher(\n Object.entries(gestureOptions).map(([gesture, item]) => ({\n gesture: gesture as Gesture,\n shortcutKey: item.shortcutKey,\n })),\n );\n\n const gestureIcon =\n gestureOptions[gesture]?.icon ?? GESTURE_KEYS_DEFAULT_ICONS[gesture];\n return (\n <>\n <SelectIconButton\n description=\"Select gesture\"\n isOpen={isMenuOpen}\n onClick={() => setIsMenuOpen((old) => !old)}\n ref={anchorRef}\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n size=\"small\"\n tooltipProps={{\n root: { isPortaled: false, placement: tooltipPlacement ?? 'bottom' },\n }}\n >\n {gestureOptions[gesture] ? gestureIcon : <SelectIcon />}\n </SelectIconButton>\n <Menu\n isOpen={isMenuOpen}\n anchorRef={anchorRef}\n onClose={() => setIsMenuOpen(false)}\n placement={menuPlacement}\n portalTarget={portalTarget}\n >\n {Object.entries(gestureOptions).map(([key, item]) => (\n <Menu.RadioItem\n key={key}\n title={item.title ?? GESTURE_KEYS_DEFAULT_TITLES[key as Gesture]}\n leadingVisual={item.icon}\n trailingContent={\n <Kbd\n keys={item.shortcutKey?.keys}\n modifierKeys={getShortcutModifierKeys(item.shortcutKey)}\n />\n }\n isChecked={key === gesture}\n onClick={() => setGesture?.(key as Gesture)}\n />\n ))}\n </Menu>\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"graph-visualization-buttons.js","sourceRoot":"","sources":["../../src/graph-visualization-buttons.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAQ0B;AAC1B,kDAagC;AAEhC,4DAA2C;AAE3C,iCAMe;AAEf,+EAGuC;AACvC,2EAAqE;AACrE,mCAAkD;AA2C3C,MAAM,WAAW,GAAG,CAAC,KAAoC,EAAE,EAAE;IAClE,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,UAAU,EACV,WAAW,EACX,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,cAAc,EACd,QAAQ,EACR,mBAAmB,GACpB,GAAG,KAAK,CAAC;IACV,OAAO,CACL,uBAAC,uBAAe,IACd,WAAW,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,SAAS,EACrC,YAAY,EAAE;YACZ,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE;YAC5C,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE;SACzD,EACD,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,EAAE,OAAO,EAChB,cAAc,kBACZ,WAAW,IACR,cAAc,aAGlB,QAAQ,GACO,CACnB,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,WAAW,eAqCtB;AAEF,MAAM,iBAAiB,GAAG,CAAC,MAA0B,EAAW,EAAE;IAChE,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,MAAM,CAAC,i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c,EAAE,cAAc,EAC9B,IAAI,EAAC,OAAO,EACZ,YAAY,EAAE;oBACZ,IAAI,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,QAAQ,EAAE;iBACrE,YAEA,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,uBAAC,kBAAU,KAAG,GACtC,EACnB,uBAAC,YAAI,IACH,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EACnC,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,YAAY,YAEzB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;;oBAAC,OAAA,CACnD,uBAAC,YAAI,CAAC,SAAS,IAEb,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,2BAA2B,CAAC,GAAc,CAAC,EAChE,aAAa,EAAE,IAAI,CAAC,IAAI,EACxB,eAAe,EACb,uBAAC,WAAG,IACF,IAAI,EAAE,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,EAC5B,YAAY,EAAE,uBAAuB,CAAC,IAAI,CAAC,WAAW,CAAC,GACvD,EAEJ,SAAS,EAAE,GAAG,KAAK,OAAO,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,GAAc,CAAC,IAVtC,GAAG,CAWR,CACH,CAAA;iBAAA,CAAC,GACG,IACN,CACJ,CAAC;AACJ,CAAC,CAAC;AAjEW,QAAA,mBAAmB,uBAiE9B","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 {\n CleanIconButton,\n IconButton,\n Kbd,\n Menu,\n SelectIconButton,\n TextInput,\n type Tooltip,\n} from '@neo4j-ndl/react';\nimport {\n ArrowDownTrayIconOutline,\n DocumentTextIconOutline,\n ExploreIcon,\n FitToScreenIcon,\n HierarchyTwoIcon,\n LassoIcon,\n MagnifyingGlassIconOutline,\n MagnifyingGlassMinusIconOutline,\n MagnifyingGlassPlusIconOutline,\n SelectIcon,\n SquareDashIcon,\n XMarkIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { type Layout } from '@neo4j-nvl/base';\nimport { default as cx } from 'classnames';\nimport type React from 'react';\nimport {\n type PropsWithChildren,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type Gesture,\n useGraphVisualizationContext,\n} from './graph-visualization-context';\nimport { useSemicontrolledState } from './use-semi-controlled-state';\nimport { searchNodes, searchRels } from './utils';\n\ntype GraphVisualizationButtonProps = {\n tooltipPlacement?: React.ComponentProps<typeof Tooltip>['placement'];\n className?: string;\n /**\n * Additional css styling. Will be applied to the root element.\n */\n style?: React.CSSProperties;\n\n /**\n * Html attributes to apply to the root element. This will override any default html attributes, use with caution.\n */\n htmlAttributes?: React.ComponentPropsWithRef<\n typeof CleanIconButton\n >['htmlAttributes'];\n\n /**\n * A ref to apply to the root element.\n */\n ref?: React.ComponentPropsWithRef<'button'>['ref'];\n shortcutKey?: {\n keys: string[];\n isMetaKey: boolean;\n isShiftKey: boolean;\n };\n};\n\ntype BaseProperties = GraphVisualizationButtonProps & {\n description: string;\n testid?: string;\n ariaLabel?: string;\n isActive?: boolean;\n isDisabled?: boolean;\n onClick?: () => void;\n onMouseDown?: () => void;\n descriptionKbdProps?: React.ComponentPropsWithRef<\n typeof CleanIconButton\n >['descriptionKbdProps'];\n};\n\nexport type GraphVisualizationGroupButton = PropsWithChildren<BaseProperties>;\n\nexport const GroupButton = (props: GraphVisualizationGroupButton) => {\n const {\n isActive,\n ariaLabel,\n isDisabled,\n description,\n onClick,\n onMouseDown,\n tooltipPlacement,\n className,\n style,\n htmlAttributes,\n children,\n descriptionKbdProps,\n } = props;\n return (\n <CleanIconButton\n description={description ?? ariaLabel}\n tooltipProps={{\n content: { style: { whiteSpace: 'nowrap' } },\n root: { isPortaled: false, placement: tooltipPlacement },\n }}\n size=\"small\"\n className={className}\n style={style}\n isActive={isActive}\n isDisabled={isDisabled}\n descriptionKbdProps={descriptionKbdProps}\n onClick={onClick}\n htmlAttributes={{\n onMouseDown,\n ...htmlAttributes,\n }}\n >\n {children}\n </CleanIconButton>\n );\n};\n\nconst targetIsTextInput = (target: EventTarget | null): boolean => {\n if (!(target instanceof HTMLElement)) {\n return false;\n }\n return (\n target.isContentEditable || ['INPUT', 'TEXTAREA'].includes(target.tagName)\n );\n};\n\nconst isEditingText = (event: KeyboardEvent): boolean => {\n return targetIsTextInput(event.target);\n};\n\nconst GESTURE_KEYS_DEFAULT: Record<Gesture, string> = {\n box: 'B',\n lasso: 'L',\n single: 'S',\n};\n\nconst GESTURE_KEYS_DEFAULT_ICONS: Record<Gesture, React.ReactNode> = {\n box: <SquareDashIcon />,\n lasso: <LassoIcon />,\n single: <SelectIcon />,\n};\n\nconst GESTURE_KEYS_DEFAULT_TITLES: Record<Gesture, string> = {\n box: 'Box',\n lasso: 'Lasso',\n single: 'Single',\n};\n\ntype ShortcutKey = NonNullable<GraphVisualizationButtonProps['shortcutKey']>;\n\nconst getShortcutModifierKeys = (\n shortcutKey: Pick<ShortcutKey, 'isMetaKey' | 'isShiftKey'> | undefined,\n): NonNullable<React.ComponentProps<typeof Kbd>['modifierKeys']> => [\n ...(shortcutKey?.isMetaKey ? (['meta'] as const) : []),\n ...(shortcutKey?.isShiftKey ? (['shift'] as const) : []),\n];\n\nconst isShortcutMatch = (\n evt: KeyboardEvent,\n shortcutKey: GraphVisualizationButtonProps['shortcutKey'],\n): boolean => {\n if (shortcutKey === undefined || shortcutKey.keys.length !== 1) {\n return false;\n }\n\n return (\n evt.key.toUpperCase() === shortcutKey.keys[0].toUpperCase() &&\n evt.metaKey === shortcutKey.isMetaKey &&\n evt.shiftKey === shortcutKey.isShiftKey &&\n !evt.altKey &&\n !evt.ctrlKey\n );\n};\n\nconst useRegisterKeyboardGestureSwitcher = (\n gestureShortcuts: ReadonlyArray<{\n gesture: Gesture;\n shortcutKey: GraphVisualizationButtonProps['shortcutKey'];\n }>,\n) => {\n const { setGesture } = useGraphVisualizationContext();\n const handleKeyDown = useCallback(\n (evt: KeyboardEvent) => {\n if (!isEditingText(evt) && setGesture !== undefined) {\n for (const { gesture, shortcutKey } of gestureShortcuts) {\n if (isShortcutMatch(evt, shortcutKey)) {\n setGesture(gesture);\n }\n }\n }\n },\n [gestureShortcuts, setGesture],\n );\n\n useEffect(() => {\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [handleKeyDown]);\n};\n\nexport const SingleSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n shortcutKey = {\n keys: [GESTURE_KEYS_DEFAULT.single],\n isMetaKey: false,\n isShiftKey: false,\n },\n}: GraphVisualizationButtonProps) => {\n const { gesture, setGesture, interactionMode } =\n useGraphVisualizationContext();\n useRegisterKeyboardGestureSwitcher([{ gesture: 'single', shortcutKey }]);\n\n return (\n <GroupButton\n isActive={gesture === 'single'}\n isDisabled={interactionMode !== 'select'}\n ariaLabel=\"Individual Select Button\"\n description=\"Individual Select\"\n descriptionKbdProps={{\n keys: shortcutKey.keys,\n modifierKeys: getShortcutModifierKeys(shortcutKey),\n }}\n onClick={() => {\n setGesture?.('single');\n }}\n tooltipPlacement={tooltipPlacement ?? 'right'}\n htmlAttributes={{\n 'data-testid': 'gesture-individual-select',\n ...htmlAttributes,\n }}\n className={className}\n style={style}\n >\n <SelectIcon aria-label=\"Individual Select\" />\n </GroupButton>\n );\n};\n\nexport const BoxSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n shortcutKey = {\n keys: [GESTURE_KEYS_DEFAULT.box],\n isMetaKey: false,\n isShiftKey: false,\n },\n}: GraphVisualizationButtonProps) => {\n const { gesture, setGesture, interactionMode } =\n useGraphVisualizationContext();\n useRegisterKeyboardGestureSwitcher([{ gesture: 'box', shortcutKey }]);\n\n return (\n <GroupButton\n isDisabled={interactionMode !== 'select' || setGesture === undefined}\n isActive={gesture === 'box'}\n ariaLabel=\"Box Select Button\"\n description=\"Box Select\"\n descriptionKbdProps={{\n keys: shortcutKey.keys,\n modifierKeys: getShortcutModifierKeys(shortcutKey),\n }}\n onClick={() => {\n setGesture?.('box');\n }}\n tooltipPlacement={tooltipPlacement ?? 'right'}\n htmlAttributes={{\n 'data-testid': 'gesture-box-select',\n ...htmlAttributes,\n }}\n className={className}\n style={style}\n >\n <SquareDashIcon aria-label=\"Box select\" />\n </GroupButton>\n );\n};\n\nexport const LassoSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n shortcutKey = {\n keys: [GESTURE_KEYS_DEFAULT.lasso],\n isMetaKey: false,\n isShiftKey: false,\n },\n}: GraphVisualizationButtonProps) => {\n const { gesture, setGesture, interactionMode } =\n useGraphVisualizationContext();\n useRegisterKeyboardGestureSwitcher([{ gesture: 'lasso', shortcutKey }]);\n\n return (\n <GroupButton\n isDisabled={interactionMode !== 'select' || setGesture === undefined}\n isActive={gesture === 'lasso'}\n ariaLabel=\"Lasso Select Button\"\n description=\"Lasso Select\"\n descriptionKbdProps={{\n keys: shortcutKey.keys,\n modifierKeys: getShortcutModifierKeys(shortcutKey),\n }}\n onClick={() => {\n setGesture?.('lasso');\n }}\n tooltipPlacement={tooltipPlacement ?? 'right'}\n htmlAttributes={{\n 'data-testid': 'gesture-lasso-select',\n ...htmlAttributes,\n }}\n className={className}\n style={style}\n >\n <LassoIcon aria-label=\"Lasso select\" />\n </GroupButton>\n );\n};\n\nexport const ZoomInButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { nvlInstance } = useGraphVisualizationContext();\n\n const handleZoomIn = useCallback(() => {\n nvlInstance.current?.setZoom(nvlInstance.current?.getScale() * 1.3);\n }, [nvlInstance]);\n\n return (\n <GroupButton\n onClick={handleZoomIn}\n description=\"Zoom in\"\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n tooltipPlacement={tooltipPlacement ?? 'left'}\n >\n <MagnifyingGlassPlusIconOutline />\n </GroupButton>\n );\n};\n\nexport const ZoomOutButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { nvlInstance } = useGraphVisualizationContext();\n\n const handleZoomOut = useCallback(() => {\n nvlInstance.current?.setZoom(nvlInstance.current?.getScale() * 0.7);\n }, [nvlInstance]);\n\n return (\n <GroupButton\n onClick={handleZoomOut}\n description=\"Zoom out\"\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n tooltipPlacement={tooltipPlacement ?? 'left'}\n >\n <MagnifyingGlassMinusIconOutline />\n </GroupButton>\n );\n};\n\nexport const ZoomToFitButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { nvlInstance } = useGraphVisualizationContext();\n\n const getNodesToFit = useCallback(() => {\n const instance = nvlInstance.current;\n if (!instance) {\n return [];\n }\n\n const selectedNodes = instance.getSelectedNodes();\n const selectedRels = instance.getSelectedRelationships();\n const nodeIds = new Set<string>();\n\n if (selectedNodes.length || selectedRels.length) {\n selectedNodes.forEach((node) => nodeIds.add(node.id));\n selectedRels.forEach((relationship) =>\n nodeIds.add(relationship.from).add(relationship.to),\n );\n return [...nodeIds];\n }\n\n const allNodes = instance.getNodes();\n const allRels = instance.getRelationships();\n\n allNodes.forEach((node) => node.disabled !== true && nodeIds.add(node.id));\n allRels.forEach(\n (relationship) =>\n relationship.disabled !== true &&\n nodeIds.add(relationship.from).add(relationship.to),\n );\n\n if (nodeIds.size > 0) {\n return [...nodeIds];\n }\n\n return allNodes.map((node) => node.id);\n }, [nvlInstance]);\n\n const handleZoomToFit = useCallback(() => {\n nvlInstance.current?.fit(getNodesToFit());\n }, [getNodesToFit, nvlInstance]);\n\n return (\n <GroupButton\n onClick={handleZoomToFit}\n description=\"Zoom to fit\"\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n tooltipPlacement={tooltipPlacement ?? 'left'}\n >\n <FitToScreenIcon />\n </GroupButton>\n );\n};\n\nexport const ToggleSidePanelButton = ({\n className,\n htmlAttributes,\n style,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { sidepanel } = useGraphVisualizationContext();\n if (!sidepanel) {\n throw new Error(\n 'Using the ToggleSidePanelButton requires having a sidepanel',\n );\n }\n const { isSidePanelOpen, setIsSidePanelOpen } = sidepanel;\n return (\n <IconButton\n size=\"small\"\n onClick={() => setIsSidePanelOpen?.(!isSidePanelOpen)}\n isFloating\n description=\"Details\"\n isActive={isSidePanelOpen}\n tooltipProps={{\n content: { style: { whiteSpace: 'nowrap' } },\n root: {\n isPortaled: false,\n placement: tooltipPlacement ?? 'bottom',\n shouldCloseOnReferenceClick: true,\n },\n }}\n className={cx('ndl-graph-visualization-toggle-sidepanel', className)}\n style={style}\n htmlAttributes={{\n 'aria-label': 'Toggle graph details panel',\n ...htmlAttributes,\n }}\n >\n <DocumentTextIconOutline className=\"ndl-graph-visualization-toggle-icon\" />\n </IconButton>\n );\n};\n\ntype SearchButtonProps = GraphVisualizationButtonProps & {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n open?: boolean;\n setOpen?: React.Dispatch<React.SetStateAction<boolean>>;\n searchTerm?: string;\n setSearchTerm?: React.Dispatch<React.SetStateAction<string>>;\n onSearch?: (\n nodeIds: string[] | undefined,\n relationshipIds: string[] | undefined,\n ) => void;\n};\n\nexport const SearchButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n open: rawOpen,\n setOpen: rawSetOpen,\n searchTerm: rawSearchTerm,\n setSearchTerm: rawSetSearchTerm,\n onSearch = () => {\n // no-op\n },\n}: SearchButtonProps) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOpen, setIsOpen] = useSemicontrolledState({\n isControlled: rawOpen !== undefined,\n onChange: rawSetOpen,\n state: rawOpen ?? false,\n });\n const [searchTerm, setSearchTerm] = useSemicontrolledState({\n isControlled: rawSearchTerm !== undefined,\n onChange: rawSetSearchTerm,\n state: rawSearchTerm ?? '',\n });\n const { nvlGraph } = useGraphVisualizationContext();\n\n const handleSearchChange = (newValue: string) => {\n setSearchTerm(newValue);\n if (newValue === '') {\n onSearch(undefined, undefined);\n return;\n }\n\n onSearch(searchNodes(nvlGraph, newValue), searchRels(nvlGraph, newValue));\n };\n\n return (\n <>\n {isOpen ? (\n <TextInput\n ref={inputRef}\n size=\"small\"\n leadingElement={<MagnifyingGlassIconOutline />}\n trailingElement={\n <CleanIconButton\n onClick={() => {\n handleSearchChange('');\n inputRef.current?.focus();\n }}\n description=\"Clear search\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n }\n placeholder=\"Search...\"\n value={searchTerm}\n onChange={(event) => handleSearchChange(event.target.value)}\n htmlAttributes={{\n autoFocus: true,\n onBlur: () => {\n if (searchTerm === '') {\n setIsOpen(false);\n }\n },\n }}\n />\n ) : (\n <IconButton\n size=\"small\"\n isFloating\n onClick={() => setIsOpen((open) => !open)}\n description=\"Search\"\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n tooltipProps={{\n root: {\n isPortaled: false,\n placement: tooltipPlacement ?? 'bottom',\n },\n }}\n >\n <MagnifyingGlassIconOutline />\n </IconButton>\n )}\n </>\n );\n};\n\nexport const DownloadButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n}: GraphVisualizationButtonProps) => {\n const { nvlInstance, portalTarget } = useGraphVisualizationContext();\n\n const [isDownloadMenuOpen, setOpen] = useState(false);\n const closeFileMenu = () => setOpen(false);\n const downloadButtonRef = useRef<HTMLButtonElement>(null);\n return (\n <>\n <IconButton\n ref={downloadButtonRef}\n size=\"small\"\n isFloating\n onClick={() => setOpen((open) => !open)}\n description=\"Download\"\n tooltipProps={{\n root: { isPortaled: false, placement: tooltipPlacement ?? 'bottom' },\n }}\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n >\n <ArrowDownTrayIconOutline />\n </IconButton>\n\n <Menu\n isOpen={isDownloadMenuOpen}\n onClose={closeFileMenu}\n anchorRef={downloadButtonRef}\n portalTarget={portalTarget}\n >\n <Menu.Item\n title=\"Download as PNG\"\n onClick={() => {\n nvlInstance.current?.saveToFile({});\n closeFileMenu();\n }}\n />\n <Menu.Item\n title=\"Download as SVG\"\n onClick={() => {\n nvlInstance.current?.saveToSvg({});\n closeFileMenu();\n }}\n />\n </Menu>\n </>\n );\n};\n\nexport type LayoutSelectOption = Record<\n Layout,\n {\n icon: React.ReactNode;\n title: string;\n }\n>;\n\nconst DEFAULT_LAYOUT_OPTIONS: Partial<LayoutSelectOption> = {\n d3Force: {\n icon: <ExploreIcon />,\n title: 'Force-based layout',\n },\n hierarchical: {\n icon: <HierarchyTwoIcon />,\n title: 'Hierarchical layout',\n },\n};\n\nexport const LayoutSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n menuPlacement,\n layoutOptions = DEFAULT_LAYOUT_OPTIONS,\n}: GraphVisualizationButtonProps & {\n menuPlacement?: React.ComponentProps<typeof Menu>['placement'];\n layoutOptions?: Partial<LayoutSelectOption>;\n}) => {\n const anchorRef = useRef<HTMLButtonElement | null>(null);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const { layout, setLayout, portalTarget } = useGraphVisualizationContext();\n\n return (\n <>\n <SelectIconButton\n description=\"Select layout\"\n isOpen={isMenuOpen}\n onClick={() => setIsMenuOpen((old) => !old)}\n ref={anchorRef}\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n size=\"small\"\n tooltipProps={{\n root: { isPortaled: false, placement: tooltipPlacement ?? 'bottom' },\n }}\n >\n {layoutOptions[layout]?.icon ?? <SelectIcon />}\n </SelectIconButton>\n <Menu\n isOpen={isMenuOpen}\n anchorRef={anchorRef}\n onClose={() => setIsMenuOpen(false)}\n placement={menuPlacement}\n portalTarget={portalTarget}\n >\n {Object.entries(layoutOptions).map(([key, item]) => (\n <Menu.RadioItem\n key={key}\n title={item.title}\n leadingVisual={item.icon}\n isChecked={key === layout}\n onClick={() => setLayout?.(key as Layout)}\n />\n ))}\n </Menu>\n </>\n );\n};\n\nexport type GestureSelectOption = Record<\n Gesture,\n {\n icon?: React.ReactNode;\n title?: string;\n shortcutKey?: GraphVisualizationButtonProps['shortcutKey'];\n }\n>;\n\n// oxlint-disable-next-line sort-keys\nconst DEFAULT_GESTURE_OPTIONS: Partial<GestureSelectOption> = {\n single: {\n icon: <SelectIcon />,\n shortcutKey: {\n keys: [GESTURE_KEYS_DEFAULT.single],\n isMetaKey: false,\n isShiftKey: false,\n },\n title: 'Individual',\n },\n box: {\n icon: <SquareDashIcon />,\n shortcutKey: {\n keys: [GESTURE_KEYS_DEFAULT.box],\n isMetaKey: false,\n isShiftKey: false,\n },\n title: 'Box',\n },\n lasso: {\n icon: <LassoIcon />,\n shortcutKey: {\n keys: [GESTURE_KEYS_DEFAULT.lasso],\n isMetaKey: false,\n isShiftKey: false,\n },\n title: 'Lasso',\n },\n};\n\nexport const GestureSelectButton = ({\n className,\n style,\n htmlAttributes,\n tooltipPlacement,\n menuPlacement,\n gestureOptions = DEFAULT_GESTURE_OPTIONS,\n}: GraphVisualizationButtonProps & {\n menuPlacement?: React.ComponentProps<typeof Menu>['placement'];\n gestureOptions?: Partial<GestureSelectOption>;\n}) => {\n const anchorRef = useRef<HTMLButtonElement | null>(null);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const { gesture, setGesture, portalTarget } = useGraphVisualizationContext();\n useRegisterKeyboardGestureSwitcher(\n Object.entries(gestureOptions).map(([gesture, item]) => ({\n gesture: gesture as Gesture,\n shortcutKey: item.shortcutKey,\n })),\n );\n\n const gestureIcon =\n gestureOptions[gesture]?.icon ?? GESTURE_KEYS_DEFAULT_ICONS[gesture];\n return (\n <>\n <SelectIconButton\n description=\"Select gesture\"\n isOpen={isMenuOpen}\n onClick={() => setIsMenuOpen((old) => !old)}\n ref={anchorRef}\n className={className}\n style={style}\n htmlAttributes={htmlAttributes}\n size=\"small\"\n tooltipProps={{\n root: { isPortaled: false, placement: tooltipPlacement ?? 'bottom' },\n }}\n >\n {gestureOptions[gesture] ? gestureIcon : <SelectIcon />}\n </SelectIconButton>\n <Menu\n isOpen={isMenuOpen}\n anchorRef={anchorRef}\n onClose={() => setIsMenuOpen(false)}\n placement={menuPlacement}\n portalTarget={portalTarget}\n >\n {Object.entries(gestureOptions).map(([key, item]) => (\n <Menu.RadioItem\n key={key}\n title={item.title ?? GESTURE_KEYS_DEFAULT_TITLES[key as Gesture]}\n leadingVisual={item.icon}\n trailingContent={\n <Kbd\n keys={item.shortcutKey?.keys}\n modifierKeys={getShortcutModifierKeys(item.shortcutKey)}\n />\n }\n isChecked={key === gesture}\n onClick={() => setGesture?.(key as Gesture)}\n />\n ))}\n </Menu>\n </>\n );\n};\n"]}
|
|
@@ -92,7 +92,7 @@ const ButtonGroup = ({ children }) => {
|
|
|
92
92
|
};
|
|
93
93
|
return (
|
|
94
94
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
95
|
-
(0, jsx_runtime_1.jsx)("ul", { onKeyDown: (
|
|
95
|
+
(0, jsx_runtime_1.jsx)("ul", { onKeyDown: (event) => handleKeyDown(event), ref: parentRef, style: { all: 'inherit', listStyleType: 'none' }, children: react_1.default.Children.map(children, (child, index) => {
|
|
96
96
|
if (!react_1.default.isValidElement(child)) {
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","sourceRoot":"","sources":["../../../src/sidepanel-components/button-group.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+CAMe;AAER,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE;IACzE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IAEjD,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE;;QACrC,MAAM,KAAK,GAAG,MAAA,MAAA,SAAS,CAAC,OAAO,0CAAE,QAAQ,CAAC,KAAK,CAAC,0CAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QAE9D,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YACjC,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,IAAA,eAAO,EAC3B,GAAG,EAAE,CAAC,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EACpC,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,MAAM,oBAAoB,GAAG,IAAA,mBAAW,EACtC,CAAC,KAAa,EAAE,EAAE;QAChB,IAAI,KAAK,IAAI,aAAa,EAAE,CAAC;YAC3B,gBAAgB,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,EACD,CAAC,aA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AAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBACpD,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACjC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,0BAA0B;QAC1B,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,OAAO;IACL,2EAA2E;IAC3E,+BACE,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAC1C,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,YAE/C,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAC7C,IAAI,CAAC,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjC,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,aAAa,GAAG,IAAA,oBAAY,EAAC,KAAK,EAAE;gBACxC,QAAQ,EAAE,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACN,CAAC,CAAC;YAExC,OAAO,yCAAiB,aAAa,IAArB,KAAK,CAAsB,CAAC;QAC9C,CAAC,CAAC,GACC,CACN,CAAC;AACJ,CAAC,CAAC;AA9DW,QAAA,WAAW,eA8DtB","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 React, {\n cloneElement,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nexport const ButtonGroup = ({ children }: { children: React.ReactNode }) => {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const parentRef = useRef<HTMLUListElement>(null);\n\n const focusElement = (index: number) => {\n const child = parentRef.current?.children[index]?.children[0];\n\n if (child instanceof HTMLElement) {\n child.focus();\n }\n };\n\n const childrenCount = useMemo(\n () => React.Children.count(children),\n [children],\n );\n const safeSetSelectedIndex = useCallback(\n (index: number) => {\n if (index >= childrenCount) {\n setSelectedIndex(childrenCount - 1);\n } else {\n setSelectedIndex(Math.max(0, index));\n }\n },\n [childrenCount, setSelectedIndex],\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLUListElement>) => {\n let newIndx = selectedIndex;\n if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {\n newIndx = (selectedIndex + 1) % React.Children.count(children);\n safeSetSelectedIndex(newIndx);\n } else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {\n newIndx =\n (selectedIndex - 1 + React.Children.count(children)) %\n React.Children.count(children);\n safeSetSelectedIndex(newIndx);\n }\n // set focus to new button\n focusElement(newIndx);\n };\n\n return (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <ul\n onKeyDown={(event) => handleKeyDown(event)}\n ref={parentRef}\n style={{ all: 'inherit', listStyleType: 'none' }}\n >\n {React.Children.map(children, (child, index) => {\n if (!React.isValidElement(child)) {\n return null;\n }\n\n const clonedElement = cloneElement(child, {\n tabIndex: selectedIndex === index ? 0 : -1,\n } as React.HTMLAttributes<HTMLElement>);\n\n return <li key={index}>{clonedElement}</li>;\n })}\n </ul>\n );\n};\n"]}
|
|
@@ -34,9 +34,9 @@ const ClickableUrlsComponent = ({ text }) => {
|
|
|
34
34
|
var _a;
|
|
35
35
|
const definedText = text !== null && text !== void 0 ? text : '';
|
|
36
36
|
const urls = (_a = definedText.match(URL_REGEX)) !== null && _a !== void 0 ? _a : [];
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: definedText.split(URL_REGEX).map((
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: definedText.split(URL_REGEX).map((textPart, index) => {
|
|
38
38
|
/* since we never move these components this key should be fine */
|
|
39
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [textPart, urls[index] && (
|
|
40
40
|
// Should be safe from XSS.
|
|
41
41
|
// Ref: https://mathiasbynens.github.io/rel-noopener/
|
|
42
42
|
(0, jsx_runtime_1.jsx)("a", { href: urls[index], target: "_blank", rel: "noopener noreferrer", className: "hover:underline", children: urls[index] }))] }, `clickable-url-${index}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clickable-urls.js","sourceRoot":"","sources":["../../../src/sidepanel-components/clickable-urls.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAA0B;AAE1B,gEAAgE;AAChE,MAAM,SAAS;AACb,2BAA2B;AAC3B,oKAAoK,CAAC;AAMvK,MAAM,sBAAsB,GAAG,CAAC,EAAE,IAAI,EAAsB,EAAE,EAAE;;IAC9D,MAAM,WAAW,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,MAAA,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,mCAAI,EAAE,CAAC;IAEhD,OAAO,CACL,2DACG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"clickable-urls.js","sourceRoot":"","sources":["../../../src/sidepanel-components/clickable-urls.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAA0B;AAE1B,gEAAgE;AAChE,MAAM,SAAS;AACb,2BAA2B;AAC3B,oKAAoK,CAAC;AAMvK,MAAM,sBAAsB,GAAG,CAAC,EAAE,IAAI,EAAsB,EAAE,EAAE;;IAC9D,MAAM,WAAW,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,MAAA,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,mCAAI,EAAE,CAAC;IAEhD,OAAO,CACL,2DACG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;YACpD,kEAAkE;YAClE,OAAO,CACL,wBAAC,eAAK,CAAC,QAAQ,eACZ,QAAQ,EACR,IAAI,CAAC,KAAK,CAAC,IAAI;oBACd,2BAA2B;oBAC3B,qDAAqD;oBACrD,8BACE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EACjB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,iBAAiB,YAE1B,IAAI,CAAC,KAAK,CAAC,GACV,CACL,KAbkB,iBAAiB,KAAK,EAAE,CAc5B,CAClB,CAAC;QACJ,CAAC,CAAC,GACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,aAAa,GAAG,eAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,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 React from 'react';\n\n// credits to https://www.regextester.com/96504, modified though\nconst URL_REGEX =\n // eslint-disable-next-line\n /(?:https?|s?ftp|bolt):\\/\\/(?:(?:[^\\s()<>]+|\\((?:[^\\s()<>]+|(?:\\([^\\s()<>]+\\)))?\\))+(?:\\((?:[^\\s()<>]+|(?:\\(?:[^\\s()<>]+\\)))?\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))?/gi;\n\ninterface ClickableUrlsProps {\n text?: string | null;\n}\n\nconst ClickableUrlsComponent = ({ text }: ClickableUrlsProps) => {\n const definedText = text ?? '';\n const urls = definedText.match(URL_REGEX) ?? [];\n\n return (\n <>\n {definedText.split(URL_REGEX).map((textPart, index) => {\n /* since we never move these components this key should be fine */\n return (\n <React.Fragment key={`clickable-url-${index}`}>\n {textPart}\n {urls[index] && (\n // Should be safe from XSS.\n // Ref: https://mathiasbynens.github.io/rel-noopener/\n <a\n href={urls[index]}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"hover:underline\"\n >\n {urls[index]}\n </a>\n )}\n </React.Fragment>\n );\n })}\n </>\n );\n};\n\nexport const ClickableUrls = React.memo(ClickableUrlsComponent);\n"]}
|