Skip to content

Commit

Permalink
refactor(web): beta visualizer (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaWaite committed Jun 7, 2023
1 parent 0ebc928 commit 332db70
Show file tree
Hide file tree
Showing 279 changed files with 71 additions and 62 deletions.
File renamed without changes.
@@ -1,8 +1,8 @@
import { useMemo, useEffect, useCallback } from "react";

import type { Alignment, Location } from "@reearth/beta/core/Crust";
import type { LatLng, Tag, ValueTypes, ComputedLayer } from "@reearth/beta/core/mantle";
import type { Layer, LayerSelectionReason, Cluster } from "@reearth/beta/core/Map";
import type { Alignment, Location } from "@reearth/beta/lib/core/Crust";
import type { LatLng, Tag, ValueTypes, ComputedLayer } from "@reearth/beta/lib/core/mantle";
import type { Layer, LayerSelectionReason, Cluster } from "@reearth/beta/lib/core/Map";
import { config } from "@reearth/services/config";
import {
useSceneId,
Expand Down
@@ -1,7 +1,7 @@
import React, { useCallback } from "react";

import ContentPicker from "@reearth/beta/components/ContentPicker";
import Visualizer, { type Props as VisualizerProps } from "@reearth/beta/core/Visualizer";
import Visualizer, { type Props as VisualizerProps } from "@reearth/beta/lib/core/Visualizer";
import { config } from "@reearth/services/config";

import FovSlider from "../FovSlider";
Expand Down
@@ -1,4 +1,4 @@
import { Item } from "@reearth/beta/components/ContentPicker";
import { Block } from "@reearth/beta/core/Crust";
import { Block } from "@reearth/beta/lib/core/Crust";

export type BlockType = Item & Pick<Block, "pluginId" | "extensionId">;
File renamed without changes.
2 changes: 1 addition & 1 deletion web/src/beta/features/Editor/index.tsx
Expand Up @@ -2,8 +2,8 @@ import Resizable from "@reearth/beta/components/Resizable";
import useLeftPanel from "@reearth/beta/features/Editor/useLeftPanel";
import useRightPanel from "@reearth/beta/features/Editor/useRightPanel";
import useVisualizerNav from "@reearth/beta/features/Editor/useVisualizerNav";
import Visualizer from "@reearth/beta/features/Editor/Visualizer";
import Navbar, { Tab } from "@reearth/beta/features/Navbar";
import Visualizer from "@reearth/beta/features/Visualizer";
import { Provider as DndProvider } from "@reearth/beta/utils/use-dnd";
import { metrics, styled } from "@reearth/services/theme";

Expand Down
2 changes: 1 addition & 1 deletion web/src/beta/features/Editor/useLeftPanel.tsx
@@ -1,6 +1,6 @@
import { ReactNode, useMemo } from "react";
import SidePanel, { SidePanelContent } from "src/beta/features/SidePanel";

import SidePanel, { SidePanelContent } from "@reearth/beta/features/Editor/SidePanel";
import { Tab } from "@reearth/beta/features/Navbar";

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion web/src/beta/features/Editor/useRightPanel.tsx
@@ -1,7 +1,7 @@
import { ReactNode, useMemo } from "react";

import SidePanel, { SidePanelContent } from "@reearth/beta/features/Editor/SidePanel";
import { Tab } from "@reearth/beta/features/Navbar";
import SidePanel, { SidePanelContent } from "@reearth/beta/features/SidePanel";

type Props = {
tab: Tab;
Expand Down
2 changes: 1 addition & 1 deletion web/src/beta/features/Editor/useVisualizerNav.tsx
@@ -1,7 +1,7 @@
import { ReactNode, useMemo } from "react";

import VisualizerNav from "@reearth/beta/features/Editor/VisualizerNav";
import { Tab } from "@reearth/beta/features/Navbar";
import VisualizerNav from "@reearth/beta/features/VisualizerNav";

type Props = {
tab: Tab;
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
import type { ComponentType, ReactNode } from "react";

import type { Layer } from "@reearth/beta/core/mantle";
import type { Layer } from "@reearth/beta/lib/core/mantle";
import type { ValueType, ValueTypes } from "@reearth/beta/utils/value";
import { styled } from "@reearth/services/theme";

Expand Down
File renamed without changes.
Expand Up @@ -3,7 +3,7 @@ import React, { type ReactNode } from "react";
import AdditionButton from "@reearth/beta/components/AdditionButton";
import Icon from "@reearth/beta/components/Icon";
import Text from "@reearth/beta/components/Text";
import type { Layer } from "@reearth/beta/core/mantle";
import type { Layer } from "@reearth/beta/lib/core/mantle";
import { useT } from "@reearth/services/i18n";
import { styled, useTheme } from "@reearth/services/theme";

Expand Down
@@ -1,4 +1,4 @@
import type { Layer } from "@reearth/beta/core/mantle";
import type { Layer } from "@reearth/beta/lib/core/mantle";

import type { Typography } from "../types";

Expand Down
File renamed without changes.
Expand Up @@ -9,7 +9,7 @@ import {
type EventEmitter,
type Events,
useGet,
} from "@reearth/beta/core/Map";
} from "@reearth/beta/lib/core/Map";

import type { Block } from "../../Infobox";
import type { MapRef } from "../../types";
Expand Down
@@ -1,6 +1,6 @@
import type { RefObject } from "react";

import type { Layer } from "@reearth/beta/core/mantle";
import type { Layer } from "@reearth/beta/lib/core/mantle";

import type { Block } from "../../Infobox";
import type { MapRef } from "../../types";
Expand Down
@@ -1,12 +1,12 @@
import type { Tag } from "@reearth/beta/core/mantle/compat";
import type { Tag } from "@reearth/beta/lib/core/mantle/compat";
import {
Events,
Layer,
LayerSelectionReason,
LayersRef,
NaiveLayer,
LazyLayer,
} from "@reearth/beta/core/Map";
} from "@reearth/beta/lib/core/Map";
import { merge } from "@reearth/beta/utils/object";

import type { Block } from "../Infobox";
Expand Down
File renamed without changes.
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo } from "react";

import type { CameraPosition, NaiveLayer } from "@reearth/beta/core/mantle";
import type { CameraPosition, NaiveLayer } from "@reearth/beta/lib/core/mantle";
import {
type MouseEventHandles,
type MouseEvents,
Expand All @@ -11,7 +11,7 @@ import {
FlyToDestination,
LayerSelectionReason,
TickEventCallback,
} from "@reearth/beta/core/Map";
} from "@reearth/beta/lib/core/Map";

import { commonReearth } from "./api";
import { ReearthEventType, Viewport, ViewportSize } from "./plugin_types";
Expand Down
File renamed without changes.
Expand Up @@ -7,7 +7,7 @@ import type {
Tag,
NaiveLayer,
LayerSimple,
} from "@reearth/beta/core/mantle";
} from "@reearth/beta/lib/core/mantle";
import type {
CameraOptions,
FlyToDestination,
Expand All @@ -20,7 +20,7 @@ import type {
OverriddenLayer,
Undefinable,
WrappedRef,
} from "@reearth/beta/core/Map";
} from "@reearth/beta/lib/core/Map";

import { Block } from "../Infobox";
import { Widget } from "../Widgets";
Expand Down
@@ -1,8 +1,17 @@
import type { PropsWithChildren, RefObject } from "react";

import type { Camera, ComputedFeature, SelectedFeatureInfo, Tag } from "@reearth/beta/core/mantle";
import type { ComputedLayer, LayerEditEvent, LayerSelectionReason } from "@reearth/beta/core/Map";
import type { Viewport } from "@reearth/beta/core/Visualizer";
import type {
Camera,
ComputedFeature,
SelectedFeatureInfo,
Tag,
} from "@reearth/beta/lib/core/mantle";
import type {
ComputedLayer,
LayerEditEvent,
LayerSelectionReason,
} from "@reearth/beta/lib/core/Map";
import type { Viewport } from "@reearth/beta/lib/core/Visualizer";

import type { MapRef } from "../types";
import type { InternalWidget, WidgetAlignSystem } from "../Widgets";
Expand Down
Expand Up @@ -40,7 +40,7 @@ export type Props = {
onZoomOut?: () => void;
};

const NavigatorPresenter: React.FC<Props> = memo(function NavigatorPresenterMemo({
const NavigatorUI: React.FC<Props> = memo(function NavigatorPresenterMemo({
theme,
degree,
editing,
Expand Down Expand Up @@ -196,4 +196,4 @@ const ToolIconButton = styled.button<{ publishedTheme?: Theme }>`
place-items: center;
`;

export default NavigatorPresenter;
export default NavigatorUI;
Expand Up @@ -3,7 +3,7 @@ import { useState, useEffect, useCallback, useRef } from "react";
import type { Camera, FlyToDestination, Widget } from "../types";
import { useVisible } from "../useVisible";

import { degreeToRadian, radianToDegree } from "./NavigatorPresenter";
import { degreeToRadian, radianToDegree } from "./UI";

export default function ({
camera,
Expand Down
Expand Up @@ -2,7 +2,7 @@ import type { ComponentProps as WidgetProps } from "..";
import { Visible } from "../useVisible";

import useHooks from "./hooks";
import NavigatorPresenter from "./NavigatorPresenter";
import NavigatorUI from "./UI";

export type Props = WidgetProps<Property>;

Expand Down Expand Up @@ -42,7 +42,7 @@ const Navigator = ({
});

return visible ? (
<NavigatorPresenter theme={theme} degree={degree} editing={!!editing} {...events} />
<NavigatorUI theme={theme} degree={degree} editing={!!editing} {...events} />
) : null;
};

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
import { useState, useCallback, useEffect, useRef } from "react";

import type { TimeEventHandler } from "@reearth/beta/components/Timeline";
import { TickEvent, TickEventCallback } from "@reearth/beta/core/Map";
import type { TimeEventHandler } from "@reearth/beta/lib/core/Crust/Widgets/Widget/Timeline/UI";
import { TickEvent, TickEventCallback } from "@reearth/beta/lib/core/Map";

import type { Clock, Widget } from "../types";
import { useVisible } from "../useVisible";
Expand Down
@@ -1,4 +1,4 @@
import TimelineUI from "@reearth/beta/components/Timeline";
import TimelineUI from "@reearth/beta/lib/core/Crust/Widgets/Widget/Timeline/UI";
import { styled } from "@reearth/services/theme";

import type { ComponentProps as WidgetProps } from "..";
Expand Down
@@ -1,6 +1,6 @@
import { ComponentType, ReactNode, useMemo } from "react";

import type { TickEvent } from "@reearth/beta/core/Map";
import type { TickEvent } from "@reearth/beta/lib/core/Map";

import builtin, { isBuiltinWidget } from "./builtin";
import type {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
import type { ReactNode, RefObject } from "react";

import type { SelectedFeatureInfo, Tag } from "@reearth/beta/core/mantle";
import type { SelectedFeatureInfo, Tag } from "@reearth/beta/lib/core/mantle";

import type { ComputedFeature, ComputedLayer, Feature } from "../mantle";
import type { Clock, LayerEditEvent, LayerSelectionReason } from "../Map";
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.
Expand Up @@ -13,7 +13,7 @@ import {
import { useSet } from "react-use";
import { v4 as uuidv4 } from "uuid";

import { DATA_CACHE_KEYS } from "@reearth/beta/core/mantle/atoms/data";
import { DATA_CACHE_KEYS } from "@reearth/beta/lib/core/mantle/atoms/data";
import { objectFromGetter } from "@reearth/beta/utils/object";

import { computeAtom, convertLegacyLayer, SelectedFeatureInfo } from "../../mantle";
Expand Down
File renamed without changes.
@@ -1,6 +1,6 @@
import { forwardRef, type ForwardRefRenderFunction } from "react";

import { SelectedFeatureInfo } from "@reearth/beta/core/mantle";
import { SelectedFeatureInfo } from "@reearth/beta/lib/core/mantle";

import ClusteredLayers, { type Props as ClusteredLayerProps } from "../ClusteredLayers";
import type { ComputedLayer } from "../types";
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.
@@ -1,4 +1,4 @@
# @reearth/core
# @reearth/beta/lib/core

- **Visualizer**: Map + Crust
- **Crust**: Plugins + Widgets + Infobox
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,6 @@
import { CSSProperties, useMemo, type ReactNode } from "react";
import { ErrorBoundary } from "react-error-boundary";

import DropHolder from "@reearth/beta/components/DropHolder";
import { styled } from "@reearth/services/theme";

import Crust, {
Expand All @@ -27,6 +26,7 @@ import Map, {
type ComputedLayer,
} from "../Map";

import DropHolder from "./DropHolder";
import { engines, type EngineType } from "./engines";
import Err from "./Error";
import useHooks from "./hooks";
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.
Expand Up @@ -9,7 +9,7 @@ import {
import { FC, memo } from "react";
import { PolylineGraphics } from "resium";

import type { EventCallback } from "@reearth/beta/core/Map";
import type { EventCallback } from "@reearth/beta/lib/core/Map";

import { EntityExt } from "../utils";

Expand Down
Expand Up @@ -9,7 +9,7 @@ import {
import { FC, memo } from "react";
import { BoxGraphics, PolylineGraphics } from "resium";

import type { EventCallback } from "@reearth/beta/core/Map";
import type { EventCallback } from "@reearth/beta/lib/core/Map";

import { EntityExt } from "../utils";

Expand Down
Expand Up @@ -10,7 +10,7 @@ import {
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useCesium } from "resium";

import { LayerEditEvent } from "@reearth/beta/core/Map";
import { LayerEditEvent } from "@reearth/beta/lib/core/Map";

import type { Property } from "..";
import { sampleTerrainHeightFromCartesian, updateMapController } from "../../../common";
Expand Down
Expand Up @@ -11,7 +11,7 @@ import {
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useCesium } from "resium";

import type { EventCallback } from "@reearth/beta/core/Map";
import type { EventCallback } from "@reearth/beta/lib/core/Map";

import { getTag } from "../../utils";
import type { EdgeEventCallback, EdgeProperties } from "../Edge";
Expand Down
Expand Up @@ -14,7 +14,7 @@ import {
import { useCallback, useMemo, useState, useEffect, useRef } from "react";
import { useCesium } from "resium";

import type { EventCallback } from "@reearth/beta/core/Map";
import type { EventCallback } from "@reearth/beta/lib/core/Map";

import { getTag } from "../../utils";
import type { PointEventCallback, ScalePointProperties } from "../ScalePoints";
Expand Down
Expand Up @@ -3,9 +3,9 @@ import React, { memo } from "react";
import type {
FeatureComponentConfig,
FeatureProps,
} from "@reearth/beta/core/engines/Cesium/Feature";
import type { BoxAppearance, LatLngHeight } from "@reearth/beta/core/mantle";
import { LayerEditEvent } from "@reearth/beta/core/Map";
} from "@reearth/beta/lib/core/engines/Cesium/Feature";
import type { BoxAppearance, LatLngHeight } from "@reearth/beta/lib/core/mantle";
import { LayerEditEvent } from "@reearth/beta/lib/core/Map";

import { BOX_EDGES, SCALE_POINTS, SIDE_PLANES, SIDE_PLANE_NAMES } from "./constants";
import { Edge } from "./Edge";
Expand Down
Expand Up @@ -12,7 +12,7 @@ import {
TranslationRotationScale,
} from "cesium";

import type { Geometry } from "@reearth/beta/core/mantle";
import type { Geometry } from "@reearth/beta/lib/core/mantle";

import { translationWithClamping } from "../../utils";

Expand Down
@@ -1,4 +1,4 @@
import { RasterAppearance } from "@reearth/beta/core/mantle";
import { RasterAppearance } from "@reearth/beta/lib/core/mantle";

import { FeatureProps } from "../utils";

Expand Down
Expand Up @@ -2,7 +2,7 @@ import { Entity, type DataSource, Color } from "cesium";
import { useCallback, useEffect, useMemo, useRef } from "react";
import { KmlDataSource, CzmlDataSource, GeoJsonDataSource, useCesium } from "resium";

import { ComputedFeature, evalFeature, Feature, guessType } from "@reearth/beta/core/mantle";
import { ComputedFeature, evalFeature, Feature, guessType } from "@reearth/beta/lib/core/mantle";
import { requestIdleCallbackWithRequiredWork } from "@reearth/beta/utils/idle";

import type { ResourceAppearance } from "../../..";
Expand Down
Expand Up @@ -12,8 +12,8 @@ import {
ComputedFeature,
ComputedLayer,
Feature,
} from "@reearth/beta/core/mantle";
import { EvalFeature } from "@reearth/beta/core/Map";
} from "@reearth/beta/lib/core/mantle";
import { EvalFeature } from "@reearth/beta/lib/core/Map";

import { heightReference, shadowMode, toColor } from "../../common";
import { attachTag, extractSimpleLayer, getTag, Tag } from "../utils";
Expand Down
Expand Up @@ -9,8 +9,8 @@ import {
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { RootEventTarget, useCesium } from "resium";

import { Camera, EXPERIMENTAL_clipping } from "@reearth/beta/core/mantle";
import { LayerEditEvent } from "@reearth/beta/core/Map";
import { Camera, EXPERIMENTAL_clipping } from "@reearth/beta/lib/core/mantle";
import { LayerEditEvent } from "@reearth/beta/lib/core/Map";

import {
getCamera,
Expand Down
@@ -1,6 +1,6 @@
import { createContext, useContext as useReactContext } from "react";

import { LayerEditEvent } from "@reearth/beta/core/Map";
import { LayerEditEvent } from "@reearth/beta/lib/core/Map";

import type { Camera, FlyToDestination, CameraOptions, LayerSelectionReason } from "../..";

Expand Down

0 comments on commit 332db70

Please sign in to comment.