Skip to content

Commit

Permalink
Fix type import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Oct 23, 2024
1 parent 6b9ef82 commit f827ad5
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/components/attribution-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useEffect, memo} from 'react';
import {applyReactStyle} from '../utils/apply-react-style';
import {useControl} from './use-control';

import type {ControlPosition, AttributionControlOptions} from '../types';
import type {ControlPosition, AttributionControlOptions} from '../types/lib';

export type AttributionControlProps = AttributionControlOptions & {
/** Placement of the control relative to the map. */
Expand Down
2 changes: 1 addition & 1 deletion src/components/fullscreen-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {useEffect, memo} from 'react';
import {applyReactStyle} from '../utils/apply-react-style';
import {useControl} from './use-control';

import type {ControlPosition, FullscreenControlOptions} from '../types';
import type {ControlPosition, FullscreenControlOptions} from '../types/lib';

export type FullscreenControlProps = Omit<FullscreenControlOptions, 'container'> & {
/** Id of the DOM element which should be made full screen. By default, the map container
Expand Down
8 changes: 3 additions & 5 deletions src/components/geolocate-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import {useControl} from './use-control';
import type {
ControlPosition,
GeolocateControlInstance,
GeolocateControlOptions,
GeolocateEvent,
GeolocateResultEvent,
GeolocateErrorEvent
} from '../types';
GeolocateControlOptions
} from '../types/lib';
import type {GeolocateEvent, GeolocateResultEvent, GeolocateErrorEvent} from '../types/events';

export type GeolocateControlProps = GeolocateControlOptions & {
/** Placement of the control relative to the map. */
Expand Down
3 changes: 2 additions & 1 deletion src/components/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {MapContext} from './map';
import assert from '../utils/assert';
import {deepEqual} from '../utils/deep-equal';

import type {MapInstance, CustomLayerInterface, AnyLayer} from '../types';
import type {MapInstance, CustomLayerInterface} from '../types/lib';
import type {AnyLayer} from '../types/style-spec';

// Omiting property from a union type, see
// https://github.com/microsoft/TypeScript/issues/39556#issuecomment-656925230
Expand Down
2 changes: 1 addition & 1 deletion src/components/logo-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useEffect, memo} from 'react';
import {applyReactStyle} from '../utils/apply-react-style';
import {useControl} from './use-control';

import type {ControlPosition, LogoControlOptions} from '../types';
import type {ControlPosition, LogoControlOptions} from '../types/lib';

export type LogoControlProps = LogoControlOptions & {
/** Placement of the control relative to the map. */
Expand Down
2 changes: 1 addition & 1 deletion src/components/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import createRef, {MapRef} from '../maplibre/create-ref';
import type {CSSProperties} from 'react';
import useIsomorphicLayoutEffect from '../utils/use-isomorphic-layout-effect';
import setGlobals, {GlobalSettings} from '../utils/set-globals';
import type {MapLib, MapOptions} from '../types';
import type {MapLib, MapOptions} from '../types/lib';

export type MapContextValue = {
mapLib: MapLib;
Expand Down
9 changes: 2 additions & 7 deletions src/components/marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ import {createPortal} from 'react-dom';
import {useImperativeHandle, useEffect, useMemo, useRef, useContext, forwardRef, memo} from 'react';
import {applyReactStyle} from '../utils/apply-react-style';

import type {
MarkerEvent,
MarkerDragEvent,
PopupInstance,
MarkerInstance,
MarkerOptions
} from '../types';
import type {PopupInstance, MarkerInstance, MarkerOptions} from '../types/lib';
import type {MarkerEvent, MarkerDragEvent} from '../types/events';

import {MapContext} from './map';
import {arePointsEqual} from '../utils/deep-equal';
Expand Down
2 changes: 1 addition & 1 deletion src/components/navigation-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useEffect, memo} from 'react';
import {applyReactStyle} from '../utils/apply-react-style';
import {useControl} from './use-control';

import type {ControlPosition, NavigationControlOptions} from '../types';
import type {ControlPosition, NavigationControlOptions} from '../types/lib';

export type NavigationControlProps = NavigationControlOptions & {
/** Placement of the control relative to the map. */
Expand Down
3 changes: 2 additions & 1 deletion src/components/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {createPortal} from 'react-dom';
import {useImperativeHandle, useEffect, useMemo, useRef, useContext, forwardRef, memo} from 'react';
import {applyReactStyle} from '../utils/apply-react-style';

import type {PopupEvent, PopupInstance, PopupOptions} from '../types';
import type {PopupInstance, PopupOptions} from '../types/lib';
import type {PopupEvent} from '../types/events';

import {MapContext} from './map';
import {deepEqual} from '../utils/deep-equal';
Expand Down
2 changes: 1 addition & 1 deletion src/components/scale-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useEffect, useRef, memo} from 'react';
import {applyReactStyle} from '../utils/apply-react-style';
import {useControl} from './use-control';

import type {ControlPosition, ScaleControlOptions} from '../types';
import type {ControlPosition, ScaleControlOptions} from '../types/lib';

export type ScaleControlProps = ScaleControlOptions & {
// These props will be further constraint by OptionsT
Expand Down
6 changes: 3 additions & 3 deletions src/components/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import assert from '../utils/assert';
import {deepEqual} from '../utils/deep-equal';

import type {
MapInstance,
GeoJSONSourceImplementation,
ImageSourceImplemtation,
AnySource,
AnySourceImplementation
} from '../types';
} from '../types/internal';
import type {AnySource} from '../types/style-spec';
import type {MapInstance} from '../types/lib';

export type SourceProps = AnySource & {
id?: string;
Expand Down
3 changes: 2 additions & 1 deletion src/components/terrain-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {useEffect, memo} from 'react';
import {applyReactStyle} from '../utils/apply-react-style';
import {useControl} from './use-control';

import type {ControlPosition, Terrain} from '../types';
import type {ControlPosition} from '../types/lib';
import type {Terrain} from '../types/style-spec';

export type TerrainControlProps = Terrain & {
/** Placement of the control relative to the map. */
Expand Down
2 changes: 1 addition & 1 deletion src/components/use-control.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useContext, useMemo, useEffect} from 'react';
import type {IControl, ControlPosition} from '../types';
import type {IControl, ControlPosition} from '../types/lib';
import {MapContext} from './map';
import type {MapContextValue} from './map';

Expand Down
2 changes: 1 addition & 1 deletion src/maplibre/create-ref.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {MapInstance} from '../types';
import type {MapInstance} from '../types/lib';
import type Maplibre from './maplibre';

/** These methods may break the react binding if called directly */
Expand Down
20 changes: 9 additions & 11 deletions src/maplibre/maplibre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@ import {transformToViewState, applyViewStateToTransform} from '../utils/transfor
import {normalizeStyle} from '../utils/style-utils';
import {deepEqual} from '../utils/deep-equal';

import type {TransformLike} from '../types/internal';
import type {
TransformLike,
ViewState,
ViewStateChangeEvent,
Point,
PointLike,
PaddingOptions,
MapStyle,
ImmutableLike,
LngLatBoundsLike,
MapGeoJSONFeature
} from '../types/common';
import type {MapStyle, Sky, Light, Terrain, Projection} from '../types/style-spec';
import type {MapInstance} from '../types/lib';
import type {
MapCallbacks,
Sky,
Light,
Terrain,
Projection,
ViewStateChangeEvent,
MapEvent,
ErrorEvent,
MapMouseEvent,
MapGeoJSONFeature,
MapInstance
} from '../types';
MapMouseEvent
} from '../types/events';

export type MaplibreProps = Partial<ViewState> &
MapCallbacks & {
Expand Down
5 changes: 0 additions & 5 deletions src/types/index.ts → src/types/internal.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
export * from './common';
export * from './lib';
export * from './events';
export * from './style-spec';

// Internal types
import type {
LngLat,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/deep-equal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {PointLike} from '../types';
import type {PointLike} from '../types/common';

/**
* Compare two points
Expand Down
3 changes: 2 additions & 1 deletion src/utils/style-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {ImmutableLike, MapStyle} from '../types';
import type {MapStyle} from '../types/style-spec';
import type {ImmutableLike} from '../types/common';

const refProps = ['type', 'source', 'source-layer', 'minzoom', 'maxzoom', 'filter', 'layout'];

Expand Down
3 changes: 2 additions & 1 deletion src/utils/transform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {MaplibreProps} from '../maplibre/maplibre';
import type {TransformLike, ViewState} from '../types';
import type {ViewState} from '../types/common';
import type {TransformLike} from '../types/internal';
import {deepEqual} from './deep-equal';

/**
Expand Down

0 comments on commit f827ad5

Please sign in to comment.