Skip to content

Commit c5cf0ce

Browse files
committed
refactor: properties & events & clean up
1 parent 1a672a0 commit c5cf0ce

File tree

8 files changed

+160
-25
lines changed

8 files changed

+160
-25
lines changed

Diff for: .vscode/mdx.code-snippets

+59
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,41 @@
2222
],
2323
"description": "Page meta",
2424
},
25+
"API": {
26+
"prefix": "api",
27+
"body": [
28+
"`${1:description}`",
29+
"",
30+
"## Properties`",
31+
"",
32+
"## Methods",
33+
"",
34+
"## Events",
35+
"",
36+
"## References",
37+
],
38+
},
39+
"Property": {
40+
"prefix": "property",
41+
"body": [
42+
"### `${1:name}`",
43+
"",
44+
"`${2:description}`",
45+
"",
46+
"#### Syntax",
47+
"",
48+
"```ts",
49+
"${3:code}",
50+
"```",
51+
"",
52+
"#### Return Value",
53+
"",
54+
"**Type** `${4:type}`",
55+
"",
56+
"${5:description}",
57+
],
58+
"description": "Property",
59+
},
2560
"Method": {
2661
"prefix": "method",
2762
"body": [
@@ -39,6 +74,10 @@
3974
"",
4075
"#### Return Value",
4176
"",
77+
"**Type** `${4:type}`",
78+
"",
79+
"${5:description}",
80+
"",
4281
"#### Example",
4382
"",
4483
],
@@ -60,4 +99,24 @@
6099
"body": ["**Type** `${1:type}`", "", "${2:description}"],
61100
"description": "Return value",
62101
},
102+
"Event": {
103+
"prefix": "event",
104+
"body": [
105+
"### `${1:name}`",
106+
"",
107+
"`${2:description}`",
108+
"",
109+
"#### Syntax",
110+
"",
111+
"```ts",
112+
"${3:code}",
113+
"```",
114+
"",
115+
"#### Parameters",
116+
"",
117+
"#### Example",
118+
"",
119+
],
120+
"description": "Event",
121+
},
63122
}

Diff for: README.md

+32-11
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
1-
# Starlight Starter Kit: Basics
1+
# Re:Earth Visualizer Developer Documentation
22

33
[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)
44

5+
## Markdown Snippets
6+
7+
We have provided a set of code snippets for Visual Studio Code to help you write markdown files faster. Please check this file for supported snippets.
8+
9+
```planetext
10+
.vscode/mdx.code-snippets
511
```
6-
npm create astro@latest -- --template starlight
12+
13+
## Manage Codes
14+
15+
To avoid markdown files from becoming too long, we have provided a way to manage codes in separate files. Please put your code file to `src/content/code/` and manage with the same folder structure as the document.
16+
You can import the code text and use it like this:
17+
18+
```mdx
19+
import Add3dModelCode from "@code/plugin-api/layers/add-3d-model?raw";
20+
import { clearNoCheck } from "@code/utils";
21+
22+
<Code code={clearNoCheck(Add3dModelCode)} lang="ts" />
723
```
824

9-
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
10-
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
11-
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics)
12-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs)
25+
## Mangae Assets
26+
27+
Please manage the assets in subfolders of `src/assets` following the same structure as the document.
28+
Use `@assets` instead of relative paths to refer to the assets in markdown files.
1329

14-
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
30+
```markdown
31+
![Re:Earth Logo](@assets/ReearthLogoColorful.svg)
32+
```
1533

16-
## 🚀 Project Structure
34+
## Project Structure
1735

1836
Inside of your Astro + Starlight project, you'll see the following folders and files:
1937

20-
```
38+
```planetext
2139
.
2240
├── public/
2341
├── src/
2442
│ ├── assets/
2543
│ ├── content/
44+
│ │ ├── code/
2645
│ │ ├── docs/
46+
│ │ ├── i18n/
2747
│ │ └── config.ts
48+
│ ├── styles/
2849
│ └── env.d.ts
2950
├── astro.config.mjs
3051
├── package.json
@@ -37,7 +58,7 @@ Images can be added to `src/assets/` and embedded in Markdown with a relative li
3758

3859
Static assets, like favicons, can be placed in the `public/` directory.
3960

40-
## 🧞 Commands
61+
## Commands
4162

4263
All commands are run from the root of the project, from a terminal:
4364

@@ -50,6 +71,6 @@ All commands are run from the root of the project, from a terminal:
5071
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
5172
| `npm run astro -- --help` | Get help using the Astro CLI |
5273

53-
## 👀 Want to learn more?
74+
## Want to learn more?
5475

5576
Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).

Diff for: src/assets/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Please manage the assets in subfolders following the same structure as the document.

Diff for: src/assets/houston.webp

-96.2 KB
Binary file not shown.

Diff for: src/content/code/plugin-api/layers/type-lazylayer.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @ts-nocheck
2+
3+
type LazyLayer = Readonly<Layer> & {
4+
computed?: Readonly<ComputedLayer>;
5+
isTempLayer?: boolean;
6+
pluginId?: string;
7+
extensionId?: string;
8+
property?: any;
9+
propertyId?: string;
10+
isVisible?: boolean;
11+
};

Diff for: src/content/docs/plugin-api/layers.mdx

+55-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,29 @@ import { Code } from "@astrojs/starlight/components";
99
import { Tabs, TabItem } from "@astrojs/starlight/components";
1010
import { clearNoCheck } from "@code/utils";
1111

12+
## Properties
13+
14+
### layers
15+
16+
This property provides a list of all layers currently exists in the **`reearth`** scene, allowing plugin developers to access and manipulate the layers as needed. The property returns an array of **`LazyLayer`** objects, each representing a distinct layer within the scene.
17+
18+
#### Syntax
19+
20+
```ts
21+
reearth.layers.layers: LazyLayer[];
22+
```
23+
24+
#### Return Value
25+
26+
**Type** `LazyLayer[]`
27+
28+
An array of **`LazyLayer`** objects, each representing a distinct layer within the scene.
29+
30+
:::note
31+
Please note that the **`LazyLayer`** object is a lightweight representation of a layer, you need to expcitly visit its property based on your needs.
32+
For more information on LazyLayer Types, please refer to [LazyLayer Type](#lazylayer-type) section.
33+
:::
34+
1235
## Methods
1336

1437
### add
@@ -97,20 +120,50 @@ import FindLayerCode from "@code/plugin-api/layers/find-layer?raw";
97120

98121
### select
99122

100-
**TODO** Description of the event.
123+
Select event is triggered when a layer is selected within the **`reearth`** scene. The event provides information about the selected layer, including its unique identifier `id`, allowing plugin developers to respond to user interactions or changes in the scene.
124+
125+
#### Syntax
126+
127+
```ts
128+
reearth.layers.on("select", (layerId: string | undefined, featureId: string | undefined) => void): void;
129+
```
130+
131+
#### Parameters
132+
133+
##### `layerId`
134+
135+
**Type**: `string | undefined`
136+
137+
The unique identifier of the selected layer. If no layer is selected, the value is `undefined`.
138+
139+
##### `featureId`
140+
141+
**Type**: `string | undefined`
142+
143+
The unique identifier of the selected feature within the layer. If no feature is selected, the value is `undefined`. Usually there will always be a feature selected when a layer is selected.
101144

102145
## References
103146

104147
### Layer Type
105148

106-
**TODO** Description of the layer type.
149+
**TODO** Description of the Layer type.
107150

108151
import TypeLayer from "@code/plugin-api/layers/type-layer?raw";
109152

110153
<Code code={clearNoCheck(TypeLayer)} lang="ts" />
111154

155+
### LazyLayer Type
156+
157+
**TODO** Description of the LazyLayer type.
158+
159+
import TypeLazyLayer from "@code/plugin-api/layers/type-lazylayer?raw";
160+
161+
<Code code={clearNoCheck(TypeLazyLayer)} lang="ts" />
162+
112163
### Layer Appearance Types
113164

165+
**TODO** Description of the Layer Appearance types.
166+
114167
import TypeAppearanceMarker from "@code/plugin-api/layers/type-appearance-marker?raw";
115168
import TypeAppearancePolyline from "@code/plugin-api/layers/type-appearance-polyline?raw";
116169
import TypeAppearancePolygon from "@code/plugin-api/layers/type-appearance-polygon?raw";

Diff for: src/content/docs/template.mdx

-11
This file was deleted.

Diff for: tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"skipLibCheck": true,
55
"baseUrl": "./",
66
"paths": {
7-
"@code/*": ["src/content/code/*"]
7+
"@code/*": ["src/content/code/*"],
8+
"@assets/*": ["src/assets/*"]
89
}
910
},
1011
"include": ["src"],

0 commit comments

Comments
 (0)