@vesium/shared 1.0.1-beta.44 → 1.0.1-beta.54

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,11 +1,7 @@
1
1
  {
2
2
  "name": "@vesium/shared",
3
3
  "type": "module",
4
- "version": "1.0.1-beta.44",
5
- "buildInfo": {
6
- "name": "VesiumShared",
7
- "bundle": true
8
- },
4
+ "version": "1.0.1-beta.54",
9
5
  "description": "Vue component and composition-api library for Cesium.",
10
6
  "license": "MIT",
11
7
  "homepage": "https://github.com/vesiumjs/vesium",
@@ -22,21 +18,25 @@
22
18
  "hooks",
23
19
  "composition-api"
24
20
  ],
25
- "main": "./dist/index.cjs",
26
- "module": "./dist/index.mjs",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./dist/index.mjs",
24
+ "require": "./dist/index.cjs"
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "unpkg": "./dist/index.iife.min.js",
29
+ "jsdelivr": "./dist/index.iife.min.js",
27
30
  "files": [
28
31
  "LICENSE",
29
32
  "README.md",
30
33
  "dist/*"
31
34
  ],
32
- "publishConfig": {
33
- "jsdelivr": "./dist/index.iife.min.js"
34
- },
35
35
  "dependencies": {
36
- "@vueuse/shared": "^13.2.0",
37
- "cesium": "^1.129.0",
38
- "vue": "^3.5.14"
36
+ "@types/geojson": "^7946.0.16",
37
+ "cesium": "^1.134.1"
39
38
  },
40
- "types": "./dist/index.d.ts",
41
- "unpkg": "./dist/index.iife.min.js"
39
+ "main": "./dist/index.cjs",
40
+ "module": "./dist/index.mjs",
41
+ "types": "./dist/index.d.mts"
42
42
  }
package/dist/index.d.ts DELETED
@@ -1,410 +0,0 @@
1
- import { Cartesian2 } from 'cesium';
2
- import { Cartesian3 } from 'cesium';
3
- import { Cartographic } from 'cesium';
4
- import { CustomDataSource } from 'cesium';
5
- import { CzmlDataSource } from 'cesium';
6
- import { DataSource } from 'cesium';
7
- import { Event as Event_2 } from 'cesium';
8
- import { GeoJsonDataSource } from 'cesium';
9
- import { GpxDataSource } from 'cesium';
10
- import { JulianDate } from 'cesium';
11
- import { KmlDataSource } from 'cesium';
12
- import { Material } from 'cesium';
13
- import { MaterialProperty } from 'cesium';
14
- import { Property } from 'cesium';
15
- import { Scene } from 'cesium';
16
- import { TextureMagnificationFilter } from 'cesium';
17
- import { TextureMinificationFilter } from 'cesium';
18
-
19
- /**
20
- * Add material to Cesium's material cache, alias of `Material._materialCache.addMaterial`
21
- */
22
- export declare function addMaterialCache(type: string, material: CesiumMaterialConstructorOptions<any>): void;
23
-
24
- export declare type AnyFn = (...args: any[]) => any;
25
-
26
- export declare type ArgsFn<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
27
-
28
- /**
29
- * 计算两个数组的差异,返回新增和删除的元素
30
- */
31
- export declare function arrayDiff<T>(list: T[], oldList: T[] | undefined): ArrayDiffRetrun<T>;
32
-
33
- export declare interface ArrayDiffRetrun<T> {
34
- added: T[];
35
- removed: T[];
36
- }
37
-
38
- export declare function assertError(condition: boolean, error: any): void;
39
-
40
- export declare type BasicType = number | string | boolean | symbol | bigint | null | undefined;
41
-
42
- /**
43
- * Convert canvas coordinates to Cartesian coordinates
44
- *
45
- * @param canvasCoord Canvas coordinates
46
- * @param scene Cesium.Scene instance
47
- * @param mode optional values are 'pickPosition' | 'globePick' | 'auto' | 'noHeight' @default 'auto'
48
- *
49
- * `pickPosition`: Use scene.pickPosition for conversion, which can be used for picking models, oblique photography, etc.
50
- * However, if depth detection is not enabled (globe.depthTestAgainstTerrain=false), picking terrain or inaccurate issues may occur
51
- *
52
- * `globePick`: Use camera.getPickRay for conversion, which cannot be used for picking models or oblique photography,
53
- * but can be used for picking terrain. If terrain does not exist, the picked elevation is 0
54
- *
55
- * `auto`: Automatically determine which picking content to return
56
- *
57
- * Calculation speed comparison: globePick > auto >= pickPosition
58
- */
59
- export declare function canvasCoordToCartesian(canvasCoord: Cartesian2, scene: Scene, mode?: 'pickPosition' | 'globePick' | 'auto'): Cartesian3 | undefined;
60
-
61
- /**
62
- * Convert Cartesian coordinates to canvas coordinates
63
- *
64
- * @param position Cartesian coordinates
65
- * @param scene Cesium.Scene instance
66
- */
67
- export declare function cartesianToCanvasCoord(position: Cartesian3, scene: Scene): Cartesian2;
68
-
69
- /**
70
- * Common DataSource
71
- */
72
- export declare type CesiumDataSource = DataSource | CustomDataSource | CzmlDataSource | GeoJsonDataSource | GpxDataSource | KmlDataSource;
73
-
74
- /**
75
- * Determines if two Cesium objects are equal.
76
- *
77
- * This function not only judges whether the instances are equal,
78
- * but also judges the equals method in the example.
79
- *
80
- * @param left The first Cesium object
81
- * @param right The second Cesium object
82
- * @returns Returns true if the two Cesium objects are equal, otherwise false
83
- */
84
- export declare function cesiumEquals(left: any, right: any): boolean;
85
-
86
- /**
87
- * Only as a type fix for `Cesium.Material`
88
- */
89
- export declare class CesiumMaterial<U> extends Material {
90
- constructor(options: CesiumMaterialConstructorOptions<U>);
91
- /**
92
- * Matrix configuration
93
- */
94
- fabric: CesiumMaterialFabricOptions<U>;
95
- }
96
-
97
- /**
98
- * Cesium.Material parameters
99
- */
100
- export declare interface CesiumMaterialConstructorOptions<U> {
101
- /**
102
- * Strict mode
103
- */
104
- strict?: boolean;
105
- /**
106
- * translucent
107
- */
108
- translucent?: boolean | ((...params: any[]) => any);
109
- /**
110
- * Minification filter
111
- */
112
- minificationFilter?: TextureMinificationFilter;
113
- /**
114
- * Magnification filter
115
- */
116
- magnificationFilter?: TextureMagnificationFilter;
117
- /**
118
- * Matrix configuration
119
- */
120
- fabric: CesiumMaterialFabricOptions<U>;
121
- }
122
-
123
- /**
124
- * Cesium.Material.fabric parameters
125
- */
126
- export declare interface CesiumMaterialFabricOptions<U> {
127
- /**
128
- * Used to declare what material the fabric object will ultimately generate. If it's an official built-in one, use the official built-in one directly; otherwise, create a custom material and cache it.
129
- */
130
- type: string;
131
- /**
132
- * Can nest another level of child fabric to form a composite material
133
- */
134
- materials?: Material;
135
- /**
136
- * glsl code
137
- */
138
- source?: string;
139
- components?: {
140
- diffuse?: string;
141
- alpha?: string;
142
- };
143
- /**
144
- * Pass variables to glsl code
145
- */
146
- uniforms?: U & Record<string, any>;
147
- }
148
-
149
- /**
150
- * Only as a type fix for `Cesium.MaterialProperty`
151
- */
152
- export declare interface CesiumMaterialProperty<V> extends MaterialProperty {
153
- get isConstant(): boolean;
154
- get definitionChanged(): Event_2<(scope: this, field: string, value: any, previous: any) => void>;
155
- getType: (time: JulianDate) => string;
156
- getValue: (time: JulianDate, result?: V) => V;
157
- equals: (other?: any) => boolean;
158
- }
159
-
160
- /**
161
- * Common Coordinate
162
- * Can be a Cartesian3 point, a Cartographic point, an array, or an object containing longitude, latitude, and optional height information
163
- */
164
- export declare type CommonCoord = Cartesian3 | Cartographic | CoordArray | CoordArray_ALT | CoordObject | CoordObject_ALT;
165
-
166
- /**
167
- * 2D Coordinate System
168
- */
169
- export declare type CoordArray = [longitude: number, latitude: number];
170
-
171
- /**
172
- * 3D Coordinate System
173
- */
174
- export declare type CoordArray_ALT = [longitude: number, latitude: number, height?: number];
175
-
176
- /**
177
- * 2D Coordinate System
178
- */
179
- export declare interface CoordObject {
180
- longitude: number;
181
- latitude: number;
182
- }
183
-
184
- /**
185
- * 3D Coordinate System
186
- */
187
- export declare interface CoordObject_ALT {
188
- longitude: number;
189
- latitude: number;
190
- height?: number | undefined;
191
- }
192
-
193
- export declare function createCesiumAttribute<Scope extends object>(scope: Scope, key: keyof Scope, value: any, options?: CreateCesiumAttributeOptions): void;
194
-
195
- export declare interface CreateCesiumAttributeOptions {
196
- readonly?: boolean;
197
- toProperty?: boolean;
198
- /**
199
- * The event name that triggers the change
200
- * @default 'definitionChanged'
201
- */
202
- changedEventKey?: string;
203
- shallowClone?: boolean;
204
- }
205
-
206
- export declare function createCesiumProperty<Scope extends object>(scope: Scope, key: keyof Scope, value: any, options?: CreateCesiumPropertyOptions): void;
207
-
208
- export declare interface CreateCesiumPropertyOptions {
209
- readonly?: boolean;
210
- /**
211
- * The event name that triggers the change
212
- * @default 'definitionChanged'
213
- */
214
- changedEventKey?: string;
215
- }
216
-
217
- /**
218
- * Create a Cesium property key
219
- *
220
- * @param scope The host object
221
- * @param field The property name
222
- * @param maybeProperty Optional property or getter
223
- * @param readonly Whether the property is read-only
224
- */
225
- export declare function createPropertyField<T>(scope: any, field: string, maybeProperty?: MaybePropertyOrGetter<T>, readonly?: boolean): void;
226
-
227
- /**
228
- * Convert latitude and longitude coordinates to degrees-minutes-seconds format
229
- *
230
- * @param position The latitude and longitude coordinates
231
- * @param precision The number of decimal places to retain for 'seconds', default is 3
232
- * @returns Returns the coordinates in degrees-minutes-seconds format, or undefined if the conversion fails
233
- */
234
- export declare function degreesToDms(position: CommonCoord, precision?: number): DMSCoord | undefined;
235
-
236
- export declare type DMSCoord = [longitude: string, latitude: string, height?: number];
237
-
238
- /**
239
- * Decode a DMS (Degrees Minutes Seconds) formatted string to a decimal angle value
240
- *
241
- * @param dmsCode DMS formatted string, e.g. "120°30′45″N"
242
- * @returns The decoded decimal angle value, or 0 if decoding fails
243
- */
244
- export declare function dmsDecode(dmsCode: string): number;
245
-
246
- /**
247
- * Convert degrees to DMS (Degrees Minutes Seconds) format string
248
- *
249
- * @param degrees The angle value
250
- * @param precision The number of decimal places to retain for the seconds, defaults to 3
251
- * @returns A DMS formatted string in the format: degrees° minutes′ seconds″
252
- */
253
- export declare function dmsEncode(degrees: number, precision?: number): string;
254
-
255
- /**
256
- * Convert DMS (Degrees Minutes Seconds) format to decimal degrees for latitude and longitude coordinates
257
- *
258
- * @param dms The latitude or longitude coordinate in DMS format
259
- * @returns Returns the coordinate in decimal degrees format, or undefined if the conversion fails
260
- */
261
- export declare function dmsToDegrees(dms: DMSCoord): CoordArray_ALT | undefined;
262
-
263
- /**
264
- * Get material from cache, alias of `Material._materialCache.getMaterial`
265
- */
266
- export declare function getMaterialCache<T extends Material = CesiumMaterial<any>>(type: string): T | undefined;
267
-
268
- export declare const isArray: (arg: any) => arg is any[];
269
-
270
- export declare function isBase64(val: string): boolean;
271
-
272
- export declare function isBoolean(val: any): val is boolean;
273
-
274
- /**
275
- * Determines if the Cesium property is a constant.
276
- *
277
- * @param value Cesium property
278
- */
279
- export declare function isCesiumConstant(value: MaybeProperty): boolean;
280
-
281
- export declare function isDef<T = any>(val?: T): val is T;
282
-
283
- export declare function isElement<T extends Element>(val: any): val is T;
284
-
285
- export declare function isFunction<T extends AnyFn>(val: any): val is T;
286
-
287
- export declare function isNumber(val: any): val is number;
288
-
289
- export declare function isObject(val: any): val is object;
290
-
291
- export declare function isPromise<T extends Promise<any>>(val: any): val is T;
292
-
293
- /**
294
- * Is Cesium.Property
295
- * @param value - The target object
296
- */
297
- export declare function isProperty(value: any): value is Property;
298
-
299
- export declare function isString(val: unknown): val is string;
300
-
301
- export declare function isWindow(val: any): val is Window;
302
-
303
- export declare type MaybePromise<T = any> = T | (() => T) | Promise<T> | (() => Promise<T>);
304
-
305
- export declare type MaybeProperty<T = any> = T | {
306
- getValue: (time?: JulianDate) => T;
307
- };
308
-
309
- export declare type MaybePropertyOrGetter<T = any> = MaybeProperty<T> | (() => T);
310
-
311
- export declare type Nullable<T> = T | null | undefined;
312
-
313
- /**
314
- * Determine if the given array of graphics is hit by Cesium's `scene.pick`
315
- *
316
- * @param pick The `scene.pick` object used for matching
317
- * @param graphic An array of graphics to check for hits
318
- */
319
- export declare function pickHitGraphic(pick: any, graphic: any | any[]): boolean;
320
-
321
- export declare type PropertyCallback<T = any> = (time: JulianDate, result?: T) => T;
322
-
323
- /**
324
- * Analyze the result of Cesium's `scene.pick` and convert it to an array format
325
- */
326
- export declare function resolvePick(pick?: any): any[];
327
-
328
- /**
329
- * Throttle function, which limits the frequency of execution of the function
330
- *
331
- * @param callback raw function
332
- * @param delay Throttled delay duration (ms)
333
- * @param trailing Trigger callback function after last call @default true
334
- * @param leading Trigger the callback function immediately on the first call @default false
335
- * @returns Throttle function
336
- */
337
- export declare function throttle<T extends any[]>(callback: ThrottleCallback<T>, delay?: number, trailing?: boolean, leading?: boolean): ThrottleCallback<T>;
338
-
339
- export declare type ThrottleCallback<T extends any[]> = (...rest: T) => void;
340
-
341
- /**
342
- * Converts position to a coordinate point in the Cartesian coordinate system
343
- *
344
- * @param position Position information, which can be a Cartesian coordinate point (Cartesian3), a geographic coordinate point (Cartographic), an array, or an object containing WGS84 latitude, longitude, and height information
345
- * @returns The converted Cartesian coordinate point. If the input parameter is invalid, undefined is returned
346
- */
347
- export declare function toCartesian3(position?: CommonCoord): Cartesian3 | undefined;
348
-
349
- /**
350
- * Converts a position to a Cartographic coordinate point
351
- *
352
- * @param position Position information, which can be a Cartesian3 coordinate point, a Cartographic coordinate point, an array, or an object containing WGS84 longitude, latitude, and height information
353
- * @returns The converted Cartographic coordinate point, or undefined if the input parameter is invalid
354
- */
355
- export declare function toCartographic(position?: CommonCoord): Cartographic | undefined;
356
-
357
- /**
358
- * Converts coordinates to an array or object in the specified format.
359
- *
360
- * @param position The coordinate to be converted, which can be a Cartesian3, Cartographic, array, or object.
361
- * @param options Conversion options, including conversion type and whether to include altitude information.
362
- * @returns The converted coordinate, which may be an array or object. If the input position is empty, undefined is returned.
363
- *
364
- * @template T Conversion type, optional values are 'Array' or 'Object', @default 'Array'.
365
- * @template Alt Whether to include altitude information, default is false
366
- */
367
- export declare function toCoord<T extends 'Array' | 'Object' = 'Array', Alt extends boolean = false>(position?: CommonCoord, options?: ToCoordOptions<T, Alt>): ToCoordReturn<T, Alt> | undefined;
368
-
369
- declare interface ToCoordOptions<T extends 'Array' | 'Object', Alt extends boolean> {
370
- /**
371
- * Return type
372
- * @default 'Array'
373
- */
374
- type?: T;
375
- /**
376
- * Whether to return altitude information
377
- */
378
- alt?: Alt;
379
- }
380
-
381
- export declare type ToCoordReturn<T extends 'Array' | 'Object', Alt extends boolean> = T extends 'Array' ? Alt extends true ? CoordArray_ALT : CoordArray : Alt extends true ? CoordObject_ALT : CoordObject;
382
-
383
- /**
384
- * Converts a value that may be a Property into a Property object, @see {toPropertyValue} for the reverse operation
385
- *
386
- * @param value - The property value or getter to convert, can be undefined or null
387
- * @param isConstant - The second parameter for converting to CallbackProperty
388
- * @returns Returns the converted Property object, if value is undefined or null, returns undefined
389
- */
390
- export declare function toProperty<T>(value?: MaybePropertyOrGetter<T>, isConstant?: boolean): Property;
391
-
392
- /**
393
- * Converts a value that may be a Property into its target value, @see {toProperty} for the reverse operation
394
- * ```typescript
395
- * toPropertyValue('val') //=> 'val'
396
- * toPropertyValue(new ConstantProperty('val')) //=> 'val'
397
- * toPropertyValue(new CallbackProperty(()=>'val')) //=> 'val'
398
- * ```
399
- *
400
- * @param value - The value to convert
401
- */
402
- export declare function toPropertyValue<T = unknown>(value: MaybeProperty<T>, time?: JulianDate): T;
403
-
404
- /**
405
- * Safely execute the provided function without throwing errors,
406
- * essentially a simple wrapper around a `try...catch...` block
407
- */
408
- export declare function tryRun<T extends AnyFn>(fn: T): T;
409
-
410
- export { }