@metastringfoundation/map-list 0.1.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.
Files changed (158) hide show
  1. package/dist/card.d.ts +7 -0
  2. package/dist/card.d.ts.map +1 -0
  3. package/dist/card.js +7 -0
  4. package/dist/components/core/button.d.ts +7 -0
  5. package/dist/components/core/button.d.ts.map +1 -0
  6. package/dist/components/core/button.js +21 -0
  7. package/dist/components/core/highlighter.d.ts +5 -0
  8. package/dist/components/core/highlighter.d.ts.map +1 -0
  9. package/dist/components/core/highlighter.js +15 -0
  10. package/dist/components/core/icons.d.ts +17 -0
  11. package/dist/components/core/icons.d.ts.map +1 -0
  12. package/dist/components/core/icons.js +60 -0
  13. package/dist/components/core/iconts.d.ts +2 -0
  14. package/dist/components/core/iconts.d.ts.map +1 -0
  15. package/dist/components/core/iconts.js +2 -0
  16. package/dist/components/core/index.d.ts +5 -0
  17. package/dist/components/core/index.d.ts.map +1 -0
  18. package/dist/components/core/index.js +20 -0
  19. package/dist/components/core/input.d.ts +14 -0
  20. package/dist/components/core/input.d.ts.map +1 -0
  21. package/dist/components/core/input.js +18 -0
  22. package/dist/components/core/popup.d.ts +5 -0
  23. package/dist/components/core/popup.d.ts.map +1 -0
  24. package/dist/components/core/popup.js +11 -0
  25. package/dist/components/core/tabs.d.ts +46 -0
  26. package/dist/components/core/tabs.d.ts.map +1 -0
  27. package/dist/components/core/tabs.js +147 -0
  28. package/dist/components/infobar/content.d.ts +4 -0
  29. package/dist/components/infobar/content.d.ts.map +1 -0
  30. package/dist/components/infobar/content.js +22 -0
  31. package/dist/components/infobar/index.d.ts +2 -0
  32. package/dist/components/infobar/index.d.ts.map +1 -0
  33. package/dist/components/infobar/index.js +17 -0
  34. package/dist/components/infobar/infobar-panel.d.ts +4 -0
  35. package/dist/components/infobar/infobar-panel.d.ts.map +1 -0
  36. package/dist/components/infobar/infobar-panel.js +52 -0
  37. package/dist/components/map/index.d.ts +2 -0
  38. package/dist/components/map/index.d.ts.map +1 -0
  39. package/dist/components/map/index.js +66 -0
  40. package/dist/components/map/layers/grid/index.d.ts +6 -0
  41. package/dist/components/map/layers/grid/index.d.ts.map +1 -0
  42. package/dist/components/map/layers/grid/index.js +31 -0
  43. package/dist/components/map/layers/highlight/index.d.ts +2 -0
  44. package/dist/components/map/layers/highlight/index.d.ts.map +1 -0
  45. package/dist/components/map/layers/highlight/index.js +7 -0
  46. package/dist/components/map/layers/index.d.ts +6 -0
  47. package/dist/components/map/layers/index.d.ts.map +1 -0
  48. package/dist/components/map/layers/index.js +27 -0
  49. package/dist/components/map/layers/raster/index.d.ts +6 -0
  50. package/dist/components/map/layers/raster/index.d.ts.map +1 -0
  51. package/dist/components/map/layers/raster/index.js +19 -0
  52. package/dist/components/map/layers/vector/index.d.ts +5 -0
  53. package/dist/components/map/layers/vector/index.d.ts.map +1 -0
  54. package/dist/components/map/layers/vector/index.js +29 -0
  55. package/dist/components/map/marker-list/index.d.ts +3 -0
  56. package/dist/components/map/marker-list/index.d.ts.map +1 -0
  57. package/dist/components/map/marker-list/index.js +16 -0
  58. package/dist/components/map/markers-list/index.d.ts +3 -0
  59. package/dist/components/map/markers-list/index.d.ts.map +1 -0
  60. package/dist/components/map/markers-list/index.js +16 -0
  61. package/dist/components/map/popup/index.d.ts +4 -0
  62. package/dist/components/map/popup/index.d.ts.map +1 -0
  63. package/dist/components/map/popup/index.js +17 -0
  64. package/dist/components/sidebar/common/grid-legend.d.ts +4 -0
  65. package/dist/components/sidebar/common/grid-legend.d.ts.map +1 -0
  66. package/dist/components/sidebar/common/grid-legend.js +22 -0
  67. package/dist/components/sidebar/common/info-popover.d.ts +10 -0
  68. package/dist/components/sidebar/common/info-popover.d.ts.map +1 -0
  69. package/dist/components/sidebar/common/info-popover.js +32 -0
  70. package/dist/components/sidebar/common/layer-item-style.d.ts +4 -0
  71. package/dist/components/sidebar/common/layer-item-style.d.ts.map +1 -0
  72. package/dist/components/sidebar/common/layer-item-style.js +21 -0
  73. package/dist/components/sidebar/common/layer-item.d.ts +11 -0
  74. package/dist/components/sidebar/common/layer-item.d.ts.map +1 -0
  75. package/dist/components/sidebar/common/layer-item.js +59 -0
  76. package/dist/components/sidebar/common/moreless.d.ts +4 -0
  77. package/dist/components/sidebar/common/moreless.d.ts.map +1 -0
  78. package/dist/components/sidebar/common/moreless.js +10 -0
  79. package/dist/components/sidebar/common/opacity-handler-addon.d.ts +3 -0
  80. package/dist/components/sidebar/common/opacity-handler-addon.d.ts.map +1 -0
  81. package/dist/components/sidebar/common/opacity-handler-addon.js +9 -0
  82. package/dist/components/sidebar/common/style-legend.d.ts +4 -0
  83. package/dist/components/sidebar/common/style-legend.d.ts.map +1 -0
  84. package/dist/components/sidebar/common/style-legend.js +23 -0
  85. package/dist/components/sidebar/common.d.ts +2 -0
  86. package/dist/components/sidebar/common.d.ts.map +1 -0
  87. package/dist/components/sidebar/common.js +2 -0
  88. package/dist/components/sidebar/index.d.ts +2 -0
  89. package/dist/components/sidebar/index.d.ts.map +1 -0
  90. package/dist/components/sidebar/index.js +38 -0
  91. package/dist/components/sidebar/layers/index.d.ts +2 -0
  92. package/dist/components/sidebar/layers/index.d.ts.map +1 -0
  93. package/dist/components/sidebar/layers/index.js +12 -0
  94. package/dist/components/sidebar/layers/layer-list.d.ts +2 -0
  95. package/dist/components/sidebar/layers/layer-list.d.ts.map +1 -0
  96. package/dist/components/sidebar/layers/layer-list.js +64 -0
  97. package/dist/components/sidebar/layers/search.d.ts +2 -0
  98. package/dist/components/sidebar/layers/search.d.ts.map +1 -0
  99. package/dist/components/sidebar/layers/search.js +16 -0
  100. package/dist/components/sidebar/layers.d.ts +2 -0
  101. package/dist/components/sidebar/layers.d.ts.map +1 -0
  102. package/dist/components/sidebar/layers.js +2 -0
  103. package/dist/components/sidebar/selected/extended.d.ts +3 -0
  104. package/dist/components/sidebar/selected/extended.d.ts.map +1 -0
  105. package/dist/components/sidebar/selected/extended.js +7 -0
  106. package/dist/components/sidebar/selected/index.d.ts +2 -0
  107. package/dist/components/sidebar/selected/index.d.ts.map +1 -0
  108. package/dist/components/sidebar/selected/index.js +20 -0
  109. package/dist/components/sidebar/selected/selected-item-list.d.ts +10 -0
  110. package/dist/components/sidebar/selected/selected-item-list.d.ts.map +1 -0
  111. package/dist/components/sidebar/selected/selected-item-list.js +36 -0
  112. package/dist/components/sidebar/settings/index.d.ts +2 -0
  113. package/dist/components/sidebar/settings/index.d.ts.map +1 -0
  114. package/dist/components/sidebar/settings/index.js +16 -0
  115. package/dist/components/sidebar/settings/layer-selection.d.ts +6 -0
  116. package/dist/components/sidebar/settings/layer-selection.d.ts.map +1 -0
  117. package/dist/components/sidebar/settings/layer-selection.js +17 -0
  118. package/dist/components/sidebar/tabs.d.ts +4 -0
  119. package/dist/components/sidebar/tabs.d.ts.map +1 -0
  120. package/dist/components/sidebar/tabs.js +15 -0
  121. package/dist/gradient.d.ts +6 -0
  122. package/dist/gradient.d.ts.map +1 -0
  123. package/dist/gradient.js +9 -0
  124. package/dist/hooks/use-layers.d.ts +55 -0
  125. package/dist/hooks/use-layers.d.ts.map +1 -0
  126. package/dist/hooks/use-layers.js +298 -0
  127. package/dist/index.css +1129 -0
  128. package/dist/index.d.ts +4 -0
  129. package/dist/index.d.ts.map +1 -0
  130. package/dist/index.js +18 -0
  131. package/dist/interfaces/index.d.ts +103 -0
  132. package/dist/interfaces/index.d.ts.map +1 -0
  133. package/dist/interfaces/index.js +2 -0
  134. package/dist/services/naksha.d.ts +62 -0
  135. package/dist/services/naksha.d.ts.map +1 -0
  136. package/dist/services/naksha.js +420 -0
  137. package/dist/static/constant.d.ts +16 -0
  138. package/dist/static/constant.d.ts.map +1 -0
  139. package/dist/static/constant.js +34 -0
  140. package/dist/static/constants.d.ts +16 -0
  141. package/dist/static/constants.d.ts.map +1 -0
  142. package/dist/static/constants.js +34 -0
  143. package/dist/test.d.ts +2 -0
  144. package/dist/test.d.ts.map +1 -0
  145. package/dist/test.js +9 -0
  146. package/dist/turborepo-logo.d.ts +2 -0
  147. package/dist/turborepo-logo.d.ts.map +1 -0
  148. package/dist/turborepo-logo.js +8 -0
  149. package/dist/utils/array-move.d.ts +3 -0
  150. package/dist/utils/array-move.d.ts.map +1 -0
  151. package/dist/utils/array-move.js +19 -0
  152. package/dist/utils/grid.d.ts +22 -0
  153. package/dist/utils/grid.d.ts.map +1 -0
  154. package/dist/utils/grid.js +116 -0
  155. package/dist/utils/naksha.d.ts +32 -0
  156. package/dist/utils/naksha.d.ts.map +1 -0
  157. package/dist/utils/naksha.js +141 -0
  158. package/package.json +57 -0
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SELECTION_STYLE = exports.LAYER_STATUS = exports.PROPERTY_ID = exports.overflowStyle2 = exports.overflowStyle = exports.FALLBACK_THUMB = exports.defaultNakshaProps = void 0;
4
+ const map_common_1 = require("@repo/map-common");
5
+ exports.defaultNakshaProps = {
6
+ defaultViewState: map_common_1.defaultViewState,
7
+ // mapboxAccessToken: "pk.xxx",
8
+ nakshaApiEndpoint: "/naksha-api/api",
9
+ geoserver: { endpoint: "/geoserver", workspace: "biodiv", store: "ibp" },
10
+ mapStyle: map_common_1.MapStyles.MAP_STREETS,
11
+ layers: [],
12
+ selectedLayers: [],
13
+ };
14
+ exports.FALLBACK_THUMB = "data:image/svg+xml,%3Csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cpath fill='%23fff' d='M0 0h72v72H0z'/%3E%3Cpath d='M35.981 48.293l-13.853-10.77-3.045 2.368L36 53.048l16.917-13.157-3.064-2.387-13.872 10.789zM36 43.519l13.834-10.77 3.083-2.388L36 17.204 19.083 30.36l3.064 2.387L36 43.518z' fill='%23A0AEC0'/%3E%3C/svg%3E";
15
+ exports.overflowStyle = {
16
+ display: "-webkit-box",
17
+ WebkitLineClamp: 1,
18
+ WebkitBoxOrient: "vertical",
19
+ overflow: "hidden",
20
+ wordBreak: "break-word",
21
+ };
22
+ exports.overflowStyle2 = {
23
+ ...exports.overflowStyle,
24
+ WebkitLineClamp: 2,
25
+ };
26
+ exports.PROPERTY_ID = "ogc_fid";
27
+ exports.LAYER_STATUS = {
28
+ ACTIVE: "Active",
29
+ PENDING: "Pending",
30
+ };
31
+ exports.SELECTION_STYLE = {
32
+ TOP: "layer_selection_top",
33
+ ALL: "layer_selection_all",
34
+ };
@@ -0,0 +1,16 @@
1
+ import { NakshaMapboxListProps } from "../interfaces";
2
+ import { CSSProperties } from "react";
3
+ export declare const defaultNakshaProps: NakshaMapboxListProps;
4
+ export declare const FALLBACK_THUMB = "data:image/svg+xml,%3Csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cpath fill='%23fff' d='M0 0h72v72H0z'/%3E%3Cpath d='M35.981 48.293l-13.853-10.77-3.045 2.368L36 53.048l16.917-13.157-3.064-2.387-13.872 10.789zM36 43.519l13.834-10.77 3.083-2.388L36 17.204 19.083 30.36l3.064 2.387L36 43.518z' fill='%23A0AEC0'/%3E%3C/svg%3E";
5
+ export declare const overflowStyle: CSSProperties;
6
+ export declare const overflowStyle2: CSSProperties;
7
+ export declare const PROPERTY_ID = "ogc_fid";
8
+ export declare const LAYER_STATUS: {
9
+ ACTIVE: string;
10
+ PENDING: string;
11
+ };
12
+ export declare const SELECTION_STYLE: {
13
+ TOP: string;
14
+ ALL: string;
15
+ };
16
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/static/constants.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,eAAO,MAAM,kBAAkB,EAAE,qBAUhC,CAAC;AAEF,eAAO,MAAM,cAAc,sWAC0U,CAAC;AAEtW,eAAO,MAAM,aAAa,EAAE,aAM3B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAG5B,CAAC;AAEF,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAEF,eAAO,MAAM,eAAe;;;CAG3B,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SELECTION_STYLE = exports.LAYER_STATUS = exports.PROPERTY_ID = exports.overflowStyle2 = exports.overflowStyle = exports.FALLBACK_THUMB = exports.defaultNakshaProps = void 0;
4
+ const map_common_1 = require("@metastringfoundation/map-common");
5
+ exports.defaultNakshaProps = {
6
+ defaultViewState: map_common_1.defaultViewState,
7
+ // mapboxAccessToken: "pk.xxx",
8
+ nakshaApiEndpoint: "/naksha-api/api",
9
+ geoserver: { endpoint: "/geoserver", workspace: "biodiv", store: "ibp" },
10
+ mapStyle: map_common_1.MapStyles.MAP_STREETS,
11
+ layers: [],
12
+ selectedLayers: [],
13
+ };
14
+ exports.FALLBACK_THUMB = "data:image/svg+xml,%3Csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cpath fill='%23fff' d='M0 0h72v72H0z'/%3E%3Cpath d='M35.981 48.293l-13.853-10.77-3.045 2.368L36 53.048l16.917-13.157-3.064-2.387-13.872 10.789zM36 43.519l13.834-10.77 3.083-2.388L36 17.204 19.083 30.36l3.064 2.387L36 43.518z' fill='%23A0AEC0'/%3E%3C/svg%3E";
15
+ exports.overflowStyle = {
16
+ display: "-webkit-box",
17
+ WebkitLineClamp: 1,
18
+ WebkitBoxOrient: "vertical",
19
+ overflow: "hidden",
20
+ wordBreak: "break-word",
21
+ };
22
+ exports.overflowStyle2 = {
23
+ ...exports.overflowStyle,
24
+ WebkitLineClamp: 2,
25
+ };
26
+ exports.PROPERTY_ID = "ogc_fid";
27
+ exports.LAYER_STATUS = {
28
+ ACTIVE: "Active",
29
+ PENDING: "Pending",
30
+ };
31
+ exports.SELECTION_STYLE = {
32
+ TOP: "layer_selection_top",
33
+ ALL: "layer_selection_all",
34
+ };
package/dist/test.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const Test: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,+CAQhB,CAAA"}
package/dist/test.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Test = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const map_common_1 = require("@repo/map-common");
6
+ const Test = () => {
7
+ return ((0, jsx_runtime_1.jsxs)("div", { className: 'bg-red-500 flex justify-center items-center', children: ["test from map-list div", (0, jsx_runtime_1.jsx)(map_common_1.Test, {})] }));
8
+ };
9
+ exports.Test = Test;
@@ -0,0 +1,2 @@
1
+ export declare const TurborepoLogo: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=turborepo-logo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turborepo-logo.d.ts","sourceRoot":"","sources":["../src/turborepo-logo.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,+CAkCzB,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TurborepoLogo = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const TurborepoLogo = () => {
6
+ return ((0, jsx_runtime_1.jsxs)("svg", { "aria-label": "Turbo logomark", height: "80", role: "img", viewBox: "0 0 40 40", width: "80", children: [(0, jsx_runtime_1.jsx)("path", { d: "M19.9845 6.99291C12.818 6.99291 6.98755 12.8279 6.98755 19.9999C6.98755 27.1721 12.818 33.0071 19.9845 33.0071C27.1509 33.0071 32.9814 27.1721 32.9814 19.9999C32.9814 12.8279 27.1509 6.99291 19.9845 6.99291ZM19.9845 26.7313C16.2694 26.7313 13.2585 23.718 13.2585 19.9999C13.2585 16.282 16.2694 13.2687 19.9845 13.2687C23.6996 13.2687 26.7105 16.282 26.7105 19.9999C26.7105 23.718 23.6996 26.7313 19.9845 26.7313Z", fill: "currentcolor" }), (0, jsx_runtime_1.jsx)("path", { clipRule: "evenodd", d: "M21.0734 4.85648V0C31.621 0.564369 40 9.30362 40 19.9999C40 30.6963 31.621 39.4332 21.0734 40V35.1435C28.9344 34.5815 35.1594 28.0078 35.1594 19.9999C35.1594 11.9922 28.9344 5.41843 21.0734 4.85648ZM8.52181 29.931C6.43794 27.5233 5.09469 24.4568 4.85508 21.09H0C0.251709 25.8011 2.13468 30.0763 5.08501 33.368L8.51938 29.931H8.52181ZM18.8951 40V35.1435C15.5285 34.9037 12.4644 33.5619 10.0587 31.4739L6.62435 34.9109C9.91593 37.866 14.1876 39.7481 18.8927 40H18.8951Z", fill: "url(#:Sb:paint0_linear_902_224)", fillRule: "evenodd" }), (0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("linearGradient", { gradientUnits: "userSpaceOnUse", id: ":Sb:paint0_linear_902_224", x1: "21.8576", x2: "2.17018", y1: "2.81244", y2: "22.4844", children: [(0, jsx_runtime_1.jsx)("stop", { stopColor: "#0096FF" }), (0, jsx_runtime_1.jsx)("stop", { offset: "1", stopColor: "#FF1E56" })] }) })] }));
7
+ };
8
+ exports.TurborepoLogo = TurborepoLogo;
@@ -0,0 +1,3 @@
1
+ export declare function arrayMoveMutable(array: any, fromIndex: any, toIndex: any): void;
2
+ export declare function arrayMoveImmutable(array: any, fromIndex: any, toIndex: any): any;
3
+ //# sourceMappingURL=array-move.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-move.d.ts","sourceRoot":"","sources":["../../src/utils/array-move.ts"],"names":[],"mappings":"AACA,wBAAgB,gBAAgB,CAAC,KAAK,KAAA,EAAE,SAAS,KAAA,EAAE,OAAO,KAAA,QASzD;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,KAAA,EAAE,SAAS,KAAA,EAAE,OAAO,KAAA,OAI3D"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.arrayMoveMutable = arrayMoveMutable;
4
+ exports.arrayMoveImmutable = arrayMoveImmutable;
5
+ // @ts-ignore
6
+ function arrayMoveMutable(array, fromIndex, toIndex) {
7
+ const startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex;
8
+ if (startIndex >= 0 && startIndex < array.length) {
9
+ const endIndex = toIndex < 0 ? array.length + toIndex : toIndex;
10
+ const [item] = array.splice(fromIndex, 1);
11
+ array.splice(endIndex, 0, item);
12
+ }
13
+ }
14
+ // @ts-ignore
15
+ function arrayMoveImmutable(array, fromIndex, toIndex) {
16
+ array = [...array];
17
+ arrayMoveMutable(array, fromIndex, toIndex);
18
+ return array;
19
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Takes zoom level of map and returns Precision, Level and Square Size (in kms)
3
+ *
4
+ * @param {*} zoom
5
+ * @returns {number[]}
6
+ */
7
+ export declare const getZoomConfig: (zoom: number) => number[];
8
+ /**
9
+ * Converts {geohash: count} to geojson
10
+ *
11
+ * @param {*} data
12
+ * @param {number} level
13
+ * @returns
14
+ */
15
+ export declare const geohashToJSON: (data: {}, level: number) => {
16
+ type: string;
17
+ features: any;
18
+ };
19
+ export declare const getDataBins: (data: {
20
+ [key: string]: number;
21
+ }, binCount: number) => (number | undefined)[];
22
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/utils/grid.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAAM,EAYlD,CAAC;AA4DF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,EAAE,EAAE,OAAO,MAAM;;;CAQnD,CAAC;AAEH,eAAO,MAAM,WAAW,GACtB,MAAM;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAC/B,UAAU,MAAM,2BASjB,CAAC"}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getDataBins = exports.geohashToJSON = exports.getZoomConfig = void 0;
7
+ // @ts-ignore
8
+ const boundingbox_1 = __importDefault(require("boundingbox"));
9
+ // @ts-ignore
10
+ const geohash_1 = require("geohash");
11
+ const constants_1 = require("../static/constants");
12
+ /**
13
+ * Takes zoom level of map and returns Precision, Level and Square Size (in kms)
14
+ *
15
+ * @param {*} zoom
16
+ * @returns {number[]}
17
+ */
18
+ const getZoomConfig = (zoom) => {
19
+ if (zoom < 6)
20
+ return [4, 1, 39.2];
21
+ else if (zoom < 7)
22
+ return [5, 0, 19.6];
23
+ else if (zoom < 8)
24
+ return [5, 1, 9.8];
25
+ else if (zoom < 9)
26
+ return [5, -1, 4.9];
27
+ else if (zoom < 10)
28
+ return [6, 0, 2.45];
29
+ else if (zoom < 11)
30
+ return [6, 1, 1.225];
31
+ else if (zoom < 12)
32
+ return [7, 0, 0.612];
33
+ else if (zoom < 13)
34
+ return [7, 1, 0.306];
35
+ else if (zoom < 14)
36
+ return [7, -1, 0.153];
37
+ else if (zoom < 15)
38
+ return [8, 0, 0.077];
39
+ return [8, 1, 0.039];
40
+ };
41
+ exports.getZoomConfig = getZoomConfig;
42
+ const BASE32 = "0123456789bcdefghjkmnpqrstuvwxyz";
43
+ const aggregateGeohashKey = (key, level, binSize) => {
44
+ binSize = binSize || 16 / 2 ** ((1 - key.length) & 1) / 4 ** level;
45
+ const keyExceptLast = key.slice(0, -1);
46
+ const binnedCharAt = ~~(BASE32.indexOf(key.slice(-1)) / binSize);
47
+ return [
48
+ keyExceptLast + BASE32[binSize * binnedCharAt],
49
+ keyExceptLast + BASE32[binSize * (binnedCharAt + 1) - 1],
50
+ ];
51
+ };
52
+ const processRectangles = function (data, level) {
53
+ var counts = new Map();
54
+ var bins = new Map();
55
+ const features = [];
56
+ for (const [hash, count] of Object.entries(data)) {
57
+ const [kStart, kEnd] = aggregateGeohashKey(hash, level);
58
+ bins.set(kStart, kEnd);
59
+ if (!counts.has(kStart)) {
60
+ counts.set(kStart, 0);
61
+ }
62
+ counts.set(kStart, counts.get(kStart) + count);
63
+ }
64
+ counts.forEach((count, hash) => {
65
+ const bboxStart = geohash_1.GeoHash.decodeGeoHash(hash);
66
+ const bboxEnd = geohash_1.GeoHash.decodeGeoHash(bins.get(hash));
67
+ const feature = new boundingbox_1.default({
68
+ minlat: bboxStart.latitude[0],
69
+ minlon: bboxStart.longitude[0],
70
+ maxlat: bboxEnd.latitude[1],
71
+ maxlon: bboxEnd.longitude[1],
72
+ }).toGeoJSON();
73
+ features.push({ ...feature, properties: { count, [constants_1.PROPERTY_ID]: hash } });
74
+ });
75
+ return features;
76
+ };
77
+ const processSquares = (data) => {
78
+ const features = [];
79
+ for (const [hash, count] of Object.entries(data)) {
80
+ const bbox = geohash_1.GeoHash.decodeGeoHash(hash);
81
+ const feature = new boundingbox_1.default({
82
+ minlat: bbox.latitude[0],
83
+ minlon: bbox.longitude[0],
84
+ maxlat: bbox.latitude[1],
85
+ maxlon: bbox.longitude[1],
86
+ }).toGeoJSON();
87
+ features.push({ ...feature, properties: { count, [constants_1.PROPERTY_ID]: hash } });
88
+ }
89
+ return features;
90
+ };
91
+ /**
92
+ * Converts {geohash: count} to geojson
93
+ *
94
+ * @param {*} data
95
+ * @param {number} level
96
+ * @returns
97
+ */
98
+ const geohashToJSON = (data, level) => ({
99
+ type: "FeatureCollection",
100
+ features: Object.keys(data).length === 0
101
+ ? []
102
+ : level === -1
103
+ ? processSquares(data)
104
+ : processRectangles(data, level),
105
+ });
106
+ exports.geohashToJSON = geohashToJSON;
107
+ const getDataBins = (data, binCount) => {
108
+ const sortedData = Object.values(data).sort((a, b) => a - b);
109
+ const cutoff = Math.floor(sortedData.length / binCount);
110
+ const tBins = new Array(binCount - 1)
111
+ .fill(0)
112
+ .map((_, index) => sortedData[cutoff * (index + 1)]);
113
+ tBins.push(sortedData[sortedData.length - 1]);
114
+ return tBins;
115
+ };
116
+ exports.getDataBins = getDataBins;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * pre-processes layers list
3
+ *
4
+ * @param {Array<any>} layers - list of layer objects returned from backend
5
+ * @param {string} nakshaApiEndpoint - base URL of naksha API (used for thumbnails)
6
+ * @param {{endpoint:string, workspace:string}} geoserver - geoserver info
7
+ * @param {string[]} selectedLayers - array of layer names already added
8
+ * @returns {Promise<any[]>}
9
+ */
10
+ export declare const parseGeoserverLayersXml: (layers: any, nakshaApiEndpoint: string, geoserver: {
11
+ endpoint?: any;
12
+ workspace: any;
13
+ }, selectedLayers: any) => Promise<any[]>;
14
+ /**
15
+ * Gets geoserver vector based layer styles and returns updated layer.data
16
+ *
17
+ * NOTE: This version does NOT use immer. It performs network calls first,
18
+ * then builds and returns a new data object that callers can assign to layer.data.
19
+ *
20
+ * @param {any} layer - parsed layer (must have .id and optional .data)
21
+ * @param {number} styleIndex - index to ensure style and colors exist
22
+ * @param {string} nakshaApiEndpoint
23
+ * @param {{workspace?: string}} geoserver
24
+ * @returns {Promise<any>} updated data object
25
+ */
26
+ export declare const getLayerStyle: (layer: {
27
+ data: any;
28
+ id: string;
29
+ }, styleIndex: number, nakshaApiEndpoint: string, geoserver: {
30
+ workspace: string;
31
+ }) => Promise<any>;
32
+ //# sourceMappingURL=naksha.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naksha.d.ts","sourceRoot":"","sources":["../../src/utils/naksha.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,GAAG,EACX,mBAAmB,MAAM,EACzB,WAAW;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC;IAAC,SAAS,EAAE,GAAG,CAAC;CAAE,EAC9C,gBAAgB,GAAG,mBAsDpB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;CAAE,EACjC,YAAY,MAAM,EAClB,mBAAmB,MAAM,EACzB,WAAW;IAAE,SAAS,EAAE,MAAM,CAAC;CAAE,iBAoFlC,CAAC"}
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLayerStyle = exports.parseGeoserverLayersXml = void 0;
4
+ const naksha_1 = require("../services/naksha");
5
+ /**
6
+ * pre-processes layers list
7
+ *
8
+ * @param {Array<any>} layers - list of layer objects returned from backend
9
+ * @param {string} nakshaApiEndpoint - base URL of naksha API (used for thumbnails)
10
+ * @param {{endpoint:string, workspace:string}} geoserver - geoserver info
11
+ * @param {string[]} selectedLayers - array of layer names already added
12
+ * @returns {Promise<any[]>}
13
+ */
14
+ const parseGeoserverLayersXml = async (layers, nakshaApiEndpoint, geoserver, selectedLayers) => {
15
+ const parsedLayers = [];
16
+ const selectedSet = new Set((selectedLayers ?? []).filter(Boolean));
17
+ for (const l of layers) {
18
+ const isAdded = selectedSet.has(l.name);
19
+ // normalize thumbnail URL
20
+ const rawThumb = l.thumbnail ?? "";
21
+ const thumbnail = rawThumb.startsWith("http") || rawThumb.startsWith("//")
22
+ ? rawThumb
23
+ : `${nakshaApiEndpoint.replace(/\/$/, "")}/${rawThumb.replace(/^\//, "")}`;
24
+ const sourceType = typeof l.layerType === "string" && l.layerType.toLowerCase() === "raster"
25
+ ? "raster"
26
+ : "vector";
27
+ const _l = {
28
+ ...l,
29
+ id: l.name,
30
+ thumbnail,
31
+ source: {
32
+ type: sourceType,
33
+ scheme: "tms",
34
+ tiles: [
35
+ `${geoserver.endpoint.replace(/\/$/, "")}/gwc/service/tms/1.0.0/${encodeURIComponent(`${geoserver.workspace}:${l.name}`)}@EPSG%3A900913@pbf/{z}/{x}/{y}.pbf`,
36
+ ],
37
+ },
38
+ data: { styles: [] },
39
+ isAdded,
40
+ };
41
+ if (isAdded) {
42
+ // if layer is already added pre-fetch it's initial style (styleIndex 0)
43
+ try {
44
+ const _ld = await (0, exports.getLayerStyle)(_l, 0, nakshaApiEndpoint, geoserver);
45
+ parsedLayers.push({ ..._l, data: _ld });
46
+ }
47
+ catch (err) {
48
+ // on failure, still include the layer with default data
49
+ // eslint-disable-next-line no-console
50
+ console.error("Error fetching layer style for prefetch:", l.name, err);
51
+ parsedLayers.push(_l);
52
+ }
53
+ }
54
+ else {
55
+ parsedLayers.push(_l);
56
+ }
57
+ }
58
+ return parsedLayers;
59
+ };
60
+ exports.parseGeoserverLayersXml = parseGeoserverLayersXml;
61
+ /**
62
+ * Gets geoserver vector based layer styles and returns updated layer.data
63
+ *
64
+ * NOTE: This version does NOT use immer. It performs network calls first,
65
+ * then builds and returns a new data object that callers can assign to layer.data.
66
+ *
67
+ * @param {any} layer - parsed layer (must have .id and optional .data)
68
+ * @param {number} styleIndex - index to ensure style and colors exist
69
+ * @param {string} nakshaApiEndpoint
70
+ * @param {{workspace?: string}} geoserver
71
+ * @returns {Promise<any>} updated data object
72
+ */
73
+ const getLayerStyle = async (layer, styleIndex, nakshaApiEndpoint, geoserver) => {
74
+ console.log("getLayerStyle", layer, styleIndex, nakshaApiEndpoint, geoserver);
75
+ // Start from existing data (defensive)
76
+ let data = layer.data && typeof layer.data === "object" ? { ...layer.data } : { styles: [] };
77
+ // 1) If styles list is empty, fetch style list and metadata
78
+ if (!Array.isArray(data.styles) || data.styles.length === 0) {
79
+ try {
80
+ const result = await (0, naksha_1.axGetGeoserverLayerStyleList)(layer.id, nakshaApiEndpoint);
81
+ if (result && result.success && result.data) {
82
+ const d = result.data;
83
+ data = {
84
+ ...data,
85
+ layerName: d.layerName ?? data.layerName,
86
+ styles: Array.isArray(d.styles) ? d.styles.slice() : [],
87
+ summaryColumn: d.summaryColumn ?? data.summaryColumn,
88
+ titleColumn: d.titleColumn ?? data.titleColumn,
89
+ };
90
+ // build propertyMap safely
91
+ try {
92
+ data.propertyMap = Object.fromEntries((data.styles || []).map((o) => [o.styleName, o.styleTitle]));
93
+ }
94
+ catch {
95
+ data.propertyMap = data.propertyMap ?? {};
96
+ }
97
+ }
98
+ }
99
+ catch (err) {
100
+ // fail silently (log) and continue with whatever `data` we have
101
+ // eslint-disable-next-line no-console
102
+ console.error("axGetGeoserverLayerStyleList error for", layer.id, err);
103
+ }
104
+ }
105
+ // ensure styles is an array
106
+ if (!Array.isArray(data.styles))
107
+ data.styles = [];
108
+ // 2) If the style at styleIndex exists but lacks colors, fetch colors
109
+ const styleExists = Boolean(data.styles[styleIndex]);
110
+ const needsColors = styleExists && !data.styles[styleIndex]?.colors;
111
+ // If style entry is missing entirely (index out of range), ensure array has placeholder(s)
112
+ if (!styleExists) {
113
+ // grow the styles array up to styleIndex with empty objects
114
+ while (data.styles.length <= styleIndex) {
115
+ data.styles.push({});
116
+ }
117
+ }
118
+ if (needsColors || !styleExists) {
119
+ // determine styleName to fetch colors for; prefer newly-fetched styles metadata if present
120
+ const styleName = (data.styles && data.styles[styleIndex] && data.styles[styleIndex].styleName) ||
121
+ null;
122
+ if (styleName) {
123
+ try {
124
+ const colors = await (0, naksha_1.axGetGeoserverLayerStyle)(layer.id, geoserver?.workspace, styleName, nakshaApiEndpoint);
125
+ // attach colors into the copy of styles
126
+ data = {
127
+ ...data,
128
+ styles: data.styles.map((s, i) => i === styleIndex ? { ...s, colors } : s),
129
+ };
130
+ }
131
+ catch (err) {
132
+ // eslint-disable-next-line no-console
133
+ console.error("axGetGeoserverLayerStyle error for", layer.id, styleName, err);
134
+ }
135
+ }
136
+ }
137
+ // 3) set styleIndex
138
+ data.styleIndex = styleIndex;
139
+ return data;
140
+ };
141
+ exports.getLayerStyle = getLayerStyle;
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@metastringfoundation/map-list",
3
+ "version": "0.1.0",
4
+ "sideEffects": [
5
+ "**/*.css"
6
+ ],
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./styles.css": "./dist/index.css"
18
+ },
19
+ "license": "MIT",
20
+ "peerDependencies": {
21
+ "react": "^19"
22
+ },
23
+ "devDependencies": {
24
+ "@tailwindcss/cli": "^4.1.5",
25
+ "@types/react": "^19.1.0",
26
+ "eslint": "^9.39.1",
27
+ "tailwindcss": "^4.1.5",
28
+ "typescript": "5.9.2",
29
+ "@repo/eslint-config": "0.0.0",
30
+ "@repo/tailwind-config": "0.0.0",
31
+ "@repo/typescript-config": "0.0.0"
32
+ },
33
+ "dependencies": {
34
+ "@dnd-kit/core": "^6.3.1",
35
+ "@dnd-kit/modifiers": "^9.0.0",
36
+ "@dnd-kit/sortable": "^10.0.0",
37
+ "@dnd-kit/utilities": "^3.2.2",
38
+ "@tanstack/react-virtual": "^3.13.12",
39
+ "boundingbox": "^1.4.0",
40
+ "colorbrewer": "^1.6.1",
41
+ "geohash": "^0.0.1",
42
+ "maplibre-gl": "^5.13.0",
43
+ "react-map-gl": "^8.1.0",
44
+ "react-tiny-popover": "^8.1.6",
45
+ "react-virtualized-auto-sizer": "^1.0.26",
46
+ "react-web-share": "^2.0.2",
47
+ "@metastringfoundation/map-common": "0.1.0"
48
+ },
49
+ "scripts": {
50
+ "build:styles": "tailwindcss -i ./src/styles.css -o ./dist/index.css",
51
+ "build:components": "tsc",
52
+ "check-types": "tsc --noEmit",
53
+ "dev:styles": "tailwindcss -i ./src/styles.css -o ./dist/index.css --watch",
54
+ "dev:components": "tsc --watch",
55
+ "lint": "eslint src --max-warnings 0"
56
+ }
57
+ }