@stampgis/webrtc 1.0.0 → 1.0.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 +64 -158
- package/assets/config/stamp_core_config.js +1 -26
- package/dist/index.cjs +3596 -1209
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +48 -23
- package/dist/index.d.ts +48 -23
- package/dist/index.js +3627 -1203
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -4642,25 +4642,39 @@ interface CoreLoadOptions {
|
|
|
4642
4642
|
pixelstreamingUrl?: string;
|
|
4643
4643
|
playerControlUrl?: string;
|
|
4644
4644
|
/**
|
|
4645
|
-
*
|
|
4645
|
+
* 匹配器 IP,覆盖 stamp_core_config.js 中的默认值。
|
|
4646
4646
|
* 如果传入,会在脚本加载后修改 window.stamp_core_config 的相关字段。
|
|
4647
4647
|
*/
|
|
4648
|
-
|
|
4648
|
+
match_maker?: string;
|
|
4649
4649
|
/** 超时时间(毫秒),默认 30 秒(像素流连接较慢) */
|
|
4650
4650
|
timeout?: number;
|
|
4651
4651
|
}
|
|
4652
4652
|
/**
|
|
4653
|
-
* 地图初始化配置(
|
|
4653
|
+
* 地图初始化配置(initMap 参数)
|
|
4654
4654
|
*/
|
|
4655
|
-
interface
|
|
4656
|
-
/** 地球容器 DOM
|
|
4657
|
-
|
|
4658
|
-
/** 错误提示容器 DOM
|
|
4659
|
-
|
|
4655
|
+
interface InitMapOptions {
|
|
4656
|
+
/** 地球容器 DOM 元素或元素 id */
|
|
4657
|
+
container: string | HTMLElement;
|
|
4658
|
+
/** 错误提示容器 DOM 元素或元素 id,不传则在内部自动创建 */
|
|
4659
|
+
errorContainer?: string | HTMLElement;
|
|
4660
4660
|
/** 屏幕索引:0=主屏, 1=副屏1, 2=副屏2 */
|
|
4661
|
-
|
|
4661
|
+
mapIndex?: number;
|
|
4662
4662
|
/** 是否显示提示信息 */
|
|
4663
4663
|
showTips?: boolean;
|
|
4664
|
+
/**
|
|
4665
|
+
* 核心脚本加载配置(可选)。
|
|
4666
|
+
*
|
|
4667
|
+
* 如果 StampAPI 尚未就绪,initMap 会自动调用 loadCore()。
|
|
4668
|
+
* 不传则默认使用 useBundledAssets: true。
|
|
4669
|
+
*
|
|
4670
|
+
* 示例:
|
|
4671
|
+
* // 自动加载(默认从包内 assets)
|
|
4672
|
+
* await initMap({ container: 'earthDiv' })
|
|
4673
|
+
*
|
|
4674
|
+
* // 指定加载方式
|
|
4675
|
+
* await initMap({ container: document.getElementById('earth')!, coreOptions: { baseUrl: '/gis/' } })
|
|
4676
|
+
*/
|
|
4677
|
+
coreOptions?: CoreLoadOptions;
|
|
4664
4678
|
}
|
|
4665
4679
|
/**
|
|
4666
4680
|
* stamp_core_config 配置对象结构(部分关键字段)
|
|
@@ -4711,7 +4725,7 @@ declare global {
|
|
|
4711
4725
|
errorDomElement?: HTMLElement;
|
|
4712
4726
|
iIndex?: number;
|
|
4713
4727
|
showTips?: boolean;
|
|
4714
|
-
}):
|
|
4728
|
+
}): Promise<unknown>;
|
|
4715
4729
|
initErrorDiv(opts: {
|
|
4716
4730
|
earthDomElement: HTMLElement;
|
|
4717
4731
|
errorDomElement: HTMLElement;
|
|
@@ -4781,7 +4795,7 @@ declare function waitForGlobal(globalName: string, timeout?: number, interval?:
|
|
|
4781
4795
|
* 2. pixelstreaming.js → 注册 window.StampPixelStreaming
|
|
4782
4796
|
* 3. playerControl.js → 注册 window.StampAPI(依赖前两个脚本)
|
|
4783
4797
|
*
|
|
4784
|
-
* 加载完成后,如果传入了
|
|
4798
|
+
* 加载完成后,如果传入了 match_maker,会覆盖 stamp_core_config 中的匹配器地址。
|
|
4785
4799
|
*
|
|
4786
4800
|
* @param options 加载配置
|
|
4787
4801
|
*
|
|
@@ -4798,7 +4812,7 @@ declare function waitForGlobal(globalName: string, timeout?: number, interval?:
|
|
|
4798
4812
|
* configUrl: 'https://cdn.example.com/config/stamp_core_config.js',
|
|
4799
4813
|
* pixelstreamingUrl: 'https://cdn.example.com/core/pixelstreaming.js',
|
|
4800
4814
|
* playerControlUrl: 'https://cdn.example.com/core/playerControl.js',
|
|
4801
|
-
*
|
|
4815
|
+
* match_maker: '/matchmaker',
|
|
4802
4816
|
* });
|
|
4803
4817
|
*
|
|
4804
4818
|
* // 方式四:通过打包器 import 获取 URL(最大灵活性)
|
|
@@ -4810,25 +4824,36 @@ declare function waitForGlobal(globalName: string, timeout?: number, interval?:
|
|
|
4810
4824
|
*/
|
|
4811
4825
|
declare function loadCore(options?: CoreLoadOptions): Promise<void>;
|
|
4812
4826
|
/**
|
|
4813
|
-
*
|
|
4827
|
+
* 初始化地图(地球渲染)
|
|
4814
4828
|
*
|
|
4815
|
-
*
|
|
4816
|
-
*
|
|
4817
|
-
*
|
|
4818
|
-
* 必须在 loadCore() 之后调用。
|
|
4829
|
+
* 如果核心脚本尚未加载(window.StampAPI 不存在),会自动调用 loadCore()。
|
|
4830
|
+
* 默认使用 useBundledAssets: true,也可通过 coreOptions 指定加载方式。
|
|
4819
4831
|
*
|
|
4820
4832
|
* @param options 初始化参数
|
|
4821
4833
|
*
|
|
4822
4834
|
* @example
|
|
4823
4835
|
* ```ts
|
|
4824
|
-
*
|
|
4836
|
+
* // 最简用法:自动加载 + 初始化(通过 id 指定容器)
|
|
4837
|
+
* await initMap({ container: 'earthDiv' });
|
|
4838
|
+
*
|
|
4839
|
+
* // 传入 DOM 元素 + 自定义错误容器
|
|
4840
|
+
* await initMap({
|
|
4841
|
+
* container: document.getElementById('earth')!,
|
|
4842
|
+
* errorContainer: 'errorDiv',
|
|
4843
|
+
* mapIndex: 0,
|
|
4844
|
+
* });
|
|
4845
|
+
*
|
|
4846
|
+
* // errorContainer 不传则内部自动创建
|
|
4847
|
+
* await initMap({ container: 'earthDiv' });
|
|
4825
4848
|
*
|
|
4826
|
-
*
|
|
4827
|
-
*
|
|
4828
|
-
*
|
|
4849
|
+
* // 指定加载方式
|
|
4850
|
+
* await initMap({
|
|
4851
|
+
* container: 'earthDiv',
|
|
4852
|
+
* coreOptions: { baseUrl: '/gis/' },
|
|
4853
|
+
* });
|
|
4829
4854
|
* ```
|
|
4830
4855
|
*/
|
|
4831
|
-
declare function
|
|
4856
|
+
declare function initMap(options: InitMapOptions): Promise<unknown>;
|
|
4832
4857
|
|
|
4833
4858
|
declare const ASSET_PATHS: {
|
|
4834
4859
|
readonly config: "@stampgis/webrtc/assets/config/stamp_core_config.js";
|
|
@@ -4836,4 +4861,4 @@ declare const ASSET_PATHS: {
|
|
|
4836
4861
|
readonly playerControl: "@stampgis/webrtc/assets/core/playerControl.js";
|
|
4837
4862
|
};
|
|
4838
4863
|
|
|
4839
|
-
export { ASSET_PATHS, type CoreLoadOptions, type
|
|
4864
|
+
export { ASSET_PATHS, type CoreLoadOptions, type InitMapOptions, STAMP_RTTI, type StampCoreConfig, StampUtil, StampUtil as default, initMap, loadCore, loadScript, waitForGlobal };
|
package/dist/index.d.ts
CHANGED
|
@@ -4642,25 +4642,39 @@ interface CoreLoadOptions {
|
|
|
4642
4642
|
pixelstreamingUrl?: string;
|
|
4643
4643
|
playerControlUrl?: string;
|
|
4644
4644
|
/**
|
|
4645
|
-
*
|
|
4645
|
+
* 匹配器 IP,覆盖 stamp_core_config.js 中的默认值。
|
|
4646
4646
|
* 如果传入,会在脚本加载后修改 window.stamp_core_config 的相关字段。
|
|
4647
4647
|
*/
|
|
4648
|
-
|
|
4648
|
+
match_maker?: string;
|
|
4649
4649
|
/** 超时时间(毫秒),默认 30 秒(像素流连接较慢) */
|
|
4650
4650
|
timeout?: number;
|
|
4651
4651
|
}
|
|
4652
4652
|
/**
|
|
4653
|
-
* 地图初始化配置(
|
|
4653
|
+
* 地图初始化配置(initMap 参数)
|
|
4654
4654
|
*/
|
|
4655
|
-
interface
|
|
4656
|
-
/** 地球容器 DOM
|
|
4657
|
-
|
|
4658
|
-
/** 错误提示容器 DOM
|
|
4659
|
-
|
|
4655
|
+
interface InitMapOptions {
|
|
4656
|
+
/** 地球容器 DOM 元素或元素 id */
|
|
4657
|
+
container: string | HTMLElement;
|
|
4658
|
+
/** 错误提示容器 DOM 元素或元素 id,不传则在内部自动创建 */
|
|
4659
|
+
errorContainer?: string | HTMLElement;
|
|
4660
4660
|
/** 屏幕索引:0=主屏, 1=副屏1, 2=副屏2 */
|
|
4661
|
-
|
|
4661
|
+
mapIndex?: number;
|
|
4662
4662
|
/** 是否显示提示信息 */
|
|
4663
4663
|
showTips?: boolean;
|
|
4664
|
+
/**
|
|
4665
|
+
* 核心脚本加载配置(可选)。
|
|
4666
|
+
*
|
|
4667
|
+
* 如果 StampAPI 尚未就绪,initMap 会自动调用 loadCore()。
|
|
4668
|
+
* 不传则默认使用 useBundledAssets: true。
|
|
4669
|
+
*
|
|
4670
|
+
* 示例:
|
|
4671
|
+
* // 自动加载(默认从包内 assets)
|
|
4672
|
+
* await initMap({ container: 'earthDiv' })
|
|
4673
|
+
*
|
|
4674
|
+
* // 指定加载方式
|
|
4675
|
+
* await initMap({ container: document.getElementById('earth')!, coreOptions: { baseUrl: '/gis/' } })
|
|
4676
|
+
*/
|
|
4677
|
+
coreOptions?: CoreLoadOptions;
|
|
4664
4678
|
}
|
|
4665
4679
|
/**
|
|
4666
4680
|
* stamp_core_config 配置对象结构(部分关键字段)
|
|
@@ -4711,7 +4725,7 @@ declare global {
|
|
|
4711
4725
|
errorDomElement?: HTMLElement;
|
|
4712
4726
|
iIndex?: number;
|
|
4713
4727
|
showTips?: boolean;
|
|
4714
|
-
}):
|
|
4728
|
+
}): Promise<unknown>;
|
|
4715
4729
|
initErrorDiv(opts: {
|
|
4716
4730
|
earthDomElement: HTMLElement;
|
|
4717
4731
|
errorDomElement: HTMLElement;
|
|
@@ -4781,7 +4795,7 @@ declare function waitForGlobal(globalName: string, timeout?: number, interval?:
|
|
|
4781
4795
|
* 2. pixelstreaming.js → 注册 window.StampPixelStreaming
|
|
4782
4796
|
* 3. playerControl.js → 注册 window.StampAPI(依赖前两个脚本)
|
|
4783
4797
|
*
|
|
4784
|
-
* 加载完成后,如果传入了
|
|
4798
|
+
* 加载完成后,如果传入了 match_maker,会覆盖 stamp_core_config 中的匹配器地址。
|
|
4785
4799
|
*
|
|
4786
4800
|
* @param options 加载配置
|
|
4787
4801
|
*
|
|
@@ -4798,7 +4812,7 @@ declare function waitForGlobal(globalName: string, timeout?: number, interval?:
|
|
|
4798
4812
|
* configUrl: 'https://cdn.example.com/config/stamp_core_config.js',
|
|
4799
4813
|
* pixelstreamingUrl: 'https://cdn.example.com/core/pixelstreaming.js',
|
|
4800
4814
|
* playerControlUrl: 'https://cdn.example.com/core/playerControl.js',
|
|
4801
|
-
*
|
|
4815
|
+
* match_maker: '/matchmaker',
|
|
4802
4816
|
* });
|
|
4803
4817
|
*
|
|
4804
4818
|
* // 方式四:通过打包器 import 获取 URL(最大灵活性)
|
|
@@ -4810,25 +4824,36 @@ declare function waitForGlobal(globalName: string, timeout?: number, interval?:
|
|
|
4810
4824
|
*/
|
|
4811
4825
|
declare function loadCore(options?: CoreLoadOptions): Promise<void>;
|
|
4812
4826
|
/**
|
|
4813
|
-
*
|
|
4827
|
+
* 初始化地图(地球渲染)
|
|
4814
4828
|
*
|
|
4815
|
-
*
|
|
4816
|
-
*
|
|
4817
|
-
*
|
|
4818
|
-
* 必须在 loadCore() 之后调用。
|
|
4829
|
+
* 如果核心脚本尚未加载(window.StampAPI 不存在),会自动调用 loadCore()。
|
|
4830
|
+
* 默认使用 useBundledAssets: true,也可通过 coreOptions 指定加载方式。
|
|
4819
4831
|
*
|
|
4820
4832
|
* @param options 初始化参数
|
|
4821
4833
|
*
|
|
4822
4834
|
* @example
|
|
4823
4835
|
* ```ts
|
|
4824
|
-
*
|
|
4836
|
+
* // 最简用法:自动加载 + 初始化(通过 id 指定容器)
|
|
4837
|
+
* await initMap({ container: 'earthDiv' });
|
|
4838
|
+
*
|
|
4839
|
+
* // 传入 DOM 元素 + 自定义错误容器
|
|
4840
|
+
* await initMap({
|
|
4841
|
+
* container: document.getElementById('earth')!,
|
|
4842
|
+
* errorContainer: 'errorDiv',
|
|
4843
|
+
* mapIndex: 0,
|
|
4844
|
+
* });
|
|
4845
|
+
*
|
|
4846
|
+
* // errorContainer 不传则内部自动创建
|
|
4847
|
+
* await initMap({ container: 'earthDiv' });
|
|
4825
4848
|
*
|
|
4826
|
-
*
|
|
4827
|
-
*
|
|
4828
|
-
*
|
|
4849
|
+
* // 指定加载方式
|
|
4850
|
+
* await initMap({
|
|
4851
|
+
* container: 'earthDiv',
|
|
4852
|
+
* coreOptions: { baseUrl: '/gis/' },
|
|
4853
|
+
* });
|
|
4829
4854
|
* ```
|
|
4830
4855
|
*/
|
|
4831
|
-
declare function
|
|
4856
|
+
declare function initMap(options: InitMapOptions): Promise<unknown>;
|
|
4832
4857
|
|
|
4833
4858
|
declare const ASSET_PATHS: {
|
|
4834
4859
|
readonly config: "@stampgis/webrtc/assets/config/stamp_core_config.js";
|
|
@@ -4836,4 +4861,4 @@ declare const ASSET_PATHS: {
|
|
|
4836
4861
|
readonly playerControl: "@stampgis/webrtc/assets/core/playerControl.js";
|
|
4837
4862
|
};
|
|
4838
4863
|
|
|
4839
|
-
export { ASSET_PATHS, type CoreLoadOptions, type
|
|
4864
|
+
export { ASSET_PATHS, type CoreLoadOptions, type InitMapOptions, STAMP_RTTI, type StampCoreConfig, StampUtil, StampUtil as default, initMap, loadCore, loadScript, waitForGlobal };
|