@worktile/planet 17.0.0-next.0 → 17.0.0-next.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/helpers.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare function createElementByTemplate(template: string): HTMLElement;
6
6
  export declare function coerceArray<T>(value: T | T[]): T[];
7
7
  export declare function isEmpty(value: any): boolean;
8
8
  export declare function isFunction(value: any): value is Function;
9
- export declare function isObject(val: any): boolean;
9
+ export declare function isObject<T extends object>(value: any): value is T;
10
10
  /**
11
11
  * Get file name from path
12
12
  * 1. "main.js" => "main.js"
@@ -14,6 +14,7 @@ export declare function isObject(val: any): boolean;
14
14
  * @param path path
15
15
  */
16
16
  export declare function getResourceFileName(path: string): string;
17
+ export declare function getExtName(name: string): string;
17
18
  /**
18
19
  * Build resource path by manifest
19
20
  * if manifest is { "main.js": "main.h2sh23abee.js"}
@@ -25,12 +26,14 @@ export declare function getResourceFileName(path: string): string;
25
26
  export declare function buildResourceFilePath(resourceFilePath: string, manifestResult: {
26
27
  [key: string]: string;
27
28
  }): string;
29
+ export declare function buildFullPath(path: string, basePath?: string): string;
30
+ export declare function getAssetsBasePath(app: PlanetApplication): string;
28
31
  /**
29
32
  * Get static resource full path
30
33
  * @param app PlanetApplication
31
34
  * @param manifestResult manifest
32
35
  */
33
- export declare function getScriptsAndStylesFullPaths(app: PlanetApplication, manifestResult?: {
36
+ export declare function getScriptsAndStylesFullPaths(app: PlanetApplication, basePath: string, manifestResult?: {
34
37
  [key: string]: string;
35
38
  }): {
36
39
  scripts: string[];
package/helpers.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../packages/planet/src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAInD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY5C;AAED,wBAAgB,c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AQ,EAAE,MAAM,eAUvD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAElD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAM3C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAGxD;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,CAAC,CAEjE;AACD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,UAO/C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,UAOtC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,UAOxG;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,UAS5D;AAeD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAWhE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE;;;EA2ChI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worktile/planet",
3
- "version": "17.0.0-next.0",
3
+ "version": "17.0.0-next.1",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^17.0.0",
package/planet.class.d.ts CHANGED
@@ -5,25 +5,105 @@ export interface PlanetOptions {
5
5
  errorHandler: (error: Error) => void;
6
6
  debugFactory?: Debug;
7
7
  }
8
+ export interface PlanetApplicationEntry {
9
+ basePath?: string;
10
+ scripts?: string[];
11
+ styles?: string[];
12
+ manifest?: string;
13
+ }
8
14
  export interface PlanetApplication<TExtra = any> {
15
+ /**
16
+ * Application name, e.g. "app1"
17
+ */
9
18
  name: string;
19
+ /**
20
+ * Selector or Element which app host parent
21
+ * 应用加载的宿主元素或者选择器
22
+ */
10
23
  hostParent: string | HTMLElement;
11
24
  /**
25
+ * Class name for host
26
+ */
27
+ hostClass?: string | string[];
28
+ /**
29
+ * Selector for sub application
30
+ * 子应用的选择器
12
31
  * @deprecated please use new defineApplication to set selector
13
32
  */
14
33
  selector?: string;
34
+ /**
35
+ * Path prefix for sub application, e.g. '/app1'
36
+ * 子应用路由前缀路径
37
+ */
15
38
  routerPathPrefix: string | RegExp;
16
- hostClass?: string | string[];
39
+ /**
40
+ * Preload enabled, default false, if enabled,the application will be loaded when idle in the background
41
+ * 是否开启预加载,开启后会在后台提前加载此应用
42
+ */
17
43
  preload?: boolean;
44
+ /**
45
+ * Sandbox enabled
46
+ * 是否开启沙箱模式
47
+ */
18
48
  sandbox?: boolean;
49
+ /**
50
+ * Switch application mode
51
+ * default: will be destroyed when switch to other app
52
+ * coexist: only hide app when switch to other app
53
+ * 切换应用的模式
54
+ */
19
55
  switchMode?: SwitchModes;
20
- resourcePathPrefix?: string;
56
+ /**
57
+ * Style prefix, e.g. 'app1'
58
+ * 样式前缀
59
+ */
21
60
  stylePrefix?: string;
61
+ /**
62
+ * The entry of the micro application, e.g. '/static/app1/index.html'
63
+ * If configured as string, it represents the entry html address of the micro application. e.g. '/static/app1/index.html'
64
+ * If configured as object, the value of manifest is the html address of the micro application
65
+ * entry.basePath: the base path of the entry, e.g. '/static/app1/'
66
+ * entry.manifest: the manifest of the entry, e.g. 'index.html' or 'assets-manifest.json'
67
+ * entry.scripts: the scripts of the entry, will get final scripts address by manifest and basePath
68
+ * entry.styles: the styles of the entry, will get final styles address by manifest and basePath
69
+ */
70
+ entry?: string | PlanetApplicationEntry;
71
+ /**
72
+ * Manifest json file path, e.g. /static/app1/assets-manifest.json
73
+ * 应用程序打包后的脚本和样式文件替换
74
+ * @deprecated Please use entry.manifest instead
75
+ */
76
+ manifest?: string;
77
+ /**
78
+ * Path prefix of scripts and styles, e.g. 'static/app1/'
79
+ * 资源文件路径的前缀
80
+ * @deprecated Please use entry.basePath instead
81
+ */
82
+ resourcePathPrefix?: string;
83
+ /**
84
+ * Style static resource paths
85
+ * 样式资源文件
86
+ * @deprecated Please use entry.styles instead
87
+ */
22
88
  styles?: string[];
89
+ /**
90
+ * Scripts static resource paths
91
+ * 脚本资源文件
92
+ * @deprecated Please use entry.scripts instead
93
+ */
23
94
  scripts?: string[];
95
+ /**
96
+ * Serial load scripts, default is parallel, only enable when the script has sequentially loaded dependency
97
+ * 串行加载,默认并行加载脚本资源,仅当脚本资源有依赖关系时开启
98
+ */
24
99
  loadSerial?: boolean;
25
- themeStylesPath?: string;
26
- manifest?: string;
100
+ /**
101
+ * 皮肤样式的路径
102
+ */
103
+ /**
104
+ * Extra data for application
105
+ * 附加数据,主要应用于业务,比如图标,子应用的颜色,显示名等个性化配置
106
+ */
27
107
  extra?: TExtra;
28
108
  }
29
109
  export declare enum SwitchModes {
@@ -1 +1 @@
1
- {"version":3,"file":"planet.class.d.ts","sourceRoot":"","sources":["../../packages/planet/src/planet.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,aAAa;IAC1B,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,KAAK,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IAEb,UAAU,EAAE,MAAM,GAAG,WAAW,CA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