@honua/react 0.1.11-beta.0 → 0.1.13
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/columnar/apache-arrow.d.ts +17 -0
- package/columnar/apache-arrow.d.ts.map +1 -0
- package/columnar/apache-arrow.js +1036 -0
- package/columnar/batch-cache-conformance.d.ts +66 -0
- package/columnar/batch-cache-conformance.d.ts.map +1 -0
- package/columnar/batch-cache-conformance.js +317 -0
- package/columnar/batch-cache-indexeddb.d.ts +31 -0
- package/columnar/batch-cache-indexeddb.d.ts.map +1 -0
- package/columnar/batch-cache-indexeddb.js +148 -0
- package/columnar/batch-cache.d.ts +298 -0
- package/columnar/batch-cache.d.ts.map +1 -0
- package/columnar/batch-cache.js +757 -0
- package/columnar/geoarrow-aggregate.d.ts +178 -0
- package/columnar/geoarrow-aggregate.d.ts.map +1 -0
- package/columnar/geoarrow-aggregate.js +976 -0
- package/columnar/geoarrow-patch.d.ts +382 -0
- package/columnar/geoarrow-patch.d.ts.map +1 -0
- package/columnar/geoarrow-patch.js +1656 -0
- package/columnar/geoarrow-reproject.d.ts +22 -0
- package/columnar/geoarrow-reproject.d.ts.map +1 -0
- package/columnar/geoarrow-reproject.js +119 -0
- package/columnar/geoarrow-serialization.d.ts +68 -0
- package/columnar/geoarrow-serialization.d.ts.map +1 -0
- package/columnar/geoarrow-serialization.js +331 -0
- package/columnar/geoarrow-types.d.ts +271 -0
- package/columnar/geoarrow-types.d.ts.map +1 -0
- package/columnar/geoarrow-types.js +15 -0
- package/columnar/geoarrow.d.ts +52 -0
- package/columnar/geoarrow.d.ts.map +1 -0
- package/columnar/geoarrow.js +1469 -0
- package/columnar/index.d.ts +43 -0
- package/columnar/index.d.ts.map +1 -0
- package/columnar/index.js +29 -0
- package/columnar/operators.d.ts +70 -0
- package/columnar/operators.d.ts.map +1 -0
- package/columnar/operators.js +307 -0
- package/columnar/result.d.ts +369 -0
- package/columnar/result.d.ts.map +1 -0
- package/columnar/result.js +815 -0
- package/columnar/telemetry.d.ts +152 -0
- package/columnar/telemetry.d.ts.map +1 -0
- package/columnar/telemetry.js +265 -0
- package/columnar/transfer.d.ts +28 -0
- package/columnar/transfer.d.ts.map +1 -0
- package/columnar/transfer.js +669 -0
- package/columnar/types.d.ts +175 -0
- package/columnar/types.d.ts.map +1 -0
- package/columnar/types.js +22 -0
- package/columnar/worker.d.ts +157 -0
- package/columnar/worker.d.ts.map +1 -0
- package/columnar/worker.js +1059 -0
- package/connect-url-safety.d.ts +53 -0
- package/connect-url-safety.js +189 -0
- package/contract/pmtiles.d.ts +6 -5
- package/contract/pmtiles.d.ts.map +1 -1
- package/contract/pmtiles.js +30 -5
- package/control-plane/generated/admin-operations.d.ts +3 -3
- package/control-plane/generated/admin-operations.d.ts.map +1 -1
- package/control-plane/generated/admin-operations.js +3 -3
- package/core/client.d.ts.map +1 -1
- package/core/client.js +87 -19
- package/core/deprecation-notice.d.ts +28 -0
- package/core/deprecation-notice.d.ts.map +1 -0
- package/core/deprecation-notice.js +22 -0
- package/core/esri-geojson.d.ts.map +1 -1
- package/core/esri-geojson.js +10 -6
- package/core/optional-grpc-peer.d.ts +15 -0
- package/core/optional-grpc-peer.d.ts.map +1 -0
- package/core/optional-grpc-peer.js +60 -0
- package/esri-compat/basemap-gallery.d.ts +2 -0
- package/esri-compat/basemap-gallery.d.ts.map +1 -1
- package/esri-compat/basemap-gallery.js +12 -0
- package/esri-compat/basemap.d.ts +4 -0
- package/esri-compat/basemap.d.ts.map +1 -1
- package/esri-compat/basemap.js +70 -0
- package/esri-compat/bookmarks.d.ts +2 -0
- package/esri-compat/bookmarks.d.ts.map +1 -1
- package/esri-compat/bookmarks.js +12 -0
- package/esri-compat/controls.d.ts +18 -0
- package/esri-compat/controls.d.ts.map +1 -1
- package/esri-compat/controls.js +120 -57
- package/esri-compat/directions.d.ts +4 -0
- package/esri-compat/directions.d.ts.map +1 -1
- package/esri-compat/directions.js +30 -20
- package/esri-compat/editor.d.ts +4 -0
- package/esri-compat/editor.d.ts.map +1 -1
- package/esri-compat/editor.js +16 -0
- package/esri-compat/esri-config.d.ts +2 -1
- package/esri-compat/esri-config.d.ts.map +1 -1
- package/esri-compat/feature-effect.d.ts +23 -0
- package/esri-compat/feature-effect.d.ts.map +1 -0
- package/esri-compat/feature-effect.js +12 -0
- package/esri-compat/feature-form.d.ts +6 -0
- package/esri-compat/feature-form.d.ts.map +1 -1
- package/esri-compat/feature-form.js +63 -0
- package/esri-compat/feature-layer.d.ts +21 -2
- package/esri-compat/feature-layer.d.ts.map +1 -1
- package/esri-compat/feature-layer.js +172 -1
- package/esri-compat/feature-table.d.ts +5 -0
- package/esri-compat/feature-table.d.ts.map +1 -1
- package/esri-compat/feature-table.js +23 -0
- package/esri-compat/identity-manager.d.ts +1 -1
- package/esri-compat/identity-manager.js +1 -1
- package/esri-compat/legend.d.ts +2 -0
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +98 -0
- package/esri-compat/locator.d.ts +1 -1
- package/esri-compat/locator.js +1 -1
- package/esri-compat/map-view-mount.d.ts +1 -0
- package/esri-compat/map-view-mount.d.ts.map +1 -1
- package/esri-compat/map-view-mount.js +46 -25
- package/esri-compat/map-view.d.ts +13 -0
- package/esri-compat/map-view.d.ts.map +1 -1
- package/esri-compat/map-view.js +94 -8
- package/esri-compat/map.d.ts +5 -1
- package/esri-compat/map.d.ts.map +1 -1
- package/esri-compat/map.js +10 -0
- package/esri-compat/measurement.d.ts +2 -0
- package/esri-compat/measurement.d.ts.map +1 -1
- package/esri-compat/measurement.js +14 -0
- package/esri-compat/point.d.ts +7 -0
- package/esri-compat/point.d.ts.map +1 -1
- package/esri-compat/point.js +33 -3
- package/esri-compat/popup.d.ts +2 -0
- package/esri-compat/popup.d.ts.map +1 -1
- package/esri-compat/popup.js +12 -0
- package/esri-compat/portal.d.ts +1 -1
- package/esri-compat/portal.js +1 -1
- package/esri-compat/print.d.ts +3 -0
- package/esri-compat/print.d.ts.map +1 -1
- package/esri-compat/print.js +15 -0
- package/esri-compat/search.d.ts +4 -0
- package/esri-compat/search.d.ts.map +1 -1
- package/esri-compat/search.js +25 -28
- package/esri-compat/sketch.d.ts +2 -0
- package/esri-compat/sketch.d.ts.map +1 -1
- package/esri-compat/sketch.js +12 -0
- package/esri-compat/widget-host.d.ts +46 -17
- package/esri-compat/widget-host.d.ts.map +1 -1
- package/esri-compat/widget-host.js +84 -20
- package/esri-compat/widget-shell-hosts.d.ts +61 -0
- package/esri-compat/widget-shell-hosts.d.ts.map +1 -0
- package/esri-compat/widget-shell-hosts.js +76 -0
- package/geocoding/index.d.ts +114 -0
- package/geocoding/index.d.ts.map +1 -0
- package/geocoding/index.js +293 -0
- package/geocoding/provider-http.d.ts +37 -0
- package/geocoding/provider-http.d.ts.map +1 -0
- package/geocoding/provider-http.js +93 -0
- package/geocoding/provider.d.ts +145 -0
- package/geocoding/provider.d.ts.map +1 -0
- package/geocoding/provider.js +41 -0
- package/geocoding/providers/honua.d.ts +28 -0
- package/geocoding/providers/honua.d.ts.map +1 -0
- package/geocoding/providers/honua.js +68 -0
- package/geocoding/providers/nominatim.d.ts +47 -0
- package/geocoding/providers/nominatim.d.ts.map +1 -0
- package/geocoding/providers/nominatim.js +105 -0
- package/geocoding/providers/pelias.d.ts +40 -0
- package/geocoding/providers/pelias.d.ts.map +1 -0
- package/geocoding/providers/pelias.js +115 -0
- package/geocoding/providers/photon.d.ts +39 -0
- package/geocoding/providers/photon.d.ts.map +1 -0
- package/geocoding/providers/photon.js +107 -0
- package/geometry/convert.d.ts +13 -0
- package/geometry/convert.d.ts.map +1 -0
- package/geometry/convert.js +12 -0
- package/geometry/index.d.ts +17 -0
- package/geometry/index.d.ts.map +1 -0
- package/geometry/index.js +15 -0
- package/geometry/internal.d.ts +25 -0
- package/geometry/internal.d.ts.map +1 -0
- package/geometry/internal.js +40 -0
- package/geometry/ops.d.ts +71 -0
- package/geometry/ops.d.ts.map +1 -0
- package/geometry/ops.js +147 -0
- package/geometry/project.d.ts +40 -0
- package/geometry/project.d.ts.map +1 -0
- package/geometry/project.js +88 -0
- package/geometry/types.d.ts +36 -0
- package/geometry/types.d.ts.map +1 -0
- package/geometry/types.js +12 -0
- package/kernel/renderer.d.ts +82 -0
- package/kernel/renderer.js +1 -0
- package/offline/digest.d.ts +15 -0
- package/offline/digest.js +58 -0
- package/offline/quota.d.ts +161 -0
- package/offline/quota.js +370 -0
- package/offline/types.d.ts +349 -0
- package/offline/types.js +75 -0
- package/package.json +14 -2
- package/widget-capabilities.d.ts +67 -0
- package/widget-capabilities.js +152 -0
package/core/client.js
CHANGED
|
@@ -9,6 +9,7 @@ import { HonuaOgcMaps, getOgcMapImage, getOgcMapsConformance, getOgcMapsLanding
|
|
|
9
9
|
import { HonuaOgcProcesses, cancelOgcProcessJob, executeOgcProcess, getOgcProcess, getOgcProcessJob, getOgcProcessJobResults, getOgcProcessesConformance, getOgcProcessesLanding, listOgcProcesses, } from "./ogc-processes.js";
|
|
10
10
|
import { HonuaOgcRecords, fetchOgcRecordRaw, fetchOgcRecordsRaw, getOgcRecord, getOgcRecordCollection, getOgcRecordsConformance, getOgcRecordsLanding, listOgcRecordCollections, searchOgcRecords, } from "./ogc-records.js";
|
|
11
11
|
import { HonuaOgcTiles, fetchOgcTile, getOgcCollectionTileset, getOgcTileMatrixSet, getOgcTilesConformance, getOgcTilesLanding, listOgcCollectionTilesets, listOgcTileMatrixSets, } from "./ogc-tiles.js";
|
|
12
|
+
import { explainOptionalGrpcLoadFailure } from "./optional-grpc-peer.js";
|
|
12
13
|
import { stripQuery, trimTrailingSlashes } from "./path-utils.js";
|
|
13
14
|
import { decodePbfQueryResponse, isPbfResponse } from "./pbf-decoder.js";
|
|
14
15
|
import { createGeoServicesGpAdapter, createGeospatialGrpcProcessAdapter, createHonuaProcessRunner, createOgcProcessesAdapter, } from "./process-runner.js";
|
|
@@ -303,16 +304,12 @@ export class HonuaClient {
|
|
|
303
304
|
if (this.connectClient) {
|
|
304
305
|
return this.connectClient;
|
|
305
306
|
}
|
|
306
|
-
// Keep optional Connect peers out of the module graph until the
|
|
307
|
-
// gRPC operation is
|
|
308
|
-
//
|
|
307
|
+
// Keep optional Connect peers out of the static module graph until the
|
|
308
|
+
// first gRPC operation is awaited. A literal import() is followed by
|
|
309
|
+
// Vite/Rolldown and fails a REST production build when the peer is absent.
|
|
309
310
|
let initPromise = this.connectClientPromise;
|
|
310
311
|
if (!initPromise) {
|
|
311
|
-
initPromise =
|
|
312
|
-
import("@connectrpc/connect"),
|
|
313
|
-
import("@connectrpc/connect-web"),
|
|
314
|
-
import("../gen/geospatial/v1/feature_service_pb.js"),
|
|
315
|
-
]).then(([{ createClient }, { createGrpcWebTransport }, { FeatureService }]) => {
|
|
312
|
+
initPromise = loadGrpcWebRuntime().then(({ createClient, createGrpcWebTransport, FeatureService }) => {
|
|
316
313
|
const transport = createGrpcWebTransport(this.connectTransportOptions());
|
|
317
314
|
this.connectClient = createClient(FeatureService, transport);
|
|
318
315
|
return this.connectClient;
|
|
@@ -327,7 +324,7 @@ export class HonuaClient {
|
|
|
327
324
|
if (this.connectClientPromise === initPromise) {
|
|
328
325
|
this.connectClientPromise = undefined;
|
|
329
326
|
}
|
|
330
|
-
throw error;
|
|
327
|
+
throw explainOptionalGrpcLoadFailure(error);
|
|
331
328
|
}
|
|
332
329
|
}
|
|
333
330
|
/**
|
|
@@ -400,7 +397,17 @@ export class HonuaClient {
|
|
|
400
397
|
}
|
|
401
398
|
}
|
|
402
399
|
static async loadGrpcAdapter() {
|
|
403
|
-
|
|
400
|
+
let loaded;
|
|
401
|
+
try {
|
|
402
|
+
loaded = await importOptionalGrpcSpecifier(GRPC_ADAPTER_SPECIFIER);
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
throw explainOptionalGrpcLoadFailure(error);
|
|
406
|
+
}
|
|
407
|
+
if (!isGrpcAdapterModule(loaded)) {
|
|
408
|
+
throw new Error("HonuaClient gRPC adapter loaded but did not export the query runtime.");
|
|
409
|
+
}
|
|
410
|
+
return loaded;
|
|
404
411
|
}
|
|
405
412
|
get isGrpcWeb() {
|
|
406
413
|
return this.transport === "grpc-web";
|
|
@@ -1276,9 +1283,10 @@ export class HonuaClient {
|
|
|
1276
1283
|
};
|
|
1277
1284
|
return this.executeRequest(request, {
|
|
1278
1285
|
callerSignal,
|
|
1286
|
+
deadlineThroughFinalize: true,
|
|
1279
1287
|
readOnlyQuery: policy?.readOnlyQuery,
|
|
1280
1288
|
redirect: policy?.readOnlyQuery ? "preserve-method" : undefined,
|
|
1281
|
-
finalize: async (response,
|
|
1289
|
+
finalize: async (response, _durationMs, _currentRequest, runAfter) => {
|
|
1282
1290
|
// Parse the original body directly when no after-interceptor will read
|
|
1283
1291
|
// it; only clone when an interceptor needs an independent copy.
|
|
1284
1292
|
const body = await parseResponseBody(this.hasAfterInterceptors() ? response.clone() : response);
|
|
@@ -1288,11 +1296,9 @@ export class HonuaClient {
|
|
|
1288
1296
|
// failure envelope back as a "successful" response object.
|
|
1289
1297
|
const envelopeError = toGeoServicesError(response.status, body, response.headers);
|
|
1290
1298
|
if (envelopeError) {
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
durationMs,
|
|
1295
|
-
});
|
|
1299
|
+
// deadlineThroughFinalize is set for this wrapper, so executeRequest
|
|
1300
|
+
// dispatches error interceptors for this throw. Notifying here as well
|
|
1301
|
+
// runs every hook twice.
|
|
1296
1302
|
throw envelopeError;
|
|
1297
1303
|
}
|
|
1298
1304
|
await runAfter();
|
|
@@ -1552,9 +1558,14 @@ export class HonuaClient {
|
|
|
1552
1558
|
return shorted.value;
|
|
1553
1559
|
}
|
|
1554
1560
|
if (!response.ok && !options.okStatuses?.includes(response.status)) {
|
|
1555
|
-
const
|
|
1556
|
-
?
|
|
1557
|
-
:
|
|
1561
|
+
const errorBodyRead = options.errorBody
|
|
1562
|
+
? options.errorBody(response, options.deadlineThroughFinalize ? timeout.signal : undefined)
|
|
1563
|
+
: parseResponseBody(response.clone());
|
|
1564
|
+
// A custom fetchFn can return a non-OK body that ignores init.signal.
|
|
1565
|
+
// Race that read with the same deadline as a successful body.
|
|
1566
|
+
const body = options.deadlineThroughFinalize
|
|
1567
|
+
? await awaitAbortable(errorBodyRead, timeout.signal)
|
|
1568
|
+
: await errorBodyRead;
|
|
1558
1569
|
const httpError = toHttpError(response.status, body, response.headers);
|
|
1559
1570
|
if (!refreshedAuth &&
|
|
1560
1571
|
(response.status === 401 || response.status === 403) &&
|
|
@@ -1591,6 +1602,16 @@ export class HonuaClient {
|
|
|
1591
1602
|
if (!options.deadlineThroughFinalize || !timeout.signal?.aborted)
|
|
1592
1603
|
throw error;
|
|
1593
1604
|
const terminalError = timeout.didTimeout ? new HonuaTimeoutError(this.timeoutMs ?? 0) : new HonuaAbortError();
|
|
1605
|
+
// A body-read or finalize deadline is the same transient failure as a
|
|
1606
|
+
// timeout inside fetch. Replay-safe requests re-enter the retry policy.
|
|
1607
|
+
// Caller cancellation is never retried. Interceptors run only once the
|
|
1608
|
+
// attempt is terminal, so a later successful retry does not observe it.
|
|
1609
|
+
if (timeout.didTimeout &&
|
|
1610
|
+
shouldRetryRequest(this.retryOptions, request.method, attempt, undefined, terminalError, readOnlyQuery)) {
|
|
1611
|
+
await options.beforeReplay?.(cloneRequestContext(request), undefined, "retry");
|
|
1612
|
+
await this.sleepBeforeRetry(attempt, undefined, retrySignal);
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1594
1615
|
beginTerminalErrorNotification(terminalError, performance.now() - startTime);
|
|
1595
1616
|
throw terminalError;
|
|
1596
1617
|
}
|
|
@@ -1978,3 +1999,50 @@ function mergePathWithQueryParams(path, additionalParams) {
|
|
|
1978
1999
|
const withQuery = nextQuery.length > 0 ? `${basePath}?${nextQuery}` : basePath;
|
|
1979
2000
|
return `${withQuery}${hash}`;
|
|
1980
2001
|
}
|
|
2002
|
+
const CONNECT_SPECIFIER = "@connectrpc/connect";
|
|
2003
|
+
const CONNECT_WEB_SPECIFIER = "@connectrpc/connect-web";
|
|
2004
|
+
const FEATURE_SERVICE_SPECIFIER = "../gen/geospatial/v1/feature_service_pb.js";
|
|
2005
|
+
const GRPC_ADAPTER_SPECIFIER = "./grpc-adapter.js";
|
|
2006
|
+
/**
|
|
2007
|
+
* Bundlers statically follow a literal `import("@connectrpc/connect")` and a
|
|
2008
|
+
* relative `import("./grpc-adapter.js")` even when REST never calls them.
|
|
2009
|
+
* Passing the specifier through a parameter leaves the import unbound, so a
|
|
2010
|
+
* REST production build does not resolve the optional peers. Node still
|
|
2011
|
+
* resolves the same strings when `transport: "grpc-web"` is selected.
|
|
2012
|
+
*/
|
|
2013
|
+
function importOptionalGrpcSpecifier(specifier) {
|
|
2014
|
+
return import(/* @vite-ignore */ specifier);
|
|
2015
|
+
}
|
|
2016
|
+
function isNamespace(value) {
|
|
2017
|
+
return (typeof value === "object" && value !== null) || typeof value === "function";
|
|
2018
|
+
}
|
|
2019
|
+
async function loadGrpcWebRuntime() {
|
|
2020
|
+
const [connect, connectWeb, featureService] = await Promise.all([
|
|
2021
|
+
importOptionalGrpcSpecifier(CONNECT_SPECIFIER),
|
|
2022
|
+
importOptionalGrpcSpecifier(CONNECT_WEB_SPECIFIER),
|
|
2023
|
+
importOptionalGrpcSpecifier(FEATURE_SERVICE_SPECIFIER),
|
|
2024
|
+
]);
|
|
2025
|
+
if (!isNamespace(connect) || typeof connect.createClient !== "function") {
|
|
2026
|
+
throw new Error('The optional peer "@connectrpc/connect" loaded but did not export createClient.');
|
|
2027
|
+
}
|
|
2028
|
+
if (!isNamespace(connectWeb) || typeof connectWeb.createGrpcWebTransport !== "function") {
|
|
2029
|
+
throw new Error('The optional peer "@connectrpc/connect-web" loaded but did not export createGrpcWebTransport.');
|
|
2030
|
+
}
|
|
2031
|
+
const descriptor = isNamespace(featureService) ? featureService.FeatureService : undefined;
|
|
2032
|
+
if (descriptor == null || typeof descriptor !== "object") {
|
|
2033
|
+
throw new Error("The gRPC FeatureService descriptor loaded but was not a service descriptor.");
|
|
2034
|
+
}
|
|
2035
|
+
return {
|
|
2036
|
+
createClient: connect.createClient,
|
|
2037
|
+
createGrpcWebTransport: connectWeb.createGrpcWebTransport,
|
|
2038
|
+
FeatureService: descriptor,
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
function isGrpcAdapterModule(value) {
|
|
2042
|
+
if (!isNamespace(value))
|
|
2043
|
+
return false;
|
|
2044
|
+
return (typeof value.toProtoQueryRequest === "function" &&
|
|
2045
|
+
typeof value.fromProtoQueryResponse === "function" &&
|
|
2046
|
+
typeof value.wrapConnectError === "function" &&
|
|
2047
|
+
typeof value.streamProtoPages === "function");
|
|
2048
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type DeprecationWarningEmitter = {
|
|
2
|
+
emitWarning(message: string, options: {
|
|
3
|
+
code: string;
|
|
4
|
+
type: string;
|
|
5
|
+
}): void;
|
|
6
|
+
};
|
|
7
|
+
type DeprecationNoticeRuntime = {
|
|
8
|
+
process?: Partial<DeprecationWarningEmitter>;
|
|
9
|
+
console?: {
|
|
10
|
+
warn?: (message: string) => void;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export interface DeprecationNotice {
|
|
14
|
+
/** Stable `process.emitWarning` code, also the once-per-process key. */
|
|
15
|
+
code: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Emits `notice` at most once per process (once per page in a browser), however
|
|
20
|
+
* many copies of the calling module are evaluated. Node routes it through
|
|
21
|
+
* `process.emitWarning` as a `DeprecationWarning`, so `--no-deprecation` and
|
|
22
|
+
* `--trace-deprecation` apply; runtimes without `process` get `console.warn`.
|
|
23
|
+
*
|
|
24
|
+
* Returns true when this call emitted the notice.
|
|
25
|
+
*/
|
|
26
|
+
export declare function emitDeprecationNoticeOnce(notice: DeprecationNotice, runtime?: DeprecationNoticeRuntime): boolean;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=deprecation-notice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecation-notice.d.ts","sourceRoot":"","sources":["../../../src/core/deprecation-notice.ts"],"names":[],"mappings":"AAAA,KAAK,yBAAyB,GAAG;IAC/B,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC7E,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAChD,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,wBAAiE,GACzE,OAAO,CAYT"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emits `notice` at most once per process (once per page in a browser), however
|
|
3
|
+
* many copies of the calling module are evaluated. Node routes it through
|
|
4
|
+
* `process.emitWarning` as a `DeprecationWarning`, so `--no-deprecation` and
|
|
5
|
+
* `--trace-deprecation` apply; runtimes without `process` get `console.warn`.
|
|
6
|
+
*
|
|
7
|
+
* Returns true when this call emitted the notice.
|
|
8
|
+
*/
|
|
9
|
+
export function emitDeprecationNoticeOnce(notice, runtime = globalThis) {
|
|
10
|
+
const key = Symbol.for(`@honua/sdk-js:deprecation:${notice.code}`);
|
|
11
|
+
const registry = runtime;
|
|
12
|
+
if (registry[key] === true)
|
|
13
|
+
return false;
|
|
14
|
+
registry[key] = true;
|
|
15
|
+
if (typeof runtime.process?.emitWarning === "function") {
|
|
16
|
+
runtime.process.emitWarning(notice.message, { code: notice.code, type: "DeprecationWarning" });
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
runtime.console?.warn?.(`DeprecationWarning [${notice.code}]: ${notice.message}`);
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esri-geojson.d.ts","sourceRoot":"","sources":["../../../src/core/esri-geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,YAAY,EAKZ,cAAc,EACd,YAAY,EACZ,qBAAqB,EACtB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"esri-geojson.d.ts","sourceRoot":"","sources":["../../../src/core/esri-geojson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,YAAY,EAKZ,cAAc,EACd,YAAY,EACZ,qBAAqB,EACtB,MAAM,YAAY,CAAC;AA2MpB;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAClE,eAAe,GAAG,IAAI,CA0ExB;AAkBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,cAAc,CAQ1E;AAyBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAC5C,gBAAgB,CAAC,EAAE,qBAAqB,GACvC,YAAY,GAAG,IAAI,CAuCrB"}
|
package/core/esri-geojson.js
CHANGED
|
@@ -62,18 +62,22 @@ function isExteriorRing(ring) {
|
|
|
62
62
|
}
|
|
63
63
|
function isPointOnSegment(point, segmentStart, segmentEnd) {
|
|
64
64
|
const epsilon = 1e-9;
|
|
65
|
-
const
|
|
66
|
-
|
|
65
|
+
const segmentDeltaX = segmentEnd[0] - segmentStart[0];
|
|
66
|
+
const segmentDeltaY = segmentEnd[1] - segmentStart[1];
|
|
67
|
+
const segmentLengthSquared = segmentDeltaX * segmentDeltaX + segmentDeltaY * segmentDeltaY;
|
|
68
|
+
if (segmentLengthSquared <= epsilon * epsilon) {
|
|
69
|
+
const pointDeltaX = point[0] - segmentStart[0];
|
|
70
|
+
const pointDeltaY = point[1] - segmentStart[1];
|
|
71
|
+
return pointDeltaX * pointDeltaX + pointDeltaY * pointDeltaY <= epsilon * epsilon;
|
|
72
|
+
}
|
|
73
|
+
const crossProduct = (point[0] - segmentStart[0]) * segmentDeltaY - (point[1] - segmentStart[1]) * segmentDeltaX;
|
|
67
74
|
if (Math.abs(crossProduct) > epsilon) {
|
|
68
75
|
return false;
|
|
69
76
|
}
|
|
70
|
-
const dotProduct = (point[0] - segmentStart[0]) * (
|
|
71
|
-
(point[1] - segmentStart[1]) * (segmentEnd[1] - segmentStart[1]);
|
|
77
|
+
const dotProduct = (point[0] - segmentStart[0]) * segmentDeltaX + (point[1] - segmentStart[1]) * segmentDeltaY;
|
|
72
78
|
if (dotProduct < -epsilon) {
|
|
73
79
|
return false;
|
|
74
80
|
}
|
|
75
|
-
const segmentLengthSquared = (segmentEnd[0] - segmentStart[0]) * (segmentEnd[0] - segmentStart[0]) +
|
|
76
|
-
(segmentEnd[1] - segmentStart[1]) * (segmentEnd[1] - segmentStart[1]);
|
|
77
81
|
return dotProduct - segmentLengthSquared <= epsilon;
|
|
78
82
|
}
|
|
79
83
|
function isPointInsideRing(point, ring) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional gRPC-Web peers are not part of a REST install. Resolution failures
|
|
3
|
+
* for those packages become an actionable error only after `transport:
|
|
4
|
+
* "grpc-web"` has actually loaded them. Connect/RPC failures are returned
|
|
5
|
+
* unchanged so a real gRPC error is not relabeled as a missing install.
|
|
6
|
+
*/
|
|
7
|
+
declare const OPTIONAL_GRPC_PACKAGES: readonly ["@connectrpc/connect-web", "@connectrpc/connect", "@bufbuild/protobuf"];
|
|
8
|
+
export type OptionalGrpcPackage = (typeof OPTIONAL_GRPC_PACKAGES)[number];
|
|
9
|
+
export declare class HonuaOptionalGrpcPeerError extends Error {
|
|
10
|
+
readonly peer: OptionalGrpcPackage;
|
|
11
|
+
constructor(peer: OptionalGrpcPackage, cause: unknown);
|
|
12
|
+
}
|
|
13
|
+
export declare function explainOptionalGrpcLoadFailure(error: unknown): unknown;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=optional-grpc-peer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-grpc-peer.d.ts","sourceRoot":"","sources":["../../../src/core/optional-grpc-peer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,QAAA,MAAM,sBAAsB,mFAAoF,CAAC;AAKjH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,SAAgB,IAAI,EAAE,mBAAmB,CAAC;gBAEvB,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO;CAU7D;AAkCD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAItE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional gRPC-Web peers are not part of a REST install. Resolution failures
|
|
3
|
+
* for those packages become an actionable error only after `transport:
|
|
4
|
+
* "grpc-web"` has actually loaded them. Connect/RPC failures are returned
|
|
5
|
+
* unchanged so a real gRPC error is not relabeled as a missing install.
|
|
6
|
+
*/
|
|
7
|
+
const OPTIONAL_GRPC_PACKAGES = ["@connectrpc/connect-web", "@connectrpc/connect", "@bufbuild/protobuf"];
|
|
8
|
+
const RESOLUTION_FAILURE = /ERR_MODULE_NOT_FOUND|ERR_PACKAGE_PATH_NOT_EXPORTED|Failed to resolve module specifier|Failed to fetch dynamically imported module|Cannot find package|Cannot find module/;
|
|
9
|
+
export class HonuaOptionalGrpcPeerError extends Error {
|
|
10
|
+
peer;
|
|
11
|
+
constructor(peer, cause) {
|
|
12
|
+
const message = [
|
|
13
|
+
`HonuaClient transport "grpc-web" could not load the optional peer "${peer}".`,
|
|
14
|
+
"Install @bufbuild/protobuf, @connectrpc/connect, and @connectrpc/connect-web.",
|
|
15
|
+
"REST, including createHonua, does not load them.",
|
|
16
|
+
].join(" ");
|
|
17
|
+
super(message, cause instanceof Error ? { cause } : undefined);
|
|
18
|
+
this.name = "HonuaOptionalGrpcPeerError";
|
|
19
|
+
this.peer = peer;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function isRecord(value) {
|
|
23
|
+
return typeof value === "object" && value !== null;
|
|
24
|
+
}
|
|
25
|
+
function isGenuineGrpcFailure(error) {
|
|
26
|
+
if (!isRecord(error))
|
|
27
|
+
return false;
|
|
28
|
+
if (error instanceof Error && error.name === "HonuaGrpcError")
|
|
29
|
+
return true;
|
|
30
|
+
return typeof error.code === "number";
|
|
31
|
+
}
|
|
32
|
+
function peerNamedByResolutionFailure(error) {
|
|
33
|
+
if (!(error instanceof Error))
|
|
34
|
+
return undefined;
|
|
35
|
+
const code = "code" in error && (typeof error.code === "string" || typeof error.code === "number") ? String(error.code) : "";
|
|
36
|
+
const message = `${code}\n${error.message}`;
|
|
37
|
+
if (!RESOLUTION_FAILURE.test(message))
|
|
38
|
+
return undefined;
|
|
39
|
+
return OPTIONAL_GRPC_PACKAGES.find((name) => message.includes(name));
|
|
40
|
+
}
|
|
41
|
+
function missingOptionalGrpcPeer(error) {
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
let current = error;
|
|
44
|
+
while (isRecord(current) && !seen.has(current)) {
|
|
45
|
+
seen.add(current);
|
|
46
|
+
if (isGenuineGrpcFailure(current))
|
|
47
|
+
return undefined;
|
|
48
|
+
const peer = peerNamedByResolutionFailure(current);
|
|
49
|
+
if (peer)
|
|
50
|
+
return peer;
|
|
51
|
+
current = current.cause;
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
export function explainOptionalGrpcLoadFailure(error) {
|
|
56
|
+
const peer = missingOptionalGrpcPeer(error);
|
|
57
|
+
if (!peer)
|
|
58
|
+
return error;
|
|
59
|
+
return new HonuaOptionalGrpcPeerError(peer, error);
|
|
60
|
+
}
|
|
@@ -23,6 +23,7 @@ export declare class BasemapGalleryCompat {
|
|
|
23
23
|
activeBasemap: unknown;
|
|
24
24
|
private readonly subscriptions;
|
|
25
25
|
private readonly watchListeners;
|
|
26
|
+
private readonly widgetHost;
|
|
26
27
|
constructor(options?: BasemapGalleryCompatOptions);
|
|
27
28
|
load(): Promise<BasemapGalleryCompat>;
|
|
28
29
|
when(callback?: (widget: BasemapGalleryCompat) => void): Promise<BasemapGalleryCompat>;
|
|
@@ -33,6 +34,7 @@ export declare class BasemapGalleryCompat {
|
|
|
33
34
|
refresh(): unknown;
|
|
34
35
|
destroy(): void;
|
|
35
36
|
private resolveBasemap;
|
|
37
|
+
private pushWidgetHost;
|
|
36
38
|
private notifyWatchers;
|
|
37
39
|
}
|
|
38
40
|
//# sourceMappingURL=basemap-gallery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basemap-gallery.d.ts","sourceRoot":"","sources":["../../../src/esri-compat/basemap-gallery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAIf,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"basemap-gallery.d.ts","sourceRoot":"","sources":["../../../src/esri-compat/basemap-gallery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAIf,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,8BAA8B,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjF,MAAM,WAAW,0BAA0B;IACzC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,qBAAa,oBAAoB;IAC/B,SAAgB,IAAI,EAAE,OAAO,CAAC;IAC9B,SAAgB,GAAG,EAAE,OAAO,CAAC;IAC7B,SAAgB,SAAS,EAAE,OAAO,CAAC;IACnC,SAAgB,QAAQ,EAAE,cAAc,CAAC;IACzC,SAAgB,WAAW,EAAE,OAAO,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,8BAA8B,CAAC;IAC3C,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IAE9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6C;IAC5E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA8B;gBAEtC,OAAO,GAAE,2BAAgC;IA0B/C,IAAI,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAiBrC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQ5F,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,0BAA0B;IAelG,IAAW,QAAQ,IAAI,SAAS,OAAO,EAAE,CAExC;IAEM,WAAW,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAO/C,MAAM,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAcrC,OAAO,IAAI,OAAO;IAOlB,OAAO,IAAI,IAAI;IAOtB,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,cAAc;CAUvB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CompatEventBus, resolveCompatEventBus, safeInvokeCompatListener, } from "./event-bus.js";
|
|
2
|
+
import { bindHonuaWidgetHost, pushWidgetHostState } from "./widget-host.js";
|
|
2
3
|
export class BasemapGalleryCompat {
|
|
3
4
|
view;
|
|
4
5
|
map;
|
|
@@ -11,6 +12,7 @@ export class BasemapGalleryCompat {
|
|
|
11
12
|
activeBasemap;
|
|
12
13
|
subscriptions;
|
|
13
14
|
watchListeners;
|
|
15
|
+
widgetHost;
|
|
14
16
|
constructor(options = {}) {
|
|
15
17
|
this.view = options.view;
|
|
16
18
|
this.map = options.map ?? extractViewMap(options.view);
|
|
@@ -23,6 +25,8 @@ export class BasemapGalleryCompat {
|
|
|
23
25
|
this.activeBasemap = extractMapBasemap(this.map);
|
|
24
26
|
this.subscriptions = [];
|
|
25
27
|
this.watchListeners = new Map();
|
|
28
|
+
this.widgetHost = bindHonuaWidgetHost("honua-basemap-control", this.container, this.eventBus);
|
|
29
|
+
this.pushWidgetHost();
|
|
26
30
|
if (this.autoRefresh) {
|
|
27
31
|
this.subscriptions.push(this.eventBus.on("map.basemap-changed", (event) => {
|
|
28
32
|
this.activeBasemap = extractPayloadBasemap(event.payload);
|
|
@@ -73,6 +77,7 @@ export class BasemapGalleryCompat {
|
|
|
73
77
|
this.source = [...basemaps];
|
|
74
78
|
this.notifyWatchers("source", this.source);
|
|
75
79
|
this.eventBus.emit("basemap-gallery.updated", { basemapCount: this.source.length }, this);
|
|
80
|
+
this.pushWidgetHost();
|
|
76
81
|
}
|
|
77
82
|
select(basemapOrId) {
|
|
78
83
|
const basemap = this.resolveBasemap(basemapOrId);
|
|
@@ -112,6 +117,13 @@ export class BasemapGalleryCompat {
|
|
|
112
117
|
}
|
|
113
118
|
return undefined;
|
|
114
119
|
}
|
|
120
|
+
pushWidgetHost() {
|
|
121
|
+
pushWidgetHostState(this.widgetHost, {
|
|
122
|
+
view: this.view,
|
|
123
|
+
mode: "gallery",
|
|
124
|
+
basemaps: this.source,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
115
127
|
notifyWatchers(propertyName, value) {
|
|
116
128
|
const listeners = this.watchListeners.get(propertyName);
|
|
117
129
|
if (!listeners) {
|
package/esri-compat/basemap.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface BasemapCompatOptions {
|
|
|
4
4
|
title?: string;
|
|
5
5
|
baseLayers?: readonly unknown[];
|
|
6
6
|
referenceLayers?: readonly unknown[];
|
|
7
|
+
/** ArcGIS portal item, `{ id }` or a portal item id string. `load` fills the tiled layers from its data. */
|
|
8
|
+
portalItem?: unknown;
|
|
7
9
|
eventBus?: CompatEventBus;
|
|
8
10
|
}
|
|
9
11
|
export type BasemapLoadStatusCompat = "not-loaded" | "loading" | "loaded";
|
|
@@ -14,6 +16,7 @@ export declare class BasemapCompat {
|
|
|
14
16
|
readonly eventBus: CompatEventBus;
|
|
15
17
|
id: string | undefined;
|
|
16
18
|
title: string | undefined;
|
|
19
|
+
portalItem: unknown;
|
|
17
20
|
baseLayers: unknown[];
|
|
18
21
|
referenceLayers: unknown[];
|
|
19
22
|
loaded: boolean;
|
|
@@ -27,6 +30,7 @@ export declare class BasemapCompat {
|
|
|
27
30
|
when(callback?: (basemap: BasemapCompat) => void): Promise<BasemapCompat>;
|
|
28
31
|
watch(propertyName: string, listener: (value: unknown) => void): BasemapHandleCompat;
|
|
29
32
|
destroy(): void;
|
|
33
|
+
private populateFromPortalItem;
|
|
30
34
|
private notifyWatchers;
|
|
31
35
|
}
|
|
32
36
|
//# sourceMappingURL=basemap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basemap.d.ts","sourceRoot":"","sources":["../../../src/esri-compat/basemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAmD,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"basemap.d.ts","sourceRoot":"","sources":["../../../src/esri-compat/basemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAmD,MAAM,gBAAgB,CAAC;AAGjG,MAAM,WAAW,oBAAoB;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,eAAe,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC,4GAA4G;IAC5G,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1E,MAAM,WAAW,mBAAmB;IAClC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,qBAAa,aAAa;IACxB,SAAgB,QAAQ,EAAE,cAAc,CAAC;IAClC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,uBAAuB,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6C;gBAEzD,OAAO,GAAE,oBAAyB;WAavC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa;IAOxC,aAAa,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAM/C,kBAAkB,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAM9C,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;IAiB9B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ/E,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,mBAAmB;IAepF,OAAO,IAAI,IAAI;YAIR,sBAAsB;IA2BpC,OAAO,CAAC,cAAc;CAUvB"}
|
package/esri-compat/basemap.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CompatEventBus, resolveCompatEventBus, safeInvokeCompatListener } from "./event-bus.js";
|
|
2
|
+
import { PortalCompat } from "./portal.js";
|
|
2
3
|
export class BasemapCompat {
|
|
3
4
|
eventBus;
|
|
4
5
|
id;
|
|
5
6
|
title;
|
|
7
|
+
portalItem;
|
|
6
8
|
baseLayers;
|
|
7
9
|
referenceLayers;
|
|
8
10
|
loaded;
|
|
@@ -13,6 +15,7 @@ export class BasemapCompat {
|
|
|
13
15
|
options.eventBus ?? resolveCompatEventBus(options.baseLayers, options.referenceLayers) ?? new CompatEventBus();
|
|
14
16
|
this.id = options.id;
|
|
15
17
|
this.title = options.title ?? options.id;
|
|
18
|
+
this.portalItem = options.portalItem;
|
|
16
19
|
this.baseLayers = options.baseLayers ? [...options.baseLayers] : [];
|
|
17
20
|
this.referenceLayers = options.referenceLayers ? [...options.referenceLayers] : [];
|
|
18
21
|
this.loaded = false;
|
|
@@ -42,6 +45,7 @@ export class BasemapCompat {
|
|
|
42
45
|
this.loadStatus = "loading";
|
|
43
46
|
this.notifyWatchers("loadStatus", this.loadStatus);
|
|
44
47
|
this.eventBus.emit("basemap.loading", { id: this.id }, this);
|
|
48
|
+
await this.populateFromPortalItem();
|
|
45
49
|
this.loaded = true;
|
|
46
50
|
this.notifyWatchers("loaded", this.loaded);
|
|
47
51
|
this.loadStatus = "loaded";
|
|
@@ -72,6 +76,33 @@ export class BasemapCompat {
|
|
|
72
76
|
destroy() {
|
|
73
77
|
this.watchListeners.clear();
|
|
74
78
|
}
|
|
79
|
+
async populateFromPortalItem() {
|
|
80
|
+
if (this.baseLayers.length > 0 || this.portalItem === undefined || this.portalItem === null) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const portalItem = readPortalItem(this.portalItem);
|
|
84
|
+
if (!portalItem) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const portal = new PortalCompat({ portalUrl: portalItem.portalUrl });
|
|
88
|
+
try {
|
|
89
|
+
const data = await portal.getItemData(portalItem.id);
|
|
90
|
+
const layers = tiledLayersFromPortalData(data);
|
|
91
|
+
if (layers.title && (this.title === undefined || this.title === this.id)) {
|
|
92
|
+
this.title = layers.title;
|
|
93
|
+
this.notifyWatchers("title", this.title);
|
|
94
|
+
}
|
|
95
|
+
if (layers.base.length > 0) {
|
|
96
|
+
this.setBaseLayers(layers.base);
|
|
97
|
+
}
|
|
98
|
+
if (layers.reference.length > 0) {
|
|
99
|
+
this.setReferenceLayers(layers.reference);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// A private item or a missing data document leaves the basemap without tiles.
|
|
104
|
+
}
|
|
105
|
+
}
|
|
75
106
|
notifyWatchers(propertyName, value) {
|
|
76
107
|
const listeners = this.watchListeners.get(propertyName);
|
|
77
108
|
if (!listeners) {
|
|
@@ -82,3 +113,42 @@ export class BasemapCompat {
|
|
|
82
113
|
}
|
|
83
114
|
}
|
|
84
115
|
}
|
|
116
|
+
function readPortalItem(value) {
|
|
117
|
+
if (typeof value === "string" && value.length > 0) {
|
|
118
|
+
return { id: value };
|
|
119
|
+
}
|
|
120
|
+
if (!value || typeof value !== "object") {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
const record = value;
|
|
124
|
+
if (typeof record.id !== "string" || record.id.length === 0) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
const portalUrl = typeof record.portal?.url === "string" ? record.portal.url : undefined;
|
|
128
|
+
return { id: record.id, portalUrl };
|
|
129
|
+
}
|
|
130
|
+
function tiledLayersFromPortalData(data) {
|
|
131
|
+
if (!data || typeof data !== "object") {
|
|
132
|
+
return { base: [], reference: [] };
|
|
133
|
+
}
|
|
134
|
+
const record = data;
|
|
135
|
+
const basemap = record.baseMap ?? record.basemap;
|
|
136
|
+
if (!basemap || typeof basemap !== "object") {
|
|
137
|
+
return { base: [], reference: [] };
|
|
138
|
+
}
|
|
139
|
+
const source = basemap;
|
|
140
|
+
const title = typeof source.title === "string" ? source.title : typeof record.title === "string" ? record.title : undefined;
|
|
141
|
+
return {
|
|
142
|
+
title,
|
|
143
|
+
base: portalLayers(source.baseMapLayers ?? source.baseLayers),
|
|
144
|
+
reference: portalLayers(source.referenceLayers),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function portalLayers(value) {
|
|
148
|
+
if (!Array.isArray(value)) {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
return value.filter((layer) => {
|
|
152
|
+
return Boolean(layer) && typeof layer === "object" && typeof layer.url === "string";
|
|
153
|
+
});
|
|
154
|
+
}
|
|
@@ -23,6 +23,7 @@ export declare class BookmarksCompat {
|
|
|
23
23
|
bookmarks: BookmarkCompatItem[];
|
|
24
24
|
activeBookmark: BookmarkCompatItem | undefined;
|
|
25
25
|
private readonly watchListeners;
|
|
26
|
+
private readonly widgetHost;
|
|
26
27
|
constructor(options?: BookmarksCompatOptions);
|
|
27
28
|
load(): Promise<BookmarksCompat>;
|
|
28
29
|
when(callback?: (widget: BookmarksCompat) => void): Promise<BookmarksCompat>;
|
|
@@ -31,6 +32,7 @@ export declare class BookmarksCompat {
|
|
|
31
32
|
remove(nameOrBookmark: string | BookmarkCompatItem): boolean;
|
|
32
33
|
goTo(nameOrBookmark: string | BookmarkCompatItem): Promise<BookmarkCompatItem | undefined>;
|
|
33
34
|
destroy(): void;
|
|
35
|
+
private pushWidgetHost;
|
|
34
36
|
private notifyWatchers;
|
|
35
37
|
}
|
|
36
38
|
//# sourceMappingURL=bookmarks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookmarks.d.ts","sourceRoot":"","sources":["../../../src/esri-compat/bookmarks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAmD,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"bookmarks.d.ts","sourceRoot":"","sources":["../../../src/esri-compat/bookmarks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAmD,MAAM,gBAAgB,CAAC;AAGjG,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5E,MAAM,WAAW,qBAAqB;IACpC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,qBAAa,eAAe;IAC1B,SAAgB,IAAI,EAAE,OAAO,CAAC;IAC9B,SAAgB,SAAS,EAAE,OAAO,CAAC;IACnC,SAAgB,QAAQ,EAAE,cAAc,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,yBAAyB,CAAC;IACtC,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,cAAc,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACtD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6C;IAC5E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA8B;gBAEtC,OAAO,GAAE,sBAA2B;IAa1C,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC;IAgBhC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC;IAQlF,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,qBAAqB;IAetF,GAAG,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAOvC,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,kBAAkB,GAAG,OAAO;IAmBtD,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAiBhG,OAAO,IAAI,IAAI;IAKtB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;CAUvB"}
|
package/esri-compat/bookmarks.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CompatEventBus, resolveCompatEventBus, safeInvokeCompatListener } from "./event-bus.js";
|
|
2
|
+
import { bindHonuaWidgetHost, pushWidgetHostState } from "./widget-host.js";
|
|
2
3
|
export class BookmarksCompat {
|
|
3
4
|
view;
|
|
4
5
|
container;
|
|
@@ -8,6 +9,7 @@ export class BookmarksCompat {
|
|
|
8
9
|
bookmarks;
|
|
9
10
|
activeBookmark;
|
|
10
11
|
watchListeners;
|
|
12
|
+
widgetHost;
|
|
11
13
|
constructor(options = {}) {
|
|
12
14
|
this.view = options.view;
|
|
13
15
|
this.container = options.container;
|
|
@@ -17,6 +19,8 @@ export class BookmarksCompat {
|
|
|
17
19
|
this.bookmarks = options.bookmarks ? [...options.bookmarks] : [];
|
|
18
20
|
this.activeBookmark = undefined;
|
|
19
21
|
this.watchListeners = new Map();
|
|
22
|
+
this.widgetHost = bindHonuaWidgetHost("honua-bookmarks", this.container, this.eventBus);
|
|
23
|
+
this.pushWidgetHost();
|
|
20
24
|
}
|
|
21
25
|
async load() {
|
|
22
26
|
if (this.loaded) {
|
|
@@ -56,6 +60,7 @@ export class BookmarksCompat {
|
|
|
56
60
|
this.bookmarks.push(bookmark);
|
|
57
61
|
this.notifyWatchers("bookmarks", this.bookmarks);
|
|
58
62
|
this.eventBus.emit("bookmarks.updated", { bookmarkCount: this.bookmarks.length }, this);
|
|
63
|
+
this.pushWidgetHost();
|
|
59
64
|
}
|
|
60
65
|
remove(nameOrBookmark) {
|
|
61
66
|
const index = typeof nameOrBookmark === "string"
|
|
@@ -89,6 +94,13 @@ export class BookmarksCompat {
|
|
|
89
94
|
}
|
|
90
95
|
destroy() {
|
|
91
96
|
this.watchListeners.clear();
|
|
97
|
+
this.widgetHost?.destroy();
|
|
98
|
+
}
|
|
99
|
+
pushWidgetHost() {
|
|
100
|
+
pushWidgetHostState(this.widgetHost, {
|
|
101
|
+
view: this.view,
|
|
102
|
+
bookmarkList: this.bookmarks,
|
|
103
|
+
});
|
|
92
104
|
}
|
|
93
105
|
notifyWatchers(propertyName, value) {
|
|
94
106
|
const listeners = this.watchListeners.get(propertyName);
|