@cosmicds/vue-toolkit 0.2.0 → 0.4.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.
- package/README.md +20 -1
- package/dist/index.common.js +32528 -31853
- package/dist/index.umd.js +32527 -31844
- package/dist/index.umd.min.js +6 -4
- package/dist/src/background.d.ts +4 -0
- package/dist/src/components/CreditLogos.vue.d.ts +27 -2
- package/dist/src/components/FundingAcknowledgement.vue.d.ts +21 -0
- package/dist/src/components/Gallery.vue.d.ts +79 -2
- package/dist/src/components/GeolocationButton.vue.d.ts +132 -0
- package/dist/src/components/IconButton.vue.d.ts +130 -2
- package/dist/src/components/LocationSelector.vue.d.ts +139 -2
- package/dist/src/components/WwtHud.vue.d.ts +69 -0
- package/dist/src/composables.d.ts +25 -0
- package/dist/src/geolocation.d.ts +31 -0
- package/dist/src/index.d.ts +11 -8
- package/dist/src/keyboard.d.ts +35 -2
- package/dist/src/mapbox.d.ts +98 -0
- package/dist/src/stories/CreditLogos.stories.d.ts +6 -0
- package/dist/src/stories/FundingAcknowledgement.stories.d.ts +6 -0
- package/dist/src/stories/Gallery.stories.d.ts +6 -0
- package/dist/src/stories/IconButton.stories.d.ts +6 -0
- package/dist/src/stories/LocationSelector.stories.d.ts +6 -0
- package/dist/src/stories/WwtHud.stories.d.ts +6 -0
- package/dist/src/types.d.ts +241 -0
- package/dist/src/utils.d.ts +27 -1
- package/dist/src/wwt-utils.d.ts +11 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -4
- package/src/background.ts +4 -0
- package/src/composables.ts +69 -0
- package/src/geolocation.ts +122 -0
- package/src/index.ts +23 -15
- package/src/keyboard.ts +39 -5
- package/src/mapbox.ts +227 -0
- package/src/types.ts +271 -0
- package/src/utils.ts +54 -1
- package/src/wwt-utils.ts +57 -0
- package/dist/index.common.js.map +0 -1
- package/dist/index.umd.js.map +0 -1
- package/dist/index.umd.min.js.map +0 -1
- package/dist/src/components/DefaultMiniCredits.vue.d.ts +0 -3
- package/dist/src/components/FundingAcknowledgment.vue.d.ts +0 -3
- package/dist/src/components/MiniDSBase.d.ts +0 -373
- package/dist/src/components/wwtHUD.vue.d.ts +0 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { BackgroundImageset, skyBackgroundImagesets } from "./background";
|
|
2
|
+
import { useFullscreen, useWindowShape, WindowShape } from "./composables";
|
|
3
|
+
import { PositionCoords, useGeolocation } from "./geolocation";
|
|
4
|
+
import { KeyPressInfo, KeyboardControlSettings } from "./keyboard";
|
|
5
|
+
import { useWWTKeyboardControls } from "./wwt-utils";
|
|
3
6
|
import IconButton from "./components/IconButton.vue";
|
|
4
7
|
import LocationSelector from "./components/LocationSelector.vue";
|
|
5
|
-
import
|
|
6
|
-
import FundingAcknowledgment from "./components/FundingAcknowledgment.vue";
|
|
8
|
+
import FundingAcknowledgement from "./components/FundingAcknowledgement.vue";
|
|
7
9
|
import CreditLogos from "./components/CreditLogos.vue";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
+
import GeolocationButton from "./components/GeolocationButton.vue";
|
|
11
|
+
import WwtHud from "./components/WwtHud.vue";
|
|
10
12
|
import Gallery from "./components/Gallery.vue";
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
+
export { BackgroundImageset, KeyPressInfo, KeyboardControlSettings, Gallery, IconButton, LocationSelector, skyBackgroundImagesets, useFullscreen, useWindowShape, WindowShape, FundingAcknowledgement, CreditLogos, GeolocationButton, WwtHud, PositionCoords, useGeolocation, useWWTKeyboardControls, };
|
|
14
|
+
export * from "./types";
|
|
15
|
+
export * from "./utils";
|
package/dist/src/keyboard.d.ts
CHANGED
|
@@ -1,24 +1,52 @@
|
|
|
1
|
-
|
|
1
|
+
/** Class representing a key press */
|
|
2
|
+
export declare class KeyPressInfo {
|
|
3
|
+
/** The code of the key that was pressed */
|
|
2
4
|
code: string;
|
|
5
|
+
/** Whether the control modifier was pressed */
|
|
3
6
|
ctrl: boolean;
|
|
7
|
+
/** Whether the alt modifier was pressed */
|
|
4
8
|
alt: boolean;
|
|
9
|
+
/** Whether the shift modifier was pressed */
|
|
5
10
|
shift: boolean;
|
|
11
|
+
/** Whether the meta modifier was pressed */
|
|
6
12
|
meta: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Create an instance of key press information
|
|
15
|
+
* @param code The key code describing the keypress
|
|
16
|
+
* @param modifiers An object of boolean values describing which modifier keys were pressed down
|
|
17
|
+
*/
|
|
7
18
|
constructor(code: string, modifiers?: {
|
|
8
19
|
ctrl?: boolean;
|
|
9
20
|
alt?: boolean;
|
|
10
21
|
shift?: boolean;
|
|
11
22
|
meta?: boolean;
|
|
12
23
|
});
|
|
24
|
+
/**
|
|
25
|
+
* Determine whether a keyboard event matches this key press information
|
|
26
|
+
* @param event - The keyboard event to test
|
|
27
|
+
* @returns Whether or not the given event matches
|
|
28
|
+
*/
|
|
13
29
|
matches(event: KeyboardEvent): boolean;
|
|
14
30
|
}
|
|
31
|
+
/** Type describing the possible WWT actions */
|
|
32
|
+
type ActionType = KeyboardControlSettings["actionTypes"][number];
|
|
33
|
+
/**
|
|
34
|
+
* Class describing keyboard control settings for WorldWide Telescope actions
|
|
35
|
+
*/
|
|
15
36
|
export declare class KeyboardControlSettings {
|
|
37
|
+
/** A list of key presses that should result in zooming in */
|
|
16
38
|
zoomIn: KeyPressInfo[];
|
|
39
|
+
/** A list of key presses that should result in zooming out */
|
|
17
40
|
zoomOut: KeyPressInfo[];
|
|
41
|
+
/** A list of key presses that should result in moving the view up */
|
|
18
42
|
moveUp: KeyPressInfo[];
|
|
43
|
+
/** A list of key presses that should result in moving the view down */
|
|
19
44
|
moveDown: KeyPressInfo[];
|
|
45
|
+
/** A list of key presses that should result in moving the view left */
|
|
20
46
|
moveLeft: KeyPressInfo[];
|
|
47
|
+
/** A list of key presses that should result in moving the view right */
|
|
21
48
|
moveRight: KeyPressInfo[];
|
|
49
|
+
/** A value describing how much to move on a movement press. Larger means more movement. */
|
|
22
50
|
moveAmount: number;
|
|
23
51
|
constructor({ zoomIn, zoomOut, moveUp, moveLeft, moveDown, moveRight, moveAmount }: {
|
|
24
52
|
zoomIn?: KeyPressInfo[] | undefined;
|
|
@@ -30,6 +58,11 @@ export declare class KeyboardControlSettings {
|
|
|
30
58
|
moveAmount?: number | undefined;
|
|
31
59
|
});
|
|
32
60
|
readonly actionTypes: readonly ["zoomIn", "zoomOut", "moveUp", "moveDown", "moveLeft", "moveRight"];
|
|
33
|
-
|
|
61
|
+
/** Make a listener for a given WWT action
|
|
62
|
+
* @param actionName - The WWT action to make a listener for
|
|
63
|
+
* @param action - Function to execute when the given WWT action occurs
|
|
64
|
+
* @returns The key event listener for the desired behavior
|
|
65
|
+
*/
|
|
66
|
+
makeListener(actionName: ActionType, action: () => void): (event: KeyboardEvent) => void;
|
|
34
67
|
}
|
|
35
68
|
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** Interface describing a MapBox content item */
|
|
2
|
+
export interface MapBoxContextItem {
|
|
3
|
+
id: string;
|
|
4
|
+
mapbox_id: string;
|
|
5
|
+
text: string;
|
|
6
|
+
wikidata: string;
|
|
7
|
+
short_code?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MapBoxFeature {
|
|
10
|
+
place_type: string[];
|
|
11
|
+
place_name: string;
|
|
12
|
+
text?: string;
|
|
13
|
+
properties: {
|
|
14
|
+
short_code: string;
|
|
15
|
+
};
|
|
16
|
+
center: [number, number];
|
|
17
|
+
context: MapBoxContextItem[];
|
|
18
|
+
}
|
|
19
|
+
/** Interface describing a MapBox feature collection, which is a GeoJSON object */
|
|
20
|
+
export interface MapBoxFeatureCollection {
|
|
21
|
+
type: "FeatureCollection";
|
|
22
|
+
/** The list of features in the collection */
|
|
23
|
+
features: MapBoxFeature[];
|
|
24
|
+
}
|
|
25
|
+
/** Union type describing the feature types available in MapBox */
|
|
26
|
+
export type MapBoxFeatureType = "country" | "region" | "postcode" | "district" | "place" | "locality" | "neighborhood" | "street" | "address";
|
|
27
|
+
/** Union type describing the worldviews available in MapBox */
|
|
28
|
+
export type MapBoxWorldviewType = "ar" | "cn" | "in" | "jp" | "ma" | "ru" | "tr" | "us";
|
|
29
|
+
/** Interface describing options common to both forward and reverse MapBox geocoding */
|
|
30
|
+
interface BaseMapBoxGeocodingOptions {
|
|
31
|
+
/** The language to use for the results, as an IEFT language tag */
|
|
32
|
+
language?: string;
|
|
33
|
+
/** The number of results to return. Default is 5 */
|
|
34
|
+
limit?: number;
|
|
35
|
+
/** Countries to include in the results. If a list is given, any result outside of these countries is omitted
|
|
36
|
+
* Specify countries using ISO 3166-1 alpha-2 country codes: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
37
|
+
*/
|
|
38
|
+
countries?: string[];
|
|
39
|
+
/** The result types to include */
|
|
40
|
+
types?: MapBoxFeatureType[];
|
|
41
|
+
/** The access token for MapBox. Required */
|
|
42
|
+
access_token: string;
|
|
43
|
+
}
|
|
44
|
+
/** Interface describing options for forward geocoding */
|
|
45
|
+
interface MapBoxForwardGeocodingOptions extends BaseMapBoxGeocodingOptions {
|
|
46
|
+
/** Whether to return autocomplete results. MapBox default is true */
|
|
47
|
+
autocomplete?: boolean;
|
|
48
|
+
/** A bounding box for results. Should be a string of the form "minLon,minLat,maxLon,maxLat" */
|
|
49
|
+
bbox?: string;
|
|
50
|
+
/** Whether MapBox should try approximate, as well as exact, matching. MapBox default is true */
|
|
51
|
+
fuzzyMatch?: boolean;
|
|
52
|
+
/** If specified, results are biased to favor results closer to this location. Should be a string of the form "longitude, latitude" */
|
|
53
|
+
proximity?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Interface describing options for reverse geocoding */
|
|
56
|
+
interface MapBoxReverseGeocodingOptions extends BaseMapBoxGeocodingOptions {
|
|
57
|
+
/** The worldview to use for search results. MapBox default is "us" */
|
|
58
|
+
worldview?: MapBoxWorldviewType[];
|
|
59
|
+
}
|
|
60
|
+
/** Find the best feature from a collection of MapBox features.
|
|
61
|
+
* We look for feature place types in the order: 'place', 'postcode', 'region', 'country'
|
|
62
|
+
* @param collection The collection of items to search
|
|
63
|
+
* @param relevantTypes The set of feature place types to consider. If not specified, we use the four types mentioned above
|
|
64
|
+
* @returns The "best" feature, as described above
|
|
65
|
+
*/
|
|
66
|
+
export declare function findBestFeature(collection: MapBoxFeatureCollection, relevantTypes?: MapBoxFeatureType[]): MapBoxFeature | null;
|
|
67
|
+
/**
|
|
68
|
+
* Create text describing a MapBox feature, based on the MapBox items inside of the feature's context
|
|
69
|
+
* @param feature The MapBox feature
|
|
70
|
+
* @param relevantTypes The item types inside the feature's context that we want to consider when creating the string. If not specified, we use 'place', 'postcode', 'region', and 'country'
|
|
71
|
+
* @returns A string describing the feature
|
|
72
|
+
*/
|
|
73
|
+
export declare function textForMapboxFeature(feature: MapBoxFeature, relevantTypes?: MapBoxFeatureType[]): string;
|
|
74
|
+
/**
|
|
75
|
+
* Return text describing the "best" feature in a MapBox collection.
|
|
76
|
+
* See @link{findBestFeature} for a description of how a feature is chosen
|
|
77
|
+
* @param results The feature collection to use
|
|
78
|
+
* @param relevantTypes The item types inside the best feature's context that we want to consider when creating the string. If not specified, we use 'place', 'postcode', 'region', and 'country'
|
|
79
|
+
*/
|
|
80
|
+
export declare function textForMapboxResults(results: MapBoxFeatureCollection, relevantTypes?: MapBoxFeatureType[]): string;
|
|
81
|
+
/**
|
|
82
|
+
* Obtain text describing a given longitude and latitude based on a MapBox reverse geocoding query
|
|
83
|
+
* @param longitudeDeg The longitude of the location, in degrees
|
|
84
|
+
* @param latitudeDeg The latitude of the location, in degrees
|
|
85
|
+
* @param options Options for the MapBox reverse geocoding
|
|
86
|
+
* @returns A promise that resolves to the string describing the given coordinates
|
|
87
|
+
*/
|
|
88
|
+
export declare function textForLocation(longitudeDeg: number, latitudeDeg: number, options: MapBoxReverseGeocodingOptions): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* Obtain a collection of MapBox items obtained from performing a forward geocoding query for a particular search string.
|
|
91
|
+
* Note that the number of items returned is set by the `limit` field in your options.
|
|
92
|
+
* If `limit` is not specified, the MapBox default is 5
|
|
93
|
+
* @param searchText The search string
|
|
94
|
+
* @param options Options for the MapBox forward geocoding
|
|
95
|
+
* @returns A promise that resolves to the found collection of MapBox items
|
|
96
|
+
*/
|
|
97
|
+
export declare function geocodingInfoForSearch(searchText: string, options: MapBoxForwardGeocodingOptions): Promise<MapBoxFeatureCollection>;
|
|
98
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import { FundingAcknowledgement } from "..";
|
|
3
|
+
declare const meta: Meta<typeof FundingAcknowledgement>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof FundingAcknowledgement>;
|
|
6
|
+
export declare const Primary: Story;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
2
|
+
import { CircleMarkerOptions, TileLayerOptions } from "leaflet";
|
|
3
|
+
import { engineStore } from "@wwtelescope/engine-pinia";
|
|
4
|
+
/** The type of the WWT engine Pinia store */
|
|
5
|
+
export type WWTEngineStore = ReturnType<typeof engineStore>;
|
|
6
|
+
/** Interface describing props for the funding acknowledgement component */
|
|
7
|
+
export interface FundingAcknowledgementProps {
|
|
8
|
+
/** The color of the acknowledgement text */
|
|
9
|
+
color?: string;
|
|
10
|
+
/** The background color of the acknowledgement */
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Interface describing a logo */
|
|
14
|
+
export interface CreditLogo {
|
|
15
|
+
/** The URL for the logo image */
|
|
16
|
+
src: string;
|
|
17
|
+
/** The URL to open when the logo is clicked */
|
|
18
|
+
href: string;
|
|
19
|
+
/** Alt text to use for the logo. If none is given, the logo will have no alt text */
|
|
20
|
+
alt?: string;
|
|
21
|
+
}
|
|
22
|
+
/** A union type enumerating the default credit logos */
|
|
23
|
+
export type DefaultCreditLogo = "cosmicds" | "wwt" | "sciact" | "nasa";
|
|
24
|
+
/** Interface describing props for the credit logos component */
|
|
25
|
+
export interface CreditLogosProps {
|
|
26
|
+
/** What size to use for the logos. Should be a valid CSS size. */
|
|
27
|
+
logoSize?: string;
|
|
28
|
+
/** Any extra logos that we want to use */
|
|
29
|
+
extraLogos?: CreditLogo[];
|
|
30
|
+
/** Which default logos to use. If not specified, use them all */
|
|
31
|
+
defaultLogos: DefaultCreditLogo[];
|
|
32
|
+
}
|
|
33
|
+
/** Interface describing props for the gallery component */
|
|
34
|
+
export interface GalleryProps {
|
|
35
|
+
/** The URL of a WTML file describing the desired gallery contents. Required */
|
|
36
|
+
wtmlUrl: string;
|
|
37
|
+
/** The number of columns of the gallery.
|
|
38
|
+
* Accepts a number or a valid CSS value to be used in `repeat` for `grid-template-columns`
|
|
39
|
+
* Defaults to 'auto-fit'
|
|
40
|
+
*/
|
|
41
|
+
columns?: number | string;
|
|
42
|
+
/** The width of the gallery. Should be a valid CSS value for `width`. Defaults to 300px */
|
|
43
|
+
width?: string;
|
|
44
|
+
/** Maximum height of the gallery. Should be a valid CSS value for `max-height`. Defaults to 500px */
|
|
45
|
+
maxHeight?: string;
|
|
46
|
+
/** The title of the gallery. Default is 'Gallery' */
|
|
47
|
+
title?: string;
|
|
48
|
+
/** The accent color to use for selected images in the gallery. Should be a valid CSS color. Default is 'dodgerblue' */
|
|
49
|
+
selectedColor?: string;
|
|
50
|
+
/** Whether a user can select only one image at a time. Default true */
|
|
51
|
+
singleSelect?: boolean;
|
|
52
|
+
/** Whether only the last selected image is highlighted. Default false */
|
|
53
|
+
highlightLastOnly?: boolean;
|
|
54
|
+
/** The index of the preview image in the WTML file. Defaults to 0. */
|
|
55
|
+
previewIndex?: number;
|
|
56
|
+
/** The text to show when the gallery is closed. Default is 'Image Gallery' */
|
|
57
|
+
closedText?: string;
|
|
58
|
+
}
|
|
59
|
+
/** A union type consisting of the density options for the geolocation button */
|
|
60
|
+
export type GeolocationButtonDensity = null | "default" | "comfortable" | "compact";
|
|
61
|
+
/** Interface describing props for the geolocation button */
|
|
62
|
+
export interface GeolocationButtonProps {
|
|
63
|
+
/** The color of the geolocation button. Defaults to "white" */
|
|
64
|
+
color?: string;
|
|
65
|
+
/** The size of the button */
|
|
66
|
+
size?: string;
|
|
67
|
+
/** The density of the button. This adjusts the vertical height of the button. Defaults to "comfortable" */
|
|
68
|
+
density?: GeolocationButtonDensity;
|
|
69
|
+
/** The elevation of the button. Defaults to "2" */
|
|
70
|
+
elevation?: string;
|
|
71
|
+
/** Whether to hide the button. Defaults to false */
|
|
72
|
+
hideButton?: boolean;
|
|
73
|
+
/** Whether to show the button's text label. Defaults to false */
|
|
74
|
+
showTextLabel?: boolean;
|
|
75
|
+
/** Whether to show the button's geolocation coordinates. Defaults to false */
|
|
76
|
+
showCoords?: boolean;
|
|
77
|
+
/** Whether to show text indicating when location fetching is in progress. Defaults to false */
|
|
78
|
+
showTextProgress?: boolean;
|
|
79
|
+
/** Whether to show circle indicator when fetching is in progress. Defaults to true */
|
|
80
|
+
showProgressCircle?: boolean;
|
|
81
|
+
/** Whether to include text on the button. Defaults to false */
|
|
82
|
+
useTextButton?: boolean;
|
|
83
|
+
/** The size of the in-progress circle. Defaults to 12 */
|
|
84
|
+
progressCircleSize?: number;
|
|
85
|
+
/** The button's label. Defaults to "My Location" */
|
|
86
|
+
label?: string;
|
|
87
|
+
/** The ID to use to create the button ID */
|
|
88
|
+
id?: string;
|
|
89
|
+
/** The icon to use when the geolocation has been obtained */
|
|
90
|
+
trueIcon?: string;
|
|
91
|
+
/** The icon to use when there is no value for the geolocation */
|
|
92
|
+
falseIcon?: string;
|
|
93
|
+
/** Whether to show the location and permission status. Useful for debugging, defaults to false */
|
|
94
|
+
showPermissions?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A type describing the props of a FontAwesome icon
|
|
98
|
+
* We need to do this because FontAwesome doesn't export the prop types
|
|
99
|
+
*/
|
|
100
|
+
export type FontAwesomeIconProps = InstanceType<typeof FontAwesomeIcon>["$props"];
|
|
101
|
+
/** A type describing the size options for a FontAwesome icon */
|
|
102
|
+
export type SizeType = Extract<FontAwesomeIconProps, 'size'>;
|
|
103
|
+
/** An interface describing props for the icon button */
|
|
104
|
+
export interface IconButtonProps {
|
|
105
|
+
/** Whether or not the icon button is active. Only makes sense in cases where one wants the button to have an on/off state */
|
|
106
|
+
modelValue?: boolean;
|
|
107
|
+
/** The name of the FontAwesome icon to use. It's assumed that only one of this and `mdIcon` will be used */
|
|
108
|
+
faIcon?: string;
|
|
109
|
+
/** The name of the MID icon to use. It's assumed that only one of this and `faIcon` will be used */
|
|
110
|
+
mdIcon?: string;
|
|
111
|
+
/** The primary color of the button. Sets the icon and border colors. Default is white */
|
|
112
|
+
color?: string;
|
|
113
|
+
/** The color of the button when focused. Default is white */
|
|
114
|
+
focusColor?: string;
|
|
115
|
+
/** The color of the button when active. Default is white */
|
|
116
|
+
activeColor?: string;
|
|
117
|
+
/** The background color of the button. Default is #040404 */
|
|
118
|
+
backgroundColor?: string;
|
|
119
|
+
/** Whether the button has a border. Default is true */
|
|
120
|
+
border?: boolean;
|
|
121
|
+
/** The time duration, in ms, to recognize a press event as a long press. Default is 500 */
|
|
122
|
+
longPressTimeMs?: number;
|
|
123
|
+
/** The tooltip text for the button. If not specified, tooltip will not be shown */
|
|
124
|
+
tooltipText?: string;
|
|
125
|
+
/** The location of the tooltip. Default is start */
|
|
126
|
+
tooltipLocation?: string;
|
|
127
|
+
/** Whether to show the tooltip when the button is clicked. Default is false */
|
|
128
|
+
tooltipOnClick?: boolean;
|
|
129
|
+
/** Whether to show the tooltip when the button is focused. Default is false */
|
|
130
|
+
tooltipOnFocus?: boolean;
|
|
131
|
+
/** Whether to show the tooltip when the button is hovered. Default is true */
|
|
132
|
+
tooltipOnHover?: boolean;
|
|
133
|
+
/** The distance away from the button that the tooltip appears. Default is 0 */
|
|
134
|
+
tooltipOffset?: string | number;
|
|
135
|
+
/** Whether to show the tooltip when appropriate. Default is true */
|
|
136
|
+
showTooltip?: boolean;
|
|
137
|
+
/** The size of the FontAwesome icon */
|
|
138
|
+
faSize?: SizeType;
|
|
139
|
+
/** The size of the MDI icon. Should be a valid CSS size */
|
|
140
|
+
mdSize?: string;
|
|
141
|
+
}
|
|
142
|
+
/** An interface describing a latitude/longitude location */
|
|
143
|
+
export interface LocationDeg {
|
|
144
|
+
/** The longitude of the location, in degrees */
|
|
145
|
+
longitudeDeg: number;
|
|
146
|
+
/** The latitude of the location, in degrees */
|
|
147
|
+
latitudeDeg: number;
|
|
148
|
+
}
|
|
149
|
+
/** An interface describing options for the Leaflet map in the location selector */
|
|
150
|
+
export interface LeafletMapOptions extends TileLayerOptions {
|
|
151
|
+
/** The template URL to use for the base map layer */
|
|
152
|
+
templateUrl: string;
|
|
153
|
+
/** The initial location to center the map on */
|
|
154
|
+
initialLocation?: LocationDeg;
|
|
155
|
+
/** The initial zoom level of the map */
|
|
156
|
+
initialZoom?: number;
|
|
157
|
+
}
|
|
158
|
+
/** An interface describing a GeoJSON item, to be used as a prop for the location selector */
|
|
159
|
+
export interface GeoJSONProp {
|
|
160
|
+
/** The URL of a remote GeoJSON resource. This and `geojson` and not intended to be used together */
|
|
161
|
+
url?: string;
|
|
162
|
+
/** A GeoJSON object to add to the location selector */
|
|
163
|
+
geojson?: GeoJSON.FeatureCollection | GeoJSON.Feature | GeoJSON.GeometryCollection;
|
|
164
|
+
/** The style options for any circle markers related to this item. Required */
|
|
165
|
+
style: CircleMarkerOptions;
|
|
166
|
+
}
|
|
167
|
+
/** Interface describing a place on the location selector */
|
|
168
|
+
export interface PlaceDeg extends LocationDeg {
|
|
169
|
+
/** The color to use for the circle showing the place */
|
|
170
|
+
color?: string;
|
|
171
|
+
/** The fill color to use for the circle showing the place */
|
|
172
|
+
fillColor?: string;
|
|
173
|
+
/** The fill opacity to use for the circle showing the place */
|
|
174
|
+
fillOpacity?: number;
|
|
175
|
+
/** The radius to use for the circle showing the place */
|
|
176
|
+
radius?: number;
|
|
177
|
+
/** The name of the place */
|
|
178
|
+
name?: string;
|
|
179
|
+
}
|
|
180
|
+
/** Interface describing props for the location selector */
|
|
181
|
+
export interface LocationSelectorProps {
|
|
182
|
+
/** The color to use for the activator button */
|
|
183
|
+
activatorColor?: string;
|
|
184
|
+
/** Whether to attempt to detect the user's location when the component is mounted. Default is true */
|
|
185
|
+
detectLocation?: boolean;
|
|
186
|
+
/** The currently selected location. Default is the coordinates for Harvard College Observatory */
|
|
187
|
+
modelValue?: LocationDeg;
|
|
188
|
+
/** Map options for the Leaflet map. If not specified, sensible defaults are used */
|
|
189
|
+
mapOptions?: LeafletMapOptions;
|
|
190
|
+
/** The initial place to be selected on the map */
|
|
191
|
+
initialPlace?: PlaceDeg;
|
|
192
|
+
/** The list of places to show on the map */
|
|
193
|
+
places?: PlaceDeg[];
|
|
194
|
+
/** Options for place circles */
|
|
195
|
+
placeCircleOptions?: CircleMarkerOptions;
|
|
196
|
+
/** Whether places can be selected on the map. Default is true */
|
|
197
|
+
placeSelectable?: boolean;
|
|
198
|
+
/** Whether a location can be selected on the map. Default is true */
|
|
199
|
+
selectable?: boolean;
|
|
200
|
+
/** Options for the circle showing the selected place */
|
|
201
|
+
selectedCircleOptions?: CircleMarkerOptions;
|
|
202
|
+
/** Which event to use to select a location. Default is "click" */
|
|
203
|
+
selectionEvent?: "click" | "dblclick";
|
|
204
|
+
/** Whether to use world radii for circle sizes (as opposed to screen radii). Default is true */
|
|
205
|
+
worldRadii?: boolean;
|
|
206
|
+
/** GeoJSON items to display on the map. The list is empty by default */
|
|
207
|
+
geoJsonFiles?: GeoJSONProp[];
|
|
208
|
+
/** Layers to show on the map. The list is empty by default */
|
|
209
|
+
layers?: L.Layer[];
|
|
210
|
+
}
|
|
211
|
+
/** Interface describing the location of the WWT HUD */
|
|
212
|
+
export interface HUDLocation {
|
|
213
|
+
/** Distance from the top. Should be a valid CSS value */
|
|
214
|
+
top?: string | number;
|
|
215
|
+
/** Distance from the left. Should be a valid CSS value */
|
|
216
|
+
left?: string | number;
|
|
217
|
+
/** Distance from the bottom. Should be a valid CSS value */
|
|
218
|
+
bottom?: string | number;
|
|
219
|
+
/** Distance from the right. Should be a valid CSS value */
|
|
220
|
+
right?: string | number;
|
|
221
|
+
}
|
|
222
|
+
/** Interface describing props for the WWT HUD */
|
|
223
|
+
export interface WwtHUDProps {
|
|
224
|
+
/** Location of the HUD in the browser window. Default is `{ top: "50%", left: "50%" }` */
|
|
225
|
+
location?: HUDLocation;
|
|
226
|
+
/** Define an offset for the HUD. Default is `{ x: 0.5, y: 0.5 }` */
|
|
227
|
+
offsetCenter?: {
|
|
228
|
+
x: number;
|
|
229
|
+
y: number;
|
|
230
|
+
};
|
|
231
|
+
/** Other variables to include in the HUD display. Default is `{}` */
|
|
232
|
+
otherVariables?: Object;
|
|
233
|
+
/** The font size of the HUD text. Should be a valid CSS value for `font-size` */
|
|
234
|
+
fontSize?: string;
|
|
235
|
+
/** Background color for the HUD. Should be a valid CSS color. Default is `rgba(0, 0, 0, 0.5)` */
|
|
236
|
+
backgroundColor?: string | null;
|
|
237
|
+
/** Text shadow for the HUD text. Should be a valid CSS value for `text-shadow`. Default is `"0 0 5px black"` */
|
|
238
|
+
textShadow?: string | null;
|
|
239
|
+
/** The WWT engine store to use for the HUD. Required */
|
|
240
|
+
store: ReturnType<typeof engineStore>;
|
|
241
|
+
}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
+
/** Degrees -> radians conversion factor */
|
|
1
2
|
export declare const D2R: number;
|
|
3
|
+
/** Radians -> degrees conversion factor */
|
|
2
4
|
export declare const R2D: number;
|
|
5
|
+
/** The base URL for the CosmicDS API server */
|
|
3
6
|
export declare const API_BASE_URL = "https://api.cosmicds.cfa.harvard.edu";
|
|
4
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Determine whether the user's device supports touch events.
|
|
9
|
+
*
|
|
10
|
+
* @returns Whether touch events are supported
|
|
11
|
+
*/
|
|
12
|
+
export declare function supportsTouchscreen(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Determine whether a given user agent string describes a mobile device.
|
|
15
|
+
* This is done via a regex match against common user agent string pieces.
|
|
16
|
+
*
|
|
17
|
+
* @returns Whether the user agent string describes a mobile device
|
|
18
|
+
*/
|
|
19
|
+
export declare function isMobile(userAgent: string): boolean;
|
|
20
|
+
/** Blur the current active element, if there is one */
|
|
21
|
+
export declare function blurActiveElement(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Filter an array in place (as opposed to .filter, which creates a new array).
|
|
24
|
+
* Modified from https://stackoverflow.com/a/37319954
|
|
25
|
+
*
|
|
26
|
+
* @param array - The array to filter
|
|
27
|
+
* @param condition - The filtering condition. Elements for which this returns true are retained
|
|
28
|
+
* @template T
|
|
29
|
+
*/
|
|
30
|
+
export declare function filterInPlace<T>(array: T[], condition: (t: T) => boolean): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { engineStore } from "@wwtelescope/engine-pinia";
|
|
2
|
+
import { KeyboardControlSettings } from "./keyboard";
|
|
3
|
+
type WWTEngineStore = ReturnType<typeof engineStore>;
|
|
4
|
+
/**
|
|
5
|
+
* A composable that sets up WWT keyboard controls.
|
|
6
|
+
* @param store The WWT engine's Pinia store
|
|
7
|
+
* @param element The element on which to attach the keyboard listeners. Uses the browser window if none is given
|
|
8
|
+
* @returns The `KeyboardControlSettings` instance that was used to create the listeners
|
|
9
|
+
*/
|
|
10
|
+
export declare function useWWTKeyboardControls(store: WWTEngineStore, element?: Window | HTMLElement): KeyboardControlSettings;
|
|
11
|
+
export {};
|