@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
@@ -154,7 +154,6 @@ type SupportedScale =
154
154
  | ReturnType<typeof scaleLinear>
155
155
  | ReturnType<typeof scaleLog>
156
156
  | ReturnType<typeof scalePow>
157
-
158
157
  | ReturnType<typeof scaleQuantize>
159
158
  | ReturnType<typeof scaleQuantile>
160
159
  | ReturnType<typeof scaleOrdinal>;
@@ -194,10 +193,18 @@ function createScaleFromConfig(config: GraphStyleScale): SupportedScale {
194
193
  if (config.range && 'range' in scale) {
195
194
  anyScale.range(config.range as never);
196
195
  }
197
- if (typeof config.clamp === 'boolean' && 'clamp' in scale && typeof anyScale.clamp === 'function') {
196
+ if (
197
+ typeof config.clamp === 'boolean' &&
198
+ 'clamp' in scale &&
199
+ typeof anyScale.clamp === 'function'
200
+ ) {
198
201
  anyScale.clamp(config.clamp);
199
202
  }
200
- if (typeof config.nice !== 'undefined' && 'nice' in scale && typeof anyScale.nice === 'function') {
203
+ if (
204
+ typeof config.nice !== 'undefined' &&
205
+ 'nice' in scale &&
206
+ typeof anyScale.nice === 'function'
207
+ ) {
201
208
  anyScale.nice(config.nice as never);
202
209
  }
203
210
  if (
@@ -273,12 +280,22 @@ function isAttributeReference(value: unknown): value is GraphStyleAttributeRefer
273
280
  if (typeof value === 'string') {
274
281
  return value.startsWith('@');
275
282
  }
276
- return Boolean(value) && typeof value === 'object' && !Array.isArray(value) && 'attribute' in (value as Record<string, unknown>);
283
+ return (
284
+ Boolean(value) &&
285
+ typeof value === 'object' &&
286
+ !Array.isArray(value) &&
287
+ 'attribute' in (value as Record<string, unknown>)
288
+ );
277
289
  }
278
290
 
279
291
  /** Determine whether a style value maps interaction states. */
280
292
  function isStatefulValue(value: unknown): value is Record<string, GraphStyleLeafValue> {
281
- return Boolean(value) && typeof value === 'object' && !Array.isArray(value) && !isAttributeReference(value);
293
+ return (
294
+ Boolean(value) &&
295
+ typeof value === 'object' &&
296
+ !Array.isArray(value) &&
297
+ !isAttributeReference(value)
298
+ );
282
299
  }
283
300
 
284
301
  /** Resolve an attribute from a datum or `Graph` entity. */
@@ -424,7 +441,9 @@ function createStatefulAccessor(
424
441
  }
425
442
 
426
443
  const defaultValue =
427
- typeof valueMap.default !== 'undefined' ? valueMap.default : parseLeafValue(key, undefined).value;
444
+ typeof valueMap.default !== 'undefined'
445
+ ? valueMap.default
446
+ : parseLeafValue(key, undefined).value;
428
447
 
429
448
  const accessor = (datum: any) => {
430
449
  const stateValue = datum?.state ? valueMap[datum.state] : undefined;
@@ -460,11 +479,7 @@ export class StyleProperty {
460
479
  this._updateTrigger = false;
461
480
 
462
481
  if (isStatefulValue(value)) {
463
- const {accessor, updateTrigger: triggers} = createStatefulAccessor(
464
- key,
465
- value,
466
- updateTrigger
467
- );
482
+ const {accessor, updateTrigger: triggers} = createStatefulAccessor(key, value, updateTrigger);
468
483
  this._value = accessor;
469
484
  this._valueType = VALUE_TYPE.ACCESSOR;
470
485
  this._updateTrigger = triggers;
@@ -75,32 +75,41 @@ export class StylesheetEngine<TStyleProperty extends StyleProperty = StyleProper
75
75
 
76
76
  const attributes = Object.values(rules).reduce<string[]>((res, rule) => {
77
77
  const attrs = Object.keys(rule || {});
78
- const set = new Set([...(res), ...attrs]);
78
+ const set = new Set([...res, ...attrs]);
79
79
  return Array.from(set);
80
80
  }, []);
81
81
 
82
- const attrMap = attributes.reduce((res, attr) => {
83
- res[attr] = Object.entries(rules).reduce((acc, entry) => {
84
- const [state, rule] = entry;
85
- if (rule && typeof (rule as any)[attr] !== 'undefined') {
86
- (acc as any)[state] = (rule as any)[attr];
82
+ const attrMap = attributes.reduce(
83
+ (res, attr) => {
84
+ res[attr] = Object.entries(rules).reduce(
85
+ (acc, entry) => {
86
+ const [state, rule] = entry;
87
+ if (rule && typeof (rule as any)[attr] !== 'undefined') {
88
+ (acc as any)[state] = (rule as any)[attr];
89
+ }
90
+ return acc;
91
+ },
92
+ {} as Record<string, unknown>
93
+ );
94
+ return res;
95
+ },
96
+ {} as Record<string, any>
97
+ );
98
+
99
+ const simplifiedStyleMap = Object.entries(attrMap).reduce(
100
+ (res, entry) => {
101
+ const [attr, valueMap] = entry as [string, Record<string, unknown>];
102
+ const states = Object.keys(valueMap);
103
+ const onlyDefault = states.length === 1 && valueMap.default !== undefined;
104
+ if (onlyDefault) {
105
+ res[attr] = valueMap.default;
106
+ return res;
87
107
  }
88
- return acc;
89
- }, {} as Record<string, unknown>);
90
- return res;
91
- }, {} as Record<string, any>);
92
-
93
- const simplifiedStyleMap = Object.entries(attrMap).reduce((res, entry) => {
94
- const [attr, valueMap] = entry as [string, Record<string, unknown>];
95
- const states = Object.keys(valueMap);
96
- const onlyDefault = states.length === 1 && valueMap.default !== undefined;
97
- if (onlyDefault) {
98
- res[attr] = valueMap.default;
108
+ res[attr] = valueMap;
99
109
  return res;
100
- }
101
- res[attr] = valueMap;
102
- return res;
103
- }, {} as Record<string, unknown>);
110
+ },
111
+ {} as Record<string, unknown>
112
+ );
104
113
 
105
114
  this.properties = {} as Record<string, TStyleProperty>;
106
115
  for (const key in simplifiedStyleMap) {
@@ -153,16 +162,22 @@ export class StylesheetEngine<TStyleProperty extends StyleProperty = StyleProper
153
162
 
154
163
  getDeckGLAccessors() {
155
164
  const accessorMap = this.getDeckGLAccessorMapForType();
156
- return Object.keys(accessorMap).reduce((res, accessor) => {
157
- res[accessor] = this.getDeckGLAccessor(accessor);
158
- return res;
159
- }, {} as Record<string, (...args: any[]) => unknown>);
165
+ return Object.keys(accessorMap).reduce(
166
+ (res, accessor) => {
167
+ res[accessor] = this.getDeckGLAccessor(accessor);
168
+ return res;
169
+ },
170
+ {} as Record<string, (...args: any[]) => unknown>
171
+ );
160
172
  }
161
173
 
162
174
  getDeckGLUpdateTriggers() {
163
- return this.getDeckGLUpdateTriggersForType().reduce((res, accessor) => {
164
- res[accessor] = this.getDeckGLAccessorUpdateTrigger(accessor);
165
- return res;
166
- }, {} as Record<string, unknown>);
175
+ return this.getDeckGLUpdateTriggersForType().reduce(
176
+ (res, accessor) => {
177
+ res[accessor] = this.getDeckGLAccessorUpdateTrigger(accessor);
178
+ return res;
179
+ },
180
+ {} as Record<string, unknown>
181
+ );
167
182
  }
168
183
  }
@@ -100,7 +100,9 @@ export function getRepresentativeNodes(engine: GraphEngine | null | undefined):
100
100
 
101
101
  export type ChainOutlineGetter = (node: NodeInterface) => [number, number][] | null;
102
102
 
103
- export function createChainOutlineGetter(engine: GraphEngine | null | undefined): ChainOutlineGetter {
103
+ export function createChainOutlineGetter(
104
+ engine: GraphEngine | null | undefined
105
+ ): ChainOutlineGetter {
104
106
  if (!engine) {
105
107
  return () => null;
106
108
  }
@@ -240,7 +242,9 @@ export function buildCollapsedChainLayers(
240
242
  );
241
243
  const collapsedOutlineNodes = collapsedNodes.filter((node) => getChainOutlinePolygon(node));
242
244
 
243
- const expandedNodes = representativeNodes.filter((node) => !node.getPropertyValue('isCollapsedChain'));
245
+ const expandedNodes = representativeNodes.filter(
246
+ (node) => !node.getPropertyValue('isCollapsedChain')
247
+ );
244
248
  const expandedOutlineNodes = expandedNodes.filter((node) => getChainOutlinePolygon(node));
245
249
 
246
250
  return {
@@ -98,7 +98,7 @@ function intersectsInnerFaces(
98
98
  return insideVerticalFace || insideHorizontalFace;
99
99
  }
100
100
 
101
- // eslint-disable-next-line max-params
101
+ // eslint-disable-next-line max-params
102
102
  function projectToCornerArc(
103
103
  geometry: NodeGeometry,
104
104
  unit: [number, number],
@@ -176,8 +176,7 @@ function computeRoundedRectangleIntersection(
176
176
  const absX = Math.abs(rectanglePoint[0] - geometry.center[0]);
177
177
  const absY = Math.abs(rectanglePoint[1] - geometry.center[1]);
178
178
 
179
- const touchesInnerFace =
180
- absX <= innerHalfWidth + EPSILON || absY <= innerHalfHeight + EPSILON;
179
+ const touchesInnerFace = absX <= innerHalfWidth + EPSILON || absY <= innerHalfHeight + EPSILON;
181
180
 
182
181
  if (
183
182
  touchesInnerFace &&
@@ -61,10 +61,7 @@ function fallbackMonotonicSpacing(positions: RankPosition[]) {
61
61
  }
62
62
  }
63
63
 
64
- function enforceMonotonicPositions(
65
- positions: RankPosition[],
66
- range: {min: number; max: number}
67
- ) {
64
+ function enforceMonotonicPositions(positions: RankPosition[], range: {min: number; max: number}) {
68
65
  if (positions.length === 0) {
69
66
  return;
70
67
  }
@@ -95,8 +92,10 @@ function resolveTargetRange(
95
92
  range: {min: number; max: number},
96
93
  override?: {min?: number; max?: number}
97
94
  ): {min: number; max: number} {
98
- const overrideMin = typeof override?.min === 'number' && Number.isFinite(override.min) ? override.min : undefined;
99
- const overrideMax = typeof override?.max === 'number' && Number.isFinite(override.max) ? override.max : undefined;
95
+ const overrideMin =
96
+ typeof override?.min === 'number' && Number.isFinite(override.min) ? override.min : undefined;
97
+ const overrideMax =
98
+ typeof override?.max === 'number' && Number.isFinite(override.max) ? override.max : undefined;
100
99
 
101
100
  const candidateMin = overrideMin ?? range.min;
102
101
  const candidateMax = overrideMax ?? range.max;
@@ -188,7 +187,9 @@ function normalizeRankAccessor(accessor: RankAccessor | undefined): (node: Node)
188
187
  };
189
188
  }
190
189
 
191
- function normalizeLabelAccessor(accessor: LabelAccessor | undefined): (node: Node) => string | number | null {
190
+ function normalizeLabelAccessor(
191
+ accessor: LabelAccessor | undefined
192
+ ): (node: Node) => string | number | null {
192
193
  if (!accessor) {
193
194
  return (node: Node) => {
194
195
  const value = node.getPropertyValue('rankLabel');
@@ -248,11 +249,13 @@ export function mapRanksToYPositions(
248
249
  }
249
250
 
250
251
  const {aggregates, range} = state;
251
- const positions: RankPosition[] = Array.from(aggregates.entries()).map(([rank, {sum, count, label}]) => ({
252
- rank,
253
- yPosition: count ? sum / count : 0,
254
- label: label ?? rank
255
- }));
252
+ const positions: RankPosition[] = Array.from(aggregates.entries()).map(
253
+ ([rank, {sum, count, label}]) => ({
254
+ rank,
255
+ yPosition: count ? sum / count : 0,
256
+ label: label ?? rank
257
+ })
258
+ );
256
259
 
257
260
  positions.sort((a, b) => a.rank - b.rank);
258
261
 
@@ -305,7 +308,10 @@ function pickNearestAvailableIndex(
305
308
  const distance = Math.abs(ranks[index].yPosition - target);
306
309
  const isCloser = distance < bestDistance;
307
310
  const isTie = distance === bestDistance && bestIndex !== -1;
308
- if (isCloser || (isTie && (ranks[index].yPosition < ranks[bestIndex].yPosition || index < bestIndex))) {
311
+ if (
312
+ isCloser ||
313
+ (isTie && (ranks[index].yPosition < ranks[bestIndex].yPosition || index < bestIndex))
314
+ ) {
309
315
  bestDistance = distance;
310
316
  bestIndex = index;
311
317
  }
@@ -314,7 +320,11 @@ function pickNearestAvailableIndex(
314
320
  consider(startIndex);
315
321
  consider(startIndex - 1);
316
322
 
317
- for (let offset = 1; bestIndex === -1 && (startIndex - offset >= 0 || startIndex + offset < ranks.length); offset++) {
323
+ for (
324
+ let offset = 1;
325
+ bestIndex === -1 && (startIndex - offset >= 0 || startIndex + offset < ranks.length);
326
+ offset++
327
+ ) {
318
328
  consider(startIndex - offset);
319
329
  consider(startIndex + offset);
320
330
  }
@@ -385,7 +395,9 @@ function chooseEvenlySpacedIndices(ranks: RankPosition[], maxCount: number): num
385
395
 
386
396
  fillRemainingSelections(used, lastIndex, maxCount);
387
397
 
388
- return Array.from(used).sort((a, b) => a - b).slice(0, maxCount);
398
+ return Array.from(used)
399
+ .sort((a, b) => a - b)
400
+ .slice(0, maxCount);
389
401
  }
390
402
 
391
403
  /**
@@ -403,7 +415,10 @@ export function selectRankLines(
403
415
  const max = Math.max(yMin, yMax);
404
416
 
405
417
  const filtered = ranks
406
- .filter((entry) => Number.isFinite(entry.yPosition) && entry.yPosition >= min && entry.yPosition <= max)
418
+ .filter(
419
+ (entry) =>
420
+ Number.isFinite(entry.yPosition) && entry.yPosition >= min && entry.yPosition <= max
421
+ )
407
422
  .sort((a, b) => a.yPosition - b.yPosition);
408
423
 
409
424
  if (filtered.length === 0) {
@@ -423,4 +438,3 @@ export function selectRankLines(
423
438
  const selected = chooseEvenlySpacedIndices(filtered, maxCount);
424
439
  return selected.map((index) => filtered[index]);
425
440
  }
426
-
@@ -1,311 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Supported scale identifiers for mapping data values to visual encodings.
4
- */
5
- export declare const GraphStyleScaleTypeEnum: z.ZodEnum<{
6
- linear: "linear";
7
- log: "log";
8
- pow: "pow";
9
- sqrt: "sqrt";
10
- quantize: "quantize";
11
- quantile: "quantile";
12
- ordinal: "ordinal";
13
- }>;
14
- /**
15
- * TypeScript union of {@link GraphStyleScaleTypeEnum} values.
16
- */
17
- export type GraphStyleScaleType = z.infer<typeof GraphStyleScaleTypeEnum>;
18
- /**
19
- * Configuration for data-driven style scaling. Supports deck.gl compatible numeric and
20
- * categorical scaling with optional d3-scale like parameters.
21
- */
22
- export declare const GraphStyleScaleSchema: z.ZodObject<{
23
- type: z.ZodOptional<z.ZodEnum<{
24
- linear: "linear";
25
- log: "log";
26
- pow: "pow";
27
- sqrt: "sqrt";
28
- quantize: "quantize";
29
- quantile: "quantile";
30
- ordinal: "ordinal";
31
- }>>;
32
- domain: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
33
- range: z.ZodOptional<z.ZodArray<z.ZodAny>>;
34
- clamp: z.ZodOptional<z.ZodBoolean>;
35
- nice: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
36
- base: z.ZodOptional<z.ZodNumber>;
37
- exponent: z.ZodOptional<z.ZodNumber>;
38
- unknown: z.ZodOptional<z.ZodAny>;
39
- }, z.core.$strict>;
40
- /**
41
- * TypeScript view of {@link GraphStyleScaleSchema} after parsing.
42
- */
43
- export type GraphStyleScale = z.infer<typeof GraphStyleScaleSchema>;
44
- /**
45
- * Reference to node/edge attributes, optionally including fallback values and scale
46
- * configuration for data-driven styling.
47
- */
48
- export declare const GraphStyleAttributeReferenceSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
49
- attribute: z.ZodString;
50
- fallback: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>>;
51
- scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
52
- type: z.ZodOptional<z.ZodEnum<{
53
- linear: "linear";
54
- log: "log";
55
- pow: "pow";
56
- sqrt: "sqrt";
57
- quantize: "quantize";
58
- quantile: "quantile";
59
- ordinal: "ordinal";
60
- }>>;
61
- domain: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
62
- range: z.ZodOptional<z.ZodArray<z.ZodAny>>;
63
- clamp: z.ZodOptional<z.ZodBoolean>;
64
- nice: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
65
- base: z.ZodOptional<z.ZodNumber>;
66
- exponent: z.ZodOptional<z.ZodNumber>;
67
- unknown: z.ZodOptional<z.ZodAny>;
68
- }, z.core.$strict>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>>;
69
- }, z.core.$strict>]>;
70
- /**
71
- * Parsed value produced by {@link GraphStyleAttributeReferenceSchema}.
72
- */
73
- export type GraphStyleAttributeReference = z.infer<typeof GraphStyleAttributeReferenceSchema>;
74
- /**
75
- * Primitive value allowed in stylesheet definitions. Supports literal values, attribute
76
- * references and imperative resolver functions.
77
- */
78
- export declare const GraphStyleLeafValueSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
79
- attribute: z.ZodString;
80
- fallback: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>>;
81
- scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
82
- type: z.ZodOptional<z.ZodEnum<{
83
- linear: "linear";
84
- log: "log";
85
- pow: "pow";
86
- sqrt: "sqrt";
87
- quantize: "quantize";
88
- quantile: "quantile";
89
- ordinal: "ordinal";
90
- }>>;
91
- domain: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
92
- range: z.ZodOptional<z.ZodArray<z.ZodAny>>;
93
- clamp: z.ZodOptional<z.ZodBoolean>;
94
- nice: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
95
- base: z.ZodOptional<z.ZodNumber>;
96
- exponent: z.ZodOptional<z.ZodNumber>;
97
- unknown: z.ZodOptional<z.ZodAny>;
98
- }, z.core.$strict>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>>;
99
- }, z.core.$strict>]>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>;
100
- /**
101
- * Union of literal, attribute-driven and functional style values.
102
- */
103
- export type GraphStyleLeafValue = z.infer<typeof GraphStyleLeafValueSchema>;
104
- /**
105
- * Mapping of interaction or application state keys to leaf style values.
106
- */
107
- export declare const GraphStyleStateMapSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
108
- attribute: z.ZodString;
109
- fallback: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>>;
110
- scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
111
- type: z.ZodOptional<z.ZodEnum<{
112
- linear: "linear";
113
- log: "log";
114
- pow: "pow";
115
- sqrt: "sqrt";
116
- quantize: "quantize";
117
- quantile: "quantile";
118
- ordinal: "ordinal";
119
- }>>;
120
- domain: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
121
- range: z.ZodOptional<z.ZodArray<z.ZodAny>>;
122
- clamp: z.ZodOptional<z.ZodBoolean>;
123
- nice: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
124
- base: z.ZodOptional<z.ZodNumber>;
125
- exponent: z.ZodOptional<z.ZodNumber>;
126
- unknown: z.ZodOptional<z.ZodAny>;
127
- }, z.core.$strict>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>>;
128
- }, z.core.$strict>]>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>>;
129
- /**
130
- * Style value that may be either a simple leaf value or a keyed map of overrides.
131
- */
132
- export declare const GraphStyleValueSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
133
- attribute: z.ZodString;
134
- fallback: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>>;
135
- scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
136
- type: z.ZodOptional<z.ZodEnum<{
137
- linear: "linear";
138
- log: "log";
139
- pow: "pow";
140
- sqrt: "sqrt";
141
- quantize: "quantize";
142
- quantile: "quantile";
143
- ordinal: "ordinal";
144
- }>>;
145
- domain: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
146
- range: z.ZodOptional<z.ZodArray<z.ZodAny>>;
147
- clamp: z.ZodOptional<z.ZodBoolean>;
148
- nice: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
149
- base: z.ZodOptional<z.ZodNumber>;
150
- exponent: z.ZodOptional<z.ZodNumber>;
151
- unknown: z.ZodOptional<z.ZodAny>;
152
- }, z.core.$strict>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>>;
153
- }, z.core.$strict>]>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
154
- attribute: z.ZodString;
155
- fallback: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>>;
156
- scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
157
- type: z.ZodOptional<z.ZodEnum<{
158
- linear: "linear";
159
- log: "log";
160
- pow: "pow";
161
- sqrt: "sqrt";
162
- quantize: "quantize";
163
- quantile: "quantile";
164
- ordinal: "ordinal";
165
- }>>;
166
- domain: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
167
- range: z.ZodOptional<z.ZodArray<z.ZodAny>>;
168
- clamp: z.ZodOptional<z.ZodBoolean>;
169
- nice: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>>;
170
- base: z.ZodOptional<z.ZodNumber>;
171
- exponent: z.ZodOptional<z.ZodNumber>;
172
- unknown: z.ZodOptional<z.ZodAny>;
173
- }, z.core.$strict>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>>;
174
- }, z.core.$strict>]>, z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>]>>]>;
175
- /**
176
- * Parsed style property value that may include state overrides.
177
- */
178
- export type GraphStyleValue = z.infer<typeof GraphStyleValueSchema>;
179
- /**
180
- * Translation table between graph style properties and the underlying deck.gl accessors for
181
- * each supported style primitive type.
182
- */
183
- export declare const GRAPH_DECKGL_ACCESSOR_MAP: {
184
- readonly circle: {
185
- readonly getFillColor: "fill";
186
- readonly getLineColor: "stroke";
187
- readonly getLineWidth: "strokeWidth";
188
- readonly getRadius: "radius";
189
- readonly getOffset: "offset";
190
- readonly opacity: "opacity";
191
- };
192
- readonly rectangle: {
193
- readonly getWidth: "width";
194
- readonly getHeight: "height";
195
- readonly getFillColor: "fill";
196
- readonly getLineColor: "stroke";
197
- readonly getLineWidth: "strokeWidth";
198
- readonly getOffset: "offset";
199
- readonly opacity: "opacity";
200
- };
201
- readonly 'rounded-rectangle': {
202
- readonly getCornerRadius: "cornerRadius";
203
- readonly getRadius: "radius";
204
- readonly getWidth: "width";
205
- readonly getHeight: "height";
206
- readonly getFillColor: "fill";
207
- readonly getLineColor: "stroke";
208
- readonly getLineWidth: "strokeWidth";
209
- readonly getOffset: "offset";
210
- readonly opacity: "opacity";
211
- };
212
- readonly 'path-rounded-rectangle': {
213
- readonly getWidth: "width";
214
- readonly getHeight: "height";
215
- readonly getFillColor: "fill";
216
- readonly getLineColor: "stroke";
217
- readonly getLineWidth: "strokeWidth";
218
- readonly getCornerRadius: "cornerRadius";
219
- readonly getOffset: "offset";
220
- readonly opacity: "opacity";
221
- };
222
- readonly label: {
223
- readonly getColor: "color";
224
- readonly getText: "text";
225
- readonly getSize: "fontSize";
226
- readonly getTextAnchor: "textAnchor";
227
- readonly getAlignmentBaseline: "alignmentBaseline";
228
- readonly getAngle: "angle";
229
- readonly scaleWithZoom: "scaleWithZoom";
230
- readonly textMaxWidth: "textMaxWidth";
231
- readonly textWordBreak: "textWordBreak";
232
- readonly textSizeMinPixels: "textSizeMinPixels";
233
- readonly getOffset: "offset";
234
- readonly opacity: "opacity";
235
- };
236
- readonly marker: {
237
- readonly getColor: "fill";
238
- readonly getSize: "size";
239
- readonly getMarker: "marker";
240
- readonly scaleWithZoom: "scaleWithZoom";
241
- readonly getOffset: "offset";
242
- readonly opacity: "opacity";
243
- };
244
- readonly Edge: {
245
- readonly getColor: "stroke";
246
- readonly getWidth: "strokeWidth";
247
- };
248
- readonly edge: {
249
- readonly getColor: "stroke";
250
- readonly getWidth: "strokeWidth";
251
- };
252
- readonly 'edge-label': {
253
- readonly getColor: "color";
254
- readonly getText: "text";
255
- readonly getSize: "fontSize";
256
- readonly getTextAnchor: "textAnchor";
257
- readonly getAlignmentBaseline: "alignmentBaseline";
258
- readonly scaleWithZoom: "scaleWithZoom";
259
- readonly textMaxWidth: "textMaxWidth";
260
- readonly textWordBreak: "textWordBreak";
261
- readonly textSizeMinPixels: "textSizeMinPixels";
262
- };
263
- readonly flow: {
264
- readonly getColor: "color";
265
- readonly getWidth: "width";
266
- readonly getSpeed: "speed";
267
- readonly getTailLength: "tailLength";
268
- };
269
- readonly arrow: {
270
- readonly getColor: "color";
271
- readonly getSize: "size";
272
- readonly getOffset: "offset";
273
- };
274
- };
275
- /**
276
- * Supported graph style primitive identifiers (e.g. `circle`, `edge`).
277
- */
278
- export type GraphStyleType = keyof typeof GRAPH_DECKGL_ACCESSOR_MAP;
279
- /**
280
- * CSS-like pseudo selector supported by the stylesheet for state overrides.
281
- */
282
- export type GraphStyleSelector = `:${string}`;
283
- type GraphStylePropertyKey<TType extends GraphStyleType> = Extract<(typeof GRAPH_DECKGL_ACCESSOR_MAP)[TType][keyof (typeof GRAPH_DECKGL_ACCESSOR_MAP)[TType]], PropertyKey>;
284
- type GraphStyleStatefulValue<TValue> = TValue | {
285
- [state: string]: TValue;
286
- };
287
- type GraphStylePropertyMap<TType extends GraphStyleType, TValue> = Partial<Record<GraphStylePropertyKey<TType>, GraphStyleStatefulValue<TValue>>>;
288
- /**
289
- * Typed representation of a stylesheet definition for a specific graph primitive.
290
- */
291
- export type GraphStylesheet<TType extends GraphStyleType = GraphStyleType, TValue = GraphStyleLeafValue> = {
292
- type: TType;
293
- } & GraphStylePropertyMap<TType, TValue> & Partial<Record<GraphStyleSelector, GraphStylePropertyMap<TType, TValue>>>;
294
- /**
295
- * Schema that validates stylesheet definitions for all graph style primitives.
296
- */
297
- export declare const GraphStylesheetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
298
- [x: string]: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
299
- }, z.core.$catchall<z.ZodUnknown>>, ...z.ZodObject<{
300
- [x: string]: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
301
- }, z.core.$catchall<z.ZodUnknown>>[]], "type">;
302
- /**
303
- * Runtime type accepted by {@link GraphStylesheetSchema} before validation.
304
- */
305
- export type GraphStylesheetInput = z.input<typeof GraphStylesheetSchema>;
306
- /**
307
- * Type returned by {@link GraphStylesheetSchema} after successful parsing.
308
- */
309
- export type GraphStylesheetParsed = z.infer<typeof GraphStylesheetSchema>;
310
- export {};
311
- //# sourceMappingURL=graph-stylesheet.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graph-stylesheet.schema.d.ts","sourceRoot":"","sources":["../../src/style/graph-stylesheet.schema.ts"],"names":[],"mappings":"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"}