From 0395c4ccf104e7408aad0a8f8362ce4f666f07fa Mon Sep 17 00:00:00 2001 From: lby Date: Tue, 27 Aug 2024 14:08:00 +0800 Subject: [PATCH] chore(web): upgrade eslint and config (#1112) --- .vscode/extensions.json | 4 +- .vscode/settings.json | 29 +- web/.eslintignore | 7 - web/.eslintrc.yml | 42 - web/.huskyrc.json | 2 +- web/.prettierignore | 2 + web/.storybook/preview-head.html | 7 +- web/.storybook/preview.tsx | 5 +- web/.storybook/public/plugins/block.js | 2 +- web/.storybook/public/sample.geojson | 500 ++----- web/.storybook/public/testdata/sample.gltf | 90 +- web/.storybook/public/tileset/tileset.json | 65 +- web/.vscode/settings.json | 10 +- web/CODE_OF_CONDUCT.md | 26 +- web/README.md | 4 +- web/bin/pluginDoc.ts | 48 +- web/codegen.ts | 5 +- web/e2e/utils/index.ts | 11 +- web/eslint.config.mjs | 40 + web/index.html | 33 +- web/package.json | 29 +- web/published.html | 45 +- web/src/app.tsx | 7 +- .../components/Accordion/AccordionItem.tsx | 18 +- .../components/Accordion/index.stories.tsx | 8 +- .../beta/components/Accordion/index.test.tsx | 11 +- web/src/beta/components/Accordion/index.tsx | 5 +- .../beta/components/Avatar/index.stories.tsx | 8 +- web/src/beta/components/Avatar/index.tsx | 13 +- web/src/beta/components/Box/index.tsx | 64 +- .../beta/components/Button/index.stories.tsx | 32 +- web/src/beta/components/Button/index.tsx | 42 +- web/src/beta/components/CatalogCard/index.tsx | 41 +- web/src/beta/components/Collapse/index.tsx | 15 +- .../beta/components/ContentPicker/README.md | 1 + .../beta/components/ContentPicker/index.tsx | 8 +- web/src/beta/components/Divider/index.tsx | 11 +- .../beta/components/DragAndDropList/Item.tsx | 25 +- .../DragAndDropList/index.stories.tsx | 24 +- .../beta/components/DragAndDropList/index.tsx | 12 +- .../components/DragAndDropList/scrollItem.tsx | 11 +- .../beta/components/Flex/index.stories.tsx | 6 +- web/src/beta/components/Flex/index.tsx | 6 +- .../components/FloatedPanel/index.stories.tsx | 2 +- .../beta/components/FloatedPanel/index.tsx | 18 +- .../beta/components/Icon/index.stories.tsx | 4 +- web/src/beta/components/Icon/index.tsx | 10 +- .../beta/components/InsertionBar/index.tsx | 37 +- .../beta/components/InsertionButton/index.tsx | 6 +- web/src/beta/components/ListItem/index.tsx | 31 +- web/src/beta/components/Loading/index.tsx | 26 +- .../components/Modal/ModalFrame/index.tsx | 23 +- .../beta/components/Modal/index.stories.tsx | 53 +- web/src/beta/components/Modal/index.tsx | 37 +- web/src/beta/components/NotFound/index.tsx | 16 +- .../beta/components/Popover/index.stories.tsx | 22 +- web/src/beta/components/Popover/index.tsx | 189 +-- .../components/PopoverMenuContent/index.tsx | 12 +- web/src/beta/components/README.md | 2 +- .../components/RadioGroup/RadioBox/index.tsx | 23 +- .../components/RadioGroup/index.stories.tsx | 10 +- .../components/RangeSlider/index.stories.tsx | 14 +- web/src/beta/components/RangeSlider/index.tsx | 9 +- web/src/beta/components/Resizable/hooks.ts | 24 +- .../components/Resizable/index.stories.tsx | 13 +- web/src/beta/components/Resizable/index.tsx | 44 +- .../SettingsButtons/index.stories.tsx | 2 +- .../beta/components/SettingsButtons/index.tsx | 18 +- .../SidePanelSectionField/index.tsx | 24 +- .../beta/components/Slide/index.stories.tsx | 5 +- web/src/beta/components/Slide/index.tsx | 9 +- .../beta/components/Slider/index.stories.tsx | 14 +- web/src/beta/components/Slider/index.tsx | 9 +- .../StorytellingPageSectionItem/index.tsx | 12 +- .../components/SubTabButtonList/index.tsx | 9 +- .../components/SwitchButtonList/index.tsx | 21 +- web/src/beta/components/TabButton/index.tsx | 9 +- .../beta/components/TabMenu/index.stories.tsx | 40 +- web/src/beta/components/TabMenu/index.tsx | 35 +- web/src/beta/components/Text/index.tsx | 18 +- .../beta/components/Toggle/index.stories.tsx | 10 +- web/src/beta/components/Toggle/index.tsx | 13 +- .../fields/CameraField/CapturePanel/index.tsx | 24 +- .../fields/CameraField/EditPanel/hooks.ts | 5 +- .../fields/CameraField/EditPanel/index.tsx | 11 +- .../fields/CameraField/index.stories.tsx | 17 +- .../components/fields/CameraField/index.tsx | 37 +- .../components/fields/CameraField/utils.ts | 6 +- .../components/fields/ColorField/hooks.ts | 36 +- .../components/fields/ColorField/index.tsx | 38 +- .../fields/DateTimeField/EditPanel/hooks.ts | 25 +- .../fields/DateTimeField/EditPanel/index.tsx | 22 +- .../fields/DateTimeField/index.stories.tsx | 4 +- .../components/fields/DateTimeField/index.tsx | 13 +- .../fields/ListField/index.stories.tsx | 10 +- .../components/fields/ListField/index.tsx | 12 +- .../components/fields/LocationField/index.tsx | 16 +- .../fields/Property/PropertyField/hooks.ts | 21 +- .../fields/Property/PropertyField/index.tsx | 21 +- .../fields/Property/PropertyItem/index.tsx | 49 +- .../Property/PropertyList/index.stories.tsx | 8 +- .../fields/Property/PropertyList/index.tsx | 21 +- .../beta/components/fields/Property/hooks.ts | 21 +- .../components/fields/RangeField/index.tsx | 19 +- .../components/fields/SelectField/index.tsx | 57 +- .../components/fields/SliderField/index.tsx | 18 +- .../fields/SpacingInput/index.stories.tsx | 2 +- .../components/fields/SpacingInput/index.tsx | 33 +- .../fields/TextAreaField/index.stories.tsx | 8 +- .../components/fields/TextAreaField/index.tsx | 17 +- .../fields/TimelineField/EditPanel/hooks.ts | 9 +- .../fields/TimelineField/EditPanel/index.tsx | 23 +- .../components/fields/TimelineField/index.tsx | 25 +- .../components/fields/ToggleField/index.tsx | 6 +- .../beta/components/fields/URLField/index.tsx | 23 +- .../fields/common/NumberInput/index.tsx | 29 +- .../components/fields/common/PanelCommon.tsx | 9 +- .../fields/common/TextInput/index.tsx | 8 +- web/src/beta/components/fields/index.tsx | 10 +- web/src/beta/components/fields/utils.ts | 17 +- web/src/beta/features/Assets/constants.ts | 3 +- web/src/beta/features/Assets/hooks.ts | 30 +- .../features/AssetsManager/AssetsSelector.tsx | 13 +- .../beta/features/AssetsManager/constants.ts | 10 +- web/src/beta/features/AssetsManager/hooks.ts | 71 +- web/src/beta/features/AssetsManager/index.tsx | 91 +- .../AssetsManager/item/AssetGridItem.tsx | 50 +- .../AssetsManager/item/AssetListItem.tsx | 48 +- .../beta/features/AssetsManager/item/utils.ts | 7 +- .../ContentsContainer/Members/ListItem.tsx | 10 +- .../ContentsContainer/Members/index.tsx | 24 +- .../Projects/Project/ProjectGridViewItem.tsx | 25 +- .../Projects/Project/ProjectListViewItem.tsx | 49 +- .../Projects/Project/hooks.ts | 13 +- .../Projects/ProjectCreatorModal.tsx | 16 +- .../ContentsContainer/Projects/hooks.ts | 68 +- .../ContentsContainer/Projects/index.tsx | 54 +- .../Dashboard/ContentsContainer/index.tsx | 13 +- .../Dashboard/LeftSidePanel/index.tsx | 7 +- .../Dashboard/LeftSidePanel/profile.tsx | 20 +- web/src/beta/features/Dashboard/hooks.ts | 17 +- web/src/beta/features/Dashboard/index.tsx | 10 +- .../Map/DataSourceLayerCreator/CSV/index.tsx | 25 +- .../DataSourceLayerCreator/Common/hooks.tsx | 12 +- .../DataSourceLayerCreator/Common/index.tsx | 21 +- .../ThreeDTiles/index.tsx | 9 +- .../VectorTiles/index.tsx | 9 +- .../DataSourceLayerCreator/WmsTiles/index.tsx | 16 +- .../DataSourceLayerCreator/index.stories.tsx | 4 +- .../Map/DataSourceLayerCreator/index.tsx | 25 +- .../FeatureInspector/CustomPropertField.tsx | 23 +- .../LayerInspector/FeatureInspector/index.tsx | 52 +- .../LayerInspector/InfoboxSettings/index.tsx | 11 +- .../LayerInspector/LayerStyle/index.tsx | 7 +- .../InspectorPanel/LayerInspector/index.tsx | 27 +- .../Map/InspectorPanel/SceneSettings/hooks.ts | 13 +- .../InspectorPanel/SceneSettings/index.tsx | 23 +- .../Editor/Map/InspectorPanel/index.tsx | 11 +- .../Map/LayerStylePanel/LayerStyleCard.tsx | 14 +- .../Map/LayerStylePanel/LayerStyleEditor.tsx | 9 +- .../Map/LayerStylePanel/LayerStyleItem.tsx | 7 +- .../Editor/Map/LayerStylePanel/index.tsx | 13 +- .../Editor/Map/LayersPanel/LayerItem.tsx | 29 +- .../features/Editor/Map/LayersPanel/index.tsx | 18 +- .../features/Editor/Map/ScenePanel/index.tsx | 36 +- .../Map/SketchLayerCreator/General/index.tsx | 21 +- .../Editor/Map/SketchLayerCreator/index.tsx | 25 +- .../Editor/Map/SketchLayerCreator/type.ts | 4 +- .../Editor/Map/SketchLayerEditor/hooks.ts | 15 +- .../Editor/Map/SketchLayerEditor/index.tsx | 22 +- web/src/beta/features/Editor/Map/context.tsx | 16 +- web/src/beta/features/Editor/Map/index.tsx | 22 +- .../CustomPropertyItem.tsx | 23 +- .../shared/SketchCustomProperties/hooks.ts | 30 +- .../PublishToolsPanel/PublishModal/hooks.ts | 47 +- .../PublishToolsPanel/PublishModal/index.tsx | 143 +- .../Editor/Publish/PublishToolsPanel/hooks.ts | 35 +- .../Publish/PublishToolsPanel/index.tsx | 35 +- .../beta/features/Editor/Publish/context.tsx | 13 +- .../beta/features/Editor/Publish/index.tsx | 10 +- .../Editor/Story/PageSettingsPanel/hooks.ts | 18 +- .../Editor/Story/PageSettingsPanel/index.tsx | 41 +- .../Editor/Story/PagesPanel/PageItem.tsx | 21 +- .../Editor/Story/PagesPanel/index.tsx | 24 +- .../Story/TempContentStory/Action/index.tsx | 20 +- .../PageItemWrapper/index.tsx | 15 +- .../Story/TempContentStory/index.stories.tsx | 2 +- .../Editor/Story/TempContentStory/index.tsx | 42 +- .../beta/features/Editor/Story/context.tsx | 13 +- web/src/beta/features/Editor/Story/index.tsx | 9 +- .../Editor/Visualizer/convert-infobox.ts | 6 +- .../Editor/Visualizer/convert-story.ts | 26 +- .../features/Editor/Visualizer/convert.ts | 94 +- .../beta/features/Editor/Visualizer/hooks.ts | 118 +- .../beta/features/Editor/Visualizer/index.tsx | 7 +- .../Editor/Visualizer/processNewProperty.ts | 44 +- .../Widgets/ContainerSettingsPanel/hooks.ts | 12 +- .../Widgets/ContainerSettingsPanel/index.tsx | 35 +- .../Editor/Widgets/WASToolsPanel/index.tsx | 13 +- .../Widgets/WidgetInspectorPanel/hooks.ts | 8 +- .../Widgets/WidgetManagerPanel/Action.tsx | 19 +- .../Widgets/WidgetManagerPanel/ListItem.tsx | 10 +- .../Widgets/WidgetManagerPanel/hooks.ts | 5 +- .../Widgets/WidgetManagerPanel/index.tsx | 13 +- .../beta/features/Editor/Widgets/context.tsx | 17 +- .../beta/features/Editor/Widgets/index.tsx | 16 +- web/src/beta/features/Editor/hooks/index.ts | 7 +- .../Editor/hooks/useEditorVisualizer.ts | 10 +- .../features/Editor/hooks/useLayerStyles.ts | 26 +- .../beta/features/Editor/hooks/useLayers.ts | 49 +- .../features/Editor/hooks/useProperty.tsx | 13 +- .../beta/features/Editor/hooks/useScene.ts | 12 +- .../beta/features/Editor/hooks/useSketch.ts | 44 +- .../features/Editor/hooks/useStorytelling.ts | 30 +- web/src/beta/features/Editor/hooks/useUI.ts | 46 +- .../beta/features/Editor/hooks/useWidgets.ts | 19 +- web/src/beta/features/Editor/utils.tsx | 7 +- web/src/beta/features/GlobalModal/index.tsx | 7 +- .../beta/features/Modals/AssetModal/index.tsx | 39 +- .../features/Modals/LayerStyleModal/hooks.ts | 29 +- .../features/Modals/LayerStyleModal/index.tsx | 25 +- .../Navbar/LeftSection/Profile/index.tsx | 7 +- .../features/Navbar/LeftSection/index.tsx | 46 +- web/src/beta/features/Navbar/hooks.ts | 20 +- web/src/beta/features/Navbar/index.tsx | 8 +- web/src/beta/features/Navbar/useDevPlugins.ts | 41 +- .../beta/features/Navbar/useRightSection.tsx | 10 +- web/src/beta/features/Notification/hooks.ts | 25 +- web/src/beta/features/Notification/index.tsx | 24 +- .../features/PluginPlayground/Viewer/hooks.ts | 7 +- .../PluginPlayground/Viewer/index.tsx | 13 +- .../beta/features/PluginPlayground/index.tsx | 24 +- .../ProjectSettings/MenuList/index.tsx | 12 +- .../beta/features/ProjectSettings/hooks.ts | 30 +- .../beta/features/ProjectSettings/index.tsx | 16 +- .../innerPages/GeneralSettings/index.tsx | 34 +- .../PluginInstall/PluginInstallCardButton.tsx | 10 +- .../PluginList/PluginListItem.tsx | 23 +- .../PluginInstall/PluginList/index.tsx | 11 +- .../PluginInstall/PublicRepo/hooks.ts | 4 +- .../PluginInstall/PublicRepo/index.tsx | 6 +- .../PluginInstall/ZipUpload/index.tsx | 11 +- .../PluginSettings/PluginInstall/index.tsx | 8 +- .../innerPages/PluginSettings/hooks.ts | 34 +- .../innerPages/PluginSettings/index.tsx | 7 +- .../PublicSettings/PublicSettingsDetail.tsx | 45 +- .../innerPages/PublicSettings/index.tsx | 14 +- .../StorySettings/StorySettingsDetail.tsx | 33 +- .../innerPages/StorySettings/index.tsx | 6 +- .../ProjectSettings/innerPages/common.tsx | 25 +- .../Published/convert-new-property.ts | 55 +- web/src/beta/features/Published/convert.ts | 24 +- .../Published/googleAnalytics/useGA.ts | 4 +- web/src/beta/features/Published/hooks.ts | 93 +- web/src/beta/features/Published/types.ts | 14 +- web/src/beta/features/README.md | 6 +- .../features/RootPage/PageWrapper/index.tsx | 16 +- web/src/beta/features/RootPage/hooks.ts | 38 +- web/src/beta/features/RootPage/index.tsx | 9 +- .../Infobox/Block/builtin/Image/index.tsx | 12 +- .../Block/builtin/PropertyList/Content.tsx | 22 +- .../PropertyList/CustomFields/index.tsx | 7 +- .../CustomFields/useEvaluateProperties.ts | 20 +- .../builtin/PropertyList/ListEditor/Item.tsx | 19 +- .../builtin/PropertyList/ListEditor/hooks.ts | 42 +- .../builtin/PropertyList/ListEditor/index.tsx | 54 +- .../Block/builtin/PropertyList/ListItem.tsx | 25 +- .../Block/builtin/PropertyList/index.tsx | 12 +- .../Infobox/Block/builtin/Text/index.tsx | 12 +- .../Crust/Infobox/Block/builtin/index.ts | 4 +- .../Block/builtin/useExpressionEval.ts | 27 +- .../Visualizer/Crust/Infobox/Block/index.tsx | 33 +- .../Visualizer/Crust/Infobox/constants.ts | 3 +- .../Visualizer/Crust/Infobox/hooks.ts | 26 +- .../Visualizer/Crust/Infobox/index.tsx | 23 +- .../Visualizer/Crust/Infobox/types.ts | 2 +- .../Plugins/Plugin/ModalContainer/index.tsx | 19 +- .../Plugins/Plugin/PopupContainer/index.tsx | 43 +- .../Crust/Plugins/Plugin/hooks/index.ts | 23 +- .../Plugins/Plugin/hooks/usePluginAPI.ts | 59 +- .../Crust/Plugins/Plugin/index.stories.tsx | 4 +- .../Visualizer/Crust/Plugins/Plugin/index.tsx | 18 +- .../Crust/Plugins/PluginFrame/IFrame/hooks.ts | 26 +- .../PluginFrame/IFrame/index.stories.tsx | 2 +- .../Plugins/PluginFrame/IFrame/index.test.tsx | 63 +- .../Plugins/PluginFrame/IFrame/index.tsx | 6 +- .../Plugins/PluginFrame/PluginIFrame/hooks.ts | 5 +- .../PluginFrame/PluginIFrame/index.tsx | 14 +- .../PluginFrame/PluginIFrame/useIFrame.ts | 15 +- .../PluginIFrame/usePostMessage.test.ts | 3 +- .../Plugins/PluginFrame/SafeIFrame/hooks.ts | 19 +- .../PluginFrame/SafeIFrame/index.stories.tsx | 2 +- .../Plugins/PluginFrame/SafeIFrame/index.tsx | 6 +- .../PluginFrame/SafeIFrame/utils.test.ts | 4 +- .../Crust/Plugins/PluginFrame/hooks.ts | 12 +- .../Plugins/PluginFrame/index.stories.tsx | 20 +- .../Crust/Plugins/PluginFrame/index.tsx | 17 +- .../Visualizer/Crust/Plugins/context.tsx | 7 +- .../Visualizer/Crust/Plugins/hooks/index.ts | 7 +- .../Crust/Plugins/hooks/useCamera.ts | 34 +- .../Crust/Plugins/hooks/useDeprecated.ts | 72 +- .../Crust/Plugins/hooks/useExtension.ts | 7 +- .../Crust/Plugins/hooks/useLayers.ts | 38 +- .../Crust/Plugins/hooks/useSketch.ts | 42 +- .../Crust/Plugins/hooks/useTimeline.ts | 14 +- .../Crust/Plugins/hooks/useViewer.ts | 35 +- .../Crust/Plugins/pluginAPI/commonReearth.ts | 23 +- .../Crust/Plugins/pluginAPI/exposedReearth.ts | 85 +- .../Plugins/pluginAPI/pluginAPIv1Types.ts | 67 +- .../Crust/Plugins/pluginAPI/types/camera.ts | 5 +- .../Crust/Plugins/pluginAPI/types/layers.ts | 18 +- .../Crust/Plugins/pluginAPI/types/timeline.ts | 4 +- .../Crust/Plugins/pluginAPI/types/viewer.ts | 26 +- .../Visualizer/Crust/Plugins/storybook.tsx | 11 +- .../Visualizer/Crust/Plugins/types.ts | 11 +- .../Crust/Plugins/useClientStorage.ts | 14 +- .../Crust/Plugins/usePluginInstances.ts | 59 +- .../Visualizer/Crust/Plugins/utils/events.ts | 49 +- .../Block/builtin/Camera/Content.tsx | 43 +- .../Block/builtin/Camera/Editor/hooks.ts | 56 +- .../Block/builtin/Camera/Editor/index.tsx | 46 +- .../StoryPanel/Block/builtin/Camera/index.tsx | 13 +- .../StoryPanel/Block/builtin/Image/index.tsx | 12 +- .../Block/builtin/Layer/Content.tsx | 34 +- .../Block/builtin/Layer/Editor/hooks.ts | 51 +- .../Block/builtin/Layer/Editor/index.tsx | 49 +- .../StoryPanel/Block/builtin/Layer/index.tsx | 13 +- .../StoryPanel/Block/builtin/Link/Content.tsx | 34 +- .../Block/builtin/Link/Editor/hooks.ts | 51 +- .../Block/builtin/Link/Editor/index.tsx | 47 +- .../StoryPanel/Block/builtin/Link/index.tsx | 13 +- .../Block/builtin/Markdown/Editor.tsx | 28 +- .../Block/builtin/Markdown/index.tsx | 30 +- .../Block/builtin/NextPage/index.tsx | 15 +- .../StoryPanel/Block/builtin/Text/Editor.tsx | 29 +- .../StoryPanel/Block/builtin/Text/index.tsx | 6 +- .../Block/builtin/Timeline/Editor.tsx | 142 +- .../StoryPanel/Block/builtin/Timeline/hook.ts | 120 +- .../Block/builtin/Timeline/index.tsx | 12 +- .../StoryPanel/Block/builtin/Title/index.tsx | 14 +- .../Block/builtin/Video/VideoPlayer.tsx | 13 +- .../StoryPanel/Block/builtin/Video/index.tsx | 20 +- .../Crust/StoryPanel/Block/builtin/index.ts | 4 +- .../Crust/StoryPanel/Block/index.tsx | 21 +- .../Visualizer/Crust/StoryPanel/Page/hooks.ts | 30 +- .../Crust/StoryPanel/Page/index.tsx | 41 +- .../PageIndicator/IndicatorSection.tsx | 42 +- .../Crust/StoryPanel/PageIndicator/index.tsx | 10 +- .../Crust/StoryPanel/PanelContent/hooks.ts | 23 +- .../Crust/StoryPanel/PanelContent/index.tsx | 71 +- .../Visualizer/Crust/StoryPanel/constants.ts | 14 +- .../Visualizer/Crust/StoryPanel/context.tsx | 9 +- .../Visualizer/Crust/StoryPanel/hooks.ts | 85 +- .../Visualizer/Crust/StoryPanel/index.tsx | 40 +- .../Visualizer/Crust/StoryPanel/utils.ts | 50 +- .../Widget/builtin/Button/MenuButton.tsx | 152 +- .../Widget/builtin/Button/index.stories.tsx | 2 +- .../Widgets/Widget/builtin/Button/index.tsx | 11 +- .../Widget/builtin/Navigator/UI/hooks.ts | 67 +- .../builtin/Navigator/UI/index.stories.tsx | 4 +- .../builtin/Navigator/UI/index.test.tsx | 5 +- .../Widget/builtin/Navigator/UI/index.tsx | 46 +- .../Widget/builtin/Navigator/UI/utils.test.ts | 7 +- .../Widgets/Widget/builtin/Navigator/hooks.ts | 7 +- .../builtin/Navigator/index.stories.tsx | 2 +- .../builtin/Timeline/UI/ScaleList.test.tsx | 16 +- .../Widget/builtin/Timeline/UI/ScaleList.tsx | 110 +- .../Widget/builtin/Timeline/UI/hooks.ts | 49 +- .../Widget/builtin/Timeline/UI/index.test.tsx | 29 +- .../Widget/builtin/Timeline/UI/index.tsx | 65 +- .../Widget/builtin/Timeline/UI/utils.test.ts | 24 +- .../Widget/builtin/Timeline/UI/utils.ts | 19 +- .../Widgets/Widget/builtin/Timeline/hooks.ts | 81 +- .../Widget/builtin/Timeline/index.stories.tsx | 2 +- .../Widgets/Widget/builtin/Timeline/index.tsx | 6 +- .../Crust/Widgets/Widget/builtin/index.ts | 33 +- .../Widgets/Widget/builtin/unsafeWidgets.ts | 11 +- .../Crust/Widgets/Widget/index.stories.tsx | 2 +- .../Visualizer/Crust/Widgets/Widget/index.tsx | 26 +- .../Crust/Widgets/WidgetAlignSystem/Area.tsx | 49 +- .../Widgets/WidgetAlignSystem/MobileZone.tsx | 50 +- .../Crust/Widgets/WidgetAlignSystem/Zone.tsx | 6 +- .../Crust/Widgets/WidgetAlignSystem/hooks.ts | 8 +- .../Crust/Widgets/WidgetAlignSystem/index.tsx | 11 +- .../Crust/Widgets/WidgetAlignSystem/types.ts | 15 +- .../Crust/Widgets/WidgetAlignSystem/utils.ts | 14 +- .../Crust/Widgets/index.stories.tsx | 2 +- .../Visualizer/Crust/Widgets/index.tsx | 34 +- .../Crust/Widgets/useWidgetAlignSystem.ts | 246 ++-- .../beta/features/Visualizer/Crust/context.ts | 44 +- .../beta/features/Visualizer/Crust/hooks.tsx | 12 +- .../Visualizer/Crust/index.stories.tsx | 13 +- .../beta/features/Visualizer/Crust/index.tsx | 42 +- .../features/Visualizer/Crust/theme/index.ts | 3 +- .../beta/features/Visualizer/Crust/utils.ts | 16 +- .../features/Visualizer/FovSlider/hooks.ts | 13 +- .../features/Visualizer/FovSlider/index.tsx | 13 +- web/src/beta/features/Visualizer/hooks.ts | 8 +- web/src/beta/features/Visualizer/index.tsx | 63 +- .../shared/components/ActionPanel/index.tsx | 94 +- .../shared/components/BlockAddBar/index.tsx | 70 +- .../shared/components/BlockWrapper/hooks.ts | 41 +- .../shared/components/BlockWrapper/index.tsx | 100 +- .../components/ContentWrapper/index.tsx | 78 +- .../SelectableArea/ActionPanel/hooks.ts | 27 +- .../SelectableArea/ActionPanel/index.tsx | 37 +- .../shared/components/SelectableArea/hooks.ts | 7 +- .../components/SelectableArea/index.tsx | 23 +- .../shared/contexts/editModeContext.tsx | 9 +- .../shared/hooks/useElementOnScreen.tsx | 2 +- .../shared/hooks/useFieldComponent.tsx | 127 +- .../shared/hooks/useTimelineBlock.ts | 43 +- .../beta/features/Visualizer/shared/types.ts | 5 +- .../utils/useOverriddenProperty.test.ts | 4 +- .../Visualizer/utils/useOverriddenProperty.ts | 33 +- web/src/beta/hooks/navigationHooks.ts | 13 +- web/src/beta/hooks/useAssetUploader/hooks.tsx | 24 +- .../beta/hooks/useManageSwitchState/hooks.tsx | 4 +- web/src/beta/lib/README.md | 2 +- .../beta/lib/lexical/RichTextEditor/index.css | 30 +- .../beta/lib/lexical/RichTextEditor/index.tsx | 20 +- .../lib/lexical/RichTextEditor/nodes/index.ts | 2 +- .../RichTextEditor/plugins/AutoLinkPlugin.tsx | 15 +- .../FloatingLinkEditorPlugin/index.tsx | 44 +- .../RichTextEditor/plugins/LinkPlugin.tsx | 15 +- .../plugins/ListMaxIndentLevelPlugin.tsx | 10 +- .../plugins/SwitchEditModePlugin.tsx | 6 +- .../RichTextEditor/plugins/ToolbarPlugin.tsx | 228 ++- .../themes/DefaultLexicalEditorTheme.css | 16 +- .../themes/DefaultLexicalEditorTheme.ts | 12 +- .../lexical/RichTextEditor/ui/ColorPicker.tsx | 56 +- .../lexical/RichTextEditor/ui/DropDown.tsx | 32 +- .../RichTextEditor/ui/DropdownColorPicker.tsx | 3 +- .../lexical/RichTextEditor/ui/TextInput.tsx | 2 +- .../RichTextEditor/utils/getSelectedNode.ts | 4 +- .../lib/lexical/RichTextEditor/utils/url.ts | 9 +- .../components/Breadcrumb/index.stories.tsx | 14 +- .../components/Breadcrumb/index.tsx | 14 +- .../components/Button/index.stories.tsx | 30 +- .../reearth-ui/components/Button/index.tsx | 160 ++- .../reearth-ui/components/CheckBox/index.tsx | 27 +- .../reearth-ui/components/CodeInput/index.tsx | 7 +- .../components/Collapse/index.stories.tsx | 45 +- .../reearth-ui/components/Collapse/index.tsx | 18 +- .../reearth-ui/components/ColorInput/hooks.ts | 19 +- .../components/ColorInput/index.stories.tsx | 6 +- .../components/ColorInput/index.tsx | 28 +- .../components/DatePicker/index.tsx | 14 +- .../DragAndDropList/index.stories.tsx | 60 +- .../components/DragAndDropList/index.tsx | 47 +- .../components/Icon/index.stories.tsx | 36 +- .../lib/reearth-ui/components/Icon/index.tsx | 20 +- .../components/IconButton/index.stories.tsx | 38 +- .../components/IconButton/index.tsx | 58 +- .../reearth-ui/components/Loading/index.tsx | 42 +- .../reearth-ui/components/Markdown/index.tsx | 116 +- .../components/Modal/index.stories.tsx | 56 +- .../lib/reearth-ui/components/Modal/index.tsx | 27 +- .../components/ModalPanel/index.stories.tsx | 22 +- .../components/ModalPanel/index.tsx | 41 +- .../components/NumberInput/index.tsx | 26 +- .../components/Popup/index.stories.tsx | 31 +- .../lib/reearth-ui/components/Popup/index.tsx | 72 +- .../components/PopupMenu/index.stories.tsx | 11 +- .../reearth-ui/components/PopupMenu/index.tsx | 153 +- .../components/PopupPanel/index.stories.tsx | 7 +- .../components/PopupPanel/index.tsx | 19 +- .../lib/reearth-ui/components/Radio/index.tsx | 47 +- .../components/Selector/index.stories.tsx | 16 +- .../reearth-ui/components/Selector/index.tsx | 51 +- .../components/Switcher/index.stories.tsx | 4 +- .../reearth-ui/components/Switcher/index.tsx | 11 +- .../components/Tabs/index.stories.tsx | 6 +- .../lib/reearth-ui/components/Tabs/index.tsx | 66 +- .../reearth-ui/components/TextArea/index.tsx | 13 +- .../reearth-ui/components/TextInput/index.tsx | 18 +- .../components/TimePicker/index.tsx | 14 +- .../components/Typography/index.tsx | 20 +- web/src/beta/pages/Dashboard/index.tsx | 11 +- web/src/beta/pages/EditorPage/index.tsx | 7 +- .../beta/pages/GraphQLPlayground/index.tsx | 7 +- web/src/beta/pages/Page.tsx | 23 +- .../beta/pages/PluginPlaygroundPage/index.tsx | 6 +- .../beta/pages/ProjectSettingsPage/index.tsx | 19 +- web/src/beta/pages/README.md | 2 +- .../ui/components/EntryItem/index.stories.tsx | 5 +- .../beta/ui/components/EntryItem/index.tsx | 64 +- .../components/ManagerBase/ManagerHeader.tsx | 81 +- .../ManagerBase/ManagerHeaderButton.tsx | 7 +- web/src/beta/ui/components/Sidebar/index.tsx | 20 +- web/src/beta/ui/fields/AssetField/index.tsx | 17 +- .../ui/fields/AssetField/useAssetUpload.ts | 24 +- .../ui/fields/CamersField/CapturePanel.tsx | 6 +- .../ui/fields/CamersField/EditorPanel.tsx | 23 +- web/src/beta/ui/fields/CamersField/hooks.ts | 11 +- web/src/beta/ui/fields/CamersField/index.tsx | 25 +- web/src/beta/ui/fields/CheckboxField.tsx | 9 +- web/src/beta/ui/fields/CodeField.tsx | 11 +- web/src/beta/ui/fields/ColorField.tsx | 9 +- web/src/beta/ui/fields/InputField.tsx | 14 +- web/src/beta/ui/fields/ListField/ListItem.tsx | 8 +- .../ui/fields/ListField/index.stories.tsx | 12 +- web/src/beta/ui/fields/ListField/index.tsx | 25 +- web/src/beta/ui/fields/NumberField.tsx | 9 +- .../ui/fields/Properties/ProprtyField.tsx | 27 +- web/src/beta/ui/fields/Properties/hooks.ts | 21 +- web/src/beta/ui/fields/Properties/index.tsx | 62 +- web/src/beta/ui/fields/QuartetInputField.tsx | 11 +- web/src/beta/ui/fields/RangeField.tsx | 9 +- web/src/beta/ui/fields/SelectField.tsx | 9 +- web/src/beta/ui/fields/SpacingField.tsx | 12 +- web/src/beta/ui/fields/SwitchField.tsx | 9 +- web/src/beta/ui/fields/TextareaField.tsx | 9 +- .../ui/fields/TimePeriodField/EditModal.tsx | 19 +- .../beta/ui/fields/TimePeriodField/hooks.ts | 9 +- .../beta/ui/fields/TimePeriodField/index.tsx | 19 +- .../ui/fields/TimePointField/EditPanel.tsx | 16 +- .../beta/ui/fields/TimePointField/hooks.ts | 26 +- .../beta/ui/fields/TimePointField/index.tsx | 6 +- web/src/beta/ui/fields/TripletInputField.tsx | 11 +- web/src/beta/ui/fields/TwinInputField.tsx | 11 +- web/src/beta/ui/fields/index.stories.tsx | 3 +- web/src/beta/ui/fields/utils.ts | 17 +- web/src/beta/ui/layout/Area/index.stories.tsx | 18 +- web/src/beta/ui/layout/Area/index.tsx | 171 ++- .../beta/ui/layout/Panel/index.stories.tsx | 11 +- web/src/beta/ui/layout/Panel/index.tsx | 10 +- web/src/beta/utils/README.md | 2 +- web/src/beta/utils/convert-object.ts | 10 +- web/src/beta/utils/deepFind.test.ts | 12 +- web/src/beta/utils/file.ts | 4 +- web/src/beta/utils/generate-random-string.ts | 5 +- web/src/beta/utils/infinite-scroll.ts | 5 +- web/src/beta/utils/localstorage.ts | 5 +- web/src/beta/utils/moment-timezone.ts | 2 +- web/src/beta/utils/object.ts | 14 +- web/src/beta/utils/raf.ts | 9 +- web/src/beta/utils/time.ts | 4 +- web/src/beta/utils/use-dnd/drag.ts | 5 +- web/src/beta/utils/use-dnd/drop.ts | 31 +- web/src/beta/utils/use-dnd/index.tsx | 7 +- web/src/beta/utils/use-dnd/types.ts | 7 +- web/src/beta/utils/util.ts | 24 +- web/src/beta/utils/value.ts | 36 +- web/src/env.d.ts | 8 +- web/src/services/README.md | 2 +- web/src/services/api/assetsApi.ts | 67 +- .../api/featureCollectionApi/index.ts | 44 +- web/src/services/api/infoboxApi/blocks.ts | 46 +- web/src/services/api/infoboxApi/index.tsx | 16 +- web/src/services/api/layerStyleApi/index.ts | 87 +- web/src/services/api/layerStyleApi/utils.ts | 3 +- web/src/services/api/layersApi/index.ts | 97 +- web/src/services/api/layersApi/utils.ts | 14 +- web/src/services/api/pluginsApi.ts | 15 +- web/src/services/api/projectApi.ts | 175 ++- web/src/services/api/propertyApi/index.ts | 47 +- web/src/services/api/propertyApi/utils.ts | 80 +- web/src/services/api/sceneApi.ts | 11 +- .../services/api/storytellingApi/blocks.ts | 92 +- web/src/services/api/storytellingApi/index.ts | 58 +- web/src/services/api/storytellingApi/pages.ts | 47 +- web/src/services/api/storytellingApi/utils.ts | 9 +- web/src/services/api/teams/index.ts | 11 +- web/src/services/api/toGqlStatus.ts | 4 +- web/src/services/api/types.ts | 2 +- web/src/services/api/widgetsApi/index.ts | 83 +- web/src/services/api/widgetsApi/utils.ts | 40 +- web/src/services/api/workspacesApi.ts | 19 +- web/src/services/auth/auth0Auth.ts | 11 +- web/src/services/auth/authProvider.tsx | 14 +- web/src/services/auth/cognitoAuth.ts | 12 +- web/src/services/auth/index.tsx | 12 +- web/src/services/auth/useAuth.ts | 19 +- web/src/services/config/extensions.ts | 18 +- web/src/services/config/index.ts | 22 +- web/src/services/config/passwordPolicy.ts | 8 +- .../services/config/unsafeBuiltinPlugin.ts | 12 +- web/src/services/gql/fragments/layer.ts | 6 +- web/src/services/gql/provider/index.tsx | 30 +- web/src/services/gql/provider/pagination.ts | 12 +- web/src/services/i18n/i18n.ts | 1 - web/src/services/i18n/locale.ts | 4 +- web/src/services/i18n/publishedProvider.tsx | 6 +- web/src/services/routing/index.tsx | 17 +- web/src/services/state/devPlugins.ts | 7 +- web/src/services/state/index.ts | 9 +- web/src/services/theme/emotion.d.ts | 1 - web/src/services/theme/publishTheme/index.ts | 4 +- web/src/services/theme/publishTheme/utils.ts | 13 +- .../theme/reearthTheme/common/fonts.ts | 4 +- .../theme/reearthTheme/darkTheme/index.ts | 5 +- .../theme/reearthTheme/lightTheme/index.ts | 5 +- web/src/test/setup.ts | 11 +- web/src/test/utils.tsx | 7 +- web/src/types.ts | 48 +- web/src/wdyr.ts | 4 +- web/tsconfig.json | 27 +- web/vite.config.ts | 25 +- web/yarn.lock | 1243 ++++++++++------- 600 files changed, 11082 insertions(+), 5987 deletions(-) delete mode 100644 web/.eslintignore delete mode 100644 web/.eslintrc.yml create mode 100644 web/eslint.config.mjs diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 0181837e93..ce38e51852 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,7 +4,9 @@ // List of extensions which should be recommended for users of this workspace. "recommendations": [ "golang.go", - "redhat.vscode-yaml" + "redhat.vscode-yaml", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] diff --git a/.vscode/settings.json b/.vscode/settings.json index ab2e48a8da..7b8d51d19b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,6 @@ { "go.testEnvFile": "${workspaceRoot}/.env", "go.lintTool": "golangci-lint", - "editor.formatOnSave": true, "yaml.format.enable": false, "yaml.completion": true, "yaml.validate": true, @@ -17,20 +16,34 @@ }, "json.schemas": [ { - "fileMatch": [ - "/server/pkg/builtin/manifest.json" - ], + "fileMatch": ["/server/pkg/builtin/manifest.json"], "url": "./server/schemas/plugin_manifest.json" }, { - "fileMatch": [ - "/server/pkg/builtin/manifest_*.json" - ], + "fileMatch": ["/server/pkg/builtin/manifest_*.json"], "url": "./server/schemas/plugin_manifest_translation.json" } ], "[yaml]": { "editor.formatOnSave": false }, - "prettier.enable": false + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "editor.formatOnSave": true, + "eslint.enable": true, + "eslint.useFlatConfig": true, + "prettier.enable": true, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } } diff --git a/web/.eslintignore b/web/.eslintignore deleted file mode 100644 index 95ced518e0..0000000000 --- a/web/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -/build -/dist -/coverage -/storybook-static -!/.storybook -/.storybook/public -/src/services/gql/__gen__ \ No newline at end of file diff --git a/web/.eslintrc.yml b/web/.eslintrc.yml deleted file mode 100644 index 0102080ce3..0000000000 --- a/web/.eslintrc.yml +++ /dev/null @@ -1,42 +0,0 @@ -extends: - - reearth -root: true -rules: - no-restricted-imports: - - error - - paths: - - name: lodash - message: Use lodash-es instead. - import/order: - - warn - - pathGroups: - - pattern: "@reearth/**" - group: external - position: after - pathGroupsExcludedImportTypes: ["builtin"] - newlines-between: always - alphabetize: - order: asc - caseInsensitive: true -overrides: - - files: - - e2e/**/* - extends: - - reearth/node - - plugin:playwright/playwright-test - env: - browser: false - rules: - no-restricted-imports: - - error - - paths: - - name: "@playwright/test" - message: Use @reearth/e2e/utils instead. - - files: - - i18next-parser.config.js - extends: - - reearth/commonjs - - files: src/beta/** - rules: - "@typescript-eslint/no-explicit-any": - - warn diff --git a/web/.huskyrc.json b/web/.huskyrc.json index 05ea0d92bf..4d077c8292 100644 --- a/web/.huskyrc.json +++ b/web/.huskyrc.json @@ -2,4 +2,4 @@ "hooks": { "pre-commit": "lint-staged" } -} \ No newline at end of file +} diff --git a/web/.prettierignore b/web/.prettierignore index ec6d3cdd7f..d85205ac1d 100644 --- a/web/.prettierignore +++ b/web/.prettierignore @@ -1 +1,3 @@ package.json +**/__gen__/** +src/services/i18n/translations/*.yml \ No newline at end of file diff --git a/web/.storybook/preview-head.html b/web/.storybook/preview-head.html index bc16b3abc1..c6ce14c850 100644 --- a/web/.storybook/preview-head.html +++ b/web/.storybook/preview-head.html @@ -1,7 +1,10 @@ - \ No newline at end of file + diff --git a/web/.storybook/preview.tsx b/web/.storybook/preview.tsx index 215f8c77d3..c6f3184eec 100644 --- a/web/.storybook/preview.tsx +++ b/web/.storybook/preview.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ import { ApolloProvider, ApolloClient, @@ -21,7 +20,7 @@ import theme from "./theme"; const mockClient = new ApolloClient({ link: new ApolloLink( () => - new Observable(observer => { + new Observable((observer) => { observer.complete(); }), ), @@ -53,7 +52,7 @@ const preview: Preview = { Provider: ThemeProvider, GlobalStyles, }), - Story => { + (Story) => { return ( diff --git a/web/.storybook/public/plugins/block.js b/web/.storybook/public/plugins/block.js index 75b4e57beb..cf203dd3d1 100644 --- a/web/.storybook/public/plugins/block.js +++ b/web/.storybook/public/plugins/block.js @@ -34,6 +34,6 @@ reearth.ui.show(html); reearth.on("update", () => { reearth.ui.postMessage(reearth.block); }); -reearth.on("message", msg => { +reearth.on("message", (msg) => { console.log("message received:", msg); }); diff --git a/web/.storybook/public/sample.geojson b/web/.storybook/public/sample.geojson index 5593349c59..8a8185bbcf 100644 --- a/web/.storybook/public/sample.geojson +++ b/web/.storybook/public/sample.geojson @@ -5,10 +5,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -47.18951431751117, - -24.789938520384457 - ] + "coordinates": [-47.18951431751117, -24.789938520384457] }, "properties": {} }, @@ -16,10 +13,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 155.84221983372979, - 74.01264716547318 - ] + "coordinates": [155.84221983372979, 74.01264716547318] }, "properties": {} }, @@ -27,10 +21,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 110.07076785868927, - -89.46999216488513 - ] + "coordinates": [110.07076785868927, -89.46999216488513] }, "properties": {} }, @@ -38,10 +29,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -99.86847083205676, - 63.7797307132169 - ] + "coordinates": [-99.86847083205676, 63.7797307132169] }, "properties": {} }, @@ -49,10 +37,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -113.37578194870969, - -76.69367044221802 - ] + "coordinates": [-113.37578194870969, -76.69367044221802] }, "properties": {} }, @@ -60,10 +45,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 72.72561073468972, - -66.07423396540386 - ] + "coordinates": [72.72561073468972, -66.07423396540386] }, "properties": {} }, @@ -71,10 +53,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -40.760352456527926, - 35.2020395893229 - ] + "coordinates": [-40.760352456527926, 35.2020395893229] }, "properties": {} }, @@ -82,10 +61,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 64.5926351271439, - -44.17513767822357 - ] + "coordinates": [64.5926351271439, -44.17513767822357] }, "properties": {} }, @@ -93,10 +69,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -42.09615220517878, - -33.50335584434493 - ] + "coordinates": [-42.09615220517878, -33.50335584434493] }, "properties": {} }, @@ -104,10 +77,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -149.22492792801265, - 21.841224879347543 - ] + "coordinates": [-149.22492792801265, 21.841224879347543] }, "properties": {} }, @@ -115,10 +85,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 84.29321157015941, - 0.07515859608883346 - ] + "coordinates": [84.29321157015941, 0.07515859608883346] }, "properties": {} }, @@ -126,10 +93,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -78.3095833369632, - 4.117647950235579 - ] + "coordinates": [-78.3095833369632, 4.117647950235579] }, "properties": {} }, @@ -137,10 +101,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -148.5588515858767, - -63.777936872357444 - ] + "coordinates": [-148.5588515858767, -63.777936872357444] }, "properties": {} }, @@ -148,10 +109,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -100.10454457712412, - 86.03524243483149 - ] + "coordinates": [-100.10454457712412, 86.03524243483149] }, "properties": {} }, @@ -159,10 +117,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 13.436120209269031, - 82.41150556167928 - ] + "coordinates": [13.436120209269031, 82.41150556167928] }, "properties": {} }, @@ -170,10 +125,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 124.28432367091438, - 8.144080311051605 - ] + "coordinates": [124.28432367091438, 8.144080311051605] }, "properties": {} }, @@ -181,10 +133,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -173.04327936439537, - -72.49509733559518 - ] + "coordinates": [-173.04327936439537, -72.49509733559518] }, "properties": {} }, @@ -192,10 +141,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -96.18937306090523, - -57.13860396512657 - ] + "coordinates": [-96.18937306090523, -57.13860396512657] }, "properties": {} }, @@ -203,10 +149,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 94.57455414504705, - 68.25466741220373 - ] + "coordinates": [94.57455414504705, 68.25466741220373] }, "properties": {} }, @@ -214,10 +157,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 81.74710445221764, - -70.17136693930061 - ] + "coordinates": [81.74710445221764, -70.17136693930061] }, "properties": {} }, @@ -225,10 +165,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -175.60441108831705, - -5.460861619300985 - ] + "coordinates": [-175.60441108831705, -5.460861619300985] }, "properties": {} }, @@ -236,10 +173,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -141.4436798546378, - 73.45550273035175 - ] + "coordinates": [-141.4436798546378, 73.45550273035175] }, "properties": {} }, @@ -247,10 +181,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -146.00894799433456, - 68.81252435965777 - ] + "coordinates": [-146.00894799433456, 68.81252435965777] }, "properties": {} }, @@ -258,10 +189,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -141.1682273861793, - -75.59589534868311 - ] + "coordinates": [-141.1682273861793, -75.59589534868311] }, "properties": {} }, @@ -269,10 +197,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -65.48510873602658, - 63.81204037415824 - ] + "coordinates": [-65.48510873602658, 63.81204037415824] }, "properties": {} }, @@ -280,10 +205,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -138.04168562826547, - -35.12478156027714 - ] + "coordinates": [-138.04168562826547, -35.12478156027714] }, "properties": {} }, @@ -291,10 +213,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -7.345168851766726, - 10.815197462658052 - ] + "coordinates": [-7.345168851766726, 10.815197462658052] }, "properties": {} }, @@ -302,10 +221,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -88.88438521329691, - -51.135607358754754 - ] + "coordinates": [-88.88438521329691, -51.135607358754754] }, "properties": {} }, @@ -313,10 +229,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 138.43728672485503, - -49.28473394997033 - ] + "coordinates": [138.43728672485503, -49.28473394997033] }, "properties": {} }, @@ -324,10 +237,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 121.91193801130521, - 43.62048233138311 - ] + "coordinates": [121.91193801130521, 43.62048233138311] }, "properties": {} }, @@ -335,10 +245,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -106.01217795615815, - 86.58776759386622 - ] + "coordinates": [-106.01217795615815, 86.58776759386622] }, "properties": {} }, @@ -346,10 +253,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 155.15099140482403, - 64.4291884202601 - ] + "coordinates": [155.15099140482403, 64.4291884202601] }, "properties": {} }, @@ -357,10 +261,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 6.285539827907183, - 43.07090989642467 - ] + "coordinates": [6.285539827907183, 43.07090989642467] }, "properties": {} }, @@ -368,10 +269,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 173.4289638276471, - 82.07788534436796 - ] + "coordinates": [173.4289638276471, 82.07788534436796] }, "properties": {} }, @@ -379,10 +277,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -135.69217883585586, - -85.81180716608387 - ] + "coordinates": [-135.69217883585586, -85.81180716608387] }, "properties": {} }, @@ -390,10 +285,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -60.29750446366873, - 63.14262347620537 - ] + "coordinates": [-60.29750446366873, 63.14262347620537] }, "properties": {} }, @@ -401,10 +293,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -62.65524929885156, - 82.76057831274042 - ] + "coordinates": [-62.65524929885156, 82.76057831274042] }, "properties": {} }, @@ -412,10 +301,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 3.647638695141726, - 60.28437784958815 - ] + "coordinates": [3.647638695141726, 60.28437784958815] }, "properties": {} }, @@ -423,10 +309,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 66.07623950766029, - -53.519719711469676 - ] + "coordinates": [66.07623950766029, -53.519719711469676] }, "properties": {} }, @@ -434,10 +317,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -103.32561477332257, - -28.078600679457146 - ] + "coordinates": [-103.32561477332257, -28.078600679457146] }, "properties": {} }, @@ -445,10 +325,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 117.02433904022372, - -6.075675781895833 - ] + "coordinates": [117.02433904022372, -6.075675781895833] }, "properties": {} }, @@ -456,10 +333,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -77.05424621483276, - -88.18362440176043 - ] + "coordinates": [-77.05424621483276, -88.18362440176043] }, "properties": {} }, @@ -467,10 +341,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -107.24413765555809, - -53.31111388966479 - ] + "coordinates": [-107.24413765555809, -53.31111388966479] }, "properties": {} }, @@ -478,10 +349,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -46.29469818008551, - 77.06906016616188 - ] + "coordinates": [-46.29469818008551, 77.06906016616188] }, "properties": {} }, @@ -489,10 +357,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 90.62559625004982, - -58.12741750202258 - ] + "coordinates": [90.62559625004982, -58.12741750202258] }, "properties": {} }, @@ -500,10 +365,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 72.97403970358879, - 53.71220806128216 - ] + "coordinates": [72.97403970358879, 53.71220806128216] }, "properties": {} }, @@ -511,10 +373,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -6.423696645118504, - -54.62053611672645 - ] + "coordinates": [-6.423696645118504, -54.62053611672645] }, "properties": {} }, @@ -522,10 +381,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -92.57863432629472, - 39.1899433173881 - ] + "coordinates": [-92.57863432629472, 39.1899433173881] }, "properties": {} }, @@ -533,10 +389,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 94.3018895274722, - -37.87978124619209 - ] + "coordinates": [94.3018895274722, -37.87978124619209] }, "properties": {} }, @@ -544,10 +397,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -59.63452453725998, - 9.312835101197606 - ] + "coordinates": [-59.63452453725998, 9.312835101197606] }, "properties": {} }, @@ -555,10 +405,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 32.74313358469327, - -58.71018187460506 - ] + "coordinates": [32.74313358469327, -58.71018187460506] }, "properties": {} }, @@ -566,10 +413,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 54.08213637169812, - 73.56937517387249 - ] + "coordinates": [54.08213637169812, 73.56937517387249] }, "properties": {} }, @@ -577,10 +421,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 71.66115695922338, - 89.34765770532591 - ] + "coordinates": [71.66115695922338, 89.34765770532591] }, "properties": {} }, @@ -588,10 +429,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 148.22009937003904, - 16.440042348147017 - ] + "coordinates": [148.22009937003904, 16.440042348147017] }, "properties": {} }, @@ -599,10 +437,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 109.96961209627963, - 1.317883999627374 - ] + "coordinates": [109.96961209627963, 1.317883999627374] }, "properties": {} }, @@ -610,10 +445,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 89.11392432194302, - 7.187090763173218 - ] + "coordinates": [89.11392432194302, 7.187090763173218] }, "properties": {} }, @@ -621,10 +453,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 7.397089922527362, - -14.49479933018607 - ] + "coordinates": [7.397089922527362, -14.49479933018607] }, "properties": {} }, @@ -632,10 +461,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -63.33632164620309, - 6.614277893452294 - ] + "coordinates": [-63.33632164620309, 6.614277893452294] }, "properties": {} }, @@ -643,10 +469,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 55.60109788024797, - -50.53410339369433 - ] + "coordinates": [55.60109788024797, -50.53410339369433] }, "properties": {} }, @@ -654,10 +477,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 32.18277610111382, - 22.619992552016637 - ] + "coordinates": [32.18277610111382, 22.619992552016637] }, "properties": {} }, @@ -665,10 +485,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 117.20235858298702, - -38.274881672283044 - ] + "coordinates": [117.20235858298702, -38.274881672283044] }, "properties": {} }, @@ -676,10 +493,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -148.48865535761198, - -45.39820754754232 - ] + "coordinates": [-148.48865535761198, -45.39820754754232] }, "properties": {} }, @@ -687,10 +501,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -172.18848840185686, - -4.842754863901573 - ] + "coordinates": [-172.18848840185686, -4.842754863901573] }, "properties": {} }, @@ -698,10 +509,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 43.00795052700316, - -44.82394719401794 - ] + "coordinates": [43.00795052700316, -44.82394719401794] }, "properties": {} }, @@ -709,10 +517,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 7.984586790965764, - -76.02586619776837 - ] + "coordinates": [7.984586790965764, -76.02586619776837] }, "properties": {} }, @@ -720,10 +525,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 68.39612181028589, - 43.278002948463346 - ] + "coordinates": [68.39612181028589, 43.278002948463346] }, "properties": {} }, @@ -731,10 +533,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 132.2033282476544, - 27.382666929097876 - ] + "coordinates": [132.2033282476544, 27.382666929097876] }, "properties": {} }, @@ -742,10 +541,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -162.00643498458444, - 36.01867885338586 - ] + "coordinates": [-162.00643498458444, 36.01867885338586] }, "properties": {} }, @@ -753,10 +549,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 43.346305680126285, - 51.45674000464121 - ] + "coordinates": [43.346305680126285, 51.45674000464121] }, "properties": {} }, @@ -764,10 +557,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 60.99605027146011, - -75.43512302422783 - ] + "coordinates": [60.99605027146011, -75.43512302422783] }, "properties": {} }, @@ -775,10 +565,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 117.286795694323, - -33.18659469474927 - ] + "coordinates": [117.286795694323, -33.18659469474927] }, "properties": {} }, @@ -786,10 +573,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -104.77795396770827, - -65.654248002992 - ] + "coordinates": [-104.77795396770827, -65.654248002992] }, "properties": {} }, @@ -797,10 +581,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -83.81159332418417, - 89.66881367669653 - ] + "coordinates": [-83.81159332418417, 89.66881367669653] }, "properties": {} }, @@ -808,10 +589,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -145.1702655049707, - -63.04204514510235 - ] + "coordinates": [-145.1702655049707, -63.04204514510235] }, "properties": {} }, @@ -819,10 +597,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 51.73970902606021, - 72.56187337601145 - ] + "coordinates": [51.73970902606021, 72.56187337601145] }, "properties": {} }, @@ -830,10 +605,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -89.51497017142346, - -11.642594253819322 - ] + "coordinates": [-89.51497017142346, -11.642594253819322] }, "properties": {} }, @@ -841,10 +613,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 78.90593679381274, - -37.74321668577914 - ] + "coordinates": [78.90593679381274, -37.74321668577914] }, "properties": {} }, @@ -852,10 +621,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -151.65592145690476, - 83.91736494909414 - ] + "coordinates": [-151.65592145690476, 83.91736494909414] }, "properties": {} }, @@ -863,10 +629,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 101.09924453183163, - -86.4968375258272 - ] + "coordinates": [101.09924453183163, -86.4968375258272] }, "properties": {} }, @@ -874,10 +637,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 89.5887631550857, - -70.98316756584224 - ] + "coordinates": [89.5887631550857, -70.98316756584224] }, "properties": {} }, @@ -885,10 +645,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 110.88640089233499, - -61.394756050132145 - ] + "coordinates": [110.88640089233499, -61.394756050132145] }, "properties": {} }, @@ -896,10 +653,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -6.408007048114506, - -13.206655474747105 - ] + "coordinates": [-6.408007048114506, -13.206655474747105] }, "properties": {} }, @@ -907,10 +661,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -80.34145911471012, - 47.09413813141 - ] + "coordinates": [-80.34145911471012, 47.09413813141] }, "properties": {} }, @@ -918,10 +669,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -98.52823413653272, - -75.34243719432504 - ] + "coordinates": [-98.52823413653272, -75.34243719432504] }, "properties": {} }, @@ -929,10 +677,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -8.397659944248783, - -41.335025921318504 - ] + "coordinates": [-8.397659944248783, -41.335025921318504] }, "properties": {} }, @@ -940,10 +685,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 156.84815091050078, - 25.87816836338686 - ] + "coordinates": [156.84815091050078, 25.87816836338686] }, "properties": {} }, @@ -951,10 +693,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 139.09672720530364, - 37.35325706292393 - ] + "coordinates": [139.09672720530364, 37.35325706292393] }, "properties": {} }, @@ -962,10 +701,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 8.793646682558673, - -34.68886988597508 - ] + "coordinates": [8.793646682558673, -34.68886988597508] }, "properties": {} }, @@ -973,10 +709,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 106.93267903996136, - -20.689254088169832 - ] + "coordinates": [106.93267903996136, -20.689254088169832] }, "properties": {} }, @@ -984,10 +717,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 76.51651800557826, - 66.15715833700494 - ] + "coordinates": [76.51651800557826, 66.15715833700494] }, "properties": {} }, @@ -995,10 +725,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -179.33101817473622, - -24.97493845676012 - ] + "coordinates": [-179.33101817473622, -24.97493845676012] }, "properties": {} }, @@ -1006,10 +733,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 43.88474876000892, - 60.44898938781364 - ] + "coordinates": [43.88474876000892, 60.44898938781364] }, "properties": {} }, @@ -1017,10 +741,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - -23.74702773345115, - 56.44480168552528 - ] + "coordinates": [-23.74702773345115, 56.44480168552528] }, "properties": {} }, @@ -1028,10 +749,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 89.1965818771476, - -63.127928972824996 - ] + "coordinates": [89.1965818771476, -63.127928972824996] }, "properties": {} }, @@ -1039,10 +757,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 139.17803502371603, - 76.80553072643481 - ] + "coordinates": [139.17803502371603, 76.80553072643481] }, "properties": {} }, @@ -1050,10 +765,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 138.04162199308098, - -14.6234595277084 - ] + "coordinates": [138.04162199308098, -14.6234595277084] }, "properties": {} }, @@ -1061,10 +773,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 174.31317825590452, - 12.57531175694111 - ] + "coordinates": [174.31317825590452, 12.57531175694111] }, "properties": {} }, @@ -1072,10 +781,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 36.826555455819346, - 15.871073075400028 - ] + "coordinates": [36.826555455819346, 15.871073075400028] }, "properties": {} }, @@ -1083,10 +789,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 84.65234855310884, - 15.736922349868095 - ] + "coordinates": [84.65234855310884, 15.736922349868095] }, "properties": {} }, @@ -1094,10 +797,7 @@ "type": "Feature", "geometry": { "type": "Point", - "coordinates": [ - 97.5413389416346, - -58.1831539942764 - ] + "coordinates": [97.5413389416346, -58.1831539942764] }, "properties": {} } diff --git a/web/.storybook/public/testdata/sample.gltf b/web/.storybook/public/testdata/sample.gltf index e7d915e191..5e7945f846 100644 --- a/web/.storybook/public/testdata/sample.gltf +++ b/web/.storybook/public/testdata/sample.gltf @@ -1,70 +1,72 @@ - { +{ "scene": 0, - "scenes" : [ + "scenes": [ { - "nodes" : [ 0 ] + "nodes": [0] } ], - - "nodes" : [ + + "nodes": [ { - "mesh" : 0 + "mesh": 0 } ], - - "meshes" : [ + + "meshes": [ { - "primitives" : [ { - "attributes" : { - "POSITION" : 1 - }, - "indices" : 0 - } ] + "primitives": [ + { + "attributes": { + "POSITION": 1 + }, + "indices": 0 + } + ] } ], - "buffers" : [ + "buffers": [ { - "uri" : "data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA=", - "byteLength" : 44 + "uri": "data:application/octet-stream;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAACAPwAAAAA=", + "byteLength": 44 } ], - "bufferViews" : [ + "bufferViews": [ { - "buffer" : 0, - "byteOffset" : 0, - "byteLength" : 6, - "target" : 34963 + "buffer": 0, + "byteOffset": 0, + "byteLength": 6, + "target": 34963 }, { - "buffer" : 0, - "byteOffset" : 8, - "byteLength" : 36, - "target" : 34962 + "buffer": 0, + "byteOffset": 8, + "byteLength": 36, + "target": 34962 } ], - "accessors" : [ + "accessors": [ { - "bufferView" : 0, - "byteOffset" : 0, - "componentType" : 5123, - "count" : 3, - "type" : "SCALAR", - "max" : [ 2 ], - "min" : [ 0 ] + "bufferView": 0, + "byteOffset": 0, + "componentType": 5123, + "count": 3, + "type": "SCALAR", + "max": [2], + "min": [0] }, { - "bufferView" : 1, - "byteOffset" : 0, - "componentType" : 5126, - "count" : 3, - "type" : "VEC3", - "max" : [ 1.0, 1.0, 0.0 ], - "min" : [ 0.0, 0.0, 0.0 ] + "bufferView": 1, + "byteOffset": 0, + "componentType": 5126, + "count": 3, + "type": "VEC3", + "max": [1.0, 1.0, 0.0], + "min": [0.0, 0.0, 0.0] } ], - - "asset" : { - "version" : "2.0" + + "asset": { + "version": "2.0" } } diff --git a/web/.storybook/public/tileset/tileset.json b/web/.storybook/public/tileset/tileset.json index eaddb399a2..e18258af72 100644 --- a/web/.storybook/public/tileset/tileset.json +++ b/web/.storybook/public/tileset/tileset.json @@ -5,38 +5,13 @@ "geometricError": 500, "root": { "transform": [ - 96.86356343768793, - 24.848542777253734, - 0, - 0, - -15.986465724980844, - 62.317780594908875, - 76.5566922962899, - 0, - 19.02322243409411, - -74.15554020821229, - 64.3356267137516, - 0, - 1215107.7612304366, - -4736682.902037748, - 4081926.095098698, - 1 + 96.86356343768793, 24.848542777253734, 0, 0, -15.986465724980844, + 62.317780594908875, 76.5566922962899, 0, 19.02322243409411, + -74.15554020821229, 64.3356267137516, 0, 1215107.7612304366, + -4736682.902037748, 4081926.095098698, 1 ], "boundingVolume": { - "box": [ - 0, - 0, - 0, - 7.0955, - 0, - 0, - 0, - 3.1405, - 0, - 0, - 0, - 5.0375 - ] + "box": [0, 0, 0, 7.0955, 0, 0, 0, 3.1405, 0, 0, 0, 5.0375] }, "geometricError": 1, "refine": "REPLACE", @@ -46,20 +21,7 @@ "children": [ { "boundingVolume": { - "box": [ - 0, - 0, - 0, - 7.0955, - 0, - 0, - 0, - 3.1405, - 0, - 0, - 0, - 5.0375 - ] + "box": [0, 0, 0, 7.0955, 0, 0, 0, 3.1405, 0, 0, 0, 5.0375] }, "geometricError": 0.1, "content": { @@ -68,20 +30,7 @@ "children": [ { "boundingVolume": { - "box": [ - 0, - 0, - 0, - 7.0955, - 0, - 0, - 0, - 3.1405, - 0, - 0, - 0, - 5.0375 - ] + "box": [0, 0, 0, 7.0955, 0, 0, 0, 3.1405, 0, 0, 0, 5.0375] }, "geometricError": 0, "content": { diff --git a/web/.vscode/settings.json b/web/.vscode/settings.json index 170b9e5d8e..7dee390f26 100644 --- a/web/.vscode/settings.json +++ b/web/.vscode/settings.json @@ -1,7 +1,7 @@ { - "typescript.tsdk": "node_modules/typescript/lib", - "yaml.schemas": { - "https://json.schemastore.org/github-workflow": "/.github/workflows/**/*.yml" - }, - "vitest.commandLine": "yarn run vitest watch" + "typescript.tsdk": "node_modules/typescript/lib", + "yaml.schemas": { + "https://json.schemastore.org/github-workflow": "/.github/workflows/**/*.yml" + }, + "vitest.commandLine": "yarn run vitest watch" } diff --git a/web/CODE_OF_CONDUCT.md b/web/CODE_OF_CONDUCT.md index ae596ec118..2969f5f5a4 100644 --- a/web/CODE_OF_CONDUCT.md +++ b/web/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within @@ -118,11 +118,11 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. -Community Impact Guidelines were inspired by +Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. For answers to common questions about this code of conduct, see the FAQ at -[https://www.contributor-covenant.org/faq][FAQ]. Translations are available +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org diff --git a/web/README.md b/web/README.md index b9cadc3b06..385c7f8843 100644 --- a/web/README.md +++ b/web/README.md @@ -1,12 +1,12 @@ # reearth/web -Web interface for Re:Earth GIS software built with React 18 and Vite. +Web interface for Re:Earth GIS software built with React 18 and Vite. ## Getting started ### Development -Add environment variables to .env. A template of the required variables are in `env.local`. +Add environment variables to .env. A template of the required variables are in `env.local`. Consult the development team for the correct environment variables. `yarn start` to start the local server. The interface will open on [http://localhost:3000](http://localhost:3000) diff --git a/web/bin/pluginDoc.ts b/web/bin/pluginDoc.ts index cb82202904..a7423b7b25 100644 --- a/web/bin/pluginDoc.ts +++ b/web/bin/pluginDoc.ts @@ -23,13 +23,13 @@ type P = { for (const s of program.getSourceFiles()) { if (s.fileName.substr(-5) === ".d.ts") continue; const decls: D[] = []; - ts.forEachChild(s, node => { + ts.forEachChild(s, (node) => { const d = parse(node); if (d) { decls.push(d); } }); - const res = render(decls, n => decls.findIndex(d => d.name === n) != -1); + const res = render(decls, (n) => decls.findIndex((d) => d.name === n) != -1); // writeFileSync("./docs/plugin.md", res); console.log(res); } @@ -64,11 +64,13 @@ function parse(node: ts.Node): D | undefined { function render(decls: D[], linkable: (name: string) => boolean): string { return decls - .flatMap(d => [ + .flatMap((d) => [ `# ${d.name}`, d.desc, - d.properties.map(p => `- ${renderHead(p, linkable)}`).join("\n"), - ...d.properties.filter(p => p.desc).flatMap(p => [`## ${renderHead(p, linkable)}`, p.desc]), + d.properties.map((p) => `- ${renderHead(p, linkable)}`).join("\n"), + ...d.properties + .filter((p) => p.desc) + .flatMap((p) => [`## ${renderHead(p, linkable)}`, p.desc]), ]) .filter(Boolean) .join("\n\n"); @@ -78,17 +80,37 @@ function renderHead(p: P, linkable: (name: string) => boolean): string { return [p.name, ": ", renderType(p.type, p.required, linkable)].join(""); } -function renderType(type: string, required: boolean, linkable: (name: string) => boolean) { - const ts = split(type, [") => ", "[]", "?: ", ": ", " & ", " | ", "(", ")", ", "]) - .map(s => +function renderType( + type: string, + required: boolean, + linkable: (name: string) => boolean, +) { + const ts = split(type, [ + ") => ", + "[]", + "?: ", + ": ", + " & ", + " | ", + "(", + ")", + ", ", + ]) + .map((s) => typeof s === "string" && linkable(s) ? { link: s, } : s, ) - .map(s => - typeof s === "string" ? s : "link" in s ? `[${s.link}](#${s.link})` : "s" in s ? s.s : "", + .map((s) => + typeof s === "string" + ? s + : "link" in s + ? `[${s.link}](#${s.link})` + : "s" in s + ? s.s + : "", ) .join(""); const func = / => /.test(type); @@ -104,9 +126,9 @@ function split(text: string, splitter: string[]): (string | { s: string })[] { if (!text.length) return []; const res: (string | { s: string })[] = []; let buf = ""; - for (let i = 0; i < text.length; i++) { - buf += text[i]; - const s = splitter.find(s => buf.includes(s)); + for (const t of text) { + buf += t; + const s = splitter.find((s) => buf.includes(s)); if (s) { res.push(buf.slice(0, -s.length), { s: buf.slice(-s.length) }); buf = ""; diff --git a/web/codegen.ts b/web/codegen.ts index a9c2e23588..a155e4e021 100644 --- a/web/codegen.ts +++ b/web/codegen.ts @@ -7,7 +7,10 @@ const rootGenerateDirectory = `${rootGQLDirectory}__gen__/`; const config: CodegenConfig = { overwrite: true, schema: "../server/gql/*.graphql", - documents: [`${rootGQLDirectory}fragments/*.ts`, `${rootGQLDirectory}queries/*.ts`], + documents: [ + `${rootGQLDirectory}fragments/*.ts`, + `${rootGQLDirectory}queries/*.ts`, + ], generates: { [rootGenerateDirectory]: { preset: "client", diff --git a/web/e2e/utils/index.ts b/web/e2e/utils/index.ts index 42cfb8acd3..a8b796815f 100644 --- a/web/e2e/utils/index.ts +++ b/web/e2e/utils/index.ts @@ -1,5 +1,10 @@ // eslint-disable-next-line no-restricted-imports -import { type APIRequestContext, request, test as base, type Page } from "@playwright/test"; +import { + type APIRequestContext, + request, + test as base, + type Page, +} from "@playwright/test"; import { config, getAccessToken, type Config } from "./config"; @@ -35,7 +40,9 @@ export const test = base.extend<{ async goto(url, options) { const res = await page.goto(url, options); if (this.token) { - await page.evaluate(`window.REEARTH_E2E_ACCESS_TOKEN = ${JSON.stringify(this.token)};`); + await page.evaluate( + `window.REEARTH_E2E_ACCESS_TOKEN = ${JSON.stringify(this.token)};`, + ); } return res; }, diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs new file mode 100644 index 0000000000..376aa35271 --- /dev/null +++ b/web/eslint.config.mjs @@ -0,0 +1,40 @@ +import config from "eslint-config-reearth"; +import playwright from "eslint-plugin-playwright"; + +/** @type { import("eslint").Linter.Config[] } */ + +const themeConfig = [ + { + rules: { + "@typescript-eslint/consistent-type-definitions": "off", + "@typescript-eslint/no-empty-object-type": [ + "error", + { + allowInterfaces: "with-single-extends", + }, + ], + }, + }, +]; + +const e2eConfig = [ + { + files: ["e2e/**/*"], + ...playwright.configs["flat/recommended"], + rules: { + "no-restricted-imports": [ + "error", + { + paths: [ + { + name: "@playwright/test", + message: "Use @reearth/e2e/utils instead.", + }, + ], + }, + ], + }, + }, +]; + +export default [...config("@reearth"), ...e2eConfig, ...themeConfig]; diff --git a/web/index.html b/web/index.html index ab4c00810b..43379d90c8 100644 --- a/web/index.html +++ b/web/index.html @@ -1,21 +1,22 @@ - + + + + Re:Earth + + + + + + - - - Re:Earth - - - - - - - - -
- - - + +
+ + - - - + +
+ + + diff --git a/web/src/app.tsx b/web/src/app.tsx index fc82cc03d8..cc5422e20b 100644 --- a/web/src/app.tsx +++ b/web/src/app.tsx @@ -1,9 +1,8 @@ -import { Suspense } from "react"; - import Loading from "@reearth/beta/components/Loading"; import GlobalModal from "@reearth/beta/features/GlobalModal"; import NotificationBanner from "@reearth/beta/features/Notification"; import { Provider as I18nProvider } from "@reearth/services/i18n"; +import { Suspense } from "react"; import { AuthProvider } from "./services/auth"; import { Provider as GqlProvider } from "./services/gql"; @@ -16,7 +15,9 @@ export default function App() { - }> + } + > diff --git a/web/src/beta/components/Accordion/AccordionItem.tsx b/web/src/beta/components/Accordion/AccordionItem.tsx index e3790456ff..7b66e0f4fb 100644 --- a/web/src/beta/components/Accordion/AccordionItem.tsx +++ b/web/src/beta/components/Accordion/AccordionItem.tsx @@ -1,3 +1,4 @@ +import { styled, useTheme } from "@reearth/services/theme"; import React from "react"; import { AccordionItem as AccordionItemComponent, @@ -7,8 +8,6 @@ import { AccordionItemState, } from "react-accessible-accordion"; -import { styled, useTheme } from "@reearth/services/theme"; - import Icon from "../Icon"; export type Props = { @@ -19,10 +18,21 @@ export type Props = { bg?: string; }; -const AccordionItem: React.FC = ({ className, id, heading, content, bg }) => { +const AccordionItem: React.FC = ({ + className, + id, + heading, + content, + bg, +}) => { const theme = useTheme(); return ( - + diff --git a/web/src/beta/components/Accordion/index.stories.tsx b/web/src/beta/components/Accordion/index.stories.tsx index 7dfbbf6adb..7573d64488 100644 --- a/web/src/beta/components/Accordion/index.stories.tsx +++ b/web/src/beta/components/Accordion/index.stories.tsx @@ -10,10 +10,14 @@ export default meta; type Story = StoryObj; -const SampleHeading =
heading
; +const SampleHeading = ( +
heading
+); const SampleContent = ( -
hoge
+
+ hoge +
); export const Default: Story = { diff --git a/web/src/beta/components/Accordion/index.test.tsx b/web/src/beta/components/Accordion/index.test.tsx index f3436a8f3e..4c7c6ac4e1 100644 --- a/web/src/beta/components/Accordion/index.test.tsx +++ b/web/src/beta/components/Accordion/index.test.tsx @@ -1,6 +1,5 @@ -import { expect, test } from "vitest"; - import { fireEvent, render, screen } from "@reearth/test/utils"; +import { expect, test } from "vitest"; import Accordion, { AccordionItemType } from "./index"; @@ -36,7 +35,11 @@ test("should display items content", () => { test("should open when header button is clicked", () => { render(); - expect(screen.getAllByTestId("atoms-accordion-item-content")[0]).not.toBeVisible(); + expect( + screen.getAllByTestId("atoms-accordion-item-content")[0], + ).not.toBeVisible(); fireEvent.click(screen.getAllByTestId("atoms-accordion-item-header")[0]); - expect(screen.getAllByTestId("atoms-accordion-item-content")[0]).toBeVisible(); + expect( + screen.getAllByTestId("atoms-accordion-item-content")[0], + ).toBeVisible(); }); diff --git a/web/src/beta/components/Accordion/index.tsx b/web/src/beta/components/Accordion/index.tsx index 0595e2787f..6b29e6dbfe 100644 --- a/web/src/beta/components/Accordion/index.tsx +++ b/web/src/beta/components/Accordion/index.tsx @@ -28,8 +28,9 @@ const Accordion: React.FC = ({ className={className} allowZeroExpanded={allowZeroExpanded} data-testid="atoms-accordion" - allowMultipleExpanded={allowMultipleExpanded}> - {items?.map(i => { + allowMultipleExpanded={allowMultipleExpanded} + > + {items?.map((i) => { return ( ; export const Default: Story = { render: () => }; -export const Small: Story = { render: () => }; -export const Large: Story = { render: () => }; +export const Small: Story = { + render: () => , +}; +export const Large: Story = { + render: () => , +}; diff --git a/web/src/beta/components/Avatar/index.tsx b/web/src/beta/components/Avatar/index.tsx index 162a9f9a14..8a1c3ed971 100644 --- a/web/src/beta/components/Avatar/index.tsx +++ b/web/src/beta/components/Avatar/index.tsx @@ -1,8 +1,7 @@ -import React from "react"; - import Flex from "@reearth/beta/components/Flex"; import Text from "@reearth/beta/components/Text"; import { styled, useTheme } from "@reearth/services/theme"; +import React from "react"; export type Size = "small" | "large"; @@ -33,10 +32,13 @@ const Avatar: React.FC = ({ size={size} avatar={avatar} background={background ?? theme.bg[4]} - borderRadius={borderRadius}> + borderRadius={borderRadius} + > {innerText && ( - {typeof innerText === "number" ? `+${innerText.toString()}` : innerText.charAt(0)} + {typeof innerText === "number" + ? `+${innerText.toString()}` + : innerText.charAt(0)} )} @@ -52,7 +54,8 @@ const StyledAvatar = styled(Flex)<{ width: ${({ size }) => (size === "large" ? "64px" : "32px")}; height: ${({ size }) => (size === "large" ? "64px" : "32px")}; border-radius: ${({ borderRadius }) => borderRadius ?? "50%"}; - background: ${({ avatar, background }) => (avatar ? `url(${avatar});` : background)}; + background: ${({ avatar, background }) => + avatar ? `url(${avatar});` : background}; `; export default Avatar; diff --git a/web/src/beta/components/Box/index.tsx b/web/src/beta/components/Box/index.tsx index 674614eeff..64a4ab1757 100644 --- a/web/src/beta/components/Box/index.tsx +++ b/web/src/beta/components/Box/index.tsx @@ -1,7 +1,6 @@ -import { CSSProperties } from "react"; - import { MetricsSizes, metricsSizes } from "@reearth/beta/utils/metrics"; import { styled } from "@reearth/services/theme"; +import { CSSProperties } from "react"; export type Props = { className?: string; @@ -43,7 +42,7 @@ type OtherCSSProperties = { type BoxProps = MetricsProps & BorderProps & OtherCSSProperties; -const Box: React.FC = props => { +const Box: React.FC = (props) => { const { className, children, onClick, ...styleProps } = props; return ( @@ -53,37 +52,50 @@ const Box: React.FC = props => { }; const Wrapper = styled.div` - background-color: ${props => props.bg}; - width: ${props => props.width}; - margin: ${props => (props.m && props.m in metricsSizes ? `${metricsSizes[props.m]}px}` : "")}; - margin: ${props => (props.mv && props.mv in metricsSizes ? `${metricsSizes[props.mv]}px 0` : "")}; - margin: ${props => (props.mh && props.mh in metricsSizes ? `0 ${metricsSizes[props.mh]}px` : "")}; - margin-top: ${props => + background-color: ${(props) => props.bg}; + width: ${(props) => props.width}; + margin: ${(props) => + props.m && props.m in metricsSizes ? `${metricsSizes[props.m]}px}` : ""}; + margin: ${(props) => + props.mv && props.mv in metricsSizes + ? `${metricsSizes[props.mv]}px 0` + : ""}; + margin: ${(props) => + props.mh && props.mh in metricsSizes + ? `0 ${metricsSizes[props.mh]}px` + : ""}; + margin-top: ${(props) => props.mt && props.mt in metricsSizes ? `${metricsSizes[props.mt]}px` : ""}; - margin-bottom: ${props => + margin-bottom: ${(props) => props.mb && props.mb in metricsSizes ? `${metricsSizes[props.mb]}px` : ""}; - margin-right: ${props => + margin-right: ${(props) => props.mr && props.mr in metricsSizes ? `${metricsSizes[props.mr]}px` : ""}; - margin-left: ${props => + margin-left: ${(props) => props.ml && props.ml in metricsSizes ? `${metricsSizes[props.ml]}px` : ""}; - padding: ${props => (props.p && props.p in metricsSizes ? `${metricsSizes[props.p]}px` : "")}; - padding: ${props => - props.pv && props.pv in metricsSizes ? `${metricsSizes[props.pv]}px 0` : ""}; - padding: ${props => - props.ph && props.ph in metricsSizes ? `0 ${metricsSizes[props.ph]}px` : ""}; - padding-top: ${props => + padding: ${(props) => + props.p && props.p in metricsSizes ? `${metricsSizes[props.p]}px` : ""}; + padding: ${(props) => + props.pv && props.pv in metricsSizes + ? `${metricsSizes[props.pv]}px 0` + : ""}; + padding: ${(props) => + props.ph && props.ph in metricsSizes + ? `0 ${metricsSizes[props.ph]}px` + : ""}; + padding-top: ${(props) => props.pt && props.pt in metricsSizes ? `${metricsSizes[props.pt]}px` : ""}; - padding-bottom: ${props => + padding-bottom: ${(props) => props.pb && props.pb in metricsSizes ? `${metricsSizes[props.pb]}px` : ""}; - padding-right: ${props => + padding-right: ${(props) => props.pr && props.pr in metricsSizes ? `${metricsSizes[props.pr]}px` : ""}; - padding-left: ${props => + padding-left: ${(props) => props.pl && props.pl in metricsSizes ? `${metricsSizes[props.pl]}px` : ""}; - border: ${props => props.border}; - border-radius: ${props => (props.border ? `${props.borderRadius}px` : "")}; - border-width: ${props => (props.borderWidth ? `${props.borderWidth}px` : "")}; - border-color: ${props => (props.borderColor ? `${props.borderColor}` : "")}; - border-style: ${props => (props.borderStyle ? `${props.borderStyle}` : "")}; + border: ${(props) => props.border}; + border-radius: ${(props) => (props.border ? `${props.borderRadius}px` : "")}; + border-width: ${(props) => + props.borderWidth ? `${props.borderWidth}px` : ""}; + border-color: ${(props) => (props.borderColor ? `${props.borderColor}` : "")}; + border-style: ${(props) => (props.borderStyle ? `${props.borderStyle}` : "")}; `; export default Box; diff --git a/web/src/beta/components/Button/index.stories.tsx b/web/src/beta/components/Button/index.stories.tsx index 54cb42cbd0..8f5747e9b3 100644 --- a/web/src/beta/components/Button/index.stories.tsx +++ b/web/src/beta/components/Button/index.stories.tsx @@ -31,7 +31,9 @@ export const SecondarySmall: Story = { }; export const SecondaryMedium: Story = { - render: () => + // `asChild` allows the user to pass any element as the anchor + if (asChild && isValidElement(children)) { + return cloneElement( + children, + context.getReferenceProps({ + ref, + ...props, + ...children.props, + "data-state": context.open ? "open" : "closed", + }), ); - }, -); + } + + return ( + + ); +}); type ContentProps = { className?: string; attachToRoot?: boolean; }; -export const Content = forwardRef & ContentProps>( - function Content({ style, className, attachToRoot = false, ...props }, propRef) { - const { context: floatingContext, ...context } = usePopoverContext(); - const theme = useTheme(); - const ref = useMergeRefs([context.refs.setFloating, propRef]); - const { isMounted, styles: transitionStyles } = useTransitionStyles(floatingContext, { +export const Content = forwardRef< + HTMLDivElement, + HTMLProps & ContentProps +>(function Content( + { style, className, attachToRoot = false, ...props }, + propRef, +) { + const { context: floatingContext, ...context } = usePopoverContext(); + const theme = useTheme(); + const ref = useMergeRefs([context.refs.setFloating, propRef]); + const { isMounted, styles: transitionStyles } = useTransitionStyles( + floatingContext, + { duration: 50, - }); + }, + ); - if (!isMounted) return null; + if (!isMounted) return null; - return ( - ) : null}> - -
- {props.children} -
-
-
- ); - }, -); + return ( + ) + : null + } + > + +
+ {props.children} +
+
+
+ ); +}); -export const Close = forwardRef>( - function PopoverClose(props, ref) { - const { setOpen } = usePopoverContext(); - return ( -