@mappedin/blue-dot 6.0.1-beta.54 → 6.0.1-beta.56
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/lib/blue-dot.iife.js.map +7 -0
- package/lib/esm/index.d.ts +37 -19
- package/lib/esm/index.js +234 -1
- package/lib/esm/index.js.map +7 -0
- package/lib/rn/index-rn.d.ts +4 -0
- package/lib/rn/index-rn.js +295 -0
- package/lib/rn/index-rn.js.map +7 -0
- package/lib/rn/rn/extension-augmentation.d.ts +15 -0
- package/lib/rn/rn/extension-source.d.ts +6 -0
- package/lib/rn/rn/use-blue-dot-events.d.ts +40 -0
- package/lib/rn/rn/use-blue-dot-registration.d.ts +16 -0
- package/lib/rn/rn/use-blue-dot.d.ts +131 -0
- package/lib/rn/types.d.ts +194 -0
- package/package.json +36 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../../packages/common/pubsub.ts", "../src/blue-dot.ts"],
|
|
4
|
+
"sourcesContent": ["export { BlueDot } from './blue-dot';\nexport type {\n\tBlueDotEvents,\n\tBlueDotEventPayloads,\n\tBlueDotPositionUpdate,\n\tBlueDotState,\n\tBlueDotAction,\n\tFollowMode,\n\tFollowCameraOptions,\n\tBlueDotOptions,\n} from './types';\n", "/**\n * Generic PubSub class implementing the Publish-Subscribe pattern for event handling.\n *\n * @template EVENT_PAYLOAD - The type of the event payload.\n * @template EVENT - The type of the event.\n */\nexport class PubSub<EVENT_PAYLOAD, EVENT extends keyof EVENT_PAYLOAD = keyof EVENT_PAYLOAD> {\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tprivate _subscribers: any = {};\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tprivate _destroyed = false;\n\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tpublish<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, data?: EVENT_PAYLOAD[EVENT_NAME]) {\n\t\tif (!this._subscribers || !this._subscribers[eventName] || this._destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._subscribers[eventName]!.forEach(function (fn) {\n\t\t\tif (typeof fn !== 'function') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfn(data);\n\t\t});\n\t}\n\n\t/**\n\t * Subscribe a function to an event.\n\t *\n\t * @param eventName An event name which, when fired, will call the provided\n\t * function.\n\t * @param fn A callback that gets called when the corresponding event is fired. The\n\t * callback will get passed an argument with a type that's one of event payloads.\n\t * @example\n\t * // Subscribe to the 'click' event\n\t * const handler = (event) => {\n\t * const { coordinate } = event;\n\t * const { latitude, longitude } = coordinate;\n\t * \tconsole.log(`Map was clicked at ${latitude}, ${longitude}`);\n\t * };\n\t * map.on('click', handler);\n\t */\n\ton<EVENT_NAME extends EVENT>(\n\t\teventName: EVENT_NAME,\n\t\tfn: (\n\t\t\tpayload: EVENT_PAYLOAD[EVENT_NAME] extends {\n\t\t\t\tdata: null;\n\t\t\t}\n\t\t\t\t? EVENT_PAYLOAD[EVENT_NAME]['data']\n\t\t\t\t: EVENT_PAYLOAD[EVENT_NAME],\n\t\t) => void,\n\t) {\n\t\tif (!this._subscribers || this._destroyed) {\n\t\t\tthis._subscribers = {};\n\t\t}\n\t\tthis._subscribers[eventName] = this._subscribers[eventName] || [];\n\t\tthis._subscribers[eventName]!.push(fn);\n\t}\n\n\t/**\n\t * Unsubscribe a function previously subscribed with {@link on}\n\t *\n\t * @param eventName An event name to which the provided function was previously\n\t * subscribed.\n\t * @param fn A function that was previously passed to {@link on}. The function must\n\t * have the same reference as the function that was subscribed.\n\t * @example\n\t * // Unsubscribe from the 'click' event\n\t * const handler = (event) => {\n\t * \tconsole.log('Map was clicked', event);\n\t * };\n\t * map.off('click', handler);\n\t */\n\toff<EVENT_NAME extends EVENT>(\n\t\teventName: EVENT_NAME,\n\t\tfn: (\n\t\t\tpayload: EVENT_PAYLOAD[EVENT_NAME] extends {\n\t\t\t\tdata: null;\n\t\t\t}\n\t\t\t\t? EVENT_PAYLOAD[EVENT_NAME]['data']\n\t\t\t\t: EVENT_PAYLOAD[EVENT_NAME],\n\t\t) => void,\n\t) {\n\t\tif (!this._subscribers || this._subscribers[eventName] == null || this._destroyed) {\n\t\t\treturn;\n\t\t}\n\t\tconst itemIdx = this._subscribers[eventName]!.indexOf(fn);\n\n\t\tif (itemIdx !== -1) {\n\t\t\tthis._subscribers[eventName]!.splice(itemIdx, 1);\n\t\t}\n\t}\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tdestroy() {\n\t\tthis._destroyed = true;\n\t\tthis._subscribers = {};\n\t}\n}\n", "import { PubSub } from '@packages/internal/common/pubsub';\nimport type { MapView } from '@mappedin/mappedin-js';\nimport type {\n\tBlueDotEventPayloads,\n\tBlueDotOptions,\n\tBlueDotPositionUpdate,\n\tBlueDotState,\n\tFollowCameraOptions,\n\tFollowMode,\n} from './types';\n\n/**\n * Show a Blue Dot indicating the device's position on the map.\n *\n * @example\n * ```ts\n * import { show3dMap } from '@mappedin/mappedin-js';\n * import { BlueDot } from '@mappedin/blue-dot';\n *\n * const mapView = await show3dMap(...);\n *\n * // Enable BlueDot\n * new BlueDot(mapView).enable();\n *\n * // Option 1: Listen for position updates from the device\n * mapView.BlueDot.on('position-update', (position) => {\n * console.log('User position:', position);\n * });\n *\n * // Option 2: Update position manually\n * new BlueDot(mapView).update({ latitude, longitude, accuracy, floorOrFloorId });\n *\n * ```\n */\nexport class BlueDot {\n\t#pubsub = new PubSub<BlueDotEventPayloads>();\n\t#mapView: MapView;\n\n\t/**\n\t * Create a new {@link BlueDot} instance.\n\t */\n\tconstructor(mapView: MapView) {\n\t\tthis.#mapView = mapView;\n\t\tthis.#mapView.__BlueDot.on('blue-dot-position-error', e => {\n\t\t\tthis.#pubsub.publish('error', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('blue-dot-position-update', e => {\n\t\t\tthis.#pubsub.publish('position-update', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('blue-dot-state-change', e => {\n\t\t\tthis.#pubsub.publish('state-change', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('blue-dot-follow-change', e => {\n\t\t\tthis.#pubsub.publish('follow-change', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('click', e => {\n\t\t\tthis.#pubsub.publish('click', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('hover', () => {\n\t\t\tthis.#pubsub.publish('hover');\n\t\t});\n\t}\n\n\t/**\n\t * The current state of the BlueDot. Can be 'hidden', 'active', 'inactive', or 'disabled'.\n\t * Listen for state changes using the 'state-change' event.\n\t *\n\t * @example\n\t * mapView.BlueDot.on('state-change', ({ state }) => {\n\t * if (state === 'active') {\n\t * // BlueDot is visible and tracking\n\t * }\n\t * });\n\t */\n\tget state(): BlueDotState {\n\t\treturn this.#mapView.__BlueDot.state;\n\t}\n\n\t/**\n\t * Whether the BlueDot is currently following the user (camera follow mode).\n\t */\n\tget following() {\n\t\treturn this.#mapView.__BlueDot.following;\n\t}\n\n\t/**\n\t * The direction the user is facing in degrees from north clockwise.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/GeolocationCoordinates/heading\n\t */\n\tget heading() {\n\t\treturn this.#mapView.__BlueDot.heading;\n\t}\n\n\t/**\n\t * The accuracy of the current position in metres.\n\t */\n\tget accuracy() {\n\t\treturn this.#mapView.__BlueDot.accuracy;\n\t}\n\n\t/**\n\t * The coordinate of the current position.\n\t */\n\tget coordinate() {\n\t\treturn this.#mapView.__BlueDot.coordinate;\n\t}\n\n\t/**\n\t * The floor the Blue Dot is currently on. If undefined, the Blue Dot will appear on every floor.\n\t */\n\tget floor() {\n\t\treturn this.#mapView.__BlueDot.floor;\n\t}\n\n\t/**\n\t * Enable the Blue Dot. It will be hidden until a position is received either from the browser or by calling {@link BlueDot.update}.\n\t * @param options - The options to setup the Blue Dot (see {@link BlueDotOptions}).\n\t *\n\t * @example Enable with default options\n\t * mapView.BlueDot.enable();\n\t *\n\t * @example Enable with custom color and accuracy ring\n\t * mapView.BlueDot.enable({ color: '#00ff00', accuracyRing: { color: '#00ff00', opacity: 0.2 } });\n\t *\n\t * @see See the [BlueDot Guide](https://developer.mappedin.com/web-sdk/blue-dot) for more information.\n\t */\n\tenable = (options?: BlueDotOptions) => {\n\t\tthis.#mapView.__BlueDot.enable(options);\n\t};\n\n\t/**\n\t * Disable the Blue Dot. It will be hidden and no longer update.\n\t */\n\tdisable = () => {\n\t\tthis.#mapView.__BlueDot.disable();\n\t};\n\n\ton: PubSub<BlueDotEventPayloads>['on'] = (eventName, fn) => {\n\t\tthis.#pubsub.on(eventName, fn);\n\t};\n\n\toff: PubSub<BlueDotEventPayloads>['off'] = (eventName, fn) => {\n\t\tthis.#pubsub.off(eventName, fn);\n\t};\n\n\t/**\n\t * Enable or disable the devices's geolocation listener to automatically position the Blue Dot.\n\t * If enabled, the device will request permission to access the user's precise location.\n\t * @param watch - Whether to enable or disable the listener.\n\t */\n\twatchDevicePosition = (watch = true) => {\n\t\tthis.#mapView.__BlueDot.watchDevicePosition(watch);\n\t};\n\n\t/**\n\t * Manually override some position properties of the Blue Dot.\n\t * Accepts a full GeolocationPosition object or a partial {@link BlueDotPositionUpdate} object.\n\t * @example Manually set the accuracy and heading\n\t * ```ts\n\t * api.BlueDot.update({ accuracy: 10, heading: 90 });\n\t * ```\n\t * @example Reset accuracy and heading to device values\n\t * ```ts\n\t * api.BlueDot.update({ accuracy: 'device', heading: 'device' });\n\t * ```\n\t */\n\tupdate = (position: BlueDotPositionUpdate) => {\n\t\tthis.#mapView.__BlueDot.update(position);\n\t};\n\n\t/**\n\t * Set the camera to follow the BlueDot in various modes. User interaction will cancel following automatically.\n\t * @param mode The follow mode ('position-only', 'position-and-heading', 'position-and-path-direction', or false to disable).\n\t * @param cameraOptions Optional camera options (zoom, pitch, etc.).\n\t *\n\t * @example\n\t * mapView.BlueDot.follow('position-and-heading', { zoomLevel: 21, pitch: 45 });\n\t */\n\tfollow = (mode: Foll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,KAAKR,GAAS,UAAU,GAAG,QAAS,GAAK,CACxCQ,EAAA,KAAKT,GAAQ,QAAQ,QAAS,CAAC,CAChC,CAAC,EACDS,EAAA,KAAKR,GAAS,UAAU,GAAG,QAAS,IAAM,CACzCQ,EAAA,KAAKT,GAAQ,QAAQ,OAAO,CAC7B,CAAC,CACF,CAaA,IAAI,OAAsB,CACzB,OAAOS,EAAA,KAAKR,GAAS,UAAU,KAChC,CAKA,IAAI,WAAY,CACf,OAAOQ,EAAA,KAAKR,GAAS,UAAU,SAChC,CAMA,IAAI,SAAU,CACb,OAAOQ,EAAA,KAAKR,GAAS,UAAU,OAChC,CAKA,IAAI,UAAW,CACd,OAAOQ,EAAA,KAAKR,GAAS,UAAU,QAChC,CAKA,IAAI,YAAa,CAChB,OAAOQ,EAAA,KAAKR,GAAS,UAAU,UAChC,CAKA,IAAI,OAAQ,CACX,OAAOQ,EAAA,KAAKR,GAAS,UAAU,KAChC,CAyED,EAtJCD,EAAA,YACAC,EAAA,YAFoBM,EAAAL,EAAA,WAAd,IAAMe,EAANf",
|
|
6
|
+
"names": ["index_exports", "__export", "BlueDot", "_PubSub", "__publicField", "eventName", "data", "fn", "itemIdx", "__name", "PubSub", "_pubsub", "_mapView", "_BlueDot", "mapView", "__privateAdd", "PubSub", "__publicField", "__name", "options", "__privateGet", "eventName", "fn", "watch", "position", "mode", "cameraOptions", "__privateSet", "BlueDot"]
|
|
7
|
+
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Generated by dts-bundle v0.7.3
|
|
2
2
|
// Dependencies for this module:
|
|
3
|
-
// ../blue-dot/@packages/internal/common
|
|
3
|
+
// ../blue-dot/@packages/internal/common/pubsub
|
|
4
4
|
// ../blue-dot/@mappedin/mappedin-js
|
|
5
5
|
// ../blue-dot/three
|
|
6
|
-
// ../blue-dot/zod
|
|
7
6
|
// ../blue-dot/type-fest
|
|
8
7
|
|
|
9
8
|
declare module '@mappedin/blue-dot' {
|
|
@@ -12,7 +11,7 @@ declare module '@mappedin/blue-dot' {
|
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
declare module '@mappedin/blue-dot/blue-dot/src/blue-dot' {
|
|
15
|
-
import { PubSub } from '@packages/internal/common';
|
|
14
|
+
import { PubSub } from '@packages/internal/common/pubsub';
|
|
16
15
|
import type { MapView } from '@mappedin/mappedin-js';
|
|
17
16
|
import type { BlueDotEventPayloads, BlueDotOptions, BlueDotPositionUpdate, BlueDotState, FollowCameraOptions, FollowMode } from '@mappedin/blue-dot/blue-dot/src/types';
|
|
18
17
|
/**
|
|
@@ -221,7 +220,7 @@ declare module '@mappedin/blue-dot/blue-dot/src/types' {
|
|
|
221
220
|
};
|
|
222
221
|
export type BlueDotEvents = keyof BlueDotEventPayloads;
|
|
223
222
|
export type BlueDotState = 'hidden' | 'active' | 'inactive' | 'disabled';
|
|
224
|
-
export type BlueDotAction = 'timeout' | 'error' | 'position-update' | 'enable' | 'disable';
|
|
223
|
+
export type BlueDotAction = 'timeout' | 'error' | 'position-update' | 'enable' | 'disable' | 'initialize';
|
|
225
224
|
export type BlueDotOptions = {
|
|
226
225
|
/**
|
|
227
226
|
* The radius of the BlueDot in pixels. The BlueDot will maintain this size clamped to a minimum of 0.35 metres.
|
|
@@ -284,6 +283,11 @@ declare module '@mappedin/blue-dot/blue-dot/src/types' {
|
|
|
284
283
|
* @default false
|
|
285
284
|
*/
|
|
286
285
|
debug?: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* The maximum acceptable accuracy in meters. Position updates with accuracy exceeding this value will be dropped.
|
|
288
|
+
* @default 50
|
|
289
|
+
*/
|
|
290
|
+
accuracyThreshold?: number;
|
|
287
291
|
};
|
|
288
292
|
/**
|
|
289
293
|
* Position update options for the {@link BlueDot.update} method.
|
|
@@ -442,10 +446,9 @@ declare module '@mappedin/blue-dot/packages/common/utils' {
|
|
|
442
446
|
end: number;
|
|
443
447
|
};
|
|
444
448
|
export function isFiniteBox(box: Box2 | Box3): boolean;
|
|
445
|
-
export
|
|
446
|
-
export
|
|
449
|
+
export { clampWithWarning } from '@mappedin/blue-dot/packages/common/math-utils';
|
|
450
|
+
export { arraysEqual } from '@mappedin/blue-dot/packages/common/array-utils';
|
|
447
451
|
export function isBrowser(): boolean;
|
|
448
|
-
export {};
|
|
449
452
|
}
|
|
450
453
|
|
|
451
454
|
declare module '@mappedin/blue-dot/packages/common/async' {
|
|
@@ -514,6 +517,7 @@ declare module '@mappedin/blue-dot/packages/common/random-id' {
|
|
|
514
517
|
*/
|
|
515
518
|
export const randomId: () => string;
|
|
516
519
|
export function cyrb53(str: string, seed?: number): number;
|
|
520
|
+
export function shortId(): string;
|
|
517
521
|
}
|
|
518
522
|
|
|
519
523
|
declare module '@mappedin/blue-dot/packages/common/pubsub' {
|
|
@@ -524,11 +528,6 @@ declare module '@mappedin/blue-dot/packages/common/pubsub' {
|
|
|
524
528
|
* @template EVENT - The type of the event.
|
|
525
529
|
*/
|
|
526
530
|
export class PubSub<EVENT_PAYLOAD, EVENT extends keyof EVENT_PAYLOAD = keyof EVENT_PAYLOAD> {
|
|
527
|
-
/**
|
|
528
|
-
* @private
|
|
529
|
-
* @internal
|
|
530
|
-
*/
|
|
531
|
-
_subscribers: any;
|
|
532
531
|
/**
|
|
533
532
|
* @private
|
|
534
533
|
* @internal
|
|
@@ -649,19 +648,24 @@ declare module '@mappedin/blue-dot/packages/common/color' {
|
|
|
649
648
|
}
|
|
650
649
|
|
|
651
650
|
declare module '@mappedin/blue-dot/packages/common/interpolate' {
|
|
652
|
-
|
|
653
|
-
export
|
|
654
|
-
|
|
651
|
+
export const EASING_CURVES: readonly ["ease-in", "ease-out", "ease-in-out", "linear"];
|
|
652
|
+
export type EasingCurve = (typeof EASING_CURVES)[number];
|
|
653
|
+
/**
|
|
654
|
+
* Validates if a value is a valid easing curve
|
|
655
|
+
* @param value The value to validate
|
|
656
|
+
* @returns True if the value is a valid easing curve
|
|
657
|
+
*/
|
|
658
|
+
export function isValidEasingCurve(value: unknown): value is EasingCurve;
|
|
655
659
|
export const linearEase: (t: number) => number;
|
|
656
660
|
export const quadEaseIn: (t: number) => number;
|
|
657
661
|
export const easeIn: (x: number) => number;
|
|
658
662
|
export const quadEaseOut: (t: number) => number;
|
|
659
663
|
export function interpolate(value: number, inputMin: number, inputMax: number, outputMin: number, outputMax: number, easeFunc?: EasingCurve | ((t: number) => number)): number;
|
|
660
664
|
/**
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
+
* Return the closest range within an ordered set of values that a given value falls within. If the given value is
|
|
666
|
+
* exactly within a range, returns the index of the range. If the given value is less than the first value in the range,
|
|
667
|
+
* returns 0. If the given value is greater than the last value in the range, returns the last range (lastIndex - 1).
|
|
668
|
+
*/
|
|
665
669
|
export function getInterpolationBreakpoint(value: number, range: number[]): number;
|
|
666
670
|
export function interpolateMulti(value: number, inputRange: number[], outputRange: number[], easeFunc?: EasingCurve | ((t: number) => number)): number;
|
|
667
671
|
}
|
|
@@ -704,3 +708,17 @@ declare module '@mappedin/blue-dot/packages/common/type-utils' {
|
|
|
704
708
|
export {};
|
|
705
709
|
}
|
|
706
710
|
|
|
711
|
+
declare module '@mappedin/blue-dot/packages/common/math-utils' {
|
|
712
|
+
/**
|
|
713
|
+
* Clamp a number between lower and upper bounds with a warning
|
|
714
|
+
*/
|
|
715
|
+
export function clampWithWarning(x: number, lower: number, upper: number, warning: string): number;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
declare module '@mappedin/blue-dot/packages/common/array-utils' {
|
|
719
|
+
/**
|
|
720
|
+
* Compare two arrays for equality
|
|
721
|
+
*/
|
|
722
|
+
export function arraysEqual(arr1: any[] | null | undefined, arr2: any[] | null | undefined): boolean;
|
|
723
|
+
}
|
|
724
|
+
|