ty-element 1.1.1
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/README.md +23 -0
- package/dist/components/animate-container/index.d.ts +9 -0
- package/dist/components/animate-container/type.d.ts +67 -0
- package/dist/components/button/count/index.d.ts +3 -0
- package/dist/components/button/count/type.d.ts +16 -0
- package/dist/components/button/glow/index.d.ts +9 -0
- package/dist/components/button/glow/type.d.ts +21 -0
- package/dist/components/button/ripple/index.d.ts +9 -0
- package/dist/components/button/ripple/type.d.ts +30 -0
- package/dist/components/button/streamer/index.d.ts +3 -0
- package/dist/components/button/streamer/type.d.ts +11 -0
- package/dist/components/carousel/index.d.ts +10 -0
- package/dist/components/carousel/type.d.ts +18 -0
- package/dist/components/globe/entity-collection.d.ts +22 -0
- package/dist/components/globe/entity.d.ts +12 -0
- package/dist/components/globe/globe.d.ts +106 -0
- package/dist/components/globe/index.d.ts +3 -0
- package/dist/components/globe/sat-util.d.ts +26 -0
- package/dist/components/globe/satellite.d.ts +107 -0
- package/dist/components/globe/type.d.ts +71 -0
- package/dist/components/globe/wide-line/geometry.d.ts +22 -0
- package/dist/components/globe/wide-line/index.d.ts +7 -0
- package/dist/components/globe/wide-line/material.d.ts +22 -0
- package/dist/components/globe/wide-line/type.d.ts +10 -0
- package/dist/components/loading/progress/index.d.ts +8 -0
- package/dist/components/loading/progress/type.d.ts +80 -0
- package/dist/components/loading/tick/index.d.ts +8 -0
- package/dist/components/loading/tick/type.d.ts +36 -0
- package/dist/components/loading/water-progress/index.d.ts +8 -0
- package/dist/components/loading/water-progress/type.d.ts +31 -0
- package/dist/components/map/compare-map/index.d.ts +38 -0
- package/dist/components/map/compare-map/type.d.ts +52 -0
- package/dist/components/map/data-selector-map/index.d.ts +30 -0
- package/dist/components/map/data-selector-map/type.d.ts +99 -0
- package/dist/components/map/gis-map/index.d.ts +9 -0
- package/dist/components/map/gis-map/type.d.ts +132 -0
- package/dist/components/map/gis-maplibre/crepuscule/index.d.ts +49 -0
- package/dist/components/map/gis-maplibre/custom-layers/atmosphere-layer/index.d.ts +5 -0
- package/dist/components/map/gis-maplibre/custom-layers/atmosphere-layer/type.d.ts +20 -0
- package/dist/components/map/gis-maplibre/custom-layers/index.d.ts +40 -0
- package/dist/components/map/gis-maplibre/custom-layers/satellite-layer/clock.d.ts +17 -0
- package/dist/components/map/gis-maplibre/custom-layers/satellite-layer/index.d.ts +135 -0
- package/dist/components/map/gis-maplibre/custom-layers/satellite-layer/source.d.ts +65 -0
- package/dist/components/map/gis-maplibre/custom-layers/satellite-layer/type.d.ts +75 -0
- package/dist/components/map/gis-maplibre/custom-layers/star-layer/index.d.ts +6 -0
- package/dist/components/map/gis-maplibre/custom-layers/star-layer/type.d.ts +14 -0
- package/dist/components/map/gis-maplibre/custom-layers/sync-camera.d.ts +2 -0
- package/dist/components/map/gis-maplibre/custom-layers/type.d.ts +7 -0
- package/dist/components/map/gis-maplibre/index.d.ts +8 -0
- package/dist/components/map/gis-maplibre/type.d.ts +236 -0
- package/dist/components/map/gis-marker/index.d.ts +12 -0
- package/dist/components/map/gis-marker/type.d.ts +36 -0
- package/dist/components/map/multi-map/index.d.ts +8 -0
- package/dist/components/map/multi-map/syncMaps.d.ts +3 -0
- package/dist/components/map/multi-map/type.d.ts +2 -0
- package/dist/components/map/stac-data-map/index.d.ts +46 -0
- package/dist/components/map/stac-data-map/type.d.ts +78 -0
- package/dist/components/radar/index.d.ts +3 -0
- package/dist/components/radar/radar-instance.d.ts +34 -0
- package/dist/components/radar/type.d.ts +58 -0
- package/dist/components/ripple-container/index.d.ts +8 -0
- package/dist/components/ripple-container/type.d.ts +23 -0
- package/dist/components/table/index.d.ts +3 -0
- package/dist/components/table/type.d.ts +114 -0
- package/dist/components/third-part/delete-button/index.d.ts +8 -0
- package/dist/components/third-part/delete-button/type.d.ts +28 -0
- package/dist/components/third-part/dragger-upload/index.d.ts +8 -0
- package/dist/components/third-part/dragger-upload/type.d.ts +8 -0
- package/dist/components/third-part/key-value/index.d.ts +8 -0
- package/dist/components/third-part/key-value/type.d.ts +47 -0
- package/dist/components/third-part/slider-input/index.d.ts +8 -0
- package/dist/components/third-part/slider-input/type.d.ts +40 -0
- package/dist/components/timeline/index.d.ts +8 -0
- package/dist/components/timeline/type.d.ts +105 -0
- package/dist/constants/index.d.ts +39 -0
- package/dist/draco/README.md +32 -0
- package/dist/draco/draco_decoder.js +34 -0
- package/dist/draco/draco_decoder.wasm +0 -0
- package/dist/draco/draco_encoder.js +33 -0
- package/dist/draco/draco_wasm_wrapper.js +117 -0
- package/dist/draco/gltf/draco_decoder.js +33 -0
- package/dist/draco/gltf/draco_decoder.wasm +0 -0
- package/dist/draco/gltf/draco_encoder.js +33 -0
- package/dist/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/dist/earth.jpg +0 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.js +33146 -0
- package/dist/shaders/program/index.d.ts +30 -0
- package/dist/shaders/shader.d.ts +16 -0
- package/dist/style.css +7 -0
- package/dist/types/geometry.d.ts +39 -0
- package/dist/types/stac.d.ts +69 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/utils/css/index.d.ts +8 -0
- package/dist/utils/io/index.d.ts +4 -0
- package/dist/utils/object/index.d.ts +6 -0
- package/dist/utils/random/index.d.ts +13 -0
- package/dist/utils/sat/index.d.ts +11 -0
- package/dist/utils/sat/type.d.ts +22 -0
- package/dist/utils/tle/index.d.ts +49 -0
- package/dist/utils/tle/type.d.ts +36 -0
- package/dist/utils/unit/index.d.ts +6 -0
- package/package.json +105 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 使用
|
|
2
|
+
|
|
3
|
+
- 在 main.tsx 中导入样式文件
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import "ty-element/dist/style.css";
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
- 如果使用 pnpm 则不需要安装 peerDependencies 中的内容
|
|
10
|
+
|
|
11
|
+
- 不需要再安装 animate.css
|
|
12
|
+
|
|
13
|
+
# 发布
|
|
14
|
+
|
|
15
|
+
- 先去 src/index.ts 中导入新开发的组件以及组件对应的 ts 类型
|
|
16
|
+
|
|
17
|
+
- 然后在 examples 中进行测试,相应的 props 与类型是否有提示
|
|
18
|
+
|
|
19
|
+
- 测试通过后,pnpm build
|
|
20
|
+
|
|
21
|
+
- 打包完成后,将 package.json 文件中的 version 进行修改
|
|
22
|
+
|
|
23
|
+
- 设置好 npm 源后,npm publish
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnimateContainerProps } from './type';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @description 带有动画的容器,容器默认撑开包含块
|
|
5
|
+
* @author tiancheng.xia
|
|
6
|
+
* @since 2024/12/31
|
|
7
|
+
*/
|
|
8
|
+
declare const AnimateContainer: (props: AnimateContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default AnimateContainer;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export declare const ANIMATE_NAMES: readonly ["none", "bounce", "flash", "pulse", "rubberBand", "shakeX", "shakeY", "headShake", "swing", "tada", "wobble", "jello", "heartBeat", "backInDown", "backInLeft", "backInRight", "backInUp", "backOutDown", "backOutLeft", "backOutRight", "backOutUp", "bounceIn", "bounceInDown", "bounceInLeft", "bounceInRight", "bounceInUp", "bounceOut", "bounceOutDown", "bounceOutLeft", "bounceOutRight", "bounceOutUp", "fadeIn", "fadeInDown", "fadeInDownBig", "fadeInLeft", "fadeInLeftBig", "fadeInRight", "fadeInRightBig", "fadeInUp", "fadeInUpBig", "fadeInTopLeft", "fadeInTopRight", "fadeInBottomLeft", "fadeInBottomRight", "fadeOut", "fadeOutDown", "fadeOutDownBig", "fadeOutLeft", "fadeOutLeftBig", "fadeOutRight", "fadeOutRightBig", "fadeOutUp", "fadeOutUpBig", "fadeOutTopLeft", "fadeOutTopRight", "fadeOutBottomRight", "fadeOutBottomLeft", "flip", "flipInX", "flipInY", "flipOutX", "flipOutY", "lightSpeedInRight", "lightSpeedInLeft", "lightSpeedOutRight", "lightSpeedOutLeft", "rotateIn", "rotateInDownLeft", "rotateInDownRight", "rotateInUpLeft", "rotateInUpRight", "rotateOut", "rotateOutDownLeft", "rotateOutDownRight", "rotateOutUpLeft", "rotateOutUpRight", "hinge", "jackInTheBox", "rollIn", "rollOut", "zoomIn", "zoomInDown", "zoomInLeft", "zoomInRight", "zoomInUp", "zoomOut", "zoomOutDown", "zoomOutLeft", "zoomOutRight", "zoomOutUp", "slideInDown", "slideInLeft", "slideInRight", "slideInUp", "slideOutDown", "slideOutLeft", "slideOutRight", "slideOutUp"];
|
|
3
|
+
export type AnimateName = (typeof ANIMATE_NAMES)[number];
|
|
4
|
+
export type AnimateContainerProps = {
|
|
5
|
+
/**
|
|
6
|
+
* @description 插槽
|
|
7
|
+
*/
|
|
8
|
+
children?: string | ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* @description 加载根的类名
|
|
11
|
+
*/
|
|
12
|
+
loadingClassName?: string;
|
|
13
|
+
/**
|
|
14
|
+
* @description 最外层容器类名
|
|
15
|
+
*/
|
|
16
|
+
rootClassName?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @description 容器宽度
|
|
19
|
+
*/
|
|
20
|
+
width?: CSSProperties["width"];
|
|
21
|
+
/**
|
|
22
|
+
* @description 容器高度
|
|
23
|
+
*/
|
|
24
|
+
height?: CSSProperties["height"];
|
|
25
|
+
/**
|
|
26
|
+
* @description 容器背景色
|
|
27
|
+
*/
|
|
28
|
+
bg?: CSSProperties["background"];
|
|
29
|
+
/**
|
|
30
|
+
* @description 是否开启弹性布局
|
|
31
|
+
*/
|
|
32
|
+
flex?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @description 水平对齐方式
|
|
35
|
+
*/
|
|
36
|
+
justify?: CSSProperties["justifyContent"];
|
|
37
|
+
/**
|
|
38
|
+
* @description 垂直对齐方式
|
|
39
|
+
*/
|
|
40
|
+
align?: CSSProperties["alignItems"];
|
|
41
|
+
/**
|
|
42
|
+
* @description 垂直对齐方式
|
|
43
|
+
*/
|
|
44
|
+
direction?: "v" | "h";
|
|
45
|
+
/**
|
|
46
|
+
* @description 弹性布局时的间隙
|
|
47
|
+
*/
|
|
48
|
+
gap?: CSSProperties["gap"];
|
|
49
|
+
/**
|
|
50
|
+
* @description 当容器有loading时候,当element为非空的时候,除了spin,其他属性失效
|
|
51
|
+
*/
|
|
52
|
+
loadingOptions?: {
|
|
53
|
+
element?: ReactNode;
|
|
54
|
+
spin?: boolean;
|
|
55
|
+
text?: string | ReactNode;
|
|
56
|
+
size?: number;
|
|
57
|
+
color?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* @description 动画名称
|
|
61
|
+
*/
|
|
62
|
+
animateName?: AnimateName;
|
|
63
|
+
/**
|
|
64
|
+
* @description 是否禁用
|
|
65
|
+
*/
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, "className" | "children">;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { RippleButtonProps } from '../ripple/type';
|
|
3
|
+
export type CountButtonProps = {
|
|
4
|
+
/**
|
|
5
|
+
* @description 倒计时的初始值
|
|
6
|
+
*/
|
|
7
|
+
count: number;
|
|
8
|
+
/**
|
|
9
|
+
* @description 开始倒计时后的展示内容
|
|
10
|
+
*/
|
|
11
|
+
text: (c: number) => ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @description 倒计时按钮点击之前,返回Promise,如果返回reject,则不执行倒计时
|
|
14
|
+
*/
|
|
15
|
+
beforeClick?: (e: MouseEvent) => Promise<any>;
|
|
16
|
+
} & Omit<RippleButtonProps, "disabled" | "onClick">;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { RippleButtonProps } from '../ripple/type';
|
|
3
|
+
export type GlowButtonProps = {
|
|
4
|
+
/**
|
|
5
|
+
* @description 触发方式
|
|
6
|
+
*/
|
|
7
|
+
trigger?: "hover" | "always";
|
|
8
|
+
/**
|
|
9
|
+
* @description 光晕范围 0-10
|
|
10
|
+
*/
|
|
11
|
+
glowRange?: number;
|
|
12
|
+
/**
|
|
13
|
+
* @description 模糊
|
|
14
|
+
*/
|
|
15
|
+
blur?: number;
|
|
16
|
+
/**
|
|
17
|
+
* @description 光晕颜色
|
|
18
|
+
*/
|
|
19
|
+
glowColor?: CSSProperties["color"];
|
|
20
|
+
} & RippleButtonProps;
|
|
21
|
+
export declare const getGlowBoxShader: (glowRange: number, blur: number, glowColor: CSSProperties["color"]) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AnimateContainerProps } from '../../animate-container/type';
|
|
2
|
+
import { RippleContainerProps } from '../../ripple-container/type';
|
|
3
|
+
import { CSSProperties } from 'react';
|
|
4
|
+
export declare const LOADING_SIZE: {
|
|
5
|
+
readonly small: 13;
|
|
6
|
+
readonly middle: 17;
|
|
7
|
+
readonly large: 21;
|
|
8
|
+
};
|
|
9
|
+
export type RippleButtonProps = {
|
|
10
|
+
/**
|
|
11
|
+
* @description 按钮尺寸,详情见index.scss
|
|
12
|
+
*/
|
|
13
|
+
size?: keyof typeof LOADING_SIZE;
|
|
14
|
+
/**
|
|
15
|
+
* @description 按钮类型,控制按钮的颜色
|
|
16
|
+
*/
|
|
17
|
+
type?: "primary" | "warning" | "danger" | "success" | "info" | "default" | "text";
|
|
18
|
+
/**
|
|
19
|
+
* @description 按钮是否为加载状态
|
|
20
|
+
*/
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @description 加载状态的颜色
|
|
24
|
+
*/
|
|
25
|
+
loadingColor?: CSSProperties["color"];
|
|
26
|
+
/**
|
|
27
|
+
* @description 加载状态的大小
|
|
28
|
+
*/
|
|
29
|
+
loadingSize?: number;
|
|
30
|
+
} & Pick<AnimateContainerProps, "disabled"> & Omit<RippleContainerProps, "enable">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { RippleButtonProps } from '../ripple/type';
|
|
3
|
+
export type GradientDirection = "right" | "left" | "bottom" | "top" | "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
|
4
|
+
export type StreamerButtonProps = {
|
|
5
|
+
colorStop0?: CSSProperties["color"];
|
|
6
|
+
colorStop1?: CSSProperties["color"];
|
|
7
|
+
interval?: number;
|
|
8
|
+
animate?: boolean;
|
|
9
|
+
borderWidth?: CSSProperties["borderWidth"];
|
|
10
|
+
gradientDirection?: GradientDirection;
|
|
11
|
+
} & Omit<RippleButtonProps, "type">;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export type CarouselItem = {
|
|
3
|
+
imgUrl: string;
|
|
4
|
+
} & Record<string, any>;
|
|
5
|
+
export type CarouselProps = {
|
|
6
|
+
data: CarouselItem[];
|
|
7
|
+
activeIndex: number;
|
|
8
|
+
onPrev?: (index: number) => void;
|
|
9
|
+
onNext?: (index: number) => void;
|
|
10
|
+
onItemClick?: (index: number) => void;
|
|
11
|
+
rootClassName?: string;
|
|
12
|
+
width?: CSSProperties["width"];
|
|
13
|
+
vw?: CSSProperties["width"];
|
|
14
|
+
vh?: CSSProperties["height"];
|
|
15
|
+
itemRender?: (item: CarouselItem, index: number) => ReactNode;
|
|
16
|
+
leftRender?: () => ReactNode;
|
|
17
|
+
rightRender?: () => ReactNode;
|
|
18
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Feature, FeatureCollection } from '../../types/geometry';
|
|
2
|
+
import { default as Entity } from './entity';
|
|
3
|
+
declare class EntityCollection<T> {
|
|
4
|
+
private _data;
|
|
5
|
+
add(entity: Entity<T>): this;
|
|
6
|
+
remove(entity: Entity<T>): this;
|
|
7
|
+
removeEntityById(uuid: string): this;
|
|
8
|
+
setData(data: Entity<T>[]): this;
|
|
9
|
+
getData(): Entity<T>[];
|
|
10
|
+
getFeatureCollection(): {
|
|
11
|
+
type: string;
|
|
12
|
+
features: Feature<T>[];
|
|
13
|
+
};
|
|
14
|
+
getIds(): string[];
|
|
15
|
+
removeFirst(): this;
|
|
16
|
+
removeLast(): this;
|
|
17
|
+
removeAll(): this;
|
|
18
|
+
getEntityById(uuid: string): Entity<T> | undefined;
|
|
19
|
+
setFeatureCollection(featureCollection: FeatureCollection<T>): this;
|
|
20
|
+
addFeature(feature: Feature<T>): this;
|
|
21
|
+
}
|
|
22
|
+
export default EntityCollection;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Feature } from '../../types/geometry';
|
|
2
|
+
declare class Entity<T> {
|
|
3
|
+
private _data;
|
|
4
|
+
private _uuid;
|
|
5
|
+
private _userData;
|
|
6
|
+
constructor(data: Feature<T>, userData?: Record<string, any>);
|
|
7
|
+
getId(): string;
|
|
8
|
+
getData(): Feature<T>;
|
|
9
|
+
getUserData(): Record<string, any>;
|
|
10
|
+
setUserData(data: Record<string, any>): void;
|
|
11
|
+
}
|
|
12
|
+
export default Entity;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
|
|
2
|
+
import { CursorType, FlyToOptions, GlobeConstructorOptions, SatelliteConstructorOptions } from './type.ts';
|
|
3
|
+
import { PerspectiveCamera, Raycaster, Scene, Vector2 } from 'three';
|
|
4
|
+
import { default as ThreeGlobe } from 'three-globe';
|
|
5
|
+
import { default as Clock } from '../map/gis-maplibre/custom-layers/satellite-layer/clock';
|
|
6
|
+
import { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer';
|
|
7
|
+
import { Feature, Point } from '../../types/geometry';
|
|
8
|
+
import { default as Entity } from './entity';
|
|
9
|
+
import { default as Satellite } from './satellite';
|
|
10
|
+
export declare const sunPosAt: (dt: Date) => any[];
|
|
11
|
+
export declare class Globe extends ThreeGlobe {
|
|
12
|
+
private _container;
|
|
13
|
+
private _atmosphereOptions;
|
|
14
|
+
private _scene;
|
|
15
|
+
private _camera;
|
|
16
|
+
private _renderer;
|
|
17
|
+
private _orbitControls;
|
|
18
|
+
private _css2dRenderer;
|
|
19
|
+
private _dayTexture?;
|
|
20
|
+
private _nightTexture?;
|
|
21
|
+
private _globeMaterial;
|
|
22
|
+
static _earthStartOffset: number;
|
|
23
|
+
private _clock;
|
|
24
|
+
private _skyBoxOptions;
|
|
25
|
+
private _skyBoxGeometry?;
|
|
26
|
+
private _skyBoxMaterial?;
|
|
27
|
+
private _skyBoxMesh?;
|
|
28
|
+
private _zoom;
|
|
29
|
+
private _center;
|
|
30
|
+
private _minZoom;
|
|
31
|
+
private _maxZoom;
|
|
32
|
+
private _tween?;
|
|
33
|
+
private _isLighting;
|
|
34
|
+
private _markerCollection;
|
|
35
|
+
private _satelliteCollection;
|
|
36
|
+
private _ambientLight;
|
|
37
|
+
private _directLight;
|
|
38
|
+
private _ray;
|
|
39
|
+
private _mouse;
|
|
40
|
+
private _cloud?;
|
|
41
|
+
private _cloudMaterial?;
|
|
42
|
+
private _cloudGeometry?;
|
|
43
|
+
private _brightness;
|
|
44
|
+
private _contrast;
|
|
45
|
+
private _shouldCSS2DRender;
|
|
46
|
+
constructor(options: GlobeConstructorOptions);
|
|
47
|
+
get _canvas(): HTMLCanvasElement;
|
|
48
|
+
get _markerData(): {
|
|
49
|
+
lng: number;
|
|
50
|
+
lat: number;
|
|
51
|
+
}[];
|
|
52
|
+
get globeRadius(): number;
|
|
53
|
+
get _minDistance(): number;
|
|
54
|
+
get _maxDistance(): number;
|
|
55
|
+
get _curDistance(): number;
|
|
56
|
+
get _xyzCenter(): {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
z: number;
|
|
60
|
+
};
|
|
61
|
+
get _sunPos(): any[];
|
|
62
|
+
get _rotateY(): number;
|
|
63
|
+
_createCanvas(): void;
|
|
64
|
+
remove(): this;
|
|
65
|
+
getCanvas(): HTMLCanvasElement;
|
|
66
|
+
get2DRenderer(): CSS2DRenderer;
|
|
67
|
+
setShouldCSS2DRender(shouldCSS2DRender: boolean): void;
|
|
68
|
+
getShouldCSS2DRender(): boolean;
|
|
69
|
+
_onContainerResize(): void;
|
|
70
|
+
_renderLoop(): void;
|
|
71
|
+
_onOrbitControlsChange(): void;
|
|
72
|
+
_init(): void;
|
|
73
|
+
setDayImage(url: string): Promise<this>;
|
|
74
|
+
setContrast(contrast: number): this;
|
|
75
|
+
setBrightness(brightness: number): this;
|
|
76
|
+
setNightImage(url: string): Promise<this>;
|
|
77
|
+
getOrbitControls(): OrbitControls;
|
|
78
|
+
setLighting(enable: boolean): this;
|
|
79
|
+
getLighting(): boolean;
|
|
80
|
+
setSkyBoxVisible(visible: boolean): this;
|
|
81
|
+
setRotateSpeed(speed: number): this;
|
|
82
|
+
getRotateSpeed(): number;
|
|
83
|
+
flyTo(flyToOptions: FlyToOptions): this | undefined;
|
|
84
|
+
_checkZoom(zoom: number): boolean;
|
|
85
|
+
getZoom(): number;
|
|
86
|
+
setZoom(zoom: number, duration?: number): this;
|
|
87
|
+
getCenter(): [number, number];
|
|
88
|
+
setCenter(center: [number, number], duration?: number): void;
|
|
89
|
+
_updateMarkerData(): this;
|
|
90
|
+
addMarker<T extends Feature<Point>>(data: T, elementCallback: (d: T["properties"]) => HTMLElement): Entity<Point>;
|
|
91
|
+
getMarker(uuid: string): void;
|
|
92
|
+
removeMarker(entity: Entity<Point>): void;
|
|
93
|
+
removeFirstMarker(): void;
|
|
94
|
+
removeAllMarker(): void;
|
|
95
|
+
getScene(): Scene;
|
|
96
|
+
getClock(): Clock;
|
|
97
|
+
getCamera(): PerspectiveCamera;
|
|
98
|
+
addSAT(options: SatelliteConstructorOptions): Satellite;
|
|
99
|
+
getSATById(id: string): Satellite | undefined;
|
|
100
|
+
removeSATById(id: string): this;
|
|
101
|
+
removeAllSAT(): this;
|
|
102
|
+
getRay(): Raycaster;
|
|
103
|
+
getMouse(): Vector2;
|
|
104
|
+
setMouse(coord: Vector2): this;
|
|
105
|
+
setCursor(cursor: CursorType): this;
|
|
106
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as SAT from "satellite.js";
|
|
2
|
+
export declare const SCALE: number;
|
|
3
|
+
export declare const getSunPos: (date: Date) => {
|
|
4
|
+
rsun: number[];
|
|
5
|
+
rtasc: number;
|
|
6
|
+
decl: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const getSATObj: (line1: string, line2: string) => SAT.SatRec;
|
|
9
|
+
export declare const getDiffAngle: (date: Date) => number;
|
|
10
|
+
export declare const calcOneCircleTime: (satObj: SAT.SatRec) => number;
|
|
11
|
+
export declare const getCoord: (satelliteObj: SAT.SatRec, date: Date) => {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
z: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const getGroundCoord: (satelliteObj: SAT.SatRec, date: Date, h?: number) => {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
z: number;
|
|
20
|
+
};
|
|
21
|
+
export declare const getCoords: (line1: string, line2: string, startTime?: Date) => any[];
|
|
22
|
+
export declare const getLngLatAltCoords: (satelliteObj: SAT.SatRec, date: Date) => {
|
|
23
|
+
lng: number;
|
|
24
|
+
lat: number;
|
|
25
|
+
alt: number;
|
|
26
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Group, MeshBasicMaterialParameters, Quaternion } from 'three';
|
|
2
|
+
import { EventCallback, Events, SatelliteStyle, SatelliteCallback, SatelliteConstructorOptions, CursorType, FlyToOptions } from './type.ts';
|
|
3
|
+
import { Globe } from './globe';
|
|
4
|
+
import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial';
|
|
5
|
+
declare class Satellite {
|
|
6
|
+
private _tle;
|
|
7
|
+
private _style;
|
|
8
|
+
private _modelUrl;
|
|
9
|
+
private _clock;
|
|
10
|
+
private _startTime;
|
|
11
|
+
private _scene?;
|
|
12
|
+
private _line;
|
|
13
|
+
private _lineGeometry;
|
|
14
|
+
private _lineMaterial;
|
|
15
|
+
private _groundLine?;
|
|
16
|
+
private _groundLineGeometry?;
|
|
17
|
+
private _groundLineMaterial?;
|
|
18
|
+
private _towardsGroundLine?;
|
|
19
|
+
private _towardsGroundLineGeometry?;
|
|
20
|
+
private _towardsGroundLineMaterial?;
|
|
21
|
+
private _groundPlane?;
|
|
22
|
+
private _groundPlaneGeometry?;
|
|
23
|
+
private _groundPlaneMaterial?;
|
|
24
|
+
private _gltf?;
|
|
25
|
+
private _uuid;
|
|
26
|
+
private _group;
|
|
27
|
+
private _map?;
|
|
28
|
+
private _userData?;
|
|
29
|
+
private _groundElevation;
|
|
30
|
+
private _dracoLoader;
|
|
31
|
+
private _visible;
|
|
32
|
+
private _handlers;
|
|
33
|
+
private _isMouseenter;
|
|
34
|
+
private _mouseleaveHandler?;
|
|
35
|
+
private _onloadHandler?;
|
|
36
|
+
private _isLoaded?;
|
|
37
|
+
constructor(options: SatelliteConstructorOptions);
|
|
38
|
+
get _isBackface(): boolean;
|
|
39
|
+
getTLE(): string[] | [string, string];
|
|
40
|
+
setTLE(tle: SatelliteConstructorOptions["tle"]): this;
|
|
41
|
+
getId(): string;
|
|
42
|
+
getUserData(): Record<string, any> | undefined;
|
|
43
|
+
isLoaded(): boolean | undefined;
|
|
44
|
+
remove(): void;
|
|
45
|
+
flyTo(options: Omit<FlyToOptions, "center">): this;
|
|
46
|
+
_updateLineGeom(): void;
|
|
47
|
+
_updateLineMaterial(): void;
|
|
48
|
+
_updateModelStyle(): void;
|
|
49
|
+
_updateModelPosition(): void;
|
|
50
|
+
_update(): void;
|
|
51
|
+
get _model(): Group<import('three').Object3DEventMap> | undefined;
|
|
52
|
+
get _satObj(): import('satellite.js').SatRec;
|
|
53
|
+
get _oneCircleTime(): number;
|
|
54
|
+
get _satCoords(): number[];
|
|
55
|
+
get _groundCoords(): number[];
|
|
56
|
+
get _originOrientation(): Quaternion;
|
|
57
|
+
get _satPosition(): {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
z: number;
|
|
61
|
+
};
|
|
62
|
+
getLngLatAlt(): {
|
|
63
|
+
lng: number;
|
|
64
|
+
lat: number;
|
|
65
|
+
alt: number;
|
|
66
|
+
};
|
|
67
|
+
get _satNextPosition(): {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
z: number;
|
|
71
|
+
};
|
|
72
|
+
get _satGroundPosition(): {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
z: number;
|
|
76
|
+
};
|
|
77
|
+
get _towardsGroundCoords(): number[];
|
|
78
|
+
addTo(map: Globe): Promise<void>;
|
|
79
|
+
setVisible(visible: boolean): this;
|
|
80
|
+
getVisible(): boolean;
|
|
81
|
+
setLineVisible(visible: boolean): this;
|
|
82
|
+
getLineVisible(): boolean;
|
|
83
|
+
setModelVisible(visible: boolean): this;
|
|
84
|
+
getModelVisible(): boolean | undefined;
|
|
85
|
+
on(event: Events, cb: EventCallback): this;
|
|
86
|
+
off(event: Events): this;
|
|
87
|
+
onload(cb: SatelliteCallback): this;
|
|
88
|
+
offload(): this;
|
|
89
|
+
onclick(cb: SatelliteCallback): this;
|
|
90
|
+
offclick(): this;
|
|
91
|
+
onmouseenter(cb: SatelliteCallback): this;
|
|
92
|
+
offmouseenter(): this;
|
|
93
|
+
onmouseleave(cb: SatelliteCallback): this;
|
|
94
|
+
offmouseleave(): this;
|
|
95
|
+
setStyle(style: SatelliteStyle): this;
|
|
96
|
+
setCursor(cursor: CursorType): this;
|
|
97
|
+
_getLineStyle(style?: Omit<SatelliteStyle, "modelSize">): LineMaterial;
|
|
98
|
+
showGroundLine(style?: Omit<SatelliteStyle, "modelSize">): this;
|
|
99
|
+
hiddenGroundLine(): this;
|
|
100
|
+
showTowardsGroundLine(style?: Omit<SatelliteStyle, "modelSize">): this;
|
|
101
|
+
hiddenTowardsGroundLine(): this;
|
|
102
|
+
showGroundPlane(options: MeshBasicMaterialParameters & {
|
|
103
|
+
size: number;
|
|
104
|
+
}): this;
|
|
105
|
+
hiddenGroundPlane(): void;
|
|
106
|
+
}
|
|
107
|
+
export default Satellite;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Clock } from '../../index';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { Globe } from './globe';
|
|
4
|
+
import { Intersection, Vector3 } from 'three';
|
|
5
|
+
import { ConfigOptions } from 'three-globe';
|
|
6
|
+
import { default as Satellite } from './satellite.ts';
|
|
7
|
+
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
|
|
8
|
+
export type AtmosphereOptions = {
|
|
9
|
+
color?: CSSProperties["color"];
|
|
10
|
+
altitude?: number;
|
|
11
|
+
};
|
|
12
|
+
export type SkyBoxOptions = {
|
|
13
|
+
starCount?: number;
|
|
14
|
+
size?: number;
|
|
15
|
+
color?: CSSProperties["color"];
|
|
16
|
+
};
|
|
17
|
+
export declare const DEFAULT_ATMOSPHERE_OPTIONS: AtmosphereOptions;
|
|
18
|
+
export declare const DEFAULT_SKYBOX_OPTIONS: SkyBoxOptions;
|
|
19
|
+
export type GlobeConstructorOptions = {
|
|
20
|
+
container: HTMLElement;
|
|
21
|
+
atmosphere?: AtmosphereOptions;
|
|
22
|
+
dayImage?: string;
|
|
23
|
+
nightImage?: string;
|
|
24
|
+
topologyImage?: string;
|
|
25
|
+
cloudImage?: string;
|
|
26
|
+
clock?: Clock;
|
|
27
|
+
skyBox?: SkyBoxOptions;
|
|
28
|
+
center?: [number, number];
|
|
29
|
+
zoom?: number;
|
|
30
|
+
minZoom?: number;
|
|
31
|
+
maxZoom?: number;
|
|
32
|
+
contrast?: number;
|
|
33
|
+
brightness?: number;
|
|
34
|
+
} & ConfigOptions;
|
|
35
|
+
export declare const DAY_NIGHT_SHADER: {
|
|
36
|
+
readonly vertexShader: "\n varying vec3 vNormal;\n varying vec2 vUv;\n void main() {\n vNormal = normalize(normalMatrix * normal);\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ";
|
|
37
|
+
readonly fragmentShader: "\n #define PI 3.141592653589793\n uniform float brightness;\n uniform float contrast;\n uniform sampler2D dayTexture;\n uniform sampler2D nightTexture;\n uniform vec2 sunPosition;\n uniform vec2 globeRotation;\n varying vec3 vNormal;\n varying vec2 vUv;\n\n float toRad(in float a) {\n return a * PI / 180.0;\n }\n\n vec3 Polar2Cartesian(in vec2 c) { // [lng, lat]\n float theta = toRad(90.0 - c.x);\n float phi = toRad(90.0 - c.y);\n return vec3( // x,y,z\n sin(phi) * cos(theta),\n cos(phi),\n sin(phi) * sin(theta)\n );\n }\n\n void main() {\n float invLon = toRad(globeRotation.x);\n float invLat = -toRad(globeRotation.y);\n mat3 rotX = mat3(\n 1, 0, 0,\n 0, cos(invLat), -sin(invLat),\n 0, sin(invLat), cos(invLat)\n );\n mat3 rotY = mat3(\n cos(invLon), 0, sin(invLon),\n 0, 1, 0,\n -sin(invLon), 0, cos(invLon)\n );\n vec3 rotatedSunDirection = rotX * rotY * Polar2Cartesian(sunPosition);\n float intensity = dot(normalize(vNormal), normalize(rotatedSunDirection));\n vec4 dayColor = (pow(texture2D(dayTexture, vUv), vec4(1.0 / brightness)) - 0.5) * contrast + 0.5;\n vec4 nightColor = texture2D(nightTexture, vUv);\n float blendFactor = smoothstep(-0.1, 0.1, intensity);\n gl_FragColor = mix(nightColor, clamp(dayColor, 0.0, 1.0), blendFactor);\n }\n ";
|
|
38
|
+
};
|
|
39
|
+
export type GlobeMapProps = Omit<GlobeConstructorOptions, "container">;
|
|
40
|
+
export type GlobeMapRef = {
|
|
41
|
+
getMap: () => Globe;
|
|
42
|
+
};
|
|
43
|
+
export type FlyToOptions = {
|
|
44
|
+
center: [number, number];
|
|
45
|
+
zoom: number;
|
|
46
|
+
duration?: number;
|
|
47
|
+
onComplete?: (obj: Vector3) => void;
|
|
48
|
+
};
|
|
49
|
+
export declare const C = 6371;
|
|
50
|
+
export declare const DEFAULT_SAT_STYLE: SatelliteStyle;
|
|
51
|
+
export type SatelliteStyle = {
|
|
52
|
+
lineColor?: CSSProperties["color"];
|
|
53
|
+
lineWidth?: number;
|
|
54
|
+
lineOpacity?: number;
|
|
55
|
+
lineDash?: [number, number];
|
|
56
|
+
modelSize?: number;
|
|
57
|
+
};
|
|
58
|
+
export type SatelliteConstructorOptions = {
|
|
59
|
+
tle: [string, string] | string[];
|
|
60
|
+
modelUrl: string;
|
|
61
|
+
clock?: Clock;
|
|
62
|
+
style?: SatelliteStyle;
|
|
63
|
+
dracoLoader: DRACOLoader;
|
|
64
|
+
userData?: Record<string, any>;
|
|
65
|
+
visible?: boolean;
|
|
66
|
+
};
|
|
67
|
+
export type EventCallback = (origin: Satellite, intersects: Intersection[]) => void;
|
|
68
|
+
export type SatelliteCallback = (satellite: Satellite, its?: Intersection[]) => void;
|
|
69
|
+
export type Events = "click" | "pointermove";
|
|
70
|
+
export declare const SAT_NAME = "SATELLITE";
|
|
71
|
+
export type CursorType = "auto" | "pointer" | "grabbing" | "crosshair" | "se-resize" | "sw-resize" | "s-resize" | "w-resize" | "move" | "default" | "text" | "wait" | "help" | "progress" | "not-allowed" | "no-drop" | "alias" | "copy" | "zoom-in" | "zoom-out";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BufferGeometry, Vector3 } from 'three';
|
|
2
|
+
export declare class WideLineGeometry extends BufferGeometry {
|
|
3
|
+
private _points;
|
|
4
|
+
private _widthFunction?;
|
|
5
|
+
private _alphaFunction?;
|
|
6
|
+
private _positionBufferAttribute?;
|
|
7
|
+
private _previousBufferAttribute?;
|
|
8
|
+
private _nextBufferAttribute?;
|
|
9
|
+
private _sideBufferAttribute?;
|
|
10
|
+
private _widthBufferAttribute?;
|
|
11
|
+
private _alphaBufferAttribute?;
|
|
12
|
+
private _counterBufferAttribute?;
|
|
13
|
+
constructor();
|
|
14
|
+
getPoints(): Vector3[];
|
|
15
|
+
_isEquals(i0: number, i1: number): boolean;
|
|
16
|
+
_copy(index: number): Vector3;
|
|
17
|
+
setWidthFunction(widthFunction: (p: number) => number): this;
|
|
18
|
+
setAlphaFunction(alphaFunction: (p: number) => number): this;
|
|
19
|
+
setGeometry(points: Vector3[], widthFunc?: (p: number) => number, alphaFunc?: (p: number) => number): this;
|
|
20
|
+
_initFloat32Attribute(key: string, y: number[], itemSize: number, isDynamic: boolean): this;
|
|
21
|
+
_setAttrs(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Mesh } from 'three';
|
|
2
|
+
import { WideLineGeometry } from './geometry';
|
|
3
|
+
import { WideLineMaterial } from './material';
|
|
4
|
+
declare class WideLine extends Mesh {
|
|
5
|
+
constructor(geometry: WideLineGeometry, material: WideLineMaterial);
|
|
6
|
+
}
|
|
7
|
+
export default WideLine;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Color, ShaderMaterial, Vector2 } from 'three';
|
|
2
|
+
import { WideLineMaterialConstructorOptions } from './type';
|
|
3
|
+
export declare class WideLineMaterial extends ShaderMaterial {
|
|
4
|
+
WideLineMaterial: boolean;
|
|
5
|
+
animateTimer: number;
|
|
6
|
+
animateSpeed: number;
|
|
7
|
+
onAnimateEndCb?: () => void;
|
|
8
|
+
private _animated;
|
|
9
|
+
constructor(options: WideLineMaterialConstructorOptions);
|
|
10
|
+
get sizeAttenuation(): boolean;
|
|
11
|
+
set sizeAttenuation(value: boolean);
|
|
12
|
+
get resolution(): Vector2;
|
|
13
|
+
set resolution(value: Vector2);
|
|
14
|
+
get lineWidth(): number;
|
|
15
|
+
set lineWidth(value: number);
|
|
16
|
+
get lineOpacity(): number;
|
|
17
|
+
set lineOpacity(value: number);
|
|
18
|
+
get lineColor(): Color;
|
|
19
|
+
set lineColor(value: Color);
|
|
20
|
+
onAnimateEnd(cb: () => void): this;
|
|
21
|
+
animate: () => void;
|
|
22
|
+
}
|