Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions modules/experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,16 @@
},
"dependencies": {
"@deck.gl/core": "~9.2.1",
"@deck.gl/extensions": "~9.2.1",
"@deck.gl/geo-layers": "~9.2.1",
"@deck.gl/layers": "~9.2.1",
"@deck.gl/mesh-layers": "~9.2.1",
"@deck.gl/react": "~9.2.1",
"@deck.gl/widgets": "~9.2.1",
"@loaders.gl/core": "^4.2.0",
"@loaders.gl/i3s": "^4.2.0",
"@loaders.gl/loader-utils": "^4.2.0",
"@loaders.gl/schema": "^4.2.0",
"@loaders.gl/tiles": "^4.2.0",
"@luma.gl/core": "~9.2.0",
"@luma.gl/engine": "~9.2.0",
"@luma.gl/shadertools": "~9.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"@luma.gl/shadertools": "~9.2.0"
}
}
13 changes: 1 addition & 12 deletions modules/geo-layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,15 @@
},
"dependencies": {
"@deck.gl/core": "~9.2.1",
"@deck.gl/extensions": "~9.2.1",
"@deck.gl/geo-layers": "~9.2.1",
"@deck.gl/layers": "~9.2.1",
"@deck.gl/mesh-layers": "~9.2.1",
"@deck.gl/react": "~9.2.1",
"@deck.gl/widgets": "~9.2.1",
"@loaders.gl/core": "^4.2.0",
"@loaders.gl/i3s": "^4.2.0",
"@loaders.gl/loader-utils": "^4.2.0",
"@loaders.gl/schema": "^4.2.0",
"@loaders.gl/tiles": "^4.2.0",
"@luma.gl/constants": "~9.2.0",
"@luma.gl/core": "~9.2.0",
"@luma.gl/engine": "~9.2.0",
"@luma.gl/shadertools": "~9.2.0",
"@math.gl/core": "^4.0.0",
"a5-js": "^0.5.0",
"h3-js": "^4.2.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"h3-js": "^4.2.1"
},
"devDependencies": {
"@deck.gl/test-utils": "~9.2.1",
Expand Down
12 changes: 6 additions & 6 deletions modules/graph-layers/src/core/graph-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class GraphEngine extends EventTarget {
* @fires GraphEngine#onLayoutStart
*/
_onLayoutStart = () => {
log.log(0, 'GraphEngine: layout start')();
log.log(0, 'GraphEngine: layout start');
/**
* @event GraphEngine#onLayoutStart
* @type {CustomEvent}
Expand All @@ -92,7 +92,7 @@ export class GraphEngine extends EventTarget {
* @fires GraphEngine#onLayoutChange
*/
_onLayoutChange = () => {
log.log(0, 'GraphEngine: layout update event')();
log.log(0, 'GraphEngine: layout update event');
/**
* @event GraphEngine#onLayoutChange
* @type {CustomEvent}
Expand All @@ -104,7 +104,7 @@ export class GraphEngine extends EventTarget {
* @fires GraphEngine#onLayoutDone
*/
_onLayoutDone = () => {
log.log(0, 'GraphEngine: layout end')();
log.log(0, 'GraphEngine: layout end');
/**
* @event GraphEngine#onLayoutDone
* @type {CustomEvent}
Expand Down Expand Up @@ -140,7 +140,7 @@ export class GraphEngine extends EventTarget {
/** Layout calculations */

run = () => {
log.log(1, 'GraphEngine: run')();
log.log(1, 'GraphEngine: run');
// TODO: throw if running on a cleared engine

this._graph.addEventListener('transactionStart', this._onTransactionStart);
Expand All @@ -160,7 +160,7 @@ export class GraphEngine extends EventTarget {
};

clear = () => {
log.log(1, 'GraphEngine: end')();
log.log(1, 'GraphEngine: end');
this._graph.removeEventListener('transactionStart', this._onTransactionStart);
this._graph.removeEventListener('transactionEnd', this._onTransactionEnd);
this._graph.removeEventListener('onNodeAdded', this._onGraphStructureChanged);
Expand All @@ -185,7 +185,7 @@ export class GraphEngine extends EventTarget {
};

_updateLayout = () => {
log.log(0, 'GraphEngine: layout update')();
log.log(0, 'GraphEngine: layout update');
this._layout.updateGraph(this._graph);
this._layout.update();
this._layoutDirty = false;
Expand Down
6 changes: 3 additions & 3 deletions modules/graph-layers/src/core/graph-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class GraphLayout<

/** @fires GraphLayout#onLayoutStart */
protected _onLayoutStart = (): void => {
log.log(0, `GraphLayout(${this._name}): start`)();
log.log(0, `GraphLayout(${this._name}): start`);
this._updateState('calculating');

/**
Expand All @@ -111,7 +111,7 @@ export class GraphLayout<

/** @fires GraphLayout#onLayoutChange */
protected _onLayoutChange = (): void => {
log.log(0, `GraphLayout(${this._name}): update`)();
log.log(0, `GraphLayout(${this._name}): update`);
this._updateState('calculating');

/**
Expand All @@ -124,7 +124,7 @@ export class GraphLayout<

/** @fires GraphLayout#onLayoutDone */
protected _onLayoutDone = (): void => {
log.log(0, `GraphLayout(${this._name}): end`)();
log.log(0, `GraphLayout(${this._name}): end`);
this._updateState('done');

/**
Expand Down
12 changes: 6 additions & 6 deletions modules/graph-layers/src/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class Graph extends EventTarget {
const targetNode = this.findNode(edge.getTargetNodeId());

if (!sourceNode || !targetNode) {
log.warn(`Unable to add edge ${edge.id}, source or target node is missing.`)();
log.warn(`Unable to add edge ${edge.id}, source or target node is missing.`);
return;
}

Expand Down Expand Up @@ -194,7 +194,7 @@ export class Graph extends EventTarget {
removeNode(nodeId: string | number): void {
const node = this.findNode(nodeId);
if (!node) {
log.warn(`Unable to remove node ${nodeId} - doesn't exist`)();
log.warn(`Unable to remove node ${nodeId} - doesn't exist`);
return;
}
// remove all edges connect to this node from map
Expand Down Expand Up @@ -232,7 +232,7 @@ export class Graph extends EventTarget {
removeEdge(edgeId: string | number): void {
const edge = this.findEdge(edgeId);
if (!edge) {
log.warn(`Unable to remove edge ${edgeId} - doesn't exist`)();
log.warn(`Unable to remove edge ${edgeId} - doesn't exist`);
return;
}
const sourceNode = this.findNode(edge.getSourceNodeId());
Expand Down Expand Up @@ -261,7 +261,7 @@ export class Graph extends EventTarget {
getConnectedEdges(nodeId: string | number): Edge[] {
const node = this.findNode(nodeId);
if (!node) {
log.warn(`Unable to find node ${nodeId} - doesn't exist`)();
log.warn(`Unable to find node ${nodeId} - doesn't exist`);
return [];
}
return node.getConnectedEdges();
Expand All @@ -275,7 +275,7 @@ export class Graph extends EventTarget {
getNodeSiblings(nodeId: string | number): Node[] {
const node = this.findNode(nodeId);
if (!node) {
log.warn(`Unable to find node ${nodeId} - doesn't exist`)();
log.warn(`Unable to find node ${nodeId} - doesn't exist`);
return [];
}
return node.getSiblingIds().map((siblingNodeId) => this.findNode(siblingNodeId));
Expand All @@ -289,7 +289,7 @@ export class Graph extends EventTarget {
getDegree(nodeId: string | number): number {
const node = this.findNode(nodeId);
if (!node) {
log.warn(`Unable to find node ${nodeId} - doesn't exist`)();
log.warn(`Unable to find node ${nodeId} - doesn't exist`);
return 0;
}
return node.getDegree();
Expand Down
13 changes: 7 additions & 6 deletions modules/graph-layers/src/layers/graph-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
normalizeGraphLayerStylesheet,
type GraphLayerEdgeStyle,
type GraphLayerNodeStyle,
type GraphLayerStylesheet
type GraphLayerStylesheet,
type NormalizedGraphLayerStylesheet
} from '../style/graph-layer-stylesheet';

// node layers
Expand Down Expand Up @@ -185,18 +186,18 @@ export class GraphLayer extends CompositeLayer<GraphLayerProps> {
this._removeGraphEngine();
}

private _getResolvedStylesheet() {
private _getResolvedStylesheet(): NormalizedGraphLayerStylesheet {
const {stylesheet, nodeStyle, edgeStyle} = this.props;

const usingNodeStyle = typeof nodeStyle !== 'undefined';
if (usingNodeStyle && !NODE_STYLE_DEPRECATION_WARNED) {
log.warn(NODE_STYLE_DEPRECATION_MESSAGE)();
log.warn(NODE_STYLE_DEPRECATION_MESSAGE);
NODE_STYLE_DEPRECATION_WARNED = true;
}

const usingEdgeStyle = typeof edgeStyle !== 'undefined';
if (usingEdgeStyle && !EDGE_STYLE_DEPRECATION_WARNED) {
log.warn(EDGE_STYLE_DEPRECATION_MESSAGE)();
log.warn(EDGE_STYLE_DEPRECATION_MESSAGE);
EDGE_STYLE_DEPRECATION_WARNED = true;
}

Expand Down Expand Up @@ -241,7 +242,7 @@ export class GraphLayer extends CompositeLayer<GraphLayerProps> {
const {pickable = true, visible = true, data = (nodes) => nodes, ...restStyle} = style;
const LayerType = NODE_LAYER_MAP[style.type];
if (!LayerType) {
log.error(`Invalid node type: ${style.type}`)();
log.error(`Invalid node type: ${style.type}`);
throw new Error(`Invalid node type: ${style.type}`);
}
const stylesheet = new GraphStyleEngine(restStyle, {
Expand Down Expand Up @@ -304,7 +305,7 @@ export class GraphLayer extends CompositeLayer<GraphLayerProps> {
const decoratorLayers = decorators.filter(Boolean).flatMap((decoratorStyle, idx2) => {
const DecoratorLayer = EDGE_DECORATOR_LAYER_MAP[decoratorStyle.type];
if (!DecoratorLayer) {
log.error(`Invalid edge decorator type: ${decoratorStyle.type}`)();
log.error(`Invalid edge decorator type: ${decoratorStyle.type}`);
throw new Error(`Invalid edge decorator type: ${decoratorStyle.type}`);
}
const decoratorStylesheet = new GraphStyleEngine(decoratorStyle, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class D3ForceLayout extends GraphLayout<D3ForceLayoutOptions> {
});

this._worker.onmessage = (event) => {
log.log(0, 'D3ForceLayout: worker message', event.data?.type, event.data)();
log.log(0, 'D3ForceLayout: worker message', event.data?.type, event.data);
if (event.data.type !== 'end') {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/graph-layers/src/loaders/edge-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function basicEdgeParser(edge: any): Omit<EdgeOptions, 'data'> {
const {id, directed, sourceId, targetId} = edge;

if (sourceId === undefined || targetId === undefined) {
log.error('Invalid edge: sourceId or targetId is missing.')();
log.error('Invalid edge: sourceId or targetId is missing.');
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/graph-layers/src/loaders/json-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {log} from '../utils/log';
export const JSONLoader = ({json, nodeParser = basicNodeParser, edgeParser = basicEdgeParser}) => {
const {name = 'default', nodes, edges} = json;
if (!nodes) {
log.error('Invalid graph: nodes is missing.')();
log.error('Invalid graph: nodes is missing.');
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/graph-layers/src/loaders/node-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {log} from '../utils/log';

export function basicNodeParser(node: any): Pick<NodeOptions, 'id'> {
if (node.id === undefined) {
log.error('Invalid node: id is missing.')();
log.error('Invalid node: id is missing.');
return null;
}
return {id: node.id};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function loadSimpleJSONGraph(
const {nodeParser = basicNodeParser, edgeParser = basicEdgeParser} = options;
const {name = 'default', nodes, edges} = json;
if (!nodes) {
log.error('Invalid graph: nodes is missing.')();
log.error('Invalid graph: nodes is missing.');
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/graph-layers/src/loaders/table-graph-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function tableGraphLoader(
// add nodes

if (!nodes) {
log.error('Invalid graph: nodes is missing.')();
log.error('Invalid graph: nodes is missing.');
return null;
}

Expand Down
17 changes: 11 additions & 6 deletions modules/graph-layers/src/style/graph-layer-stylesheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export type GraphLayerStylesheet = {
edges?: GraphLayerEdgeStyle | GraphLayerEdgeStyle[];
};

export type NormalizedGraphLayerStylesheet = {
nodes: GraphLayerNodeStyle[];
edges: GraphLayerEdgeStyle[];
};

export type GraphLayerStylesheetInput = GraphLayerStylesheet | null | undefined;

const DEFAULT_EDGE_STYLE: GraphLayerEdgeStyle = {
Expand All @@ -44,7 +49,7 @@ const DEFAULT_EDGE_STYLE: GraphLayerEdgeStyle = {
decorators: []
};

export const DEFAULT_GRAPH_LAYER_STYLESHEET: Required<Pick<GraphLayerStylesheet, 'nodes' | 'edges'>> = {
export const DEFAULT_GRAPH_LAYER_STYLESHEET: NormalizedGraphLayerStylesheet = {
nodes: [],
edges: [DEFAULT_EDGE_STYLE]
};
Expand All @@ -59,7 +64,7 @@ export function normalizeGraphLayerStylesheet({
stylesheet,
nodeStyle,
edgeStyle
}: GraphLayerStylesheetSources): Required<Pick<GraphLayerStylesheet, 'nodes' | 'edges'>> {
}: GraphLayerStylesheetSources): NormalizedGraphLayerStylesheet {
const resolvedStylesheet = stylesheet ?? {};
const resolvedNodeStyles = Array.isArray(resolvedStylesheet.nodes)
? resolvedStylesheet.nodes
Expand All @@ -80,10 +85,10 @@ export function normalizeGraphLayerStylesheet({
const edges = edgesArray
.filter(Boolean)
.map((edgeStyleEntry) => ({
type: 'edge',
decorators: [],
...edgeStyleEntry
}));
...edgeStyleEntry,
type: ((edgeStyleEntry as GraphLayerEdgeStyle).type ?? 'edge') as EdgeStyleType,
decorators: (edgeStyleEntry as GraphLayerEdgeStyle).decorators ?? []
})) as GraphLayerEdgeStyle[];

return {
nodes,
Expand Down
2 changes: 1 addition & 1 deletion modules/graph-layers/src/style/graph-style-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const GRAPH_DECKGL_ACCESSOR_MAP = {
}
} as const satisfies DeckGLAccessorMap;

type GraphStyleType = keyof typeof GRAPH_DECKGL_ACCESSOR_MAP;
export type GraphStyleType = keyof typeof GRAPH_DECKGL_ACCESSOR_MAP;
export type GraphStyleSelector = `:${string}`;

type GraphStylePropertyKey<TType extends GraphStyleType> = Extract<
Expand Down
2 changes: 1 addition & 1 deletion modules/graph-layers/src/style/style-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class StyleEngine<TStyleProperty extends StyleProperty = StyleProperty> {
}
const styleProp = map[deckglAccessor];
if (!styleProp) {
log.error(`Invalid DeckGL accessor: ${deckglAccessor}`)();
log.error(`Invalid DeckGL accessor: ${deckglAccessor}`);
throw new Error(`Invalid DeckGL accessor: ${deckglAccessor}`);
}
return this.properties[styleProp];
Expand Down
Loading