@cosmicds/vue-toolkit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 cosmicds
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@cosmicds/vue-toolkit",
3
+ "version": "0.1.0",
4
+ "browser": "dist/index.umd.js",
5
+ "dependencies": {
6
+ "@fortawesome/fontawesome-svg-core": "^6.5.1",
7
+ "@fortawesome/free-solid-svg-icons": "^6.5.1",
8
+ "@fortawesome/vue-fontawesome": "^3.0.3",
9
+ "@kyvg/vue3-notification": "^2.9.1",
10
+ "@mdi/font": "^7.4.47",
11
+ "@wwtelescope/engine-pinia": "^0.9.0",
12
+ "leaflet": "^1.9.4",
13
+ "screenfull": "^6.0.2",
14
+ "vue": "^3",
15
+ "vuetify": "^3.3.3"
16
+ },
17
+ "devDependencies": {
18
+ "@types/leaflet": "^1.9.3",
19
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
20
+ "@typescript-eslint/parser": "^6.19.0",
21
+ "@vue/cli-plugin-eslint": "^5.0.8",
22
+ "@vue/cli-plugin-typescript": "^5.0.8",
23
+ "@vue/cli-service": "^5.0.8",
24
+ "@vue/eslint-config-typescript": "^12.0.0",
25
+ "copy-webpack-plugin": "^12.0.2",
26
+ "eslint": "^8.31.0",
27
+ "eslint-plugin-vue": "^9.8.0",
28
+ "less": "^4.2.0",
29
+ "less-loader": "^12.1.0",
30
+ "typescript": "^4.9.4",
31
+ "vue-template-compiler": "^2.7.14",
32
+ "webpack": "^5.75.0"
33
+ },
34
+ "files": [
35
+ "dist/*",
36
+ "src/*"
37
+ ],
38
+ "main": "./dist/index.common.js",
39
+ "module": "dist/",
40
+ "packageManager": "yarn@3.3.0",
41
+ "publicConfig": {
42
+ "access": "public"
43
+ },
44
+ "scripts": {
45
+ "build": "vue-cli-service build --target lib --name index src/index.ts",
46
+ "clean": "rimraf dist",
47
+ "lint": "vue-cli-service lint src --no-fix"
48
+ },
49
+ "types": "./dist/src/index.d.ts"
50
+ }
@@ -0,0 +1,31 @@
1
+ export class BackgroundImageset {
2
+ public imagesetName: string;
3
+ public displayName: string;
4
+
5
+ constructor(displayName: string, imagesetName: string) {
6
+ this.displayName = displayName;
7
+ this.imagesetName = imagesetName;
8
+ }
9
+ }
10
+
11
+ export const skyBackgroundImagesets: BackgroundImageset[] = [
12
+ new BackgroundImageset(
13
+ "Optical (Terapixel DSS)",
14
+ "Digitized Sky Survey (Color)"
15
+ ),
16
+ new BackgroundImageset(
17
+ "Low-frequency radio (VLSS)",
18
+ "VLSS: VLA Low-frequency Sky Survey (Radio)"
19
+ ),
20
+ new BackgroundImageset("Infrared (2MASS)", "2Mass: Imagery (Infrared)"),
21
+ new BackgroundImageset("Infrared (SFD dust map)", "SFD Dust Map (Infrared)"),
22
+ new BackgroundImageset("Ultraviolet (GALEX)", "GALEX (Ultraviolet)"),
23
+ new BackgroundImageset(
24
+ "X-Ray (ROSAT RASS)",
25
+ "RASS: ROSAT All Sky Survey (X-ray)"
26
+ ),
27
+ new BackgroundImageset(
28
+ "Gamma Rays (FERMI LAT 8-year)",
29
+ "Fermi LAT 8-year (gamma)"
30
+ ),
31
+ ];
package/src/index.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { KeyboardControlSettings } from "./keyboard";
2
+ import MiniDSBase from "./components/MiniDSBase";
3
+ import IconButton from "./components/IconButton.vue";
4
+ import LocationSelector from "./components/LocationSelector.vue";
5
+ import DefaultMiniCredits from "./components/DefaultMiniCredits.vue";
6
+ import FundingAcknowledgment from "./components/FundingAcknowledgment.vue";
7
+ import CreditLogos from "./components/CreditLogos.vue";
8
+ import wwtHUD from "./components/wwtHUD.vue";
9
+ import { BackgroundImageset, skyBackgroundImagesets } from "./background";
10
+ import Gallery from "./components/Gallery.vue";
11
+ import { API_BASE_URL, MINIDS_BASE_URL, R2D, D2R } from "./utils";
12
+
13
+ export {
14
+ BackgroundImageset,
15
+ KeyboardControlSettings,
16
+ MiniDSBase,
17
+ Gallery,
18
+ IconButton,
19
+ LocationSelector,
20
+ skyBackgroundImagesets,
21
+ DefaultMiniCredits,
22
+ FundingAcknowledgment,
23
+ CreditLogos,
24
+ wwtHUD,
25
+ API_BASE_URL,
26
+ MINIDS_BASE_URL,
27
+ R2D,
28
+ D2R
29
+ };
@@ -0,0 +1,84 @@
1
+ class KeyPressInfo {
2
+ code: string;
3
+ ctrl: boolean;
4
+ alt: boolean;
5
+ shift: boolean;
6
+ meta: boolean;
7
+
8
+ constructor(
9
+ code: string,
10
+ modifiers?: {
11
+ ctrl?: boolean;
12
+ alt?: boolean;
13
+ shift?: boolean;
14
+ meta?: boolean;
15
+ }
16
+ ) {
17
+ this.code = code;
18
+ this.ctrl = modifiers?.ctrl ?? false;
19
+ this.alt = modifiers?.alt ?? false;
20
+ this.shift = modifiers?.shift ?? false;
21
+ this.meta = modifiers?.meta ?? false;
22
+ }
23
+
24
+ matches(event: KeyboardEvent): boolean {
25
+ return (
26
+ event.code === this.code &&
27
+ event.ctrlKey === this.ctrl &&
28
+ event.altKey === this.alt &&
29
+ event.shiftKey === this.shift &&
30
+ event.metaKey === this.meta
31
+ );
32
+ }
33
+ }
34
+
35
+ export class KeyboardControlSettings {
36
+ zoomIn: KeyPressInfo[];
37
+ zoomOut: KeyPressInfo[];
38
+ moveUp: KeyPressInfo[];
39
+ moveDown: KeyPressInfo[];
40
+ moveLeft: KeyPressInfo[];
41
+ moveRight: KeyPressInfo[];
42
+ moveAmount: number;
43
+
44
+ constructor({
45
+ zoomIn = [new KeyPressInfo("KeyI")],
46
+ zoomOut = [new KeyPressInfo("KeyO")],
47
+ moveUp = [new KeyPressInfo("KeyW")],
48
+ moveLeft = [new KeyPressInfo("KeyA")],
49
+ moveDown = [new KeyPressInfo("KeyS")],
50
+ moveRight =[new KeyPressInfo("KeyD")],
51
+ moveAmount = 20
52
+ }) {
53
+ this.zoomIn = zoomIn;
54
+ this.zoomOut = zoomOut;
55
+ this.moveUp = moveUp;
56
+ this.moveDown = moveDown;
57
+ this.moveLeft = moveLeft;
58
+ this.moveRight = moveRight;
59
+ this.moveAmount = moveAmount;
60
+ }
61
+
62
+ // This is to make sure that we can't make a listener for an action type that doesn't exist
63
+ readonly actionTypes = [
64
+ "zoomIn",
65
+ "zoomOut",
66
+ "moveUp",
67
+ "moveDown",
68
+ "moveLeft",
69
+ "moveRight",
70
+ ] as const;
71
+
72
+ makeListener(
73
+ actionName: KeyboardControlSettings["actionTypes"][number],
74
+ action: () => void
75
+ ): (e: KeyboardEvent) => void {
76
+ return (e) => {
77
+ for (const keyPress of this[actionName]) {
78
+ if (keyPress.matches(e)) {
79
+ action();
80
+ }
81
+ }
82
+ };
83
+ }
84
+ }
@@ -0,0 +1,5 @@
1
+ declare module "*.vue" {
2
+ import { defineComponent } from "vue";
3
+ const component: ReturnType<typeof defineComponent>;
4
+ export default component;
5
+ }
package/src/utils.ts ADDED
@@ -0,0 +1,5 @@
1
+ export const D2R = Math.PI / 180;
2
+ export const R2D = 180 / Math.PI;
3
+
4
+ export const API_BASE_URL = "https://api.cosmicds.cfa.harvard.edu";
5
+ export const MINIDS_BASE_URL = `${API_BASE_URL}/minids`;