@deck.gl-community/graph-layers 9.2.8 → 9.3.1-alpha.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.
@@ -1,2 +1,2 @@
1
- export const GRAPH_STYLE_SCHEMA_CDN_URL = 'https://cdn.jsdelivr.net/npm/@deck.gl-community/graph-layers@9.2.8/dist/graph-style-schema.json';
1
+ export const GRAPH_STYLE_SCHEMA_CDN_URL = 'https://cdn.jsdelivr.net/npm/@deck.gl-community/graph-layers@9.3.1-alpha.0/dist/graph-style-schema.json';
2
2
  export default GRAPH_STYLE_SCHEMA_CDN_URL;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://cdn.jsdelivr.net/npm/@deck.gl-community/graph-layers@9.2.8/dist/graph-style-schema.json",
3
+ "$id": "https://cdn.jsdelivr.net/npm/@deck.gl-community/graph-layers@9.3.1-alpha.0/dist/graph-style-schema.json",
4
4
  "title": "Deck.gl Graph Stylesheet",
5
5
  "description": "JSON schema describing the declarative stylesheet format supported by @deck.gl-community/graph-layers.",
6
6
  "$ref": "#/definitions/GraphStylesheet",
package/dist/index.cjs CHANGED
@@ -4803,9 +4803,6 @@ var import_core4 = require("@deck.gl/core");
4803
4803
  var import_core3 = require("@deck.gl/core");
4804
4804
  var import_layers3 = require("@deck.gl/layers");
4805
4805
  var ZoomableTextLayer = class extends import_core3.CompositeLayer {
4806
- initializeState() {
4807
- this.state = { characterSet: [] };
4808
- }
4809
4806
  shouldUpdateState({ props, changeFlags }) {
4810
4807
  const { scaleWithZoom } = this.props;
4811
4808
  if (!scaleWithZoom) {
@@ -4813,41 +4810,35 @@ var ZoomableTextLayer = class extends import_core3.CompositeLayer {
4813
4810
  }
4814
4811
  return changeFlags.dataChanged || changeFlags.propsChanged || changeFlags.viewportChanged;
4815
4812
  }
4816
- updateState({ props, oldProps, changeFlags }) {
4817
- super.updateState({ props, oldProps, changeFlags });
4818
- if (changeFlags.propsOrDataChanged) {
4819
- const { getText } = props;
4820
- let textLabels = [];
4821
- if (typeof getText === "function") {
4822
- textLabels = props.data.map(getText);
4823
- } else {
4824
- textLabels = [getText];
4825
- }
4826
- const characterSet = new Set(textLabels.join(""));
4827
- const uniqueCharacters = Array.from(characterSet);
4828
- this.setState({ characterSet: uniqueCharacters });
4829
- }
4830
- }
4813
+ // eslint-disable-next-line complexity
4831
4814
  renderLayers() {
4832
4815
  const { data, getPosition, getColor: getColor2, getText, getSize, getTextAnchor, getAlignmentBaseline, getAngle, scaleWithZoom, updateTriggers, fontFamily, textWordUnits, textWordBreak, textMaxWidth, textSizeMinPixels } = this.props;
4833
4816
  const sizeUpdateTrigger = scaleWithZoom ? [getSize, this.context.viewport.zoom] : false;
4834
4817
  const newGetText = typeof getText === "function" ? getText : () => getText;
4818
+ const filteredData = data ? data.filter((d) => {
4819
+ const t = newGetText(d);
4820
+ return t !== null && t !== void 0 && t !== "";
4821
+ }) : [];
4822
+ if (filteredData.length === 0) {
4823
+ return [];
4824
+ }
4825
+ const safeGetText = (d) => String(newGetText(d) ?? "") || " ";
4835
4826
  return [
4836
4827
  new import_layers3.TextLayer(this.getSubLayerProps({
4837
4828
  id: "__text-layer",
4838
- data,
4829
+ data: filteredData,
4839
4830
  sizeScale: scaleWithZoom ? Math.pow(2, this.context.viewport.zoom - 1) : 1,
4840
- characterSet: this.state.characterSet,
4831
+ characterSet: "auto",
4841
4832
  getPosition,
4842
4833
  getColor: getColor2,
4843
4834
  getSize,
4844
4835
  getTextAnchor,
4845
4836
  getAlignmentBaseline,
4846
4837
  getAngle,
4847
- getText: newGetText,
4838
+ getText: safeGetText,
4848
4839
  maxWidth: textMaxWidth ?? 12,
4849
4840
  wordBreak: textWordBreak ?? "break-all",
4850
- fontFamily: fontFamily ?? "Red Hat Text",
4841
+ fontFamily: fontFamily ?? "sans-serif",
4851
4842
  wordUnits: textWordUnits ?? "pixels",
4852
4843
  sizeMinPixels: textSizeMinPixels ?? 9,
4853
4844
  updateTriggers: {
@@ -6672,6 +6663,7 @@ var GridLayer = class extends import_core17.CompositeLayer {
6672
6663
  const textLayer = new import_layers12.TextLayer({
6673
6664
  id: `${this.props.id}-labels`,
6674
6665
  data: textData,
6666
+ characterSet: "auto",
6675
6667
  getPosition: (d) => d.position,
6676
6668
  getText: (d) => d.text,
6677
6669
  getColor: getColor2 ? (d) => getColor2(d.datum) ?? color : () => color,
@@ -8208,7 +8200,7 @@ function isPlainObject(value) {
8208
8200
  }
8209
8201
 
8210
8202
  // dist/loaders/json-graph-loader.js
8211
- var VERSION = true ? "9.2.8" : "latest";
8203
+ var VERSION = true ? "9.3.1-alpha.0" : "latest";
8212
8204
  var JSONGraphLoader = {
8213
8205
  dataType: null,
8214
8206
  batchType: null,
@@ -8233,7 +8225,7 @@ var JSONGraphLoader = {
8233
8225
  };
8234
8226
 
8235
8227
  // dist/loaders/dot-graph-loader.js
8236
- var VERSION2 = true ? "9.2.8" : "latest";
8228
+ var VERSION2 = true ? "9.3.1-alpha.0" : "latest";
8237
8229
  var DOTGraphLoader = {
8238
8230
  dataType: null,
8239
8231
  batchType: null,