jmapcloud-ng-core-types 2.0.15-qa.6 → 2.0.15-qa.8

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/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { JAttribute, JDataSource, JDataSourceType, JForm, JRelationship } from "
4
4
  import type * as maplibregl from "maplibre-gl"
5
5
  import { Action, Store } from "redux"
6
6
  import { JDataSourceData, JDataSourceDataParams, JDataSourcePermissions } from "./public/jmap/datasource.ts"
7
+ import type { JDrawEventModule, JDrawService } from "./public/jmap/draw.d.ts"
7
8
  import type { JCoreState, JMapLegendMode } from "./public/state.d.ts"
8
9
 
9
10
  export type { JCoreOptions } from "./public/jmap/startup-options.d.ts"
@@ -24,6 +25,28 @@ export type {
24
25
  JUIState,
25
26
  JUserState
26
27
  } from "./public/state.d.ts"
28
+ export type {
29
+ JDrawArmedChangedReason,
30
+ JDrawArmedEventChannel,
31
+ JDrawArmedEventParams,
32
+ JDrawArmOptions,
33
+ JDrawEventModule,
34
+ JDrawEventParams,
35
+ JDrawFeature,
36
+ JDrawFeatureEventChannel,
37
+ JDrawFeatureId,
38
+ JDrawFeaturePatch,
39
+ JDrawListenerOptions,
40
+ JDrawMode,
41
+ JDrawModeEventChannel,
42
+ JDrawModeEventParams,
43
+ JDrawProperties,
44
+ JDrawRegisterOptions,
45
+ JDrawService,
46
+ JDrawShape,
47
+ JDrawSnapping,
48
+ JDrawStyle
49
+ } from "./public/jmap/draw.d.ts"
27
50
  export type { JAppConfirmMessage, JAppMessage, JAppMessageOptions, JAppMessageService, JAppMessageState, JAppOverlayMessage, JAppRenderableMessage } from "./public/jmap/message.d.ts"
28
51
  export type { JAppUserAction } from "./public/jmap/user.d.ts"
29
52
 
@@ -52,6 +75,7 @@ export interface JCoreService extends JCoreMainService {
52
75
  UI: JUIService
53
76
  SimpleSearch: JSimpleSearchService
54
77
  DataSource: JDataSourceService
78
+ Draw: JDrawService
55
79
  Table: JTableService
56
80
  }
57
81
 
@@ -71,7 +95,11 @@ export interface JSimpleSearchService {
71
95
  }
72
96
 
73
97
  export interface JLibraryService {
74
- maplibregl(): any
98
+ /**
99
+ * Returns the host's maplibre-gl namespace. The namespace is versioned with the host;
100
+ * a host major version bump is a breaking change through this door.
101
+ */
102
+ maplibregl(): typeof import("maplibre-gl")
75
103
  html2canvas(): any
76
104
  }
77
105
 
@@ -228,6 +256,7 @@ export interface JEventService {
228
256
  User: JUserEventModule
229
257
  Feature: JFeatureEventModule
230
258
  Extension: JExtensionEventModule
259
+ Draw: JDrawEventModule
231
260
  MouseOver: JMouseOverEventModule
232
261
  MapContext: JMapContextEventModule
233
262
  Server: JServerEventModule
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "2.0.15-qa.6",
3
+ "version": "2.0.15-qa.8",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG Core types and interfaces",
5
5
  "main": "index.js",
6
6
  "types": "ambient.d.ts",
@@ -34,7 +34,7 @@
34
34
  "@types/geojson": "^7946.0.14",
35
35
  "geojson": "^0.5.0",
36
36
  "jmapcloud-types": "../packages/jmapcloud-types",
37
- "maplibre-gl": "^4.7.1",
37
+ "maplibre-gl": "^6.4.0",
38
38
  "redux": "^5.0.1"
39
39
  }
40
40
  }
package/public/core.d.ts CHANGED
@@ -4,6 +4,20 @@ import type { JRequestConfig } from "./jmap/ajax.d.ts"
4
4
  import type { JAttachment, JAttachmentFile, JCreateAttachmentParams, JUpdateAttachmentParams } from "./jmap/attachment.d.ts"
5
5
  import type { JDataSourceData, JDataSourceDataParams, JDataSourcePermissions } from "./jmap/datasource.ts"
6
6
  import type { JDateFormatParams, JDateLike, JTIME_UNITS } from "./jmap/date.d.ts"
7
+ import type {
8
+ JDrawArmedEventParams,
9
+ JDrawArmOptions,
10
+ JDrawEventParams,
11
+ JDrawFeature,
12
+ JDrawFeatureId,
13
+ JDrawFeaturePatch,
14
+ JDrawListenerOptions,
15
+ JDrawMode,
16
+ JDrawModeEventParams,
17
+ JDrawRegisterOptions,
18
+ JDrawSnapping,
19
+ JDrawStyle
20
+ } from "./jmap/draw.d.ts"
7
21
  import type { JCoreExtension, JExtensionEventParams, JExtensionMouseOver } from "./jmap/extension.d.ts"
8
22
  import type {
9
23
  JAttributeValueByName,
@@ -7032,6 +7046,325 @@ export namespace JMap {
7032
7046
  */
7033
7047
  function getInvalidQueryStringCharacters(): string
7034
7048
  }
7049
+ /**
7050
+ * **JMap.Draw**
7051
+ *
7052
+ * Owner-scoped drawing primitives for applications and extensions. Each consumer registers
7053
+ * an owner before adding features or arming an interactive mode. Features are plain GeoJSON
7054
+ * tagged with `properties.owner` and `properties.shape`; drawing-engine bookkeeping is never
7055
+ * exposed.
7056
+ *
7057
+ * Only one owner is interactive at a time. Completed features from every registered owner
7058
+ * remain rendered while Draw is disarmed or another owner is armed.
7059
+ *
7060
+ * @example
7061
+ * ```ts
7062
+ * JMap.Draw.register("analysis-mask", {
7063
+ * style: {
7064
+ * fillColor: "#ff0066",
7065
+ * fillOpacity: 0.2,
7066
+ * strokeColor: "#ff0066",
7067
+ * strokeWidth: 2
7068
+ * }
7069
+ * })
7070
+ * JMap.Event.Draw.featureCreated.on(
7071
+ * "analysis-mask-created",
7072
+ * ({ features }) => console.log(features[0]),
7073
+ * { owner: "analysis-mask" }
7074
+ * )
7075
+ * JMap.Draw.arm({ owner: "analysis-mask", mode: "polygon" })
7076
+ * ```
7077
+ */
7078
+ namespace Draw {
7079
+ /**
7080
+ * **JMap.Draw.register**
7081
+ *
7082
+ * Registers a non-empty, unique owner and its default style and snapping options.
7083
+ * Registration persists across map changes.
7084
+ *
7085
+ * @param owner Unique owner id used to scope features and events.
7086
+ * @param options Default rendering style and optional snapping configuration.
7087
+ * @throws If the owner is empty or already registered, or if no style object is supplied.
7088
+ * @example
7089
+ * ```ts
7090
+ * JMap.Draw.register("analysis-mask", {
7091
+ * style: {
7092
+ * fillColor: "#ff0066",
7093
+ * fillOpacity: 0.2,
7094
+ * strokeColor: "#ff0066",
7095
+ * strokeWidth: 2
7096
+ * },
7097
+ * snapping: { enabled: true, toDrawFeatures: true }
7098
+ * })
7099
+ * ```
7100
+ */
7101
+ function register(owner: string, options: JDrawRegisterOptions): void
7102
+ /**
7103
+ * **JMap.Draw.unregister**
7104
+ *
7105
+ * Unregisters an owner and deletes all of its Draw features.
7106
+ *
7107
+ * @param owner Registered owner id.
7108
+ * @throws If the owner is armed or is not registered.
7109
+ * @example
7110
+ * ```ts
7111
+ * JMap.Draw.unregister("analysis-mask")
7112
+ * ```
7113
+ */
7114
+ function unregister(owner: string): void
7115
+ /**
7116
+ * **JMap.Draw.arm**
7117
+ *
7118
+ * Makes an owner interactive in a drawing or selection mode. Draw temporarily takes map
7119
+ * interaction ownership and restores the previous interactor when the final arm is disarmed.
7120
+ * Arming another owner suspends the current Draw arm on the internal arm stack.
7121
+ *
7122
+ * Keyboard handling is enabled by default. Set `keyboard: false` when the consumer owns
7123
+ * Escape/Delete handling itself.
7124
+ *
7125
+ * @param options Registered owner, mode, optional per-arm style overrides, and keyboard flag.
7126
+ * @throws If the owner is not registered, the mode is invalid, or Draw has no active map.
7127
+ * @example
7128
+ * ```ts
7129
+ * // Let the user draw a polygon with keyboard cancellation enabled.
7130
+ * JMap.Draw.arm({ owner: "analysis-mask", mode: "polygon" })
7131
+ * ```
7132
+ */
7133
+ function arm(options: JDrawArmOptions): void
7134
+ /**
7135
+ * **JMap.Draw.disarm**
7136
+ *
7137
+ * Cancels any provisional feature and disarms the active owner. If a previous Draw arm was
7138
+ * suspended, it is restored; otherwise the map's previous interactor and handlers are restored.
7139
+ * Does nothing when Draw is not armed.
7140
+ *
7141
+ * @example
7142
+ * ```ts
7143
+ * JMap.Draw.disarm()
7144
+ * ```
7145
+ */
7146
+ function disarm(): void
7147
+ /**
7148
+ * **JMap.Draw.isArmed**
7149
+ *
7150
+ * Returns whether Draw is currently armed. If an owner is supplied, returns true only when
7151
+ * that owner is the active owner.
7152
+ *
7153
+ * @param owner Optional registered owner id to test.
7154
+ * @example
7155
+ * ```ts
7156
+ * const isMaskToolActive = JMap.Draw.isArmed("analysis-mask")
7157
+ * ```
7158
+ */
7159
+ function isArmed(owner?: string): boolean
7160
+ /**
7161
+ * **JMap.Draw.getMode**
7162
+ *
7163
+ * Returns the active public Draw mode, or `undefined` while Draw is disarmed.
7164
+ *
7165
+ * @example
7166
+ * ```ts
7167
+ * console.log(JMap.Draw.getMode()) // "polygon"
7168
+ * ```
7169
+ */
7170
+ function getMode(): JDrawMode | undefined
7171
+ /**
7172
+ * **JMap.Draw.getFeatures**
7173
+ *
7174
+ * Returns a snapshot of all completed and provisional Draw features belonging to an owner.
7175
+ *
7176
+ * @param owner Registered owner id.
7177
+ * @throws If the owner is not registered.
7178
+ * @example
7179
+ * ```ts
7180
+ * const masks = JMap.Draw.getFeatures("analysis-mask")
7181
+ * console.log(masks[0].geometry)
7182
+ * ```
7183
+ */
7184
+ function getFeatures(owner: string): JDrawFeature[]
7185
+ /**
7186
+ * **JMap.Draw.addFeatures**
7187
+ *
7188
+ * Adds plain GeoJSON features to Draw. Each feature's owner must already be registered and
7189
+ * its geometry must match its declared shape. A missing feature id is generated by Draw.
7190
+ * Added features emit `JMap.Event.Draw.featureCreated` grouped by owner.
7191
+ *
7192
+ * @param features Features to add.
7193
+ * @throws If an owner is not registered or a feature is invalid.
7194
+ * @example
7195
+ * ```ts
7196
+ * JMap.Draw.addFeatures([
7197
+ * {
7198
+ * type: "Feature",
7199
+ * id: "mask-1",
7200
+ * geometry: {
7201
+ * type: "Polygon",
7202
+ * coordinates: [[[-73.62, 45.5], [-73.6, 45.5], [-73.6, 45.52], [-73.62, 45.5]]]
7203
+ * },
7204
+ * properties: { owner: "analysis-mask", shape: "polygon" }
7205
+ * }
7206
+ * ])
7207
+ * ```
7208
+ */
7209
+ function addFeatures(features: JDrawFeature[]): void
7210
+ /**
7211
+ * **JMap.Draw.setFeatures**
7212
+ *
7213
+ * Replaces all features belonging to an owner. Every replacement feature must carry the
7214
+ * same owner id.
7215
+ *
7216
+ * @param owner Registered owner id.
7217
+ * @param features Complete replacement feature set for the owner.
7218
+ * @throws If the owner is not registered or a feature belongs to another owner.
7219
+ * @example
7220
+ * ```ts
7221
+ * JMap.Draw.setFeatures("analysis-mask", [
7222
+ * {
7223
+ * type: "Feature",
7224
+ * id: "mask-center",
7225
+ * geometry: { type: "Point", coordinates: [-73.61, 45.51] },
7226
+ * properties: { owner: "analysis-mask", shape: "point" }
7227
+ * }
7228
+ * ])
7229
+ * ```
7230
+ */
7231
+ function setFeatures(owner: string, features: JDrawFeature[]): void
7232
+ /**
7233
+ * **JMap.Draw.updateFeature**
7234
+ *
7235
+ * Updates a feature's geometry and/or consumer properties, then emits
7236
+ * `JMap.Event.Draw.featureUpdated`. The routing properties `owner` and `shape`, and the
7237
+ * drawing engine's reserved properties, cannot be changed.
7238
+ *
7239
+ * @param id Feature id.
7240
+ * @param patch Geometry and/or property changes.
7241
+ * @throws If the feature is missing or the patch contains reserved properties.
7242
+ * @example
7243
+ * ```ts
7244
+ * JMap.Draw.updateFeature("mask-1", {
7245
+ * properties: { fillColor: "#3366ff", fillOpacity: 0.35 }
7246
+ * })
7247
+ * ```
7248
+ */
7249
+ function updateFeature(id: JDrawFeatureId, patch: JDrawFeaturePatch): void
7250
+ /**
7251
+ * **JMap.Draw.deleteFeatures**
7252
+ *
7253
+ * Deletes features by id and emits `JMap.Event.Draw.featureDeleted` grouped by owner.
7254
+ * This mutation also works during the map teardown gap, using Draw's cached snapshot.
7255
+ *
7256
+ * @param ids Feature ids to delete.
7257
+ * @throws If any feature id is unknown.
7258
+ * @example
7259
+ * ```ts
7260
+ * JMap.Draw.deleteFeatures(["mask-1", "mask-2"])
7261
+ * ```
7262
+ */
7263
+ function deleteFeatures(ids: JDrawFeatureId[]): void
7264
+ /**
7265
+ * **JMap.Draw.deleteAll**
7266
+ *
7267
+ * Deletes every feature belonging to an owner.
7268
+ *
7269
+ * @param owner Registered owner id.
7270
+ * @throws If the owner is not registered.
7271
+ * @example
7272
+ * ```ts
7273
+ * JMap.Draw.deleteAll("analysis-mask")
7274
+ * ```
7275
+ */
7276
+ function deleteAll(owner: string): void
7277
+ /**
7278
+ * **JMap.Draw.select**
7279
+ *
7280
+ * Selects features for editing. Draw must be armed in `select` mode, and every feature must
7281
+ * belong to the active owner.
7282
+ *
7283
+ * @param ids Feature ids to select.
7284
+ * @throws If select mode is not armed, a feature is missing, or a feature belongs to another owner.
7285
+ * @example
7286
+ * ```ts
7287
+ * JMap.Draw.arm({ owner: "analysis-mask", mode: "select" })
7288
+ * JMap.Draw.select(["mask-1"])
7289
+ * ```
7290
+ */
7291
+ function select(ids: JDrawFeatureId[]): void
7292
+ /**
7293
+ * **JMap.Draw.deselect**
7294
+ *
7295
+ * Clears the current Draw selection and emits `JMap.Event.Draw.selectionChanged` with an
7296
+ * empty feature array. Does nothing while Draw is disarmed.
7297
+ *
7298
+ * @example
7299
+ * ```ts
7300
+ * JMap.Draw.deselect()
7301
+ * ```
7302
+ */
7303
+ function deselect(): void
7304
+ /**
7305
+ * **JMap.Draw.getSelected**
7306
+ *
7307
+ * Returns a snapshot of the currently selected Draw features. Returns an empty array when
7308
+ * there is no active map or selection.
7309
+ *
7310
+ * @example
7311
+ * ```ts
7312
+ * const selectedMasks = JMap.Draw.getSelected()
7313
+ * ```
7314
+ */
7315
+ function getSelected(): JDrawFeature[]
7316
+ /**
7317
+ * **JMap.Draw.setStyle**
7318
+ *
7319
+ * Merges style changes into an owner's default style and refreshes that owner's rendering.
7320
+ * Per-feature style properties continue to override owner defaults.
7321
+ *
7322
+ * @param owner Registered owner id.
7323
+ * @param style Partial style to merge into the owner's defaults.
7324
+ * @throws If the owner is not registered.
7325
+ * @example
7326
+ * ```ts
7327
+ * JMap.Draw.setStyle("analysis-mask", {
7328
+ * fillColor: "#3366ff",
7329
+ * strokeColor: "#003399"
7330
+ * })
7331
+ * ```
7332
+ */
7333
+ function setStyle(owner: string, style: Partial<JDrawStyle>): void
7334
+ /**
7335
+ * **JMap.Draw.setSnapping**
7336
+ *
7337
+ * Merges snapping changes into an owner's configuration and refreshes the shared snapping
7338
+ * candidate cache.
7339
+ *
7340
+ * @param owner Registered owner id.
7341
+ * @param snapping Partial snapping configuration.
7342
+ * @throws If the owner is not registered.
7343
+ * @example
7344
+ * ```ts
7345
+ * JMap.Draw.setSnapping("analysis-mask", {
7346
+ * enabled: true,
7347
+ * toDrawFeatures: true,
7348
+ * toLayers: ["roads"],
7349
+ * tolerancePx: 20
7350
+ * })
7351
+ * ```
7352
+ */
7353
+ function setSnapping(owner: string, snapping: Partial<JDrawSnapping>): void
7354
+ /**
7355
+ * **JMap.Draw.cancel**
7356
+ *
7357
+ * Cancels the provisional feature, if one is being drawn, and emits
7358
+ * `JMap.Event.Draw.drawingCancelled`. The active owner remains armed in the same mode.
7359
+ *
7360
+ * @example
7361
+ * ```ts
7362
+ * // Abandon the current polygon but keep polygon drawing active.
7363
+ * JMap.Draw.cancel()
7364
+ * ```
7365
+ */
7366
+ function cancel(): void
7367
+ }
7035
7368
  /**
7036
7369
  * **JMap.Event**
7037
7370
  *
@@ -7054,6 +7387,200 @@ export namespace JMap {
7054
7387
  * Deactivating a listener keep it in the JMap Cloud NG Core library, but ignore it when an event is emitted.
7055
7388
  */
7056
7389
  namespace Event {
7390
+ /**
7391
+ * ***JMap.Event.Draw***
7392
+ *
7393
+ * Draw lifecycle and feature events. Register listeners through each channel's `on` method.
7394
+ * The optional `{ owner }` filter limits delivery to one Draw owner. Listener ids should be
7395
+ * unique across Draw channels because activation, deactivation, and removal operate by id.
7396
+ */
7397
+ namespace Draw {
7398
+ /** Emitted after an interactive feature is completed or features are added through the API. */
7399
+ namespace featureCreated {
7400
+ /**
7401
+ * Registers a feature-created listener.
7402
+ *
7403
+ * @param listenerId Non-empty listener id.
7404
+ * @param fn Listener receiving the event owner and created features.
7405
+ * @param options Optional owner filter.
7406
+ * @example
7407
+ * ```ts
7408
+ * JMap.Event.Draw.featureCreated.on(
7409
+ * "mask-created",
7410
+ * ({ features }) => console.log("Created", features),
7411
+ * { owner: "analysis-mask" }
7412
+ * )
7413
+ * ```
7414
+ */
7415
+ function on(listenerId: string, fn: (params: JDrawEventParams) => void, options?: JDrawListenerOptions): void
7416
+ }
7417
+ /** Emitted after a selected feature edit or a call to `JMap.Draw.updateFeature`. */
7418
+ namespace featureUpdated {
7419
+ /**
7420
+ * Registers a feature-updated listener.
7421
+ *
7422
+ * @param listenerId Non-empty listener id.
7423
+ * @param fn Listener receiving the event owner and updated features.
7424
+ * @param options Optional owner filter.
7425
+ * @example
7426
+ * ```ts
7427
+ * JMap.Event.Draw.featureUpdated.on(
7428
+ * "mask-updated",
7429
+ * ({ features }) => console.log("Updated", features),
7430
+ * { owner: "analysis-mask" }
7431
+ * )
7432
+ * ```
7433
+ */
7434
+ function on(listenerId: string, fn: (params: JDrawEventParams) => void, options?: JDrawListenerOptions): void
7435
+ }
7436
+ /** Emitted after Draw features are deleted. */
7437
+ namespace featureDeleted {
7438
+ /**
7439
+ * Registers a feature-deleted listener.
7440
+ *
7441
+ * @param listenerId Non-empty listener id.
7442
+ * @param fn Listener receiving the event owner and deleted feature snapshots.
7443
+ * @param options Optional owner filter.
7444
+ * @example
7445
+ * ```ts
7446
+ * JMap.Event.Draw.featureDeleted.on(
7447
+ * "mask-deleted",
7448
+ * ({ features }) => console.log("Deleted ids", features.map(feature => feature.id)),
7449
+ * { owner: "analysis-mask" }
7450
+ * )
7451
+ * ```
7452
+ */
7453
+ function on(listenerId: string, fn: (params: JDrawEventParams) => void, options?: JDrawListenerOptions): void
7454
+ }
7455
+ /** Emitted when the active owner's feature selection changes. */
7456
+ namespace selectionChanged {
7457
+ /**
7458
+ * Registers a selection-changed listener.
7459
+ *
7460
+ * @param listenerId Non-empty listener id.
7461
+ * @param fn Listener receiving the event owner and complete selected feature snapshot.
7462
+ * @param options Optional owner filter.
7463
+ * @example
7464
+ * ```ts
7465
+ * JMap.Event.Draw.selectionChanged.on(
7466
+ * "mask-selection",
7467
+ * ({ features }) => console.log("Selected ids", features.map(feature => feature.id)),
7468
+ * { owner: "analysis-mask" }
7469
+ * )
7470
+ * ```
7471
+ */
7472
+ function on(listenerId: string, fn: (params: JDrawEventParams) => void, options?: JDrawListenerOptions): void
7473
+ }
7474
+ /** Emitted when an owner's active drawing or selection mode changes. */
7475
+ namespace modeChanged {
7476
+ /**
7477
+ * Registers a mode-changed listener.
7478
+ *
7479
+ * @param listenerId Non-empty listener id.
7480
+ * @param fn Listener receiving the event owner and active mode.
7481
+ * @param options Optional owner filter.
7482
+ * @example
7483
+ * ```ts
7484
+ * JMap.Event.Draw.modeChanged.on(
7485
+ * "mask-mode",
7486
+ * ({ mode }) => console.log("Active mode", mode),
7487
+ * { owner: "analysis-mask" }
7488
+ * )
7489
+ * ```
7490
+ */
7491
+ function on(listenerId: string, fn: (params: JDrawModeEventParams) => void, options?: JDrawListenerOptions): void
7492
+ }
7493
+ /**
7494
+ * Emitted when an owner is armed or disarmed. The reason distinguishes an explicit
7495
+ * `disarm`, external `preempted` interaction, stack `restored` arm, and `mapChanged` teardown.
7496
+ */
7497
+ namespace armedChanged {
7498
+ /**
7499
+ * Registers an armed-state listener.
7500
+ *
7501
+ * @param listenerId Non-empty listener id.
7502
+ * @param fn Listener receiving the owner, armed state, and transition reason.
7503
+ * @param options Optional owner filter.
7504
+ * @example
7505
+ * ```ts
7506
+ * JMap.Event.Draw.armedChanged.on(
7507
+ * "mask-armed",
7508
+ * ({ armed, reason }) => console.log({ armed, reason }),
7509
+ * { owner: "analysis-mask" }
7510
+ * )
7511
+ * ```
7512
+ */
7513
+ function on(listenerId: string, fn: (params: JDrawArmedEventParams) => void, options?: JDrawListenerOptions): void
7514
+ }
7515
+ /** Emitted with a provisional feature while drawing, throttled to at most once per animation frame. */
7516
+ namespace drawingProgress {
7517
+ /**
7518
+ * Registers a drawing-progress listener.
7519
+ *
7520
+ * @param listenerId Non-empty listener id.
7521
+ * @param fn Listener receiving the owner and provisional feature snapshot.
7522
+ * @param options Optional owner filter.
7523
+ * @example
7524
+ * ```ts
7525
+ * JMap.Event.Draw.drawingProgress.on(
7526
+ * "mask-progress",
7527
+ * ({ features }) => console.log("Provisional geometry", features[0].geometry),
7528
+ * { owner: "analysis-mask" }
7529
+ * )
7530
+ * ```
7531
+ */
7532
+ function on(listenerId: string, fn: (params: JDrawEventParams) => void, options?: JDrawListenerOptions): void
7533
+ }
7534
+ /** Emitted when a provisional feature is cancelled before completion. */
7535
+ namespace drawingCancelled {
7536
+ /**
7537
+ * Registers a drawing-cancelled listener.
7538
+ *
7539
+ * @param listenerId Non-empty listener id.
7540
+ * @param fn Listener receiving the owner and cancelled provisional feature snapshot.
7541
+ * @param options Optional owner filter.
7542
+ * @example
7543
+ * ```ts
7544
+ * JMap.Event.Draw.drawingCancelled.on(
7545
+ * "mask-cancelled",
7546
+ * ({ features }) => console.log("Cancelled", features[0]),
7547
+ * { owner: "analysis-mask" }
7548
+ * )
7549
+ * ```
7550
+ */
7551
+ function on(listenerId: string, fn: (params: JDrawEventParams) => void, options?: JDrawListenerOptions): void
7552
+ }
7553
+ /**
7554
+ * Reactivates every Draw listener carrying the id.
7555
+ *
7556
+ * @param listenerId Listener id.
7557
+ * @example
7558
+ * ```ts
7559
+ * JMap.Event.Draw.activateListener("mask-created")
7560
+ * ```
7561
+ */
7562
+ function activateListener(listenerId: string): void
7563
+ /**
7564
+ * Deactivates every Draw listener carrying the id without removing it.
7565
+ *
7566
+ * @param listenerId Listener id.
7567
+ * @example
7568
+ * ```ts
7569
+ * JMap.Event.Draw.deactivateListener("mask-created")
7570
+ * ```
7571
+ */
7572
+ function deactivateListener(listenerId: string): void
7573
+ /**
7574
+ * Removes every Draw listener carrying the id.
7575
+ *
7576
+ * @param listenerId Listener id.
7577
+ * @example
7578
+ * ```ts
7579
+ * JMap.Event.Draw.removeListener("mask-created")
7580
+ * ```
7581
+ */
7582
+ function removeListener(listenerId: string): void
7583
+ }
7057
7584
  /**
7058
7585
  * ***JMap.Event.Main***
7059
7586
  *
@@ -11094,7 +11621,8 @@ export namespace JMap {
11094
11621
  /**
11095
11622
  * **JMap.Library.maplibregl**
11096
11623
  *
11097
- * Returns the maplibre-gl library.
11624
+ * Returns the host's maplibre-gl namespace. The namespace is versioned with the host;
11625
+ * a host major version bump is a breaking change through this door.
11098
11626
  *
11099
11627
  * @example
11100
11628
  * ```ts
@@ -11102,7 +11630,7 @@ export namespace JMap {
11102
11630
  * const maplibregl = JMap.Library.maplibregl()
11103
11631
  * ```
11104
11632
  */
11105
- function maplibregl(): any
11633
+ function maplibregl(): typeof import("maplibre-gl")
11106
11634
  /**
11107
11635
  * **JMap.Library.html2canvas**
11108
11636
  *
@@ -0,0 +1,127 @@
1
+ import type { Feature, Geometry } from "geojson"
2
+
3
+ export type JDrawShape = "point" | "linestring" | "polygon" | "rectangle" | "circle" | "freehand" | "text"
4
+ export type JDrawMode = JDrawShape | "select"
5
+ export type JDrawFeatureId = string | number
6
+
7
+ export interface JDrawProperties {
8
+ owner: string
9
+ shape: JDrawShape
10
+ text?: string
11
+ textSize?: number
12
+ textColor?: string
13
+ textRotation?: number
14
+ zoomRef?: number
15
+ [key: string]: unknown
16
+ }
17
+
18
+ export type JDrawFeature = Feature<Geometry, JDrawProperties>
19
+
20
+ export interface JDrawStyle {
21
+ fillColor?: string
22
+ fillOpacity?: number
23
+ strokeColor?: string
24
+ strokeOpacity?: number
25
+ strokeWidth?: number
26
+ pointRadius?: number
27
+ pointOutlineColor?: string
28
+ pointOutlineWidth?: number
29
+ vertexActiveColor?: string
30
+ vertexInactiveColor?: string
31
+ textColor?: string
32
+ textRotation?: number
33
+ textSize?: number
34
+ }
35
+
36
+ export interface JDrawSnapping {
37
+ enabled: boolean
38
+ toDrawFeatures?: boolean
39
+ toLayers?: string[]
40
+ tolerancePx?: number
41
+ }
42
+
43
+ export interface JDrawRegisterOptions {
44
+ style: JDrawStyle
45
+ snapping?: JDrawSnapping
46
+ }
47
+
48
+ export interface JDrawArmOptions {
49
+ owner: string
50
+ mode: JDrawMode
51
+ style?: Partial<JDrawStyle>
52
+ keyboard?: boolean
53
+ }
54
+
55
+ export interface JDrawFeaturePatch {
56
+ properties?: Partial<Omit<JDrawProperties, "owner" | "shape">>
57
+ geometry?: Geometry
58
+ }
59
+
60
+ export interface JDrawService {
61
+ register(owner: string, options: JDrawRegisterOptions): void
62
+ unregister(owner: string): void
63
+ arm(options: JDrawArmOptions): void
64
+ disarm(): void
65
+ isArmed(owner?: string): boolean
66
+ getMode(): JDrawMode | undefined
67
+ getFeatures(owner: string): JDrawFeature[]
68
+ addFeatures(features: JDrawFeature[]): void
69
+ setFeatures(owner: string, features: JDrawFeature[]): void
70
+ updateFeature(id: JDrawFeatureId, patch: JDrawFeaturePatch): void
71
+ deleteFeatures(ids: JDrawFeatureId[]): void
72
+ deleteAll(owner: string): void
73
+ select(ids: JDrawFeatureId[]): void
74
+ deselect(): void
75
+ getSelected(): JDrawFeature[]
76
+ setStyle(owner: string, style: Partial<JDrawStyle>): void
77
+ setSnapping(owner: string, snapping: Partial<JDrawSnapping>): void
78
+ cancel(): void
79
+ }
80
+
81
+ export interface JDrawEventParams {
82
+ owner: string
83
+ features: JDrawFeature[]
84
+ }
85
+
86
+ export type JDrawArmedChangedReason = "disarm" | "preempted" | "restored" | "mapChanged"
87
+
88
+ export interface JDrawArmedEventParams {
89
+ owner: string
90
+ armed: boolean
91
+ reason: JDrawArmedChangedReason
92
+ }
93
+
94
+ export interface JDrawModeEventParams {
95
+ owner: string
96
+ mode: JDrawMode
97
+ }
98
+
99
+ export interface JDrawListenerOptions {
100
+ owner?: string
101
+ }
102
+
103
+ export interface JDrawFeatureEventChannel {
104
+ on(listenerId: string, fn: (params: JDrawEventParams) => void, options?: JDrawListenerOptions): void
105
+ }
106
+
107
+ export interface JDrawModeEventChannel {
108
+ on(listenerId: string, fn: (params: JDrawModeEventParams) => void, options?: JDrawListenerOptions): void
109
+ }
110
+
111
+ export interface JDrawArmedEventChannel {
112
+ on(listenerId: string, fn: (params: JDrawArmedEventParams) => void, options?: JDrawListenerOptions): void
113
+ }
114
+
115
+ export interface JDrawEventModule {
116
+ featureCreated: JDrawFeatureEventChannel
117
+ featureUpdated: JDrawFeatureEventChannel
118
+ featureDeleted: JDrawFeatureEventChannel
119
+ selectionChanged: JDrawFeatureEventChannel
120
+ modeChanged: JDrawModeEventChannel
121
+ armedChanged: JDrawArmedEventChannel
122
+ drawingProgress: JDrawFeatureEventChannel
123
+ drawingCancelled: JDrawFeatureEventChannel
124
+ activateListener(listenerId: string): void
125
+ deactivateListener(listenerId: string): void
126
+ removeListener(listenerId: string): void
127
+ }