ts-maps 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -648,7 +648,7 @@ class Legend {
648
648
  _map;
649
649
  _series;
650
650
  _body;
651
- constructor(options) {
651
+ constructor(options = {}) {
652
652
  this._options = options;
653
653
  this._map = this._options.map;
654
654
  this._series = this._options.series;
@@ -656,7 +656,7 @@ class Legend {
656
656
  if (this._options.cssClass) {
657
657
  this._body.setAttribute("class", this._options.cssClass);
658
658
  }
659
- if (options.vertical) {
659
+ if (this._options.vertical) {
660
660
  this._map.legendVertical.appendChild(this._body);
661
661
  } else {
662
662
  this._map.legendHorizontal.appendChild(this._body);
@@ -665,13 +665,11 @@ class Legend {
665
665
  }
666
666
  render() {
667
667
  const ticks = this._series.scale.getTicks();
668
- const inner = createElement("div", "jvm-legend-inner");
669
668
  this._body.innerHTML = "";
670
669
  if (this._options.title) {
671
670
  const legendTitle = createElement("div", "jvm-legend-title", this._options.title);
672
671
  this._body.appendChild(legendTitle);
673
672
  }
674
- this._body.appendChild(inner);
675
673
  for (let i = 0;i < ticks.length; i++) {
676
674
  const tick = createElement("div", "jvm-legend-tick");
677
675
  const sample = createElement("div", "jvm-legend-tick-sample");
@@ -687,7 +685,7 @@ class Legend {
687
685
  sample.style.background = ticks[i].value;
688
686
  break;
689
687
  case "image":
690
- sample.style.background = `url(${ticks[i].value}) no-repeat center center`;
688
+ sample.style.background = `url(${typeof ticks[i].value === "object" ? ticks[i].value.url : ticks[i].value}) no-repeat center center`;
691
689
  sample.style.backgroundSize = "cover";
692
690
  break;
693
691
  }
@@ -698,7 +696,7 @@ class Legend {
698
696
  }
699
697
  const tickText = createElement("div", "jvm-legend-tick-text", label);
700
698
  tick.appendChild(tickText);
701
- inner.appendChild(tick);
699
+ this._body.appendChild(tick);
702
700
  }
703
701
  }
704
702
  }
package/dist/legend.d.ts CHANGED
@@ -1,3 +1,11 @@
1
+ declare interface LegendOptions {
2
+ map?: any
3
+ series?: any
4
+ cssClass?: string
5
+ vertical?: boolean
6
+ title?: string
7
+ labelRender?: (label: string) => string
8
+ }
1
9
  declare const ticks: unknown;
2
10
  declare const legendTitle: unknown;
3
11
  declare const tick: unknown;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ts-maps",
3
3
  "type": "module",
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "description": "A modern vector map library.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -97,9 +97,9 @@
97
97
  "typecheck": "bun --bun tsc --noEmit"
98
98
  },
99
99
  "devDependencies": {
100
- "bun-plugin-dtsx": "^0.21.9",
100
+ "bun-plugin-dtsx": "^0.21.12",
101
101
  "bunfig": "^0.14.1",
102
- "lint-staged": "^15.5.1",
102
+ "lint-staged": "^16.1.5",
103
103
  "simple-git-hooks": "^2.13.1",
104
104
  "typescript": "^5.9.0"
105
105
  },