@reearth/core 0.0.7-alpha.11 → 0.0.7-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reearth/core",
3
- "version": "0.0.7-alpha.11",
3
+ "version": "0.0.7-alpha.12",
4
4
  "author": "Re:Earth contributors <community@reearth.io>",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A library that abstracts a map engine as one common API.",
@@ -32,6 +32,13 @@
32
32
  "react-dom": "^18.2.0"
33
33
  },
34
34
  "dependencies": {
35
+ "@radix-ui/react-checkbox": "1.1.1",
36
+ "@radix-ui/react-select": "2.1.1",
37
+ "@radix-ui/react-separator": "1.1.0",
38
+ "@radix-ui/react-switch": "1.1.0",
39
+ "@radix-ui/react-dialog": "1.1.1",
40
+ "@radix-ui/react-icons": "1.3.0",
41
+ "@radix-ui/react-slot": "1.1.0",
35
42
  "@reearth/cesium-mvt-imagery-provider": "1.5.4",
36
43
  "@rot1024/use-transition": "1.0.0",
37
44
  "@seznam/compose-react-refs": "1.0.6",
@@ -61,8 +68,11 @@
61
68
  "react-error-boundary": "4.0.11",
62
69
  "react-nl2br": "1.0.4",
63
70
  "react-use": "17.5.0",
64
- "resium": "1.18.1",
71
+ "resium": "1.18.2",
65
72
  "suspend-react": "0.1.3",
73
+ "tailwind-merge": "2.5.2",
74
+ "tailwindcss": "3.4.10",
75
+ "tailwindcss-animate": "1.0.7",
66
76
  "tiny-invariant": "1.3.3",
67
77
  "use-callback-ref": "1.3.2",
68
78
  "use-custom-compare": "1.4.0",
@@ -91,17 +101,22 @@
91
101
  "@types/pbf": "3.0.5",
92
102
  "@types/react": "18.3.0",
93
103
  "@types/react-dom": "18.3.0",
104
+ "@types/scheduler": "0.23.0",
94
105
  "@types/uuid": "9.0.8",
95
106
  "@typescript-eslint/eslint-plugin": "7.2.0",
96
107
  "@typescript-eslint/parser": "7.2.0",
97
108
  "@vitejs/plugin-react": "4.2.1",
109
+ "autoprefixer": "10.4.20",
98
110
  "cesium": "1.118.0",
111
+ "class-variance-authority": "0.7.0",
112
+ "clsx": "2.1.1",
99
113
  "eslint": "8.57.0",
100
114
  "eslint-config-reearth": "0.3.0",
101
115
  "eslint-plugin-react-hooks": "4.6.0",
102
116
  "eslint-plugin-react-refresh": "0.4.6",
103
117
  "eslint-plugin-storybook": "0.8.0",
104
118
  "jsdom": "22.1.0",
119
+ "postcss": "8.4.41",
105
120
  "prettier": "3.2.5",
106
121
  "react": "18.2.0",
107
122
  "react-dom": "18.2.0",
@@ -17,15 +17,16 @@ import {
17
17
  GroundPrimitive,
18
18
  } from "cesium";
19
19
  import md5 from "js-md5";
20
- import { isEqual, pick } from "lodash-es";
20
+ import { pick } from "lodash-es";
21
21
  import {
22
22
  ComponentProps,
23
23
  ComponentType,
24
24
  ForwardedRef,
25
25
  forwardRef,
26
+ useCallback,
26
27
  useLayoutEffect,
27
28
  useMemo,
28
- useRef,
29
+ useState,
29
30
  } from "react";
30
31
  import { type CesiumComponentRef, Entity } from "resium";
31
32
 
@@ -86,19 +87,11 @@ function EntityExtComponent(
86
87
  }: ComponentProps<typeof Entity> & Tag,
87
88
  ref: ForwardedRef<CesiumComponentRef<CesiumEntity>>,
88
89
  ) {
89
- const r = useRef<CesiumComponentRef<CesiumEntity>>(null);
90
- const entityRef = useRef<CesiumEntity | undefined>(r?.current?.cesiumElement);
90
+ const [entity, setEntity] = useState<CesiumComponentRef<CesiumEntity> | null>(null);
91
91
 
92
92
  useLayoutEffect(() => {
93
- // Note: Sketch feature's tag cannot be attached properly when first load
94
- // The cesiumElement is undefined when attach, and doesn't have a chance to attach again.
95
- // Root cause is still not clear.
96
- // Here we add r.current as a dependency and check cesiumElement instead.
97
- if (entityRef.current !== undefined && isEqual(entityRef.current, r.current?.cesiumElement))
98
- return;
99
- entityRef.current = r.current?.cesiumElement;
100
-
101
- attachTag(r.current?.cesiumElement, {
93
+ if (!entity?.cesiumElement) return;
94
+ attachTag(entity.cesiumElement, {
102
95
  layerId: layerId || props.id,
103
96
  featureId,
104
97
  draggable,
@@ -106,7 +99,6 @@ function EntityExtComponent(
106
99
  legacyLocationPropertyKey,
107
100
  hideIndicator,
108
101
  });
109
- // eslint-disable-next-line react-hooks/exhaustive-deps
110
102
  }, [
111
103
  draggable,
112
104
  featureId,
@@ -115,10 +107,12 @@ function EntityExtComponent(
115
107
  props.id,
116
108
  unselectable,
117
109
  hideIndicator,
118
- r.current,
110
+ entity,
119
111
  ]);
120
112
 
121
- return <Entity ref={composeRefs(ref, r)} {...props} />;
113
+ const handleRef = useCallback((r: CesiumComponentRef<CesiumEntity>) => setEntity(r), []);
114
+
115
+ return <Entity ref={composeRefs(ref, handleRef)} {...props} />;
122
116
  }
123
117
 
124
118
  export function attachTag(