Skip to content

Commit

Permalink
fix: setup for npm release
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Apr 20, 2023
1 parent 53d2552 commit f00409a
Show file tree
Hide file tree
Showing 44 changed files with 55 additions and 37 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ rollup.config-dev.js
.hotreload
webpack.dev.js

.env
.env
main.js
styles.css
main.css
15 changes: 15 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ObsidianAppData } from "types";

export interface LeafletAPI {
openInitiativeView(
pcs: import("../src/utils/creature").Creature[],
npcs: import("../src/utils/creature").Creature[]
): unknown;
markerIcons: MarkerIcon[];
data: ObsidianAppData;
}

interface MarkerIcon {
html: string;
type: string;
}
2 changes: 1 addition & 1 deletion src/controls/distance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType, Popup } from "src/@types";
import { BaseMapType, Popup } from "../types";
import { popup } from "src/map/popup";
import { LAT_LONG_DECIMALS } from "src/utils";

Expand Down
2 changes: 1 addition & 1 deletion src/controls/filter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BaseMapType } from "src/@types";
import type { BaseMapType } from "../types";
import { getId } from "src/utils";
import { FontAwesomeControl, FontAwesomeControlOptions } from "./controls";
import { LeafletSymbol } from "src/utils/leaflet-import";
Expand Down
2 changes: 1 addition & 1 deletion src/controls/gpx.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import { GPX } from "src/layer";
import { FontAwesomeControl, FontAwesomeControlOptions } from "./controls";
import { LeafletSymbol } from "src/utils/leaflet-import";
Expand Down
2 changes: 1 addition & 1 deletion src/controls/lock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import { FontAwesomeControl, FontAwesomeControlOptions } from "./controls";

export class LockControl extends FontAwesomeControl {
Expand Down
2 changes: 1 addition & 1 deletion src/controls/mapview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import t from "src/l10n/locale";
import { EditParametersModal } from "src/modals/mapview";
import { FontAwesomeControl, FontAwesomeControlOptions } from "./controls";
Expand Down
2 changes: 1 addition & 1 deletion src/controls/reset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Map } from "leaflet";
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import t from "src/l10n/locale";
import { FontAwesomeControl, FontAwesomeControlOptions } from "./controls";

Expand Down
2 changes: 1 addition & 1 deletion src/controls/zoom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import { FontAwesomeControl, FontAwesomeControlOptions } from "./controls";

import { LeafletSymbol } from "src/utils/leaflet-import";
Expand Down
2 changes: 1 addition & 1 deletion src/draw/controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import { LeafletSymbol } from "src/utils/leaflet-import";
import { Polygon } from "./polygon";
import { Polyline, PolylineProperties } from "./polyline";
Expand Down
2 changes: 1 addition & 1 deletion src/draw/controls.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import {
FontAwesomeControl,
FontAwesomeControlOptions
Expand Down
2 changes: 1 addition & 1 deletion src/draw/geojson.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import t from "src/l10n/locale";
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import { DrawControl } from "./controls";
import { FontAwesomeControl, FontAwesomeControlOptions } from "src/controls/controls";
import { LayerGroup, Polyline } from "leaflet";
Expand Down
2 changes: 1 addition & 1 deletion src/draw/polygon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType } from "src/@types";
import { BaseMapType } from "../types";
import t from "src/l10n/locale";
import { Marker } from "src/layer";
import { LeafletSymbol } from "src/utils/leaflet-import";
Expand Down
2 changes: 1 addition & 1 deletion src/initiative/initiative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ImageLayerData,
MarkerDivIconOptions,

} from "src/@types";
} from "../types";
import { FontAwesomeControl } from "src/controls/controls";
import t from "src/l10n/locale";
import { Marker } from "src/layer";
Expand Down
2 changes: 1 addition & 1 deletion src/layer/geojson.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BaseMapType } from "src/@types";
import type { BaseMapType } from "../types";
import type geojson from "geojson";

import { Marker } from "./marker";
Expand Down
6 changes: 3 additions & 3 deletions src/layer/gpx.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BaseMapType } from "src/@types";
import type { BaseMapType } from "../types";
import { Layer } from "../layer/layer";

import { LeafletSymbol } from "src/utils/leaflet-import";
Expand All @@ -7,13 +7,13 @@ import { gpx as gpxtoGeoJSON } from "@tmcw/togeojson";
import gpxWorker from "../worker/gpx.worker";
import type { HotlineOptions } from "leaflet";
import { popup } from "src/map/popup";
import { GPXPoint } from "src/@types/layers";
import { GPXPoint } from "../types/layers";

import { GeoJSON } from "./geojson";
import { formatLatLng, formatNumber, getIcon, icon } from "src/utils";
import t from "src/l10n/locale";

import { GPX_Data } from "src/@types/gpx";
import { GPX_Data } from "../types/gpx";
import { Position } from "geojson";
import convert from "convert";

Expand Down
2 changes: 1 addition & 1 deletion src/layer/layer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseMapType, LayerGroup, Popup } from "src/@types";
import { BaseMapType, LayerGroup, Popup } from "../types";

export abstract class Layer<T extends L.Layer> {
map: BaseMapType;
Expand Down
2 changes: 1 addition & 1 deletion src/layer/marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
MarkerProperties,
SavedMarkerProperties,
BaseMapType
} from "src/@types";
} from "../types";
import { MarkerContextModal } from "src/modals";
import { divIconMarker, markerDivIcon } from "src/map";
import { Layer } from "../layer/layer";
Expand Down
2 changes: 1 addition & 1 deletion src/layer/overlay.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import convert from "convert";
import { Notice } from "obsidian";

import { BaseMapType, SavedOverlayData } from "src/@types";
import { BaseMapType, SavedOverlayData } from "../types";
import t from "src/l10n/locale";
import { popup } from "src/map/popup";
import { formatLatLng, formatNumber } from "src/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
Icon,
Marker,
BaseMapType
} from "./@types";
} from "../types";

import { LeafletRenderer } from "./renderer/renderer";
import { markerDivIcon } from "./map/divicon";
Expand Down
2 changes: 1 addition & 1 deletion src/map/divicon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LeafletSymbol } from "src/utils/leaflet-import";
import { DivIconMarkerOptions, MarkerDivIconOptions } from "../@types";
import { DivIconMarkerOptions, MarkerDivIconOptions } from "../../types";

const L = window[LeafletSymbol];
export class MarkerDivIcon extends L.DivIcon {
Expand Down
4 changes: 2 additions & 2 deletions src/map/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
ImageLayerData,
SavedMapData,
DistanceDisplay
} from "src/@types";
} from "../../types";

import { GPX, Marker, GeoJSON, Overlay } from "src/layer";

Expand Down Expand Up @@ -985,7 +985,7 @@ export abstract class BaseMap extends Events implements BaseMapDefinition {
let newRadius = convert(
Number(overlay.data.radius)
)
.from(overlay.data.unit ?? "m")
.from((overlay.data.unit as Length) ?? "m")
.to(this.type == "image" ? this.unit : "m");

if (this.type == "image") {
Expand Down
2 changes: 1 addition & 1 deletion src/map/popup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BaseMapType, LeafletOverlay, TooltipDisplay } from "src/@types";
import type { BaseMapType, LeafletOverlay, TooltipDisplay } from "../types";
import { Marker, Overlay } from "src/layer";
import { Layer } from "src/layer/layer";
import { BASE_POPUP_OPTIONS } from "src/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/map/view.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ItemView, MarkdownRenderChild, Menu, WorkspaceLeaf } from "obsidian";
import { BaseMapType, } from "src/@types";
import { BaseMapType, } from "../types";
import t from "src/l10n/locale";
import { EditParametersModal } from "src/modals/mapview";
import { LeafletRenderer } from "src/renderer/renderer";
Expand Down
2 changes: 1 addition & 1 deletion src/modals/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
Marker,
TooltipDisplay,
BaseMapType
} from "src/@types";
} from "../types";

import { PathSuggestionModal } from "./path";
import { CommandSuggestionModal } from "./command";
Expand Down
2 changes: 1 addition & 1 deletion src/modals/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
TextComponent
} from "obsidian";
import t from "src/l10n/locale";
import { Icon } from "../@types";
import { Icon } from "../../types";
import type ObsidianLeaflet from "src/main";
import {
findIconDefinition,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import type {
LeafletMapOptions,
SavedMarkerProperties,
SavedOverlayData
} from "../@types";
} from "../../types";
import type ObsidianLeaflet from "src/main";
import type { BaseMapType, ImageLayerData } from "../@types/map";
import type { BaseMapType, ImageLayerData } from "../../types/map";

import Watcher from "../utils/watcher";
import { RealMap, ImageMap } from "../map/map";
Expand Down
2 changes: 1 addition & 1 deletion src/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {
Icon,
SavedMarkerProperties,
TooltipDisplay,
} from "src/@types";
} from "../types";
import { FolderSuggestionModal } from "src/modals/path";
import type ObsidianLeaflet from "src/main";
import t from "src/l10n/locale";
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
BlockParameters,
LeafletMapOptions,
ObsidianAppData
} from "src/@types";
} from "../types";

export const OBSIDIAN_LEAFLET_POPOVER_SOURCE = "obsidian-leaflet";

Expand Down
2 changes: 1 addition & 1 deletion src/utils/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
IconDefinition,
IconName
} from "@fortawesome/fontawesome-svg-core";
import { Icon } from "src/@types";
import { Icon } from "../types";

library.add(fas);

Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "obsidian";
import Color from "color";

import { BaseMapType, BlockParameters } from "src/@types";
import { BaseMapType, BlockParameters } from "../types";
import { LAT_LONG_DECIMALS } from "./constants";
import { DESCRIPTION_ICON } from ".";
import t from "src/l10n/locale";
Expand Down
2 changes: 1 addition & 1 deletion src/utils/watcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MarkerIcon, SavedOverlayData } from "src/@types";
import type { MarkerIcon, SavedOverlayData } from "../types";
import {
Component,
Events,
Expand Down
2 changes: 1 addition & 1 deletion src/worker/gpx.worker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GPX_OPTIONS, GPX_Data, Coordinate } from "src/@types/gpx";
import { GPX_OPTIONS, GPX_Data, Coordinate } from "../types/gpx";
import { DOMParser } from "xmldom";

const ctx: Worker = self as any;
Expand Down
2 changes: 1 addition & 1 deletion src/worker/loader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { App, Events, Notice } from "obsidian";

import { parseLink } from "../utils";
import { ImageLayerData } from "src/@types";
import { ImageLayerData } from "../types";
import t from "src/l10n/locale";

export default class Loader extends Events {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f00409a

Please sign in to comment.