@neo4j-ndl/react-graph 2.0.22 → 2.1.0
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/LICENSES.txt +59 -6
- package/lib/cjs/_generated/style-rules/index.js +10 -1
- package/lib/cjs/_generated/style-rules/index.js.map +1 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js +16 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/cjs/_generated/style-rules/numeric-utils.js +163 -0
- package/lib/cjs/_generated/style-rules/numeric-utils.js.map +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/stories/graph-visualization-range-styling.story.js +35 -35
- package/lib/cjs/stories/graph-visualization-range-styling.story.js.map +1 -1
- package/lib/cjs/styling/compile-graph-styles.js +68 -22
- package/lib/cjs/styling/compile-graph-styles.js.map +1 -1
- package/lib/cjs/styling/style-types.js +21 -12
- package/lib/cjs/styling/style-types.js.map +1 -1
- package/lib/esm/_generated/style-rules/index.js +2 -1
- package/lib/esm/_generated/style-rules/index.js.map +1 -1
- package/lib/esm/_generated/style-rules/literal-schemas.js +15 -0
- package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/esm/_generated/style-rules/numeric-utils.js +155 -0
- package/lib/esm/_generated/style-rules/numeric-utils.js.map +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/stories/graph-visualization-range-styling.story.js +35 -35
- package/lib/esm/stories/graph-visualization-range-styling.story.js.map +1 -1
- package/lib/esm/styling/compile-graph-styles.js +69 -23
- package/lib/esm/styling/compile-graph-styles.js.map +1 -1
- package/lib/esm/styling/style-types.js +21 -12
- package/lib/esm/styling/style-types.js.map +1 -1
- package/lib/types/_generated/style-rules/index.d.ts +4 -2
- package/lib/types/_generated/style-rules/index.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/literal-schemas.d.ts +13 -0
- package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/numeric-utils.d.ts +45 -0
- package/lib/types/_generated/style-rules/numeric-utils.d.ts.map +1 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/styling/compile-graph-styles.d.ts.map +1 -1
- package/lib/types/styling/style-types.d.ts +87 -26
- package/lib/types/styling/style-types.d.ts.map +1 -1
- package/package.json +6 -6
package/lib/LICENSES.txt
CHANGED
|
@@ -6628,6 +6628,59 @@ terms above.
|
|
|
6628
6628
|
|
|
6629
6629
|
---
|
|
6630
6630
|
|
|
6631
|
+
The following software may be included in this product: lodash (4.18.1)
|
|
6632
|
+
This software contains the following license and notice below:
|
|
6633
|
+
|
|
6634
|
+
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
6635
|
+
|
|
6636
|
+
Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
6637
|
+
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
6638
|
+
|
|
6639
|
+
This software consists of voluntary contributions made by many
|
|
6640
|
+
individuals. For exact contribution history, see the revision history
|
|
6641
|
+
available at https://github.com/lodash/lodash
|
|
6642
|
+
|
|
6643
|
+
The following license applies to all parts of this software except as
|
|
6644
|
+
documented below:
|
|
6645
|
+
|
|
6646
|
+
====
|
|
6647
|
+
|
|
6648
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6649
|
+
a copy of this software and associated documentation files (the
|
|
6650
|
+
"Software"), to deal in the Software without restriction, including
|
|
6651
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
6652
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
6653
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
6654
|
+
the following conditions:
|
|
6655
|
+
|
|
6656
|
+
The above copyright notice and this permission notice shall be
|
|
6657
|
+
included in all copies or substantial portions of the Software.
|
|
6658
|
+
|
|
6659
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
6660
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
6661
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
6662
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
6663
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
6664
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
6665
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
6666
|
+
|
|
6667
|
+
====
|
|
6668
|
+
|
|
6669
|
+
Copyright and related rights for sample code are waived via CC0. Sample
|
|
6670
|
+
code is defined as all source code displayed within the prose of the
|
|
6671
|
+
documentation.
|
|
6672
|
+
|
|
6673
|
+
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
|
6674
|
+
|
|
6675
|
+
====
|
|
6676
|
+
|
|
6677
|
+
Files located in the node_modules and vendor directories are externally
|
|
6678
|
+
maintained libraries used by this software which have their own
|
|
6679
|
+
licenses; we recommend you read them, as their terms may differ from the
|
|
6680
|
+
terms above.
|
|
6681
|
+
|
|
6682
|
+
---
|
|
6683
|
+
|
|
6631
6684
|
The following software may be included in this product: lodash-es (4.17.23)
|
|
6632
6685
|
This software contains the following license and notice below:
|
|
6633
6686
|
|
|
@@ -11096,7 +11149,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
|
11096
11149
|
|
|
11097
11150
|
---
|
|
11098
11151
|
|
|
11099
|
-
The following software may be included in this product: uuid (
|
|
11152
|
+
The following software may be included in this product: uuid (11.1.0)
|
|
11100
11153
|
This software contains the following license and notice below:
|
|
11101
11154
|
|
|
11102
11155
|
The MIT License (MIT)
|
|
@@ -11111,7 +11164,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11111
11164
|
|
|
11112
11165
|
---
|
|
11113
11166
|
|
|
11114
|
-
The following software may be included in this product: uuid (
|
|
11167
|
+
The following software may be included in this product: uuid (14.0.1)
|
|
11115
11168
|
This software contains the following license and notice below:
|
|
11116
11169
|
|
|
11117
11170
|
The MIT License (MIT)
|
|
@@ -35935,7 +35988,7 @@ licensed under the Apache License, Version 2.0.
|
|
|
35935
35988
|
|
|
35936
35989
|
---
|
|
35937
35990
|
|
|
35938
|
-
The following software may be included in this product: @neo4j-nvl/base (1.1
|
|
35991
|
+
The following software may be included in this product: @neo4j-nvl/base (1.2.1)
|
|
35939
35992
|
This software contains the following license and notice below:
|
|
35940
35993
|
|
|
35941
35994
|
Neo4j, Inc.
|
|
@@ -35945,7 +35998,7 @@ The Neo4j Visualization Library (“NVL” or “NVL Software”) may only be us
|
|
|
35945
35998
|
|
|
35946
35999
|
---
|
|
35947
36000
|
|
|
35948
|
-
The following software may be included in this product: @neo4j-nvl/interaction-handlers (1.1
|
|
36001
|
+
The following software may be included in this product: @neo4j-nvl/interaction-handlers (1.2.1)
|
|
35949
36002
|
This software contains the following license and notice below:
|
|
35950
36003
|
|
|
35951
36004
|
Neo4j, Inc.
|
|
@@ -35955,7 +36008,7 @@ The Neo4j Visualization Library (“NVL” or “NVL Software”) may only be us
|
|
|
35955
36008
|
|
|
35956
36009
|
---
|
|
35957
36010
|
|
|
35958
|
-
The following software may be included in this product: @neo4j-nvl/layout-workers (1.1
|
|
36011
|
+
The following software may be included in this product: @neo4j-nvl/layout-workers (1.2.1)
|
|
35959
36012
|
This software contains the following license and notice below:
|
|
35960
36013
|
|
|
35961
36014
|
Neo4j, Inc.
|
|
@@ -35965,7 +36018,7 @@ The Neo4j Visualization Library (“NVL” or “NVL Software”) may only be us
|
|
|
35965
36018
|
|
|
35966
36019
|
---
|
|
35967
36020
|
|
|
35968
|
-
The following software may be included in this product: @neo4j-nvl/react (1.1
|
|
36021
|
+
The following software may be included in this product: @neo4j-nvl/react (1.2.1)
|
|
35969
36022
|
This software contains the following license and notice below:
|
|
35970
36023
|
|
|
35971
36024
|
Neo4j, Inc.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.TimeLiteralSchema = exports.LocalDatetimeLiteralSchema = exports.DatetimeLiteralSchema = exports.parseTimeString = exports.parseLocalDateString = exports.parseDateString = exports.lerpColor = exports.getWeight = void 0;
|
|
8
|
+
exports.resolveNumericLiteral = exports.numericValuesEqual = exports.isBigintLiteral = exports.getNumericWeight = exports.compareNumericValues = exports.clampNumericValue = exports.TimeLiteralSchema = exports.NumericLiteralSchema = exports.LocalDatetimeLiteralSchema = exports.DatetimeLiteralSchema = exports.BigintLiteralSchema = exports.parseTimeString = exports.parseLocalDateString = exports.parseDateString = exports.lerpColor = exports.getWeight = void 0;
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) "Neo4j"
|
|
@@ -34,7 +34,16 @@ Object.defineProperty(exports, "parseDateString", { enumerable: true, get: funct
|
|
|
34
34
|
Object.defineProperty(exports, "parseLocalDateString", { enumerable: true, get: function () { return date_utils_1.parseLocalDateString; } });
|
|
35
35
|
Object.defineProperty(exports, "parseTimeString", { enumerable: true, get: function () { return date_utils_1.parseTimeString; } });
|
|
36
36
|
var literal_schemas_1 = require("./literal-schemas");
|
|
37
|
+
Object.defineProperty(exports, "BigintLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.BigintLiteralSchema; } });
|
|
37
38
|
Object.defineProperty(exports, "DatetimeLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.DatetimeLiteralSchema; } });
|
|
38
39
|
Object.defineProperty(exports, "LocalDatetimeLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.LocalDatetimeLiteralSchema; } });
|
|
40
|
+
Object.defineProperty(exports, "NumericLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.NumericLiteralSchema; } });
|
|
39
41
|
Object.defineProperty(exports, "TimeLiteralSchema", { enumerable: true, get: function () { return literal_schemas_1.TimeLiteralSchema; } });
|
|
42
|
+
var numeric_utils_1 = require("./numeric-utils");
|
|
43
|
+
Object.defineProperty(exports, "clampNumericValue", { enumerable: true, get: function () { return numeric_utils_1.clampNumericValue; } });
|
|
44
|
+
Object.defineProperty(exports, "compareNumericValues", { enumerable: true, get: function () { return numeric_utils_1.compareNumericValues; } });
|
|
45
|
+
Object.defineProperty(exports, "getNumericWeight", { enumerable: true, get: function () { return numeric_utils_1.getNumericWeight; } });
|
|
46
|
+
Object.defineProperty(exports, "isBigintLiteral", { enumerable: true, get: function () { return numeric_utils_1.isBigintLiteral; } });
|
|
47
|
+
Object.defineProperty(exports, "numericValuesEqual", { enumerable: true, get: function () { return numeric_utils_1.numericValuesEqual; } });
|
|
48
|
+
Object.defineProperty(exports, "resolveNumericLiteral", { enumerable: true, get: function () { return numeric_utils_1.resolveNumericLiteral; } });
|
|
40
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,6CAAqD;AAA5C,wGAAA,SAAS,OAAA;AAAE,wGAAA,SAAS,OAAA;AAC7B,2CAIsB;AAHpB,6GAAA,eAAe,OAAA;AACf,kHAAA,oBAAoB,OAAA;AACpB,6GAAA,eAAe,OAAA;AAEjB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,6CAAqD;AAA5C,wGAAA,SAAS,OAAA;AAAE,wGAAA,SAAS,OAAA;AAC7B,2CAIsB;AAHpB,6GAAA,eAAe,OAAA;AACf,kHAAA,oBAAoB,OAAA;AACpB,6GAAA,eAAe,OAAA;AAEjB,qDAM2B;AALzB,sHAAA,mBAAmB,OAAA;AACnB,wHAAA,qBAAqB,OAAA;AACrB,6HAAA,0BAA0B,OAAA;AAC1B,uHAAA,oBAAoB,OAAA;AACpB,oHAAA,iBAAiB,OAAA;AASnB,iDAOyB;AANvB,kHAAA,iBAAiB,OAAA;AACjB,qHAAA,oBAAoB,OAAA;AACpB,iHAAA,gBAAgB,OAAA;AAChB,gHAAA,eAAe,OAAA;AACf,mHAAA,kBAAkB,OAAA;AAClB,sHAAA,qBAAqB,OAAA","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nexport { getWeight, lerpColor } from './color-utils';\nexport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\nexport {\n BigintLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n NumericLiteralSchema,\n TimeLiteralSchema,\n} from './literal-schemas';\nexport type {\n BigintLiteral,\n DatetimeLiteral,\n LocalDatetimeLiteral,\n NumericLiteral,\n TimeLiteral,\n} from './literal-schemas';\nexport {\n clampNumericValue,\n compareNumericValues,\n getNumericWeight,\n isBigintLiteral,\n numericValuesEqual,\n resolveNumericLiteral,\n} from './numeric-utils';\nexport type { NumericValue } from './numeric-utils';\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.TimeLiteralSchema = exports.LocalDatetimeLiteralSchema = exports.DatetimeLiteralSchema = void 0;
|
|
8
|
+
exports.TimeLiteralSchema = exports.LocalDatetimeLiteralSchema = exports.DatetimeLiteralSchema = exports.NumericLiteralSchema = exports.BigintLiteralSchema = void 0;
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) "Neo4j"
|
|
@@ -28,6 +28,21 @@ exports.TimeLiteralSchema = exports.LocalDatetimeLiteralSchema = exports.Datetim
|
|
|
28
28
|
*/
|
|
29
29
|
const zod_1 = require("zod");
|
|
30
30
|
const date_utils_1 = require("./date-utils");
|
|
31
|
+
/**
|
|
32
|
+
* A JSON-safe bigint literal. Native bigint values cannot be serialized as
|
|
33
|
+
* JSON, so persisted style rules can use a signed decimal string instead.
|
|
34
|
+
*/
|
|
35
|
+
exports.BigintLiteralSchema = zod_1.z.object({
|
|
36
|
+
bigint: zod_1.z.string().regex(/^[+-]?\d+$/, {
|
|
37
|
+
message: 'bigint must be a signed decimal integer string',
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
/** A numeric style-rule literal, including native and JSON-safe bigints. */
|
|
41
|
+
exports.NumericLiteralSchema = zod_1.z.union([
|
|
42
|
+
zod_1.z.number(),
|
|
43
|
+
zod_1.z.bigint(),
|
|
44
|
+
exports.BigintLiteralSchema,
|
|
45
|
+
]);
|
|
31
46
|
/**
|
|
32
47
|
* An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond
|
|
33
48
|
* timestamp at evaluation time. Supported formats:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6BAAwB;AAExB,6CAIsB;AAEtB;;;;;;;;;GASG;AACU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC9D,OAAO,EACL,sEAAsE;KACzE,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,iCAAoB,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QACxE,OAAO,EACL,kGAAkG;KACrG,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC1D,OAAO,EACL,iFAAiF;KACpF,CAAC;CACH,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 * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((s) => parseDateString(s) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z.string().refine((s) => parseLocalDateString(s) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((s) => parseTimeString(s) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6BAAwB;AAExB,6CAIsB;AAEtB;;;GAGG;AACU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE;QACrC,OAAO,EAAE,gDAAgD;KAC1D,CAAC;CACH,CAAC,CAAC;AAGH,4EAA4E;AAC/D,QAAA,oBAAoB,GAAG,OAAC,CAAC,KAAK,CAAC;IAC1C,OAAC,CAAC,MAAM,EAAE;IACV,OAAC,CAAC,MAAM,EAAE;IACV,2BAAmB;CACpB,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC9D,OAAO,EACL,sEAAsE;KACzE,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,iCAAoB,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QACxE,OAAO,EACL,kGAAkG;KACrG,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAe,EAAC,CAAC,CAAC,KAAK,IAAI,EAAE;QAC1D,OAAO,EACL,iFAAiF;KACpF,CAAC;CACH,CAAC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\n\n/**\n * A JSON-safe bigint literal. Native bigint values cannot be serialized as\n * JSON, so persisted style rules can use a signed decimal string instead.\n */\nexport const BigintLiteralSchema = z.object({\n bigint: z.string().regex(/^[+-]?\\d+$/, {\n message: 'bigint must be a signed decimal integer string',\n }),\n});\nexport type BigintLiteral = z.infer<typeof BigintLiteralSchema>;\n\n/** A numeric style-rule literal, including native and JSON-safe bigints. */\nexport const NumericLiteralSchema = z.union([\n z.number(),\n z.bigint(),\n BigintLiteralSchema,\n]);\nexport type NumericLiteral = z.infer<typeof NumericLiteralSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((s) => parseDateString(s) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z.string().refine((s) => parseLocalDateString(s) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((s) => parseTimeString(s) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n"]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
"use strict";
|
|
23
|
+
/*
|
|
24
|
+
* AUTO-GENERATED FILE — DO NOT EDIT.
|
|
25
|
+
* Source of truth: packages/style-rules/src/
|
|
26
|
+
* Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.resolveNumericLiteral = resolveNumericLiteral;
|
|
30
|
+
exports.isBigintLiteral = isBigintLiteral;
|
|
31
|
+
exports.compareNumericValues = compareNumericValues;
|
|
32
|
+
exports.numericValuesEqual = numericValuesEqual;
|
|
33
|
+
exports.clampNumericValue = clampNumericValue;
|
|
34
|
+
exports.getNumericWeight = getNumericWeight;
|
|
35
|
+
const BIGINT_ZERO = BigInt(0);
|
|
36
|
+
const BIGINT_ONE = BigInt(1);
|
|
37
|
+
const BIGINT_TWO = BigInt(2);
|
|
38
|
+
const BIGINT_RATIO_SCALE = BigInt('1000000000000000000');
|
|
39
|
+
function bigintPowerOfTen(exponent) {
|
|
40
|
+
return BigInt(`1${'0'.repeat(exponent)}`);
|
|
41
|
+
}
|
|
42
|
+
/** Resolves a native or JSON-safe numeric literal without reducing bigints. */
|
|
43
|
+
function resolveNumericLiteral(value) {
|
|
44
|
+
return typeof value === 'object' ? BigInt(value.bigint) : value;
|
|
45
|
+
}
|
|
46
|
+
/** Returns whether a value is the JSON-safe bigint literal shape. */
|
|
47
|
+
function isBigintLiteral(value) {
|
|
48
|
+
return (typeof value === 'object' &&
|
|
49
|
+
value !== null &&
|
|
50
|
+
'bigint' in value &&
|
|
51
|
+
typeof value.bigint === 'string' &&
|
|
52
|
+
/^[+-]?\d+$/.test(value.bigint));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Compares numeric values without coercing bigint operands to number.
|
|
56
|
+
* Returns null for NaN, otherwise -1, 0, or 1.
|
|
57
|
+
*/
|
|
58
|
+
function compareNumericValues(left, right) {
|
|
59
|
+
if ((typeof left === 'number' && Number.isNaN(left)) ||
|
|
60
|
+
(typeof right === 'number' && Number.isNaN(right))) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
if (left < right) {
|
|
64
|
+
return -1;
|
|
65
|
+
}
|
|
66
|
+
if (left > right) {
|
|
67
|
+
return 1;
|
|
68
|
+
}
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
/** Numeric equality that treats equivalent number and bigint values as equal. */
|
|
72
|
+
function numericValuesEqual(left, right) {
|
|
73
|
+
return compareNumericValues(left, right) === 0;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Clamps a numeric value between two endpoints. Inverted endpoints are
|
|
77
|
+
* supported, and the original number/bigint representation is retained.
|
|
78
|
+
*/
|
|
79
|
+
function clampNumericValue(value, firstBound, secondBound) {
|
|
80
|
+
const boundsOrder = compareNumericValues(firstBound, secondBound);
|
|
81
|
+
if (boundsOrder === null) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const min = boundsOrder <= 0 ? firstBound : secondBound;
|
|
85
|
+
const max = boundsOrder <= 0 ? secondBound : firstBound;
|
|
86
|
+
const minOrder = compareNumericValues(value, min);
|
|
87
|
+
const maxOrder = compareNumericValues(value, max);
|
|
88
|
+
if (minOrder === null || maxOrder === null) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
if (minOrder < 0) {
|
|
92
|
+
return min;
|
|
93
|
+
}
|
|
94
|
+
if (maxOrder > 0) {
|
|
95
|
+
return max;
|
|
96
|
+
}
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
function numberToRational(value) {
|
|
100
|
+
if (!Number.isFinite(value)) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const match = /^([+-]?)(\d+)(?:\.(\d+))?(?:e([+-]?\d+))?$/i.exec(value.toString());
|
|
104
|
+
if (!match) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const [, sign, integer, fraction = '', exponentText = '0'] = match;
|
|
108
|
+
const exponent = Number(exponentText) - fraction.length;
|
|
109
|
+
const digits = BigInt(`${sign}${integer}${fraction}`);
|
|
110
|
+
if (exponent >= 0) {
|
|
111
|
+
return {
|
|
112
|
+
denominator: BIGINT_ONE,
|
|
113
|
+
numerator: digits * bigintPowerOfTen(exponent),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
denominator: bigintPowerOfTen(-exponent),
|
|
118
|
+
numerator: digits,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function toRational(value) {
|
|
122
|
+
return typeof value === 'bigint'
|
|
123
|
+
? { denominator: BIGINT_ONE, numerator: value }
|
|
124
|
+
: numberToRational(value);
|
|
125
|
+
}
|
|
126
|
+
function divideBigints(numerator, denominator) {
|
|
127
|
+
if (denominator === BIGINT_ZERO) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const isNegative = numerator < BIGINT_ZERO !== denominator < BIGINT_ZERO;
|
|
131
|
+
const absoluteNumerator = numerator < BIGINT_ZERO ? -numerator : numerator;
|
|
132
|
+
const absoluteDenominator = denominator < BIGINT_ZERO ? -denominator : denominator;
|
|
133
|
+
const integer = absoluteNumerator / absoluteDenominator;
|
|
134
|
+
const remainder = absoluteNumerator % absoluteDenominator;
|
|
135
|
+
const fraction = (remainder * BIGINT_RATIO_SCALE + absoluteDenominator / BIGINT_TWO) /
|
|
136
|
+
absoluteDenominator;
|
|
137
|
+
const result = Number(integer) + Number(fraction) / Number(BIGINT_RATIO_SCALE);
|
|
138
|
+
return isNegative ? -result : result;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Computes `(value - startValue) / (endValue - startValue)` while retaining
|
|
142
|
+
* bigint precision. Only the final dimensionless interpolation weight is
|
|
143
|
+
* converted to number.
|
|
144
|
+
*/
|
|
145
|
+
function getNumericWeight(startValue, endValue, value) {
|
|
146
|
+
if (typeof startValue === 'number' &&
|
|
147
|
+
typeof endValue === 'number' &&
|
|
148
|
+
typeof value === 'number') {
|
|
149
|
+
const weight = (value - startValue) / (endValue - startValue);
|
|
150
|
+
return Number.isNaN(weight) ? null : weight;
|
|
151
|
+
}
|
|
152
|
+
const start = toRational(startValue);
|
|
153
|
+
const end = toRational(endValue);
|
|
154
|
+
const current = toRational(value);
|
|
155
|
+
if (start === null || end === null || current === null) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
const valueDelta = current.numerator * start.denominator -
|
|
159
|
+
start.numerator * current.denominator;
|
|
160
|
+
const rangeDelta = end.numerator * start.denominator - start.numerator * end.denominator;
|
|
161
|
+
return divideBigints(valueDelta * end.denominator, current.denominator * rangeDelta);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=numeric-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/numeric-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA0CH,sDAEC;AAGD,0CAQC;AAMD,oDAiBC;AAGD,gDAKC;AAMD,8CAuBC;AA4DD,4CA+BC;AA9KD,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7B,MAAM,kBAAkB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEzD,SAAS,gBAAgB,CAAC,QAAgB;IACxC,OAAO,MAAM,CAAC,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E — 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 { BigintLiteral, NumericLiteral } from './literal-schemas';\n\nexport type NumericValue = number | bigint;\n\ntype Rational = {\n denominator: bigint;\n numerator: bigint;\n};\n\nconst BIGINT_ZERO = BigInt(0);\nconst BIGINT_ONE = BigInt(1);\nconst BIGINT_TWO = BigInt(2);\nconst BIGINT_RATIO_SCALE = BigInt('1000000000000000000');\n\nfunction bigintPowerOfTen(exponent: number): bigint {\n return BigInt(`1${'0'.repeat(exponent)}`);\n}\n\n/** Resolves a native or JSON-safe numeric literal without reducing bigints. */\nexport function resolveNumericLiteral(value: NumericLiteral): NumericValue {\n return typeof value === 'object' ? BigInt(value.bigint) : value;\n}\n\n/** Returns whether a value is the JSON-safe bigint literal shape. */\nexport function isBigintLiteral(value: unknown): value is BigintLiteral {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'bigint' in value &&\n typeof value.bigint === 'string' &&\n /^[+-]?\\d+$/.test(value.bigint)\n );\n}\n\n/**\n * Compares numeric values without coercing bigint operands to number.\n * Returns null for NaN, otherwise -1, 0, or 1.\n */\nexport function compareNumericValues(\n left: NumericValue,\n right: NumericValue,\n): -1 | 0 | 1 | null {\n if (\n (typeof left === 'number' && Number.isNaN(left)) ||\n (typeof right === 'number' && Number.isNaN(right))\n ) {\n return null;\n }\n if (left < right) {\n return -1;\n }\n if (left > right) {\n return 1;\n }\n return 0;\n}\n\n/** Numeric equality that treats equivalent number and bigint values as equal. */\nexport function numericValuesEqual(\n left: NumericValue,\n right: NumericValue,\n): boolean {\n return compareNumericValues(left, right) === 0;\n}\n\n/**\n * Clamps a numeric value between two endpoints. Inverted endpoints are\n * supported, and the original number/bigint representation is retained.\n */\nexport function clampNumericValue(\n value: NumericValue,\n firstBound: NumericValue,\n secondBound: NumericValue,\n): NumericValue | null {\n const boundsOrder = compareNumericValues(firstBound, secondBound);\n if (boundsOrder === null) {\n return null;\n }\n const min = boundsOrder <= 0 ? firstBound : secondBound;\n const max = boundsOrder <= 0 ? secondBound : firstBound;\n const minOrder = compareNumericValues(value, min);\n const maxOrder = compareNumericValues(value, max);\n if (minOrder === null || maxOrder === null) {\n return null;\n }\n if (minOrder < 0) {\n return min;\n }\n if (maxOrder > 0) {\n return max;\n }\n return value;\n}\n\nfunction numberToRational(value: number): Rational | null {\n if (!Number.isFinite(value)) {\n return null;\n }\n\n const match = /^([+-]?)(\\d+)(?:\\.(\\d+))?(?:e([+-]?\\d+))?$/i.exec(\n value.toString(),\n );\n if (!match) {\n return null;\n }\n\n const [, sign, integer, fraction = '', exponentText = '0'] = match;\n const exponent = Number(exponentText) - fraction.length;\n const digits = BigInt(`${sign}${integer}${fraction}`);\n if (exponent >= 0) {\n return {\n denominator: BIGINT_ONE,\n numerator: digits * bigintPowerOfTen(exponent),\n };\n }\n return {\n denominator: bigintPowerOfTen(-exponent),\n numerator: digits,\n };\n}\n\nfunction toRational(value: NumericValue): Rational | null {\n return typeof value === 'bigint'\n ? { denominator: BIGINT_ONE, numerator: value }\n : numberToRational(value);\n}\n\nfunction divideBigints(numerator: bigint, denominator: bigint): number | null {\n if (denominator === BIGINT_ZERO) {\n return null;\n }\n\n const isNegative = numerator < BIGINT_ZERO !== denominator < BIGINT_ZERO;\n const absoluteNumerator = numerator < BIGINT_ZERO ? -numerator : numerator;\n const absoluteDenominator =\n denominator < BIGINT_ZERO ? -denominator : denominator;\n const integer = absoluteNumerator / absoluteDenominator;\n const remainder = absoluteNumerator % absoluteDenominator;\n const fraction =\n (remainder * BIGINT_RATIO_SCALE + absoluteDenominator / BIGINT_TWO) /\n absoluteDenominator;\n const result =\n Number(integer) + Number(fraction) / Number(BIGINT_RATIO_SCALE);\n\n return isNegative ? -result : result;\n}\n\n/**\n * Computes `(value - startValue) / (endValue - startValue)` while retaining\n * bigint precision. Only the final dimensionless interpolation weight is\n * converted to number.\n */\nexport function getNumericWeight(\n startValue: NumericValue,\n endValue: NumericValue,\n value: NumericValue,\n): number | null {\n if (\n typeof startValue === 'number' &&\n typeof endValue === 'number' &&\n typeof value === 'number'\n ) {\n const weight = (value - startValue) / (endValue - startValue);\n return Number.isNaN(weight) ? null : weight;\n }\n\n const start = toRational(startValue);\n const end = toRational(endValue);\n const current = toRational(value);\n if (start === null || end === null || current === null) {\n return null;\n }\n\n const valueDelta =\n current.numerator * start.denominator -\n start.numerator * current.denominator;\n const rangeDelta =\n end.numerator * start.denominator - start.numerator * end.denominator;\n\n return divideBigints(\n valueDelta * end.denominator,\n current.denominator * rangeDelta,\n );\n}\n"]}
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAC3B,6EAgBuC;AAfrC,2IAAA,4BAA4B,OAAA;AAgB9B,qDAAyD;AAAhD,+GAAA,gBAAgB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAC3B,6EAgBuC;AAfrC,2IAAA,4BAA4B,OAAA;AAgB9B,qDAAyD;AAAhD,+GAAA,gBAAgB,OAAA;AAoBzB,uEAAwE;AAA/D,8HAAA,sBAAsB,OAAA;AAC/B,iEAA8D;AAArD,oHAAA,eAAe,OAAA","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { GraphVisualization } from './graph-visualization';\nexport {\n useGraphVisualizationContext,\n type ColorCount,\n type Gesture,\n type GraphItemMetaData,\n type GraphSelection,\n type GraphVisualizationContextData,\n type InteractionMode,\n type MetadataLookupTable,\n type NeoNode,\n type NeoRel,\n type NodeData,\n type NvlGraph,\n type PortableProperty,\n type RelData,\n type Sidepanel,\n} from './graph-visualization-context';\nexport { isGraphStyleRule } from './styling/style-types';\nexport type {\n GraphStyleRule,\n GraphBigintLiteral,\n GraphNumericLiteral,\n Style as GraphStyle,\n Where as GraphWhere,\n Value as GraphValue,\n CypherValue as GraphCypherValue,\n Caption as GraphCaption,\n CaptionValue as GraphCaptionValue,\n CaptionVariation as GraphCaptionVariation,\n ColorRange as GraphColorRange,\n SizeRange as GraphSizeRange,\n WidthRange as GraphWidthRange,\n UniqueColors as GraphUniqueColors,\n DatetimeLiteral as GraphDatetimeLiteral,\n LocalDatetimeLiteral as GraphLocalDatetimeLiteral,\n TimeLiteral as GraphTimeLiteral,\n} from './styling/style-types';\nexport { compileGraphStyleRules } from './styling/compile-graph-styles';\nexport { parseStyleRules } from './styling/parse-style-rules';\n"]}
|
|
@@ -26,67 +26,67 @@ const graph_visualization_1 = require("../graph-visualization");
|
|
|
26
26
|
const story_data_1 = require("./story-data");
|
|
27
27
|
const pokemonRules = [
|
|
28
28
|
{
|
|
29
|
-
match: { label: 'Pokemon' },
|
|
30
29
|
apply: {
|
|
30
|
+
captions: {
|
|
31
|
+
text: [
|
|
32
|
+
{ styles: ['bold'], value: { property: 'name' } },
|
|
33
|
+
{ styles: [], value: ' Lv' },
|
|
34
|
+
{ styles: [], value: { property: 'level' } },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
31
37
|
colorRange: {
|
|
32
|
-
onProperty: 'level',
|
|
33
|
-
minValue: 1,
|
|
34
|
-
minColor: '#3498db',
|
|
35
|
-
midValue: 45,
|
|
36
|
-
midColor: '#f1c40f',
|
|
37
|
-
maxValue: 88,
|
|
38
38
|
maxColor: '#e74c3c',
|
|
39
|
+
maxValue: 88,
|
|
40
|
+
midColor: '#f1c40f',
|
|
41
|
+
midValue: 45,
|
|
42
|
+
minColor: '#3498db',
|
|
43
|
+
minValue: 1,
|
|
44
|
+
onProperty: 'level',
|
|
39
45
|
},
|
|
40
46
|
sizeRange: {
|
|
41
|
-
|
|
42
|
-
minValue: 1,
|
|
47
|
+
maxSize: 50,
|
|
43
48
|
maxValue: 88,
|
|
44
49
|
minSize: 20,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
captions: {
|
|
48
|
-
text: [
|
|
49
|
-
{ value: { property: 'name' }, styles: ['bold'] },
|
|
50
|
-
{ value: ' Lv', styles: [] },
|
|
51
|
-
{ value: { property: 'level' }, styles: [] },
|
|
52
|
-
],
|
|
50
|
+
minValue: 1,
|
|
51
|
+
onProperty: 'level',
|
|
53
52
|
},
|
|
54
53
|
},
|
|
54
|
+
match: { label: 'Pokemon' },
|
|
55
55
|
},
|
|
56
56
|
];
|
|
57
57
|
const caughtRelRules = [
|
|
58
58
|
{
|
|
59
|
-
match: { reltype: 'CAUGHT' },
|
|
60
59
|
apply: {
|
|
60
|
+
captions: {
|
|
61
|
+
size: 1.5,
|
|
62
|
+
text: [
|
|
63
|
+
{ styles: [], value: 'Caught @ Lv' },
|
|
64
|
+
{ styles: ['bold'], value: { property: 'level' } },
|
|
65
|
+
],
|
|
66
|
+
},
|
|
61
67
|
colorRange: {
|
|
62
|
-
onProperty: 'level',
|
|
63
|
-
minValue: 1,
|
|
64
|
-
minColor: '#00d2ff',
|
|
65
|
-
maxValue: 40,
|
|
66
68
|
maxColor: '#ff2d78',
|
|
69
|
+
maxValue: 40,
|
|
70
|
+
minColor: '#00d2ff',
|
|
71
|
+
minValue: 1,
|
|
72
|
+
onProperty: 'level',
|
|
67
73
|
},
|
|
68
74
|
width: { value: 4 },
|
|
69
75
|
widthRange: {
|
|
70
|
-
onProperty: 'level',
|
|
71
|
-
minValue: 1,
|
|
72
76
|
maxValue: 40,
|
|
73
|
-
minWidth: 1,
|
|
74
77
|
maxWidth: 8,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{ value: 'Caught @ Lv', styles: [] },
|
|
79
|
-
{ value: { property: 'level' }, styles: ['bold'] },
|
|
80
|
-
],
|
|
81
|
-
size: 1.5,
|
|
78
|
+
minValue: 1,
|
|
79
|
+
minWidth: 1,
|
|
80
|
+
onProperty: 'level',
|
|
82
81
|
},
|
|
83
82
|
},
|
|
83
|
+
match: { reltype: 'CAUGHT' },
|
|
84
84
|
},
|
|
85
85
|
];
|
|
86
86
|
const otherNodeRules = [
|
|
87
|
-
{
|
|
88
|
-
{
|
|
89
|
-
{
|
|
87
|
+
{ apply: { color: { value: '#95a5a6' } }, match: { label: 'Trainer' } },
|
|
88
|
+
{ apply: { color: { value: '#bdc3c7' } }, match: { label: 'Type' } },
|
|
89
|
+
{ apply: { color: { value: '#bdc3c7' } }, match: { label: 'Gym' } },
|
|
90
90
|
];
|
|
91
91
|
exports.colorRangeStyleRules = [
|
|
92
92
|
...pokemonRules,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-visualization-range-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-range-styling.story.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gEAA4D;AAE5D,6CAAoE;AAEpE,MAAM,YAAY,GAAqB;IACrC;QACE,KAAK,EAAE,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"graph-visualization-range-styling.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-range-styling.story.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gEAA4D;AAE5D,6CAAoE;AAEpE,MAAM,YAAY,GAAqB;IACrC;QACE,KAAK,EAAE;YACL,QAAQ,EAAE;gBACR,IAAI,EAAE;oBACJ,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;oBACjD,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC5B,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;iBAC7C;aACF;YACD,UAAU,EAAE;gBACV,QAAQ,EAAE,SAAS;gBACnB,QAAQ,EAAE,EAAE;gBACZ,QAAQ,EAAE,SAAS;gBACnB,QAAQ,EAAE,EAAE;gBACZ,QAAQ,EAAE,SAAS;gBACnB,QAAQ,EAAE,CAAC;gBACX,UAAU,EAAE,OAAO;aACpB;YACD,SAAS,EAAE;gBACT,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,CAAC;gBACX,UAAU,EAAE,OAAO;aACpB;SACF;QACD,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;KAC5B;CACF,CAAC;AAEF,MAAM,cAAc,GAAqB;IACvC;QACE,KAAK,EAAE;YACL,QAAQ,EAAE;gBACR,IAAI,EAAE,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,OAAO,EAAE,YAC7B,uBAAC,wCAAkB,IACjB,KAAK,EAAE,+BAAkB,CAAC,KAAK,EAC/B,IAAI,EAAE,+BAAkB,CAAC,IAAI,EAC7B,SAAS,EAAE,6BAAgB,EAC3B,UAAU,EAAE,4BAAoB,GAChC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,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 { GraphVisualization } from '../graph-visualization';\nimport { type GraphStyleRule } from '../styling/style-types';\nimport { advancedStoryGraph, containerClasses } from './story-data';\n\nconst pokemonRules: GraphStyleRule[] = [\n {\n apply: {\n captions: {\n text: [\n { styles: ['bold'], value: { property: 'name' } },\n { styles: [], value: ' Lv' },\n { styles: [], value: { property: 'level' } },\n ],\n },\n colorRange: {\n maxColor: '#e74c3c',\n maxValue: 88,\n midColor: '#f1c40f',\n midValue: 45,\n minColor: '#3498db',\n minValue: 1,\n onProperty: 'level',\n },\n sizeRange: {\n maxSize: 50,\n maxValue: 88,\n minSize: 20,\n minValue: 1,\n onProperty: 'level',\n },\n },\n match: { label: 'Pokemon' },\n },\n];\n\nconst caughtRelRules: GraphStyleRule[] = [\n {\n apply: {\n captions: {\n size: 1.5,\n text: [\n { styles: [], value: 'Caught @ Lv' },\n { styles: ['bold'], value: { property: 'level' } },\n ],\n },\n colorRange: {\n maxColor: '#ff2d78',\n maxValue: 40,\n minColor: '#00d2ff',\n minValue: 1,\n onProperty: 'level',\n },\n width: { value: 4 },\n widthRange: {\n maxValue: 40,\n maxWidth: 8,\n minValue: 1,\n minWidth: 1,\n onProperty: 'level',\n },\n },\n match: { reltype: 'CAUGHT' },\n },\n];\n\nconst otherNodeRules: GraphStyleRule[] = [\n { apply: { color: { value: '#95a5a6' } }, match: { label: 'Trainer' } },\n { apply: { color: { value: '#bdc3c7' } }, match: { label: 'Type' } },\n { apply: { color: { value: '#bdc3c7' } }, match: { label: 'Gym' } },\n];\n\nexport const colorRangeStyleRules: GraphStyleRule[] = [\n ...pokemonRules,\n ...caughtRelRules,\n ...otherNodeRules,\n];\n\nconst Component = () => {\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n nodes={advancedStoryGraph.nodes}\n rels={advancedStoryGraph.rels}\n className={containerClasses}\n styleRules={colorRangeStyleRules}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|