ofs-object 0.1.1 → 0.1.3

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/docs/API.md CHANGED
@@ -399,16 +399,23 @@ macro play ตรวจแปลง --times 2
399
399
 
400
400
  รองรับทั้ง MapLibre GL และ Mapbox GL ด้วย Interface เดียวกัน:
401
401
 
402
+ **ไลบรารีไม่ `import` map engine ตัวไหนเลย** ถ้า import ไว้ มันจะเป็น dependency บังคับของทุกคน
403
+ คนที่ใช้ Mapbox และไม่ได้ลง `maplibre-gl` จะ build ไม่ผ่านด้วย `Can't resolve 'maplibre-gl'`
404
+ ตั้งแต่ยังไม่ได้รันโค้ด → **ต้องส่ง library เข้ามาตอน `init()`**
405
+
402
406
  ```typescript
403
407
  import { MapLibreAdapter, MapboxAdapter } from 'ofs-object';
408
+ import * as maplibregl from 'maplibre-gl'; // v6 ไม่มี default export
409
+ import mapboxgl from 'mapbox-gl';
404
410
 
405
411
  // สำหรับ MapLibre GL JS
406
412
  const mapAdapter = new MapLibreAdapter();
413
+ await mapAdapter.init('map-div', { maplibregl, center: [100.5, 13.7], zoom: 14 });
407
414
 
408
415
  // หรือสำหรับ Mapbox GL JS
409
416
  const mapAdapter = new MapboxAdapter();
410
-
411
417
  await mapAdapter.init('map-div', {
418
+ mapboxgl,
412
419
  accessToken: 'YOUR_MAPBOX_TOKEN',
413
420
  style: 'mapbox://styles/mapbox/satellite-streets-v12',
414
421
  center: [100.5, 13.7],
@@ -429,6 +436,7 @@ const map = new maplibregl.Map({ container: el, style, center: [100.5, 13.7], zo
429
436
 
430
437
  const ofs = new OFSObject({ map }); // Mapbox: เพิ่ม mapAdapter: new MapboxAdapter()
431
438
  await ofs.init(); // ไม่ต้องส่ง container — รอ style พร้อมแล้วผูกให้เอง
439
+ // และไม่ต้องส่ง map engine เพราะไม่ได้สร้างแผนที่เอง
432
440
 
433
441
  // หรือเรียกที่ adapter ตรง ๆ
434
442
  await ofs.mapAdapter.attach(map);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofs-object",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Framework-agnostic TypeScript Library for GIS Map Tools (Data Adapter, Draw Tools, Legend & Thematic Symbology, Map Adapters, Web CLI & AI Bridge)",
5
5
  "license": "MIT",
6
6
  "author": "On-Farm Solution Co.,Ltd.",