@metagl/smartearth-base 0.2.0 → 0.3.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/dist/index.d.ts CHANGED
@@ -1,7 +1,24 @@
1
- import { L as LayerSpec, P as PbrMaterialParams, G as GeoPosition, a as PickedFeature } from './errors-CtkYU3iT.js';
2
- export { C as CESIUM_MAX_VERSION_EXCLUSIVE, b as CESIUM_MIN_VERSION, c as ClickEvent, d as CreateEarthOptions, e as CustomBasemap, E as Earth, f as EarthEvents, g as EarthLayers, h as EarthPbr, F as FlyToTarget, I as InitialView, i as LayerContext, j as LayerFactory, k as LayerHandle, l as LayerInfo, M as MAP_TOKEN_APPLY_URL, m as PbrConfig, n as PbrGlobalParams, o as PbrTarget, p as PickEvent, q as PickResolver, Q as Quality, S as SdkAuth, r as SmartEarthError, s as SmartEarthErrorCode, t as createEarth, u as createEarthPbr, v as getSupportedQualities, w as isSmartEarthError, x as makeExtensible, y as supportsPbr } from './errors-CtkYU3iT.js';
1
+ import { L as LayerSpec, P as PbrMaterialParams, G as GeoPosition, a as PickedFeature } from './createEarth-BY0dtgQQ.js';
2
+ export { C as CESIUM_MAX_VERSION_EXCLUSIVE, b as CESIUM_MIN_VERSION, c as COLOR_FILTERS, d as CameraPose, e as CaptureOptions, f as ClickEvent, g as ClockOfDay, h as ClockState, i as ColorFilter, j as CreateEarthOptions, k as CustomBasemap, E as ENVIRONMENT_PRESETS, l as Earth, m as EarthEnvironment, n as EarthEvents, o as EarthLayers, p as EarthPbr, q as EffectOptions, r as EffectOptionsTarget, s as EnvironmentBaseline, t as EnvironmentChange, u as EnvironmentChangeSource, v as EnvironmentConfig, w as EnvironmentEffect, x as EnvironmentPreset, y as EnvironmentSnapshot, z as EnvironmentTime, F as FlyToTarget, I as InitialView, A as LayerContext, B as LayerFactory, D as LayerHandle, H as LayerInfo, J as LightDirection, K as LightingMode, M as PRESET_DOCUMENT_SCHEMA, N as PbrConfig, O as PbrGlobalParams, Q as PbrTarget, R as PickEvent, S as PickResolver, T as PresetDocumentCore, U as Quality, V as RestoreOptions, W as SceneFogOptions, X as SdkAuth, Y as TerrainAdjustOptions, Z as WindOptions, _ as createEarth, $ as createEarthPbr, a0 as getSupportedQualities, a1 as makeExtensible, a2 as requirePresetDocument, a3 as requireSnapshot, a4 as supportsPbr } from './createEarth-BY0dtgQQ.js';
3
+ export { M as MAP_TOKEN_APPLY_URL, S as SmartEarthError, a as SmartEarthErrorCode, i as isSmartEarthError } from './errors-cB7IQlHy.js';
3
4
  import { Cesium3DTileset } from 'cesium';
4
- import '@metagl/sdk-render';
5
+ import { RiverWaterConfig } from '@metagl/sdk-render';
6
+
7
+ /** 本包用到的 4.x Render 环境能力子集。 */
8
+ interface EnvironmentCapableRender {
9
+ applyPreset(presetId: string): void;
10
+ transitionToPreset(presetId: string, durationSec?: number): void;
11
+ clearPreset(): void;
12
+ getActivePreset(): string | null;
13
+ toggleSystem(systemName: string, enabled?: boolean): void;
14
+ getSystemStatus(systemName: string): boolean | undefined;
15
+ getSystemConfig(systemName: string): unknown;
16
+ updateSystemConfig(systemName: string, config: unknown): void;
17
+ }
18
+ declare function supportsEnvironment(render: unknown): render is EnvironmentCapableRender;
19
+
20
+ /** 底座版本(预设文档的 producedBy.base 用)。发版时与 package.json 的 version 一起改,有测试核对。 */
21
+ declare const BASE_VERSION = "0.3.1";
5
22
 
6
23
  /**
7
24
  * sdk-render 3.0 没有画质档位接口时,本包按 geovisearthsdk_web《渲染性能优化方案》(2026-08-18)
@@ -262,6 +279,15 @@ interface AnnotationApi {
262
279
  on<K extends keyof AnnotationEvents>(event: K, listener: (payload: AnnotationEvents[K]) => void): () => void;
263
280
  }
264
281
 
282
+ /** 按坑加水:在挖好的坑里生成顺着坑走的水面(sdk-render ≥ 4.0.3)。 */
283
+ interface PitWaterOptions {
284
+ /** 水面比坑沿低多少米,默认 5。 */
285
+ readonly freeboard?: number;
286
+ /** 水面至少比坑底高多少米,默认 0.5。 */
287
+ readonly minDepth?: number;
288
+ /** 网格间距(米),默认按坑面积自适应。 */
289
+ readonly spacingMeters?: number;
290
+ }
265
291
  interface RiverWaterLayerSpec extends LayerSpec {
266
292
  readonly kind: 'riverWater';
267
293
  /**
@@ -285,25 +311,35 @@ interface RiverWaterLayerSpec extends LayerSpec {
285
311
  readonly thickness?: number;
286
312
  /**
287
313
  * 地形挖坑,把地形压低 depth 米(正数)。
314
+ * `fillWater`(sdk-render ≥ 4.0.3):按坑加水,水面顺着坑走、比坑沿低 freeboard 米,
315
+ * 这时不再按数据另铺平水面,坐标也不需要 Z。
288
316
  * - sdk-render ≥ 4.0.2:湖、库与河道线都挖(河道线按 width 转成面交给挖坑,逐点顺坡下挖)。
289
317
  * - 更早的版本:只挖 Polygon(旧版把区域压平到「平均高程 + 偏移」,沿坡的河道会被压成平台)。
290
318
  * 地形调整在 sdk-render 里是全局的,一个地球同时只能有一个带 dig 的 riverWater 图层。
291
319
  */
292
320
  readonly dig?: {
293
321
  readonly depth: number;
322
+ readonly fillWater?: boolean | PitWaterOptions;
294
323
  };
324
+ /**
325
+ * 坐标没有 Z、也没给 height 时,sdk-render ≥ 4.0.3 会把水面贴着地形放,lift 是比地形高的米数(默认 0.5)。
326
+ * 更早的版本没有这个能力,仍要求坐标带 Z 或给 height。
327
+ */
328
+ readonly lift?: number;
295
329
  /** 显示 sdk-render 挖坑的青色示意面和「区域 N」标签,默认 false。 */
296
330
  readonly showDigViz?: boolean;
297
- /** 河道水面外观参数,原样交给 sdk-render 的 RiverWaterSystem.update(颜色、波浪、反射等)。 */
298
- readonly config?: Readonly<Record<string, unknown>>;
331
+ /** 河道水面外观参数,原样交给 sdk-render 的 RiverWaterSystem.update(颜色、波浪、反射、浪花、焦散等)。 */
332
+ readonly config?: Readonly<Partial<RiverWaterConfig>>;
299
333
  }
300
334
  interface RiverWaterApi {
301
335
  /** 本图层创建的水面图层 id。 */
302
336
  readonly layerIds: readonly string[];
303
337
  /** 实际用的线模式。 */
304
338
  readonly lineMode: 'ribbon' | 'native';
305
- /** 改水面外观参数(作用于整个河道水面系统)。 */
306
- update(config: Readonly<Record<string, unknown>>): void;
339
+ /** 水面是怎么放的:'data' = 按数据里的高度,'terrain' = 贴地形(4.0.3),'pit' = 按坑加水(4.0.3)。 */
340
+ readonly placement: 'data' | 'terrain' | 'pit';
341
+ /** 改水面外观参数(作用于整个河道水面系统;也可用 earth.environment.setEffectOptions('riverWater', …))。 */
342
+ update(config: Readonly<Partial<RiverWaterConfig>>): void;
307
343
  }
308
344
 
309
- export { type AnnotationApi, type AnnotationDraft, type AnnotationEvents, type AnnotationItem, type AnnotationLayerSpec, type FieldColors, GeoPosition, type GeojsonLayerSpec, type GeojsonStyle, LOW_QUALITY_OVERRIDES, LayerSpec, PbrMaterialParams, PickedFeature, type PointDatum, type PointsLayerSpec, type PopupApi, type PopupContent, type PopupLayerSpec, type RiverWaterApi, type RiverWaterLayerSpec, type RouteApi, type RouteEvents, type RouteLayerSpec, type RoutePoint, type RouteProgressEvent, type RouteSource, type Tileset3dApi, type Tileset3dLayerSpec, escapeHtml };
345
+ export { type AnnotationApi, type AnnotationDraft, type AnnotationEvents, type AnnotationItem, type AnnotationLayerSpec, BASE_VERSION, type FieldColors, GeoPosition, type GeojsonLayerSpec, type GeojsonStyle, LOW_QUALITY_OVERRIDES, LayerSpec, PbrMaterialParams, PickedFeature, type PointDatum, type PointsLayerSpec, type PopupApi, type PopupContent, type PopupLayerSpec, type RiverWaterApi, type RiverWaterLayerSpec, type RouteApi, type RouteEvents, type RouteLayerSpec, type RoutePoint, type RouteProgressEvent, type RouteSource, type Tileset3dApi, type Tileset3dLayerSpec, escapeHtml, supportsEnvironment };
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
- export { CESIUM_MAX_VERSION_EXCLUSIVE, CESIUM_MIN_VERSION, LOW_QUALITY_OVERRIDES, MAP_TOKEN_APPLY_URL, SmartEarthError, createEarth, createEarthPbr, escapeHtml, getSupportedQualities, isSmartEarthError, makeExtensible, supportsPbr } from './chunk-O7CP7PJG.js';
1
+ export { CESIUM_MAX_VERSION_EXCLUSIVE, CESIUM_MIN_VERSION, LOW_QUALITY_OVERRIDES, createEarth, createEarthPbr, escapeHtml, getSupportedQualities, makeExtensible, supportsPbr } from './chunk-JGNKH4TR.js';
2
+ export { BASE_VERSION, COLOR_FILTERS, ENVIRONMENT_PRESETS, MAP_TOKEN_APPLY_URL, PRESET_DOCUMENT_SCHEMA, SmartEarthError, isSmartEarthError, requirePresetDocument, requireSnapshot, supportsEnvironment } from './chunk-XJRW7VZC.js';
@@ -0,0 +1,311 @@
1
+ import { T as PresetDocumentCore, l as Earth } from './createEarth-BY0dtgQQ.js';
2
+ import 'cesium';
3
+ import '@metagl/sdk-render';
4
+
5
+ /** 预设文档:底座认的部分(schema + snapshot)加上预设层的元数据。智作冻结进工程的文件就是它。 */
6
+ interface PresetDocument extends PresetDocumentCore {
7
+ readonly id: string;
8
+ readonly name: string;
9
+ readonly desc?: string;
10
+ /** 归属城市(6 位 adcode)。 */
11
+ readonly adcode?: string;
12
+ readonly tags?: readonly string[];
13
+ /** 由服务端从令牌里填,前端写了也会被覆盖。 */
14
+ readonly author?: string;
15
+ readonly createdAt: number;
16
+ /** 生成时的版本:判断兼容用。legacy 表示样板间桶里的老格式(裸 sdk-render 配置)。 */
17
+ readonly producedBy: {
18
+ readonly base: string;
19
+ readonly sdkRender: string;
20
+ } | 'legacy';
21
+ /** 冻结进工程时记下来源,便于提示「业务集群上有新版本」。 */
22
+ readonly source?: {
23
+ readonly kind: string;
24
+ readonly id: string;
25
+ readonly frozenAt?: number;
26
+ };
27
+ }
28
+ /** 卡片列表用的摘要(不含快照)。 */
29
+ interface PresetSummary {
30
+ /** 全局唯一:`{来源}:{来源内 id}`。 */
31
+ readonly id: string;
32
+ readonly source: string;
33
+ readonly name: string;
34
+ readonly desc?: string;
35
+ readonly adcode?: string;
36
+ readonly thumb?: string;
37
+ readonly createdAt?: number;
38
+ readonly producedBy?: PresetDocument['producedBy'];
39
+ readonly writable: boolean;
40
+ }
41
+ declare function requireDocument(value: unknown, what?: string): PresetDocument;
42
+ /** 样板间桶里的老格式(裸 sdk-render 配置,时间在 settings.clockIsoTime)包成预设文档。 */
43
+ declare function wrapLegacyConfig(config: Record<string, unknown>, meta: {
44
+ readonly id: string;
45
+ readonly name: string;
46
+ readonly desc?: string;
47
+ readonly adcode?: string;
48
+ }): PresetDocument;
49
+ /** 主版本不同算「可能不兼容」:套用前提醒,不阻止。 */
50
+ declare function compatibilityNote(producedBy: PresetDocument['producedBy'] | undefined, sdkRenderVersion: string | undefined): string | null;
51
+
52
+ /** 保存时由预设库填好的草稿:快照、版本、截图都已就绪,数据源只管存。 */
53
+ interface PresetDraft {
54
+ readonly name: string;
55
+ readonly desc?: string;
56
+ readonly adcode?: string;
57
+ readonly tags?: readonly string[];
58
+ readonly document: PresetDocument;
59
+ /** 缩略图(JPEG dataURL)。 */
60
+ readonly thumb?: string;
61
+ /** 地区:名称取城市名,范围取保存时的可视范围(业务集群预设必填)。 */
62
+ readonly region?: {
63
+ readonly name: string;
64
+ readonly bbox: readonly [number, number, number, number];
65
+ };
66
+ }
67
+ /** 列卡片的条件:adcode 与(预设库知道时)对应的城市名、省份。 */
68
+ interface PresetListQuery {
69
+ readonly adcode?: string;
70
+ readonly city?: {
71
+ readonly name: string;
72
+ readonly province?: string;
73
+ };
74
+ }
75
+ /**
76
+ * 预设数据源(可插拔)。内置:builtin(交付基线)、cluster(`httpPresetStore`,业务集群预设服务)、
77
+ * bucket(样板间储存桶,只读)、local(离线演示用,显式开启)。业务可以自己实现。
78
+ */
79
+ interface PresetSource {
80
+ /** 来源 id,也是卡片 id 的前缀。 */
81
+ readonly id: string;
82
+ /** 卡片上显示的来源名,如「业务集群」「样板间」。 */
83
+ readonly label: string;
84
+ readonly writable: boolean;
85
+ /** 列某城市的预设;adcode 为空时列不分城市的。 */
86
+ list(query: PresetListQuery): Promise<PresetSummary[]>;
87
+ /** 取完整预设(id 是来源内的 id,不带前缀)。 */
88
+ get(id: string): Promise<PresetDocument>;
89
+ save?(draft: PresetDraft): Promise<PresetSummary>;
90
+ remove?(id: string): Promise<void>;
91
+ /** 自定义套用方式;不给就整份导入快照。 */
92
+ apply?(earth: Earth, id: string): Promise<void>;
93
+ }
94
+
95
+ /**
96
+ * 样板间储存桶(与 sdk-render 样板间同一套 CDN 目录,只读):
97
+ * {base}/{adcode}/index.json 清单 { configs: [{ file, name, desc, thumb? }] }
98
+ * {base}/{adcode}/render-config-时间戳.json 整份环境配置(含 settings.clockIsoTime)
99
+ */
100
+ declare const DEFAULT_CITY_CONFIG_BASE_URL = "https://io-qos.geovisearth.com/getfile/46/brainsim-cdn/CityConfig";
101
+ interface CityConfigEntry {
102
+ /** 配置文件名,如 render-config-2026-04-29-04-15-19.json。 */
103
+ readonly file: string;
104
+ /** 名称,如「晨曦北京」。 */
105
+ readonly name: string;
106
+ readonly desc?: string;
107
+ /** 缩略图完整地址(清单里有 thumb 时)。 */
108
+ readonly thumbUrl?: string;
109
+ }
110
+ interface CityConfigIndex {
111
+ readonly configs: readonly {
112
+ readonly file: string;
113
+ readonly name: string;
114
+ readonly desc?: string;
115
+ readonly thumb?: string;
116
+ }[];
117
+ }
118
+ /** createCityConfig 的结果:两个文件交给有 CDN 写权限的人上传到 {base}/{adcode}/。 */
119
+ interface CityConfigDraft {
120
+ readonly adcode: string;
121
+ /** 配置文件名与内容。 */
122
+ readonly filename: string;
123
+ readonly config: Record<string, unknown>;
124
+ /** 合并好新条目的 index.json 内容(同名覆盖,否则追加)。 */
125
+ readonly index: CityConfigIndex;
126
+ /** 上传目录。 */
127
+ readonly uploadDir: string;
128
+ }
129
+ declare function createCityConfigLibrary(baseUrl: string): {
130
+ listCityConfigs(adcode: string | number): Promise<CityConfigEntry[]>;
131
+ fetchCityConfig(adcode: string | number, file: string): Promise<Record<string, unknown>>;
132
+ draftCityConfig(adcode: string | number, entry: {
133
+ readonly name: string;
134
+ readonly desc?: string;
135
+ }, config: Record<string, unknown>, now: Date): Promise<CityConfigDraft>;
136
+ };
137
+ interface BucketSourceOptions {
138
+ /** 储存桶根地址,默认样板间的 CityConfig 目录。 */
139
+ readonly baseUrl?: string;
140
+ readonly label?: string;
141
+ }
142
+ /** 样板间储存桶数据源:只读,老格式(裸 SDK 配置)自动包成预设文档。 */
143
+ declare function bucketSource(options?: BucketSourceOptions): PresetSource & {
144
+ /** 生成样板间桶的上传包(配置 + 合并好的 index.json),给有 CDN 写权限的人手动上传。 */
145
+ draftUpload: ReturnType<typeof createCityConfigLibrary>['draftCityConfig'];
146
+ };
147
+
148
+ /** 样板间同款城市列表接口(公开、允许跨域)。 */
149
+ declare const DEFAULT_CITY_LIST_URL = "https://metaverseds.geovisearth.com/api/v1/city/list";
150
+ /** 按行政区划代码前两位分的 7 个大区(同样板间)。 */
151
+ declare const REGION_RULES: readonly [{
152
+ readonly id: "north";
153
+ readonly name: "华北";
154
+ readonly prefixes: readonly [11, 12, 13, 14, 15];
155
+ }, {
156
+ readonly id: "northeast";
157
+ readonly name: "东北";
158
+ readonly prefixes: readonly [21, 22, 23];
159
+ }, {
160
+ readonly id: "east";
161
+ readonly name: "华东";
162
+ readonly prefixes: readonly [31, 32, 33, 34, 35, 36, 37];
163
+ }, {
164
+ readonly id: "central";
165
+ readonly name: "华中";
166
+ readonly prefixes: readonly [41, 42, 43];
167
+ }, {
168
+ readonly id: "south";
169
+ readonly name: "华南";
170
+ readonly prefixes: readonly [44, 45, 46];
171
+ }, {
172
+ readonly id: "southwest";
173
+ readonly name: "西南";
174
+ readonly prefixes: readonly [50, 51, 52, 53, 54];
175
+ }, {
176
+ readonly id: "northwest";
177
+ readonly name: "西北";
178
+ readonly prefixes: readonly [61, 62, 63, 64, 65];
179
+ }];
180
+ type RegionId = (typeof REGION_RULES)[number]['id'] | 'other';
181
+ declare const REGIONS: readonly {
182
+ readonly id: RegionId;
183
+ readonly name: string;
184
+ }[];
185
+ interface LibraryCity {
186
+ /** 6 位行政区划代码。 */
187
+ readonly adcode: string;
188
+ readonly name: string;
189
+ /** 所属省份(如「河北省」);直辖市为自身。 */
190
+ readonly province?: string;
191
+ readonly regionId: RegionId;
192
+ }
193
+ declare function regionOf(adcode: string): RegionId;
194
+
195
+ /** 本地存的一条:完整预设文档 + 缩略图。 */
196
+ interface LocalPresetRecord {
197
+ readonly document: PresetDocument;
198
+ readonly thumb?: string;
199
+ }
200
+ /** 本地存储接口。预设默认存上层传的 store;这个只给离线演示等场景显式开启。 */
201
+ interface PresetLibraryStorage {
202
+ load(): LocalPresetRecord[] | Promise<LocalPresetRecord[]>;
203
+ save(records: readonly LocalPresetRecord[]): void | Promise<void>;
204
+ }
205
+ declare const LOCAL_STORAGE_KEY = "smartearth-base.presets";
206
+ /** 用 localStorage 实现的本地存储(离线演示用;读失败当作空,写失败报错)。 */
207
+ declare function createLocalStorageStorage(key?: string): PresetLibraryStorage;
208
+ /** 本地数据源(显式开启)。 */
209
+ declare function localSource(storage: PresetLibraryStorage, label?: string): PresetSource;
210
+
211
+ /**
212
+ * 内置的唯一预设:sdk-render 交付基线,也就是建地球时默认的环境。
213
+ * 套用走 environment.resetConfig(保持当前画质),再把时间拨到基线自带的时刻。
214
+ */
215
+ declare function baselineSource(options?: {
216
+ readonly label?: string;
217
+ }): PresetSource;
218
+
219
+ /**
220
+ * 业务集群预设服务(stratex-cluster `docs/api-v1.md`「地区预设 render-preset/1」)。
221
+ * 地址和令牌都由上层给:智作里是主进程的本机代理地址,转发到已部署的服务,如
222
+ * `https://sites.geovisearth.com/stratex-cluster/api/v1/presets`,令牌是 AEP 访问令牌。底座不存令牌。
223
+ */
224
+ interface HttpPresetStoreOptions {
225
+ /** 预设接口根地址,到 `/presets` 为止,如 `https://sites.geovisearth.com/stratex-cluster/api/v1/presets`。 */
226
+ readonly baseUrl: string;
227
+ /** 每次请求现取的 Bearer 令牌;返回空或不给就不带(经上层代理附令牌时)。 */
228
+ readonly getToken?: () => string | null | undefined | Promise<string | null | undefined>;
229
+ /** 本集群编号:非管理员写入必填,读取时用来带出自己写的本集群版本。 */
230
+ readonly clusterId?: string;
231
+ /** 换请求方式(如 Electron 里走 IPC);默认全局 fetch。 */
232
+ readonly fetch?: typeof fetch;
233
+ /** 卡片上的来源名,默认「业务集群」。 */
234
+ readonly label?: string;
235
+ /** 预设里 time 字段(日期 + 时分)按哪个时区理解,默认 8(北京时间)。 */
236
+ readonly utcOffset?: number;
237
+ }
238
+ /** 去掉省 / 市等后缀,比较地区名。 */
239
+ declare function normalizeRegionName(name: string): string;
240
+ declare function httpPresetStore(options: HttpPresetStoreOptions): PresetSource;
241
+
242
+ interface PresetLibraryOptions {
243
+ /**
244
+ * 存预设的地方(可写数据源),由上层建好传进来,底座不认识地址和令牌。
245
+ * 智作里是 `httpPresetStore({ baseUrl, getToken, clusterId })`(业务集群预设服务)。没给就只能浏览、不能存。
246
+ */
247
+ readonly store?: PresetSource;
248
+ /** 内置的「交付基线」预设(sdk-render 交付基线参数),默认开;false 关掉。 */
249
+ readonly builtin?: boolean;
250
+ /** 样板间储存桶(只读),默认开;false 关掉。 */
251
+ readonly bucket?: BucketSourceOptions | false;
252
+ /** 浏览器本地存储,默认关;只给离线演示显式开启。 */
253
+ readonly storage?: PresetLibraryStorage;
254
+ /** 业务自己的数据源,排在内置的后面。 */
255
+ readonly sources?: readonly PresetSource[];
256
+ /** 城市列表接口,默认样板间同一个。 */
257
+ readonly cityListUrl?: string;
258
+ }
259
+ interface SavePresetOptions {
260
+ readonly name: string;
261
+ readonly desc?: string;
262
+ /** 归属城市(6 位 adcode);存业务集群时必填。 */
263
+ readonly adcode?: string;
264
+ readonly tags?: readonly string[];
265
+ /** 存下当前视角,默认 true;套用时默认不飞过去。 */
266
+ readonly camera?: boolean;
267
+ /** 截缩略图,默认 true。 */
268
+ readonly thumbnail?: boolean;
269
+ /** 存到哪个数据源(id),默认第一个可写的。 */
270
+ readonly target?: string;
271
+ }
272
+ interface PresetLibrary {
273
+ readonly sources: readonly PresetSource[];
274
+ readonly regions: typeof REGIONS;
275
+ /** 有没有可写的数据源。 */
276
+ readonly canSave: boolean;
277
+ listCities(): Promise<LibraryCity[]>;
278
+ /** 搜城市:城市名、省份、大区名,或看过的卡片名称 / 描述。 */
279
+ searchCities(query: string): Promise<LibraryCity[]>;
280
+ /** 卡片:各数据源合并(内置的「交付基线」不分城市,总在最前)。 */
281
+ list(adcode?: string | number): Promise<PresetSummary[]>;
282
+ /** 取完整预设文档。 */
283
+ getDocument(card: PresetSummary): Promise<PresetDocument>;
284
+ /** 套用前的兼容提醒(版本不一致时有)。 */
285
+ compatibility(card: PresetSummary): string | null;
286
+ /** 预览:第一次预览前拍快照,之后套用这张卡。 */
287
+ preview(card: PresetSummary): Promise<void>;
288
+ confirmPreview(): void;
289
+ /** 取消预览:恢复到第一次预览前(含时间)。 */
290
+ cancelPreview(): Promise<void>;
291
+ readonly isPreviewing: boolean;
292
+ /** 套用;`camera: true` 时顺便飞到预设里存的视角(默认不飞)。 */
293
+ apply(card: PresetSummary, options?: {
294
+ readonly camera?: boolean;
295
+ }): Promise<void>;
296
+ /** 把当前环境存成预设(默认存第一个可写数据源,通常是业务集群)。 */
297
+ save(options: SavePresetOptions): Promise<PresetSummary>;
298
+ remove(card: PresetSummary): Promise<void>;
299
+ /** 把当前环境做成预设文档(不存):智作「冻结进工程」用。 */
300
+ documentFromCurrent(options: Omit<SavePresetOptions, 'thumbnail' | 'target'>): Promise<PresetDocument>;
301
+ /** 生成样板间储存桶的上传包(手动上传)。 */
302
+ bucketUploadPackage(adcode: string | number, options: SavePresetOptions): Promise<CityConfigDraft & {
303
+ thumb?: {
304
+ filename: string;
305
+ dataUrl: string;
306
+ };
307
+ }>;
308
+ }
309
+ declare function createPresetLibrary(earth: Earth, options?: PresetLibraryOptions): PresetLibrary;
310
+
311
+ export { type BucketSourceOptions, type CityConfigDraft, DEFAULT_CITY_CONFIG_BASE_URL, DEFAULT_CITY_LIST_URL, type HttpPresetStoreOptions, LOCAL_STORAGE_KEY, type LibraryCity, type LocalPresetRecord, type PresetDocument, type PresetDraft, type PresetLibrary, type PresetLibraryOptions, type PresetLibraryStorage, type PresetListQuery, type PresetSource, type PresetSummary, REGIONS, type RegionId, type SavePresetOptions, baselineSource, bucketSource, compatibilityNote, createLocalStorageStorage, createPresetLibrary, httpPresetStore, localSource, normalizeRegionName, regionOf, requireDocument, wrapLegacyConfig };
@@ -0,0 +1,2 @@
1
+ export { DEFAULT_CITY_CONFIG_BASE_URL, DEFAULT_CITY_LIST_URL, LOCAL_STORAGE_KEY, REGIONS, baselineSource, bucketSource, compatibilityNote, createLocalStorageStorage, createPresetLibrary, httpPresetStore, localSource, normalizeRegionName, regionOf, requireDocument, wrapLegacyConfig } from './chunk-6U32ENXU.js';
2
+ import './chunk-XJRW7VZC.js';
package/dist/vue.d.ts CHANGED
@@ -1,9 +1,85 @@
1
1
  import * as vue from 'vue';
2
- import { PropType } from 'vue';
3
- import { d as CreateEarthOptions, E as Earth, r as SmartEarthError } from './errors-CtkYU3iT.js';
2
+ import { PropType, VNode } from 'vue';
3
+ import { l as Earth, j as CreateEarthOptions } from './createEarth-BY0dtgQQ.js';
4
+ import { S as SmartEarthError } from './errors-cB7IQlHy.js';
5
+ import { PresetLibrary, PresetSource, PresetSummary } from './presets.js';
4
6
  import 'cesium';
5
7
  import '@metagl/sdk-render';
6
8
 
9
+ /**
10
+ * 预设库面板(同 sdk-render 样板间的配置库):大区 / 城市浏览与搜索、交付基线 / 业务集群 / 样板间预设卡、
11
+ * 预览 → 确认 / 取消、存到业务集群、下载、生成样板间上传包。逻辑在 createPresetLibrary 上,这里只是界面。
12
+ *
13
+ * <SmartEarthPresetLibrary :earth="earth" :store="store" adcode="110000" @applied="..." @close="..." />
14
+ * 要自己配数据源就传 :library="createPresetLibrary(earth, {...})",此时 store 不再起作用。
15
+ */
16
+ declare const SmartEarthPresetLibrary: vue.DefineComponent<vue.ExtractPropTypes<{
17
+ earth: {
18
+ type: PropType<Earth>;
19
+ required: true;
20
+ };
21
+ /** 现成的预设库;不传就按 store 建一个。只在挂载时读一次。 */
22
+ library: {
23
+ type: PropType<PresetLibrary>;
24
+ default: undefined;
25
+ };
26
+ /** 存预设的地方,上层建好传进来(如 httpPresetStore({ baseUrl, getToken, clusterId }));不传就只能浏览、不能存。只在挂载时读一次。 */
27
+ store: {
28
+ type: PropType<PresetSource>;
29
+ default: undefined;
30
+ };
31
+ /** 打开时默认选中的城市(6 位 adcode)。 */
32
+ adcode: {
33
+ type: StringConstructor;
34
+ default: undefined;
35
+ };
36
+ /** 显示右上角关闭按钮(点了发 close 事件)。 */
37
+ closable: {
38
+ type: BooleanConstructor;
39
+ default: boolean;
40
+ };
41
+ }>, () => VNode<vue.RendererNode, vue.RendererElement, {
42
+ [key: string]: any;
43
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
44
+ applied: (entry: PresetSummary) => boolean;
45
+ saved: (entry: PresetSummary) => boolean;
46
+ close: () => true;
47
+ }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
48
+ earth: {
49
+ type: PropType<Earth>;
50
+ required: true;
51
+ };
52
+ /** 现成的预设库;不传就按 store 建一个。只在挂载时读一次。 */
53
+ library: {
54
+ type: PropType<PresetLibrary>;
55
+ default: undefined;
56
+ };
57
+ /** 存预设的地方,上层建好传进来(如 httpPresetStore({ baseUrl, getToken, clusterId }));不传就只能浏览、不能存。只在挂载时读一次。 */
58
+ store: {
59
+ type: PropType<PresetSource>;
60
+ default: undefined;
61
+ };
62
+ /** 打开时默认选中的城市(6 位 adcode)。 */
63
+ adcode: {
64
+ type: StringConstructor;
65
+ default: undefined;
66
+ };
67
+ /** 显示右上角关闭按钮(点了发 close 事件)。 */
68
+ closable: {
69
+ type: BooleanConstructor;
70
+ default: boolean;
71
+ };
72
+ }>> & Readonly<{
73
+ onClose?: (() => any) | undefined;
74
+ onApplied?: ((entry: PresetSummary) => any) | undefined;
75
+ onSaved?: ((entry: PresetSummary) => any) | undefined;
76
+ }>, {
77
+ adcode: string;
78
+ library: PresetLibrary;
79
+ store: PresetSource;
80
+ closable: boolean;
81
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
82
+
7
83
  /**
8
84
  * <SmartEarthView :options="..." @ready="(earth) => ..." @error="(err) => ..." />
9
85
  *
@@ -29,4 +105,4 @@ declare const SmartEarthView: vue.DefineComponent<vue.ExtractPropTypes<{
29
105
  onError?: ((error: SmartEarthError) => any) | undefined;
30
106
  }>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
31
107
 
32
- export { SmartEarthView, SmartEarthView as default };
108
+ export { SmartEarthPresetLibrary, SmartEarthView, SmartEarthView as default };