@deck.gl-community/graph-layers 9.2.0-beta.6 → 9.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/_deprecated/old-constants.d.ts.map +1 -1
  2. package/dist/_deprecated/old-constants.js.map +1 -1
  3. package/dist/core/graph-engine.d.ts +3 -2
  4. package/dist/core/graph-engine.d.ts.map +1 -1
  5. package/dist/core/graph-engine.js +1 -0
  6. package/dist/core/graph-engine.js.map +1 -1
  7. package/dist/core/graph-layout.d.ts.map +1 -1
  8. package/dist/core/graph-layout.js.map +1 -1
  9. package/dist/core/interaction-manager.d.ts.map +1 -1
  10. package/dist/core/interaction-manager.js.map +1 -1
  11. package/dist/graph/arrow-graph.d.ts.map +1 -1
  12. package/dist/graph/arrow-graph.js.map +1 -1
  13. package/dist/graph/classic-graph.d.ts.map +1 -1
  14. package/dist/graph/classic-graph.js +1 -3
  15. package/dist/graph/classic-graph.js.map +1 -1
  16. package/dist/graph/functions/arrow-utils.d.ts.map +1 -1
  17. package/dist/graph/functions/arrow-utils.js +5 -3
  18. package/dist/graph/functions/arrow-utils.js.map +1 -1
  19. package/dist/graph/functions/create-graph-from-data.d.ts.map +1 -1
  20. package/dist/graph/functions/create-graph-from-data.js.map +1 -1
  21. package/dist/graph/graph-normalization.d.ts.map +1 -1
  22. package/dist/graph/graph-normalization.js.map +1 -1
  23. package/dist/graph-data/arrow-graph-data-builder.d.ts.map +1 -1
  24. package/dist/graph-data/arrow-graph-data-builder.js.map +1 -1
  25. package/dist/graph-data/graph-data-builder.d.ts.map +1 -1
  26. package/dist/graph-data/plain-graph-data-builder.d.ts.map +1 -1
  27. package/dist/graph-style-schema.cdn.js +1 -1
  28. package/dist/graph-style-schema.json +1 -1
  29. package/dist/index.cjs +332 -224
  30. package/dist/index.cjs.map +4 -4
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +2 -2
  34. package/dist/index.js.map +1 -1
  35. package/dist/layers/common-layers/grid-layer/grid-layer.d.ts.map +1 -1
  36. package/dist/layers/common-layers/grid-layer/grid-layer.js +6 -16
  37. package/dist/layers/common-layers/grid-layer/grid-layer.js.map +1 -1
  38. package/dist/layers/edge-attachment-helper.d.ts.map +1 -1
  39. package/dist/layers/edge-attachment-helper.js +1 -3
  40. package/dist/layers/edge-attachment-helper.js.map +1 -1
  41. package/dist/layers/edge-layer.js +4 -4
  42. package/dist/layers/edge-layer.js.map +1 -1
  43. package/dist/layers/edge-layers/arrow-2d-geometry.js +1 -8
  44. package/dist/layers/edge-layers/arrow-2d-geometry.js.map +1 -1
  45. package/dist/layers/graph-layer.d.ts +4 -3
  46. package/dist/layers/graph-layer.d.ts.map +1 -1
  47. package/dist/layers/graph-layer.js +20 -17
  48. package/dist/layers/graph-layer.js.map +1 -1
  49. package/dist/layouts/d3-dag/collapsable-d3-dag-layout.d.ts.map +1 -1
  50. package/dist/layouts/d3-dag/collapsable-d3-dag-layout.js.map +1 -1
  51. package/dist/layouts/d3-dag/d3-dag-layout.d.ts.map +1 -1
  52. package/dist/layouts/d3-dag/d3-dag-layout.js +9 -2
  53. package/dist/layouts/d3-dag/d3-dag-layout.js.map +1 -1
  54. package/dist/layouts/experimental/radial-layout.d.ts.map +1 -1
  55. package/dist/layouts/experimental/radial-layout.js.map +1 -1
  56. package/dist/layouts/simple-layout.d.ts.map +1 -1
  57. package/dist/layouts/simple-layout.js +4 -1
  58. package/dist/layouts/simple-layout.js.map +1 -1
  59. package/dist/loaders/dot-graph-loader.d.ts.map +1 -1
  60. package/dist/loaders/dot-graph-loader.js +10 -3
  61. package/dist/loaders/dot-graph-loader.js.map +1 -1
  62. package/dist/loaders/json-graph-loader.d.ts.map +1 -1
  63. package/dist/loaders/json-graph-loader.js +2 -2
  64. package/dist/loaders/json-graph-loader.js.map +1 -1
  65. package/dist/loaders/parsers/parse-json-graph.js +2 -1
  66. package/dist/loaders/parsers/parse-json-graph.js.map +1 -1
  67. package/dist/style/graph-layer-stylesheet.d.ts +14 -5
  68. package/dist/style/graph-layer-stylesheet.d.ts.map +1 -1
  69. package/dist/style/graph-layer-stylesheet.js +14 -8
  70. package/dist/style/graph-layer-stylesheet.js.map +1 -1
  71. package/dist/style/graph-style-engine.d.ts +4 -4
  72. package/dist/style/graph-style-engine.d.ts.map +1 -1
  73. package/dist/style/graph-style-engine.js +7 -5
  74. package/dist/style/graph-style-engine.js.map +1 -1
  75. package/dist/style/graph-stylesheet-schema.d.ts +13211 -0
  76. package/dist/style/graph-stylesheet-schema.d.ts.map +1 -0
  77. package/dist/style/graph-stylesheet-schema.js +346 -0
  78. package/dist/style/graph-stylesheet-schema.js.map +1 -0
  79. package/dist/style/style-property.d.ts.map +1 -1
  80. package/dist/style/style-property.js +17 -5
  81. package/dist/style/style-property.js.map +1 -1
  82. package/dist/style/stylesheet-engine.d.ts.map +1 -1
  83. package/dist/style/stylesheet-engine.js +1 -1
  84. package/dist/style/stylesheet-engine.js.map +1 -1
  85. package/dist/utils/collapsed-chains.d.ts.map +1 -1
  86. package/dist/utils/collapsed-chains.js.map +1 -1
  87. package/dist/utils/node-boundary.d.ts.map +1 -1
  88. package/dist/utils/node-boundary.js +1 -1
  89. package/dist/utils/node-boundary.js.map +1 -1
  90. package/dist/utils/rank-grid.d.ts.map +1 -1
  91. package/dist/utils/rank-grid.js +5 -2
  92. package/dist/utils/rank-grid.js.map +1 -1
  93. package/package.json +8 -8
  94. package/src/_deprecated/old-constants.ts +12 -6
  95. package/src/core/graph-engine.ts +7 -2
  96. package/src/core/graph-layout.ts +2 -6
  97. package/src/core/interaction-manager.ts +2 -1
  98. package/src/graph/arrow-graph.ts +17 -10
  99. package/src/graph/classic-graph.ts +8 -5
  100. package/src/graph/functions/arrow-utils.ts +8 -4
  101. package/src/graph/functions/create-graph-from-data.ts +2 -2
  102. package/src/graph/graph-normalization.ts +8 -2
  103. package/src/graph-data/arrow-graph-data-builder.ts +6 -3
  104. package/src/graph-data/graph-data-builder.ts +1 -1
  105. package/src/graph-data/plain-graph-data-builder.ts +1 -1
  106. package/src/index.ts +35 -17
  107. package/src/layers/common-layers/grid-layer/grid-layer.ts +26 -19
  108. package/src/layers/edge-attachment-helper.ts +54 -45
  109. package/src/layers/edge-layer.ts +4 -4
  110. package/src/layers/edge-layers/arrow-2d-geometry.ts +1 -8
  111. package/src/layers/graph-layer.ts +109 -99
  112. package/src/layouts/d3-dag/collapsable-d3-dag-layout.ts +14 -7
  113. package/src/layouts/d3-dag/d3-dag-layout.ts +31 -19
  114. package/src/layouts/experimental/radial-layout.ts +4 -1
  115. package/src/layouts/simple-layout.ts +6 -4
  116. package/src/loaders/dot-graph-loader.ts +19 -7
  117. package/src/loaders/json-graph-loader.ts +3 -5
  118. package/src/loaders/parsers/parse-json-graph.ts +2 -1
  119. package/src/style/graph-layer-stylesheet.ts +26 -19
  120. package/src/style/graph-style-engine.ts +30 -17
  121. package/src/style/graph-stylesheet-schema.ts +490 -0
  122. package/src/style/style-property.ts +26 -11
  123. package/src/style/stylesheet-engine.ts +44 -29
  124. package/src/utils/collapsed-chains.ts +6 -2
  125. package/src/utils/node-boundary.ts +2 -3
  126. package/src/utils/rank-grid.ts +31 -17
  127. package/dist/style/graph-stylesheet.schema.d.ts +0 -311
  128. package/dist/style/graph-stylesheet.schema.d.ts.map +0 -1
  129. package/dist/style/graph-stylesheet.schema.js +0 -238
  130. package/dist/style/graph-stylesheet.schema.js.map +0 -1
  131. package/src/style/graph-stylesheet.schema.ts +0 -344
package/dist/index.cjs CHANGED
@@ -2249,56 +2249,10 @@ var StylesheetEngine = class {
2249
2249
  }
2250
2250
  };
2251
2251
 
2252
- // dist/style/graph-stylesheet.schema.js
2252
+ // dist/style/graph-stylesheet-schema.js
2253
2253
  var import_zod = require("zod");
2254
- var GraphStylePrimitiveSchema = import_zod.z.union([
2255
- import_zod.z.string(),
2256
- import_zod.z.number(),
2257
- import_zod.z.boolean(),
2258
- import_zod.z.null(),
2259
- import_zod.z.array(import_zod.z.union([import_zod.z.string(), import_zod.z.number(), import_zod.z.boolean(), import_zod.z.null()]))
2260
- ]);
2261
- var GraphStyleFunctionSchema = import_zod.z.custom((value) => typeof value === "function", {
2262
- message: "Style functions must be callable."
2263
- });
2264
- var GraphStyleScaleTypeEnum = import_zod.z.enum([
2265
- "linear",
2266
- "log",
2267
- "pow",
2268
- "sqrt",
2269
- "quantize",
2270
- "quantile",
2271
- "ordinal"
2272
- ]);
2273
- var GraphStyleScaleSchema = import_zod.z.object({
2274
- type: GraphStyleScaleTypeEnum.optional(),
2275
- domain: import_zod.z.array(import_zod.z.union([import_zod.z.number(), import_zod.z.string()])).optional(),
2276
- range: import_zod.z.array(import_zod.z.any()).optional(),
2277
- clamp: import_zod.z.boolean().optional(),
2278
- nice: import_zod.z.union([import_zod.z.boolean(), import_zod.z.number()]).optional(),
2279
- base: import_zod.z.number().optional(),
2280
- exponent: import_zod.z.number().optional(),
2281
- unknown: import_zod.z.any().optional()
2282
- }).strict();
2283
- var GraphStyleAttributeReferenceSchema = import_zod.z.union([
2284
- import_zod.z.string().regex(/^@.+/, 'Attribute reference strings must start with "@" and include an attribute name.'),
2285
- import_zod.z.object({
2286
- attribute: import_zod.z.string().min(1, "Attribute name is required."),
2287
- fallback: GraphStylePrimitiveSchema.optional(),
2288
- scale: import_zod.z.union([GraphStyleScaleSchema, GraphStyleFunctionSchema]).optional()
2289
- }).strict()
2290
- ]);
2291
- var GraphStyleLeafValueSchema = import_zod.z.union([
2292
- GraphStylePrimitiveSchema,
2293
- GraphStyleAttributeReferenceSchema,
2294
- GraphStyleFunctionSchema
2295
- ]);
2296
- var RESERVED_STATE_KEYS = /* @__PURE__ */ new Set(["attribute", "fallback", "scale"]);
2297
- var GraphStyleStateMapSchema = import_zod.z.record(import_zod.z.string().refine((key) => !RESERVED_STATE_KEYS.has(key), "State overrides must not use reserved keys."), GraphStyleLeafValueSchema);
2298
- var GraphStyleValueSchema = import_zod.z.union([
2299
- GraphStyleLeafValueSchema,
2300
- GraphStyleStateMapSchema
2301
- ]);
2254
+
2255
+ // dist/style/graph-style-accessor-map.js
2302
2256
  var COMMON_DECKGL_PROPS = {
2303
2257
  getOffset: "offset",
2304
2258
  opacity: "opacity"
@@ -2389,32 +2343,66 @@ var GRAPH_DECKGL_ACCESSOR_MAP = {
2389
2343
  getOffset: "offset"
2390
2344
  }
2391
2345
  };
2346
+
2347
+ // dist/style/graph-stylesheet-schema.js
2348
+ var GraphStylePrimitiveSchema = import_zod.z.union([
2349
+ import_zod.z.string(),
2350
+ import_zod.z.number(),
2351
+ import_zod.z.boolean(),
2352
+ import_zod.z.null(),
2353
+ import_zod.z.array(import_zod.z.union([import_zod.z.string(), import_zod.z.number(), import_zod.z.boolean(), import_zod.z.null()]))
2354
+ ]);
2355
+ var GraphStyleFunctionSchema = import_zod.z.custom((value) => typeof value === "function", {
2356
+ message: "Style functions must be callable."
2357
+ });
2358
+ var GraphStyleScaleTypeEnum = import_zod.z.enum([
2359
+ "linear",
2360
+ "log",
2361
+ "pow",
2362
+ "sqrt",
2363
+ "quantize",
2364
+ "quantile",
2365
+ "ordinal"
2366
+ ]);
2367
+ var GraphStyleScaleSchema = import_zod.z.object({
2368
+ type: GraphStyleScaleTypeEnum.optional(),
2369
+ domain: import_zod.z.array(import_zod.z.union([import_zod.z.number(), import_zod.z.string()])).optional(),
2370
+ range: import_zod.z.array(import_zod.z.any()).optional(),
2371
+ clamp: import_zod.z.boolean().optional(),
2372
+ nice: import_zod.z.union([import_zod.z.boolean(), import_zod.z.number()]).optional(),
2373
+ base: import_zod.z.number().optional(),
2374
+ exponent: import_zod.z.number().optional(),
2375
+ unknown: import_zod.z.any().optional()
2376
+ }).strict();
2377
+ var GraphStyleAttributeReferenceSchema = import_zod.z.union([
2378
+ import_zod.z.string().regex(/^@.+/, 'Attribute reference strings must start with "@" and include an attribute name.'),
2379
+ import_zod.z.object({
2380
+ attribute: import_zod.z.string().min(1, "Attribute name is required."),
2381
+ fallback: GraphStylePrimitiveSchema.optional(),
2382
+ scale: import_zod.z.union([GraphStyleScaleSchema, GraphStyleFunctionSchema]).optional()
2383
+ }).strict()
2384
+ ]);
2385
+ var GraphStyleLeafValueSchema = import_zod.z.union([
2386
+ GraphStylePrimitiveSchema,
2387
+ GraphStyleAttributeReferenceSchema,
2388
+ GraphStyleFunctionSchema
2389
+ ]);
2390
+ var RESERVED_STATE_KEYS = /* @__PURE__ */ new Set(["attribute", "fallback", "scale"]);
2391
+ var GraphStyleStateMapSchema = import_zod.z.record(import_zod.z.string().refine((key) => !RESERVED_STATE_KEYS.has(key), "State overrides must not use reserved keys."), GraphStyleLeafValueSchema);
2392
+ var GraphStyleValueSchema = import_zod.z.union([GraphStyleLeafValueSchema, GraphStyleStateMapSchema]);
2392
2393
  var GraphStyleSelectorKeySchema = import_zod.z.string().regex(/^:[^\s]+/, 'Selectors must start with ":".');
2393
- function createPropertiesSchema(keys) {
2394
- const shape = keys.reduce((acc, key) => {
2395
- acc[key] = GraphStyleValueSchema.optional();
2396
- return acc;
2397
- }, {});
2398
- return import_zod.z.object(shape).partial().strict();
2399
- }
2400
- var GraphStylesheetVariants = Object.entries(GRAPH_DECKGL_ACCESSOR_MAP).map(([type, accessors]) => {
2401
- const propertyKeys = Object.values(accessors);
2402
- const propertyKeySet = new Set(propertyKeys);
2403
- const propertiesSchema = createPropertiesSchema(propertyKeys);
2404
- const baseShape = {
2405
- type: import_zod.z.literal(type)
2406
- };
2407
- for (const key of propertyKeys) {
2408
- baseShape[key] = GraphStyleValueSchema.optional();
2409
- }
2410
- return import_zod.z.object(baseShape).catchall(import_zod.z.unknown()).superRefine((value, ctx) => {
2411
- for (const key of Object.keys(value)) {
2412
- if (key === "type") {
2394
+ function createSelectorRefinement(allowedKeys, propertiesSchema) {
2395
+ const allowedKeySet = new Set(allowedKeys);
2396
+ return (value, ctx) => {
2397
+ if (typeof value !== "object" || value === null) {
2398
+ return;
2399
+ }
2400
+ const record = value;
2401
+ for (const key of Object.keys(record)) {
2402
+ if (key === "type")
2413
2403
  continue;
2414
- }
2415
- if (propertyKeySet.has(key)) {
2404
+ if (allowedKeySet.has(key))
2416
2405
  continue;
2417
- }
2418
2406
  if (!key.startsWith(":")) {
2419
2407
  ctx.addIssue({
2420
2408
  code: import_zod.z.ZodIssueCode.custom,
@@ -2431,7 +2419,7 @@ var GraphStylesheetVariants = Object.entries(GRAPH_DECKGL_ACCESSOR_MAP).map(([ty
2431
2419
  });
2432
2420
  continue;
2433
2421
  }
2434
- const selectorResult = propertiesSchema.safeParse(value[key]);
2422
+ const selectorResult = propertiesSchema.safeParse(record[key]);
2435
2423
  if (!selectorResult.success) {
2436
2424
  for (const issue of selectorResult.error.issues) {
2437
2425
  ctx.addIssue({
@@ -2441,101 +2429,190 @@ var GraphStylesheetVariants = Object.entries(GRAPH_DECKGL_ACCESSOR_MAP).map(([ty
2441
2429
  }
2442
2430
  }
2443
2431
  }
2444
- });
2445
- });
2446
- var GraphStylesheetSchema = import_zod.z.discriminatedUnion("type", GraphStylesheetVariants);
2447
-
2448
- // dist/style/graph-style-accessor-map.js
2449
- var COMMON_DECKGL_PROPS2 = {
2450
- getOffset: "offset",
2451
- opacity: "opacity"
2432
+ };
2433
+ }
2434
+ var CircleShape = {
2435
+ offset: GraphStyleValueSchema.optional(),
2436
+ opacity: GraphStyleValueSchema.optional(),
2437
+ fill: GraphStyleValueSchema.optional(),
2438
+ stroke: GraphStyleValueSchema.optional(),
2439
+ strokeWidth: GraphStyleValueSchema.optional(),
2440
+ radius: GraphStyleValueSchema.optional()
2452
2441
  };
2453
- var GRAPH_DECKGL_ACCESSOR_MAP2 = {
2454
- circle: {
2455
- ...COMMON_DECKGL_PROPS2,
2456
- getFillColor: "fill",
2457
- getLineColor: "stroke",
2458
- getLineWidth: "strokeWidth",
2459
- getRadius: "radius"
2460
- },
2461
- rectangle: {
2462
- ...COMMON_DECKGL_PROPS2,
2463
- getWidth: "width",
2464
- getHeight: "height",
2465
- getFillColor: "fill",
2466
- getLineColor: "stroke",
2467
- getLineWidth: "strokeWidth"
2468
- },
2469
- "rounded-rectangle": {
2470
- ...COMMON_DECKGL_PROPS2,
2471
- getCornerRadius: "cornerRadius",
2472
- getRadius: "radius",
2473
- getWidth: "width",
2474
- getHeight: "height",
2475
- getFillColor: "fill",
2476
- getLineColor: "stroke",
2477
- getLineWidth: "strokeWidth"
2478
- },
2479
- "path-rounded-rectangle": {
2480
- ...COMMON_DECKGL_PROPS2,
2481
- getWidth: "width",
2482
- getHeight: "height",
2483
- getFillColor: "fill",
2484
- getLineColor: "stroke",
2485
- getLineWidth: "strokeWidth",
2486
- getCornerRadius: "cornerRadius"
2487
- },
2488
- label: {
2489
- ...COMMON_DECKGL_PROPS2,
2490
- getColor: "color",
2491
- getText: "text",
2492
- getSize: "fontSize",
2493
- getTextAnchor: "textAnchor",
2494
- getAlignmentBaseline: "alignmentBaseline",
2495
- getAngle: "angle",
2496
- scaleWithZoom: "scaleWithZoom",
2497
- textMaxWidth: "textMaxWidth",
2498
- textWordBreak: "textWordBreak",
2499
- textSizeMinPixels: "textSizeMinPixels"
2500
- },
2501
- marker: {
2502
- ...COMMON_DECKGL_PROPS2,
2503
- getColor: "fill",
2504
- getSize: "size",
2505
- getMarker: "marker",
2506
- scaleWithZoom: "scaleWithZoom"
2507
- },
2508
- Edge: {
2509
- getColor: "stroke",
2510
- getWidth: "strokeWidth"
2511
- },
2512
- edge: {
2513
- getColor: "stroke",
2514
- getWidth: "strokeWidth"
2515
- },
2516
- "edge-label": {
2517
- getColor: "color",
2518
- getText: "text",
2519
- getSize: "fontSize",
2520
- getTextAnchor: "textAnchor",
2521
- getAlignmentBaseline: "alignmentBaseline",
2522
- scaleWithZoom: "scaleWithZoom",
2523
- textMaxWidth: "textMaxWidth",
2524
- textWordBreak: "textWordBreak",
2525
- textSizeMinPixels: "textSizeMinPixels"
2526
- },
2527
- flow: {
2528
- getColor: "color",
2529
- getWidth: "width",
2530
- getSpeed: "speed",
2531
- getTailLength: "tailLength"
2532
- },
2533
- arrow: {
2534
- getColor: "color",
2535
- getSize: "size",
2536
- getOffset: "offset"
2537
- }
2442
+ var CirclePropertiesSchema = import_zod.z.object(CircleShape).partial().strict();
2443
+ var CircleStylesheetSchema = import_zod.z.object({
2444
+ type: import_zod.z.literal("circle"),
2445
+ ...CircleShape
2446
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(CircleShape), CirclePropertiesSchema));
2447
+ var RectangleShape = {
2448
+ offset: GraphStyleValueSchema.optional(),
2449
+ opacity: GraphStyleValueSchema.optional(),
2450
+ width: GraphStyleValueSchema.optional(),
2451
+ height: GraphStyleValueSchema.optional(),
2452
+ fill: GraphStyleValueSchema.optional(),
2453
+ stroke: GraphStyleValueSchema.optional(),
2454
+ strokeWidth: GraphStyleValueSchema.optional()
2455
+ };
2456
+ var RectanglePropertiesSchema = import_zod.z.object(RectangleShape).partial().strict();
2457
+ var RectangleStylesheetSchema = import_zod.z.object({
2458
+ type: import_zod.z.literal("rectangle"),
2459
+ ...RectangleShape
2460
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(RectangleShape), RectanglePropertiesSchema));
2461
+ var RoundedRectangleShape = {
2462
+ offset: GraphStyleValueSchema.optional(),
2463
+ opacity: GraphStyleValueSchema.optional(),
2464
+ cornerRadius: GraphStyleValueSchema.optional(),
2465
+ radius: GraphStyleValueSchema.optional(),
2466
+ width: GraphStyleValueSchema.optional(),
2467
+ height: GraphStyleValueSchema.optional(),
2468
+ fill: GraphStyleValueSchema.optional(),
2469
+ stroke: GraphStyleValueSchema.optional(),
2470
+ strokeWidth: GraphStyleValueSchema.optional()
2471
+ };
2472
+ var RoundedRectanglePropertiesSchema = import_zod.z.object(RoundedRectangleShape).partial().strict();
2473
+ var RoundedRectangleStylesheetSchema = import_zod.z.object({
2474
+ type: import_zod.z.literal("rounded-rectangle"),
2475
+ ...RoundedRectangleShape
2476
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(RoundedRectangleShape), RoundedRectanglePropertiesSchema));
2477
+ var PathRoundedRectangleShape = {
2478
+ offset: GraphStyleValueSchema.optional(),
2479
+ opacity: GraphStyleValueSchema.optional(),
2480
+ width: GraphStyleValueSchema.optional(),
2481
+ height: GraphStyleValueSchema.optional(),
2482
+ fill: GraphStyleValueSchema.optional(),
2483
+ stroke: GraphStyleValueSchema.optional(),
2484
+ strokeWidth: GraphStyleValueSchema.optional(),
2485
+ cornerRadius: GraphStyleValueSchema.optional()
2486
+ };
2487
+ var PathRoundedRectanglePropertiesSchema = import_zod.z.object(PathRoundedRectangleShape).partial().strict();
2488
+ var PathRoundedRectangleStylesheetSchema = import_zod.z.object({
2489
+ type: import_zod.z.literal("path-rounded-rectangle"),
2490
+ ...PathRoundedRectangleShape
2491
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(PathRoundedRectangleShape), PathRoundedRectanglePropertiesSchema));
2492
+ var LabelShape = {
2493
+ offset: GraphStyleValueSchema.optional(),
2494
+ opacity: GraphStyleValueSchema.optional(),
2495
+ color: GraphStyleValueSchema.optional(),
2496
+ text: GraphStyleValueSchema.optional(),
2497
+ fontSize: GraphStyleValueSchema.optional(),
2498
+ textAnchor: GraphStyleValueSchema.optional(),
2499
+ alignmentBaseline: GraphStyleValueSchema.optional(),
2500
+ angle: GraphStyleValueSchema.optional(),
2501
+ scaleWithZoom: GraphStyleValueSchema.optional(),
2502
+ textMaxWidth: GraphStyleValueSchema.optional(),
2503
+ textWordBreak: GraphStyleValueSchema.optional(),
2504
+ textSizeMinPixels: GraphStyleValueSchema.optional()
2505
+ };
2506
+ var LabelPropertiesSchema = import_zod.z.object(LabelShape).partial().strict();
2507
+ var LabelStylesheetSchema = import_zod.z.object({
2508
+ type: import_zod.z.literal("label"),
2509
+ ...LabelShape
2510
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(LabelShape), LabelPropertiesSchema));
2511
+ var MarkerShape = {
2512
+ offset: GraphStyleValueSchema.optional(),
2513
+ opacity: GraphStyleValueSchema.optional(),
2514
+ fill: GraphStyleValueSchema.optional(),
2515
+ size: GraphStyleValueSchema.optional(),
2516
+ marker: GraphStyleValueSchema.optional(),
2517
+ scaleWithZoom: GraphStyleValueSchema.optional()
2518
+ };
2519
+ var MarkerPropertiesSchema = import_zod.z.object(MarkerShape).partial().strict();
2520
+ var MarkerStylesheetSchema = import_zod.z.object({
2521
+ type: import_zod.z.literal("marker"),
2522
+ ...MarkerShape
2523
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(MarkerShape), MarkerPropertiesSchema));
2524
+ var EdgeUpperShape = {
2525
+ stroke: GraphStyleValueSchema.optional(),
2526
+ strokeWidth: GraphStyleValueSchema.optional()
2527
+ };
2528
+ var EdgeUpperPropertiesSchema = import_zod.z.object(EdgeUpperShape).partial().strict();
2529
+ var EdgeUpperStylesheetSchema = import_zod.z.object({
2530
+ type: import_zod.z.literal("Edge"),
2531
+ ...EdgeUpperShape
2532
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(EdgeUpperShape), EdgeUpperPropertiesSchema));
2533
+ var EdgeLowerShape = {
2534
+ stroke: GraphStyleValueSchema.optional(),
2535
+ strokeWidth: GraphStyleValueSchema.optional()
2536
+ };
2537
+ var EdgeLowerPropertiesSchema = import_zod.z.object(EdgeLowerShape).partial().strict();
2538
+ var EdgeLowerStylesheetSchema = import_zod.z.object({
2539
+ type: import_zod.z.literal("edge"),
2540
+ ...EdgeLowerShape
2541
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(EdgeLowerShape), EdgeLowerPropertiesSchema));
2542
+ var EdgeLabelShape = {
2543
+ color: GraphStyleValueSchema.optional(),
2544
+ text: GraphStyleValueSchema.optional(),
2545
+ fontSize: GraphStyleValueSchema.optional(),
2546
+ textAnchor: GraphStyleValueSchema.optional(),
2547
+ alignmentBaseline: GraphStyleValueSchema.optional(),
2548
+ scaleWithZoom: GraphStyleValueSchema.optional(),
2549
+ textMaxWidth: GraphStyleValueSchema.optional(),
2550
+ textWordBreak: GraphStyleValueSchema.optional(),
2551
+ textSizeMinPixels: GraphStyleValueSchema.optional()
2538
2552
  };
2553
+ var EdgeLabelPropertiesSchema = import_zod.z.object(EdgeLabelShape).partial().strict();
2554
+ var EdgeLabelStylesheetSchema = import_zod.z.object({
2555
+ type: import_zod.z.literal("edge-label"),
2556
+ ...EdgeLabelShape
2557
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(EdgeLabelShape), EdgeLabelPropertiesSchema));
2558
+ var FlowShape = {
2559
+ color: GraphStyleValueSchema.optional(),
2560
+ width: GraphStyleValueSchema.optional(),
2561
+ speed: GraphStyleValueSchema.optional(),
2562
+ tailLength: GraphStyleValueSchema.optional()
2563
+ };
2564
+ var FlowPropertiesSchema = import_zod.z.object(FlowShape).partial().strict();
2565
+ var FlowStylesheetSchema = import_zod.z.object({
2566
+ type: import_zod.z.literal("flow"),
2567
+ ...FlowShape
2568
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(FlowShape), FlowPropertiesSchema));
2569
+ var ArrowShape = {
2570
+ color: GraphStyleValueSchema.optional(),
2571
+ size: GraphStyleValueSchema.optional(),
2572
+ offset: GraphStyleValueSchema.optional()
2573
+ };
2574
+ var ArrowPropertiesSchema = import_zod.z.object(ArrowShape).partial().strict();
2575
+ var ArrowStylesheetSchema = import_zod.z.object({
2576
+ type: import_zod.z.literal("arrow"),
2577
+ ...ArrowShape
2578
+ }).catchall(import_zod.z.unknown()).superRefine(createSelectorRefinement(Object.keys(ArrowShape), ArrowPropertiesSchema));
2579
+ var GraphNodeStylesheetVariants = [
2580
+ CircleStylesheetSchema,
2581
+ RectangleStylesheetSchema,
2582
+ RoundedRectangleStylesheetSchema,
2583
+ PathRoundedRectangleStylesheetSchema,
2584
+ LabelStylesheetSchema,
2585
+ MarkerStylesheetSchema
2586
+ ];
2587
+ var GraphEdgeStylesheetVariants = [
2588
+ EdgeUpperStylesheetSchema,
2589
+ EdgeLowerStylesheetSchema,
2590
+ EdgeLabelStylesheetSchema,
2591
+ FlowStylesheetSchema,
2592
+ ArrowStylesheetSchema
2593
+ ];
2594
+ var GraphStyleRuleVariants = [...GraphNodeStylesheetVariants, ...GraphEdgeStylesheetVariants];
2595
+ var GraphStyleRuleSchema = import_zod.z.discriminatedUnion("type", GraphStyleRuleVariants);
2596
+ var GraphNodeStyleRuleSchema = import_zod.z.discriminatedUnion("type", GraphNodeStylesheetVariants);
2597
+ var GraphEdgeDecoratorRuleSchema = import_zod.z.discriminatedUnion("type", [
2598
+ EdgeLabelStylesheetSchema,
2599
+ FlowStylesheetSchema,
2600
+ ArrowStylesheetSchema
2601
+ ]);
2602
+ var EdgeUpperWithDecoratorsSchema = EdgeUpperStylesheetSchema.safeExtend({
2603
+ decorators: import_zod.z.array(GraphEdgeDecoratorRuleSchema).optional()
2604
+ });
2605
+ var EdgeLowerWithDecoratorsSchema = EdgeLowerStylesheetSchema.safeExtend({
2606
+ decorators: import_zod.z.array(GraphEdgeDecoratorRuleSchema).optional()
2607
+ });
2608
+ var GraphEdgeRuleWithDecoratorsSchema = import_zod.z.discriminatedUnion("type", [
2609
+ EdgeUpperWithDecoratorsSchema,
2610
+ EdgeLowerWithDecoratorsSchema
2611
+ ]);
2612
+ var GraphStylesheetSchema = import_zod.z.object({
2613
+ nodes: import_zod.z.array(GraphNodeStyleRuleSchema).optional(),
2614
+ edges: import_zod.z.array(GraphEdgeRuleWithDecoratorsSchema).optional()
2615
+ }).strict();
2539
2616
 
2540
2617
  // dist/style/graph-style-engine.js
2541
2618
  var GRAPH_DECKGL_UPDATE_TRIGGERS = {
@@ -2561,10 +2638,10 @@ ${details}`;
2561
2638
  }
2562
2639
  var GraphStylesheetEngine = class extends StylesheetEngine {
2563
2640
  constructor(style, { stateUpdateTrigger } = {}) {
2564
- const result = GraphStylesheetSchema.safeParse(style);
2641
+ const result = GraphStyleRuleSchema.safeParse(style);
2565
2642
  const parsedStyle = result.success ? result.data : sanitizeStylesheet(style, result.error.issues);
2566
2643
  super(parsedStyle, {
2567
- deckglAccessorMap: GRAPH_DECKGL_ACCESSOR_MAP2,
2644
+ deckglAccessorMap: GRAPH_DECKGL_ACCESSOR_MAP,
2568
2645
  deckglUpdateTriggers: GRAPH_DECKGL_UPDATE_TRIGGERS,
2569
2646
  stateUpdateTrigger
2570
2647
  });
@@ -2606,7 +2683,7 @@ function sanitizeStylesheet(style, issues) {
2606
2683
  }
2607
2684
  delete sanitized[rootKey];
2608
2685
  }
2609
- const result = GraphStylesheetSchema.safeParse(sanitized);
2686
+ const result = GraphStyleRuleSchema.safeParse(sanitized);
2610
2687
  if (result.success) {
2611
2688
  return result.data;
2612
2689
  }
@@ -2756,6 +2833,7 @@ var GraphEngine = class {
2756
2833
  var _a, _b, _c, _d;
2757
2834
  return ((_b = (_a = this._graph).findNode) == null ? void 0 : _b.call(_a, nodeId)) ?? ((_d = (_c = this._graph).findNodeById) == null ? void 0 : _d.call(_c, nodeId));
2758
2835
  }
2836
+ /** Creates a stylesheet engine for a single validated or raw style rule. */
2759
2837
  createStylesheetEngine(style, options = {}) {
2760
2838
  return new GraphStylesheetEngine(style, options);
2761
2839
  }
@@ -2945,7 +3023,10 @@ var _SimpleLayout = class extends GraphLayout {
2945
3023
  this._graph = graph;
2946
3024
  const nodes = Array.from(graph.getNodes());
2947
3025
  this._nodeMap = new Map(nodes.map((node) => [node.getId(), node]));
2948
- this._nodePositionMap = new Map(nodes.map((node) => [node.getId(), this._normalizePosition(this.props.nodePositionAccessor(node))]));
3026
+ this._nodePositionMap = new Map(nodes.map((node) => [
3027
+ node.getId(),
3028
+ this._normalizePosition(this.props.nodePositionAccessor(node))
3029
+ ]));
2949
3030
  }
2950
3031
  setNodePositionAccessor = (accessor) => {
2951
3032
  this.props.nodePositionAccessor = accessor;
@@ -3536,7 +3617,10 @@ var _D3DagLayout = class extends GraphLayout {
3536
3617
  if (!edge) {
3537
3618
  continue;
3538
3619
  }
3539
- const points = link.points && link.points.length ? link.points : [[link.source.x ?? 0, link.source.y ?? 0], [link.target.x ?? 0, link.target.y ?? 0]];
3620
+ const points = link.points && link.points.length ? link.points : [
3621
+ [link.source.x ?? 0, link.source.y ?? 0],
3622
+ [link.target.x ?? 0, link.target.y ?? 0]
3623
+ ];
3540
3624
  this._rawEdgePoints.set(edge.getId(), points.map((point) => [...point]));
3541
3625
  }
3542
3626
  this._updateTransformedGeometry();
@@ -4633,10 +4717,18 @@ var import_core18 = require("@deck.gl/core");
4633
4717
  var import_layers13 = require("@deck.gl/layers");
4634
4718
 
4635
4719
  // dist/style/graph-layer-stylesheet.js
4720
+ var DEFAULT_GRAPH_LAYER_STYLESHEET_INPUT = {
4721
+ nodes: [],
4722
+ edges: [
4723
+ {
4724
+ type: "edge",
4725
+ stroke: "black",
4726
+ strokeWidth: 1
4727
+ }
4728
+ ]
4729
+ };
4636
4730
  var DEFAULT_EDGE_STYLE = {
4637
- type: "edge",
4638
- stroke: "black",
4639
- strokeWidth: 1,
4731
+ ...DEFAULT_GRAPH_LAYER_STYLESHEET_INPUT.edges[0],
4640
4732
  decorators: []
4641
4733
  };
4642
4734
  var DEFAULT_GRAPH_LAYER_STYLESHEET = {
@@ -5704,8 +5796,8 @@ __publicField(CurvedEdgeLayer, "layerName", "CurvedEdgeLayer");
5704
5796
 
5705
5797
  // dist/layers/edge-layer.js
5706
5798
  var EDGE_LAYER_MAP = {
5707
- "line": StraightLineEdgeLayer,
5708
- "path": PathEdgeLayer,
5799
+ line: StraightLineEdgeLayer,
5800
+ path: PathEdgeLayer,
5709
5801
  "spline-curve": CurvedEdgeLayer
5710
5802
  };
5711
5803
  var EdgeLayer = class extends import_core13.CompositeLayer {
@@ -5722,8 +5814,8 @@ var EdgeLayer = class extends import_core13.CompositeLayer {
5722
5814
  res[type].push(d);
5723
5815
  return res;
5724
5816
  }, {
5725
- "line": [],
5726
- "path": [],
5817
+ line: [],
5818
+ path: [],
5727
5819
  "spline-curve": []
5728
5820
  });
5729
5821
  this.setState({ typedEdgeData });
@@ -6062,14 +6154,7 @@ function getArrowAttributes({ length = 1, headWidth = 1 }) {
6062
6154
  0
6063
6155
  ]);
6064
6156
  const normals = new Float32Array([0, 0, 1, 0, 0, 1, 0, 0, 1]);
6065
- const texCoords = new Float32Array([
6066
- 0.5,
6067
- 1,
6068
- 0,
6069
- 0,
6070
- 1,
6071
- 0
6072
- ]);
6157
+ const texCoords = new Float32Array([0.5, 1, 0, 0, 1, 0]);
6073
6158
  return {
6074
6159
  positions: { size: 3, value: positions },
6075
6160
  normals: { size: 3, value: normals },
@@ -6667,31 +6752,6 @@ __publicField(GridLayer, "defaultProps", {
6667
6752
  labelOffset: DEFAULT_OFFSET
6668
6753
  });
6669
6754
 
6670
- // dist/loaders/json-graph-loader.js
6671
- var VERSION = true ? "9.2.0-beta.6" : "latest";
6672
- var JSONGraphLoader = {
6673
- dataType: null,
6674
- batchType: null,
6675
- name: "DOT Graph",
6676
- id: "dot-graph",
6677
- module: "graph-layers",
6678
- version: VERSION,
6679
- worker: false,
6680
- extensions: ["json"],
6681
- mimeTypes: ["application/json"],
6682
- text: true,
6683
- options: {
6684
- "jsongraph": {}
6685
- },
6686
- parse: async (arrayBuffer, options) => {
6687
- const text = new TextDecoder().decode(arrayBuffer);
6688
- return Promise.resolve(JSONGraphLoader.parseTextSync(text, options));
6689
- },
6690
- parseTextSync: (text, options) => {
6691
- throw new Error("JSONGraphLoader.parseTextSync not implemented");
6692
- }
6693
- };
6694
-
6695
6755
  // dist/utils/layer-utils.js
6696
6756
  var mixedGetPosition = (getPosition, getOffset2) => {
6697
6757
  if (!getOffset2) {
@@ -7382,20 +7442,34 @@ function selectRankLines(ranks, { yMin, yMax, maxCount = 8 }) {
7382
7442
  return selected.map((index) => filtered[index]);
7383
7443
  }
7384
7444
 
7445
+ // dist/graph-data/graph-data.js
7446
+ function isArrowGraphData(value) {
7447
+ const candidate = value;
7448
+ return typeof value === "object" && (candidate == null ? void 0 : candidate.shape) === "arrow-graph-data";
7449
+ }
7450
+
7451
+ // dist/graph/functions/create-graph-from-data.js
7452
+ function createGraphFromData(data, props = {}) {
7453
+ if (isArrowGraphData(data)) {
7454
+ return new ArrowGraph({ ...props, data });
7455
+ }
7456
+ return new ClassicGraph({ ...props, data });
7457
+ }
7458
+
7385
7459
  // dist/layers/graph-layer.js
7386
7460
  var NODE_LAYER_MAP = {
7387
- "rectangle": RectangleLayer,
7461
+ rectangle: RectangleLayer,
7388
7462
  "rounded-rectangle": RoundedRectangleLayer,
7389
7463
  "path-rounded-rectangle": PathBasedRoundedRectangleLayer,
7390
- "icon": ImageLayer,
7391
- "circle": CircleLayer,
7392
- "label": LabelLayer,
7393
- "marker": ZoomableMarkerLayer
7464
+ icon: ImageLayer,
7465
+ circle: CircleLayer,
7466
+ label: LabelLayer,
7467
+ marker: ZoomableMarkerLayer
7394
7468
  };
7395
7469
  var EDGE_DECORATOR_LAYER_MAP = {
7396
7470
  "edge-label": EdgeLabelLayer,
7397
- "flow": FlowLayer,
7398
- "arrow": EdgeArrowLayer
7471
+ flow: FlowLayer,
7472
+ arrow: EdgeArrowLayer
7399
7473
  };
7400
7474
  var SHARED_LAYER_PROPS = {
7401
7475
  coordinateSystem: import_core18.COORDINATE_SYSTEM.CARTESIAN,
@@ -7411,6 +7485,12 @@ var NODE_STYLE_DEPRECATION_WARNED = false;
7411
7485
  var EDGE_STYLE_DEPRECATION_WARNED = false;
7412
7486
  var GRAPH_PROP_DEPRECATION_WARNED = false;
7413
7487
  var LAYOUT_REQUIRED_WARNED = false;
7488
+ var DEFAULT_GRAPH_LOADER = ({ json }) => {
7489
+ if (!json || typeof json !== "object") {
7490
+ return null;
7491
+ }
7492
+ return createGraphFromData(json);
7493
+ };
7414
7494
  var _GraphLayer = class extends import_core18.CompositeLayer {
7415
7495
  // @ts-expect-error Some typescript confusion due to override of base class state
7416
7496
  state;
@@ -7605,7 +7685,7 @@ var _GraphLayer = class extends import_core18.CompositeLayer {
7605
7685
  return void 0;
7606
7686
  }
7607
7687
  if (Array.isArray(data) || isPlainObject(data)) {
7608
- const loader = props.graphLoader ?? JSONGraphLoader;
7688
+ const loader = props.graphLoader ?? DEFAULT_GRAPH_LOADER;
7609
7689
  const graph = loader({ json: data });
7610
7690
  if (!graph) {
7611
7691
  return null;
@@ -8090,12 +8170,11 @@ var GraphLayer = _GraphLayer;
8090
8170
  __publicField(GraphLayer, "layerName", "GraphLayer");
8091
8171
  __publicField(GraphLayer, "defaultProps", {
8092
8172
  // Composite layer props
8093
- // @ts-expect-error composite layer props
8094
8173
  pickable: true,
8095
8174
  data: { type: "object", value: null, async: true },
8096
8175
  // Graph props
8097
- graphLoader: JSONGraphLoader,
8098
- stylesheet: DEFAULT_GRAPH_LAYER_STYLESHEET,
8176
+ graphLoader: DEFAULT_GRAPH_LOADER,
8177
+ stylesheet: DEFAULT_GRAPH_LAYER_STYLESHEET_INPUT,
8099
8178
  nodeStyle: void 0,
8100
8179
  nodeEvents: {
8101
8180
  onMouseLeave: () => {
@@ -8128,8 +8207,33 @@ function isPlainObject(value) {
8128
8207
  return prototype === Object.prototype || prototype === null;
8129
8208
  }
8130
8209
 
8210
+ // dist/loaders/json-graph-loader.js
8211
+ var VERSION = true ? "9.2.5" : "latest";
8212
+ var JSONGraphLoader = {
8213
+ dataType: null,
8214
+ batchType: null,
8215
+ name: "DOT Graph",
8216
+ id: "dot-graph",
8217
+ module: "graph-layers",
8218
+ version: VERSION,
8219
+ worker: false,
8220
+ extensions: ["json"],
8221
+ mimeTypes: ["application/json"],
8222
+ text: true,
8223
+ options: {
8224
+ jsongraph: {}
8225
+ },
8226
+ parse: async (arrayBuffer, options) => {
8227
+ const text = new TextDecoder().decode(arrayBuffer);
8228
+ return Promise.resolve(JSONGraphLoader.parseTextSync(text, options));
8229
+ },
8230
+ parseTextSync: (text, options) => {
8231
+ throw new Error("JSONGraphLoader.parseTextSync not implemented");
8232
+ }
8233
+ };
8234
+
8131
8235
  // dist/loaders/dot-graph-loader.js
8132
- var VERSION2 = true ? "9.2.0-beta.6" : "latest";
8236
+ var VERSION2 = true ? "9.2.5" : "latest";
8133
8237
  var DOTGraphLoader = {
8134
8238
  dataType: null,
8135
8239
  batchType: null,
@@ -8410,7 +8514,11 @@ var DOTParser = class {
8410
8514
  graphAttributes: {}
8411
8515
  };
8412
8516
  this.scopes.push(context);
8413
- this.result.subgraphs.set(subgraphId, { id: subgraphId, attributes: context.graphAttributes, parentId });
8517
+ this.result.subgraphs.set(subgraphId, {
8518
+ id: subgraphId,
8519
+ attributes: context.graphAttributes,
8520
+ parentId
8521
+ });
8414
8522
  let shouldContinue = true;
8415
8523
  while (shouldContinue) {
8416
8524
  if (this.match("rbrace")) {