@geolonia/maps-core 0.4.3 → 0.5.1

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.
@@ -38,6 +38,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
38
38
  var index_exports = {};
39
39
  __export(index_exports, {
40
40
  CustomAttributionControl: () => attribution_default,
41
+ DEFAULT_STAGE: () => DEFAULT_STAGE,
41
42
  GeoloniaControl: () => GeoloniaControl,
42
43
  GeoloniaMap: () => GeoloniaMap,
43
44
  GeoloniaMarker: () => GeoloniaMarker,
@@ -410,11 +411,11 @@ var CustomAttributionControl = class {
410
411
  attributions.push(this.options.customAttribution);
411
412
  }
412
413
  }
413
- const sourceCaches = this._map.style.sourceCaches;
414
- for (const id in sourceCaches) {
415
- const sourceCache = sourceCaches[id];
416
- if (sourceCache.used || sourceCache.usedForTerrain) {
417
- const source = sourceCache.getSource();
414
+ const tileManagers = this._map.style.tileManagers ?? this._map.style.sourceCaches ?? {};
415
+ for (const id in tileManagers) {
416
+ const tileManager = tileManagers[id];
417
+ if (tileManager.used || tileManager.usedForTerrain) {
418
+ const source = tileManager.getSource();
418
419
  if (source.attribution && attributions.indexOf(source.attribution) < 0) {
419
420
  attributions.push(source.attribution);
420
421
  }
@@ -584,11 +585,12 @@ var import_center = __toESM(require("@turf/center"), 1);
584
585
  var import_maplibre_gl3 = __toESM(require("maplibre-gl"), 1);
585
586
 
586
587
  // src/lib/keyring.ts
588
+ var DEFAULT_STAGE = "v1";
587
589
  var _apiKey, _stage, _isGeoloniaStyle;
588
590
  var Keyring = class {
589
591
  constructor() {
590
592
  __privateAdd(this, _apiKey, "");
591
- __privateAdd(this, _stage, "dev");
593
+ __privateAdd(this, _stage, DEFAULT_STAGE);
592
594
  __privateAdd(this, _isGeoloniaStyle, true);
593
595
  }
594
596
  /**
@@ -604,7 +606,7 @@ var Keyring = class {
604
606
  /**
605
607
  * 現在設定されているステージを返します。
606
608
  *
607
- * 初期値は `"dev"` です。
609
+ * 初期値は {@link DEFAULT_STAGE}(`"v1"`)です。
608
610
  *
609
611
  * @returns ステージを表す文字列を返します。
610
612
  */
@@ -646,11 +648,11 @@ var Keyring = class {
646
648
  /**
647
649
  * API キー、ステージ、Geolonia スタイル判定をすべて初期状態に戻します。
648
650
  *
649
- * API キーは空文字列、ステージは `"dev"`、Geolonia スタイル判定は `true` にリセットされます。
651
+ * API キーは空文字列、ステージは {@link DEFAULT_STAGE}、Geolonia スタイル判定は `true` にリセットされます。
650
652
  */
651
653
  reset() {
652
654
  __privateSet(this, _apiKey, "");
653
- __privateSet(this, _stage, "dev");
655
+ __privateSet(this, _stage, DEFAULT_STAGE);
654
656
  __privateSet(this, _isGeoloniaStyle, true);
655
657
  }
656
658
  /**
@@ -2055,10 +2057,11 @@ var GeoloniaMap = class extends import_maplibre_gl5.default.Map {
2055
2057
  };
2056
2058
 
2057
2059
  // src/version.ts
2058
- var VERSION = "0.4.3";
2060
+ var VERSION = "0.5.1";
2059
2061
  // Annotate the CommonJS export names for ESM import in node:
2060
2062
  0 && (module.exports = {
2061
2063
  CustomAttributionControl,
2064
+ DEFAULT_STAGE,
2062
2065
  GeoloniaControl,
2063
2066
  GeoloniaMap,
2064
2067
  GeoloniaMarker,
@@ -493,6 +493,34 @@ declare class GeoloniaMarker extends maplibregl.Marker {
493
493
  constructor(options?: MarkerOptions);
494
494
  }
495
495
 
496
+ /**
497
+ * ステージの既定値です。本番環境を表す `"v1"` です。
498
+ *
499
+ * ステージは、SDK がタイルや API をどの環境から取得するかを決める値です。
500
+ * `stage` を指定しなかった場合は、この値が使われます。
501
+ *
502
+ * - `"v1"`(既定): 本番環境。`tileserver.geolonia.com` と `https://api.geolonia.com/v1` を使用します。
503
+ * - `"dev"`: 開発環境。`tileserver-dev.geolonia.com` と `https://api.geolonia.com/dev` を使用します。
504
+ *
505
+ * 通常は指定する必要がありません。開発環境を使う場合のみ、`GeoloniaMap` の
506
+ * `stage` オプションか {@link Keyring.setStage} で明示的に切り替えてください。
507
+ *
508
+ * `@geolonia/maps-react` や `@geolonia/maps-suite` のようなラッパーが、
509
+ * 自身の既定として参照することを想定して公開しています。値をハードコードせず
510
+ * この定数を使うことで、SDK 全体で既定のステージが揃います。
511
+ *
512
+ * @example
513
+ * ```typescript
514
+ * import { DEFAULT_STAGE, GeoloniaMap } from "@geolonia/maps-core";
515
+ *
516
+ * new GeoloniaMap({
517
+ * container: "#map",
518
+ * apiKey: "YOUR-API-KEY",
519
+ * stage: DEFAULT_STAGE,
520
+ * });
521
+ * ```
522
+ */
523
+ declare const DEFAULT_STAGE = "v1";
496
524
  /**
497
525
  * API キー、ステージ、現在のスタイルが Geolonia スタイルかどうかを保持するクラスです。
498
526
  *
@@ -521,7 +549,7 @@ declare class Keyring {
521
549
  /**
522
550
  * 現在設定されているステージを返します。
523
551
  *
524
- * 初期値は `"dev"` です。
552
+ * 初期値は {@link DEFAULT_STAGE}(`"v1"`)です。
525
553
  *
526
554
  * @returns ステージを表す文字列を返します。
527
555
  */
@@ -553,7 +581,7 @@ declare class Keyring {
553
581
  /**
554
582
  * API キー、ステージ、Geolonia スタイル判定をすべて初期状態に戻します。
555
583
  *
556
- * API キーは空文字列、ステージは `"dev"`、Geolonia スタイル判定は `true` にリセットされます。
584
+ * API キーは空文字列、ステージは {@link DEFAULT_STAGE}、Geolonia スタイル判定は `true` にリセットされます。
557
585
  */
558
586
  reset(): void;
559
587
  /**
@@ -841,4 +869,4 @@ declare class SimpleStyleVector {
841
869
 
842
870
  declare const VERSION: string;
843
871
 
844
- export { CustomAttributionControl, GeoloniaControl, GeoloniaMap, type GeoloniaMapOptions, GeoloniaMarker, SimpleStyle, SimpleStyleVector, VERSION as coreVersion, getLang, getStyle, isGeoloniaTilesHost, keyring };
872
+ export { CustomAttributionControl, DEFAULT_STAGE, GeoloniaControl, GeoloniaMap, type GeoloniaMapOptions, GeoloniaMarker, SimpleStyle, SimpleStyleVector, VERSION as coreVersion, getLang, getStyle, isGeoloniaTilesHost, keyring };
@@ -493,6 +493,34 @@ declare class GeoloniaMarker extends maplibregl.Marker {
493
493
  constructor(options?: MarkerOptions);
494
494
  }
495
495
 
496
+ /**
497
+ * ステージの既定値です。本番環境を表す `"v1"` です。
498
+ *
499
+ * ステージは、SDK がタイルや API をどの環境から取得するかを決める値です。
500
+ * `stage` を指定しなかった場合は、この値が使われます。
501
+ *
502
+ * - `"v1"`(既定): 本番環境。`tileserver.geolonia.com` と `https://api.geolonia.com/v1` を使用します。
503
+ * - `"dev"`: 開発環境。`tileserver-dev.geolonia.com` と `https://api.geolonia.com/dev` を使用します。
504
+ *
505
+ * 通常は指定する必要がありません。開発環境を使う場合のみ、`GeoloniaMap` の
506
+ * `stage` オプションか {@link Keyring.setStage} で明示的に切り替えてください。
507
+ *
508
+ * `@geolonia/maps-react` や `@geolonia/maps-suite` のようなラッパーが、
509
+ * 自身の既定として参照することを想定して公開しています。値をハードコードせず
510
+ * この定数を使うことで、SDK 全体で既定のステージが揃います。
511
+ *
512
+ * @example
513
+ * ```typescript
514
+ * import { DEFAULT_STAGE, GeoloniaMap } from "@geolonia/maps-core";
515
+ *
516
+ * new GeoloniaMap({
517
+ * container: "#map",
518
+ * apiKey: "YOUR-API-KEY",
519
+ * stage: DEFAULT_STAGE,
520
+ * });
521
+ * ```
522
+ */
523
+ declare const DEFAULT_STAGE = "v1";
496
524
  /**
497
525
  * API キー、ステージ、現在のスタイルが Geolonia スタイルかどうかを保持するクラスです。
498
526
  *
@@ -521,7 +549,7 @@ declare class Keyring {
521
549
  /**
522
550
  * 現在設定されているステージを返します。
523
551
  *
524
- * 初期値は `"dev"` です。
552
+ * 初期値は {@link DEFAULT_STAGE}(`"v1"`)です。
525
553
  *
526
554
  * @returns ステージを表す文字列を返します。
527
555
  */
@@ -553,7 +581,7 @@ declare class Keyring {
553
581
  /**
554
582
  * API キー、ステージ、Geolonia スタイル判定をすべて初期状態に戻します。
555
583
  *
556
- * API キーは空文字列、ステージは `"dev"`、Geolonia スタイル判定は `true` にリセットされます。
584
+ * API キーは空文字列、ステージは {@link DEFAULT_STAGE}、Geolonia スタイル判定は `true` にリセットされます。
557
585
  */
558
586
  reset(): void;
559
587
  /**
@@ -841,4 +869,4 @@ declare class SimpleStyleVector {
841
869
 
842
870
  declare const VERSION: string;
843
871
 
844
- export { CustomAttributionControl, GeoloniaControl, GeoloniaMap, type GeoloniaMapOptions, GeoloniaMarker, SimpleStyle, SimpleStyleVector, VERSION as coreVersion, getLang, getStyle, isGeoloniaTilesHost, keyring };
872
+ export { CustomAttributionControl, DEFAULT_STAGE, GeoloniaControl, GeoloniaMap, type GeoloniaMapOptions, GeoloniaMarker, SimpleStyle, SimpleStyleVector, VERSION as coreVersion, getLang, getStyle, isGeoloniaTilesHost, keyring };
package/dist/npm/index.js CHANGED
@@ -365,11 +365,11 @@ var CustomAttributionControl = class {
365
365
  attributions.push(this.options.customAttribution);
366
366
  }
367
367
  }
368
- const sourceCaches = this._map.style.sourceCaches;
369
- for (const id in sourceCaches) {
370
- const sourceCache = sourceCaches[id];
371
- if (sourceCache.used || sourceCache.usedForTerrain) {
372
- const source = sourceCache.getSource();
368
+ const tileManagers = this._map.style.tileManagers ?? this._map.style.sourceCaches ?? {};
369
+ for (const id in tileManagers) {
370
+ const tileManager = tileManagers[id];
371
+ if (tileManager.used || tileManager.usedForTerrain) {
372
+ const source = tileManager.getSource();
373
373
  if (source.attribution && attributions.indexOf(source.attribution) < 0) {
374
374
  attributions.push(source.attribution);
375
375
  }
@@ -539,11 +539,12 @@ import turfCenter from "@turf/center";
539
539
  import maplibregl3 from "maplibre-gl";
540
540
 
541
541
  // src/lib/keyring.ts
542
+ var DEFAULT_STAGE = "v1";
542
543
  var _apiKey, _stage, _isGeoloniaStyle;
543
544
  var Keyring = class {
544
545
  constructor() {
545
546
  __privateAdd(this, _apiKey, "");
546
- __privateAdd(this, _stage, "dev");
547
+ __privateAdd(this, _stage, DEFAULT_STAGE);
547
548
  __privateAdd(this, _isGeoloniaStyle, true);
548
549
  }
549
550
  /**
@@ -559,7 +560,7 @@ var Keyring = class {
559
560
  /**
560
561
  * 現在設定されているステージを返します。
561
562
  *
562
- * 初期値は `"dev"` です。
563
+ * 初期値は {@link DEFAULT_STAGE}(`"v1"`)です。
563
564
  *
564
565
  * @returns ステージを表す文字列を返します。
565
566
  */
@@ -601,11 +602,11 @@ var Keyring = class {
601
602
  /**
602
603
  * API キー、ステージ、Geolonia スタイル判定をすべて初期状態に戻します。
603
604
  *
604
- * API キーは空文字列、ステージは `"dev"`、Geolonia スタイル判定は `true` にリセットされます。
605
+ * API キーは空文字列、ステージは {@link DEFAULT_STAGE}、Geolonia スタイル判定は `true` にリセットされます。
605
606
  */
606
607
  reset() {
607
608
  __privateSet(this, _apiKey, "");
608
- __privateSet(this, _stage, "dev");
609
+ __privateSet(this, _stage, DEFAULT_STAGE);
609
610
  __privateSet(this, _isGeoloniaStyle, true);
610
611
  }
611
612
  /**
@@ -2010,9 +2011,10 @@ var GeoloniaMap = class extends maplibregl5.Map {
2010
2011
  };
2011
2012
 
2012
2013
  // src/version.ts
2013
- var VERSION = "0.4.3";
2014
+ var VERSION = "0.5.1";
2014
2015
  export {
2015
2016
  attribution_default as CustomAttributionControl,
2017
+ DEFAULT_STAGE,
2016
2018
  GeoloniaControl,
2017
2019
  GeoloniaMap,
2018
2020
  GeoloniaMarker,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolonia/maps-core",
3
- "version": "0.4.3",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "main": "dist/npm/index.cjs",
6
6
  "module": "dist/npm/index.js",
@@ -35,7 +35,7 @@
35
35
  "@types/tinycolor2": "^1.4.6",
36
36
  "@vitest/coverage-v8": "^4.1.2",
37
37
  "jsdom": "^29.0.1",
38
- "maplibre-gl": "5.7.0",
38
+ "maplibre-gl": "5.24.0",
39
39
  "tsup": "^8",
40
40
  "typedoc": "^0.28.20",
41
41
  "typedoc-plugin-markdown": "^4.12.0",