@polyvharmony/live-scenes-foundation 1.2.0-rc.1 → 1.3.0-rc.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/Index.d.ets +4 -2
  3. package/Index.js +3 -1
  4. package/ResourceTable.txt +2 -1
  5. package/libs/plvclasstransformer.har +0 -0
  6. package/oh-package.json5 +1 -1
  7. package/package.json +1 -1
  8. package/src/main/ets/common/PLVCallback.d.ets +31 -6
  9. package/src/main/ets/common/PLVCallback.js +85 -27
  10. package/src/main/ets/common/PLVCommonConstants.d.ets +1 -0
  11. package/src/main/ets/common/PLVCommonConstants.js +1 -0
  12. package/src/main/ets/common/PLVCommonEnums.js +16 -16
  13. package/src/main/ets/common/PLVDeviceUtils.d.ets +7 -0
  14. package/src/main/ets/common/PLVDeviceUtils.js +28 -1
  15. package/src/main/ets/common/PLVJSONUtils.d.ets +7 -7
  16. package/src/main/ets/common/PLVJSONUtils.js +20 -20
  17. package/src/main/ets/common/PLVNetUtils.d.ets +4 -3
  18. package/src/main/ets/common/PLVNetUtils.js +20 -14
  19. package/src/main/ets/common/PLVPreferencesUtils.d.ets +8 -8
  20. package/src/main/ets/common/PLVPreferencesUtils.js +16 -16
  21. package/src/main/ets/common/PLVScheduledTask.js +2 -2
  22. package/src/main/ets/common/PLVSimpleBuffer.d.ets +2 -2
  23. package/src/main/ets/common/PLVSimpleBuffer.js +6 -6
  24. package/src/main/ets/common/PLVSparseArray.d.ets +10 -0
  25. package/src/main/ets/common/PLVSparseArray.js +44 -0
  26. package/src/main/ets/common/PLVTextUtils.d.ets +2 -1
  27. package/src/main/ets/common/PLVTextUtils.js +28 -22
  28. package/src/main/ets/common/PLVTimeUtils.d.ets +1 -1
  29. package/src/main/ets/common/PLVTimeUtils.js +8 -8
  30. package/src/main/ets/common/PLVToastUtils.d.ets +2 -2
  31. package/src/main/ets/common/PLVType.d.ets +1 -0
  32. package/src/main/ets/common/PLVUACreator.d.ets +1 -1
  33. package/src/main/ets/common/PLVUACreator.js +6 -6
  34. package/src/main/ets/common/PLVUtils.d.ets +15 -8
  35. package/src/main/ets/common/PLVUtils.js +89 -45
  36. package/src/main/ets/common/PLVWebUtils.d.ets +1 -1
  37. package/src/main/ets/common/PLVWebUtils.js +22 -22
  38. package/src/main/ets/common/ui/PLVNodeController.d.ets +41 -0
  39. package/src/main/ets/common/ui/PLVNodeController.js +103 -0
  40. package/src/main/ets/modules/log/PLVLogger.d.ets +9 -9
  41. package/src/main/ets/modules/log/PLVLogger.js +20 -20
  42. package/src/main/ets/modules/log/PLVXLogFilePrinter.d.ets +1 -1
  43. package/src/main/ets/modules/log/PLVXLogFilePrinter.js +2 -2
  44. package/src/main/ets/modules/net/PLVHttpData.d.ets +1 -1
  45. package/src/main/ets/modules/net/PLVHttpData.js +2 -2
  46. package/src/main/ets/modules/net/PLVHttpError.d.ets +2 -2
  47. package/src/main/ets/modules/net/PLVHttpError.js +5 -5
  48. package/src/main/ets/modules/net/PLVHttpRequest.d.ets +7 -7
  49. package/src/main/ets/modules/net/PLVHttpRequest.js +31 -31
  50. package/src/main/ets/modules/net/PLVRequestSetting.js +7 -7
  51. package/src/main/ets/modules/socket/PLVSocketIO.d.ets +19 -18
  52. package/src/main/ets/modules/socket/PLVSocketIO.js +70 -53
  53. package/src/main/ets/modules/web/PLVSimpleWeb.js +3 -3
  54. package/src/main/ets/modules/web/PLVWebController.d.ets +5 -3
  55. package/src/main/ets/modules/web/PLVWebController.js +29 -21
  56. package/src/main/module.json +1 -28
package/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## [v1.2.0-rc.1] - 2025-02-10
1
+ ## [v1.3.0-rc.1] - 2025-08-25
2
+
3
+ Canary build
4
+
5
+ ## [v1.2.0] - 2025-02-10
2
6
 
3
7
  新增:
4
8
 
package/Index.d.ets CHANGED
@@ -1,6 +1,7 @@
1
+ export { PLVNodeControllerManager, PLVNodeController, NodeControllerConfig } from './src/main/ets/common/ui/PLVNodeController';
1
2
  export { IPLVBackwardInterface } from './src/main/ets/common/IPLVBackwardInterface';
2
3
  export { default as PLVLazyDataSource } from './src/main/ets/common/PLVBasicDataSource';
3
- export { PLVCallback, PLVCallback2, PLVStateData, PLVDisposable, PLVPromiseValue, PLVLazyValue, PLVAsyncLazyValue, IPLVEventEmitter, IPLVEventNotify, PLVEventNotify } from './src/main/ets/common/PLVCallback';
4
+ export { PLVCallback, PLVCallback2, PLVCustomBuilder, PLVMediaQueryListener, PLVAvoidAreaChangeListener, PLVStateData, PLVStatefulData, PLVDisposable, PLVPromiseValue, PLVLazyValue, PLVAsyncLazyValue, IPLVEventEmitter, IPLVEventNotify, PLVEventNotify } from './src/main/ets/common/PLVCallback';
4
5
  export { default as PLVCommonConstants } from './src/main/ets/common/PLVCommonConstants';
5
6
  export { PLVDeviceUtils } from './src/main/ets/common/PLVDeviceUtils';
6
7
  export { PLVHashMap } from './src/main/ets/common/PLVHashMap';
@@ -9,10 +10,11 @@ export { default as PLVJSONUtils } from './src/main/ets/common/PLVJSONUtils';
9
10
  export { PLVPreferencesUtils } from './src/main/ets/common/PLVPreferencesUtils';
10
11
  export { PLVScheduledTask } from './src/main/ets/common/PLVScheduledTask';
11
12
  export { PLVSimpleBuffer } from './src/main/ets/common/PLVSimpleBuffer';
13
+ export { PLVSparseArray } from './src/main/ets/common/PLVSparseArray';
12
14
  export { PLVTextUtils } from './src/main/ets/common/PLVTextUtils';
13
15
  export { PLVUACreator } from './src/main/ets/common/PLVUACreator';
14
16
  export { default as PLVToastUtils } from './src/main/ets/common/PLVToastUtils';
15
- export { PLVResponseObject, PLVResponseData, PLVResponse, PLVJSONObject, PLVResolve, PLVReject } from './src/main/ets/common/PLVType';
17
+ export { PLVResponseObject, PLVResponseType, PLVResponseData, PLVResponse, PLVJSONObject, PLVResolve, PLVReject } from './src/main/ets/common/PLVType';
16
18
  export { default as PLVUtils } from './src/main/ets/common/PLVUtils';
17
19
  export { PLVWebUtils } from './src/main/ets/common/PLVWebUtils';
18
20
  export { PLVTimeUtils } from './src/main/ets/common/PLVTimeUtils';
package/Index.js CHANGED
@@ -1,5 +1,6 @@
1
+ export { PLVNodeControllerManager, PLVNodeController } from './src/main/ets/common/ui/PLVNodeController';
1
2
  export { default as PLVLazyDataSource } from './src/main/ets/common/PLVBasicDataSource';
2
- export { PLVStateData, PLVDisposable, PLVPromiseValue, PLVLazyValue, PLVAsyncLazyValue, PLVEventNotify } from './src/main/ets/common/PLVCallback';
3
+ export { PLVCustomBuilder, PLVMediaQueryListener, PLVAvoidAreaChangeListener, PLVStateData, PLVStatefulData, PLVDisposable, PLVPromiseValue, PLVLazyValue, PLVAsyncLazyValue, PLVEventNotify } from './src/main/ets/common/PLVCallback';
3
4
  export { default as PLVCommonConstants } from './src/main/ets/common/PLVCommonConstants';
4
5
  export { PLVDeviceUtils } from './src/main/ets/common/PLVDeviceUtils';
5
6
  export { PLVHashMap } from './src/main/ets/common/PLVHashMap';
@@ -8,6 +9,7 @@ export { default as PLVJSONUtils } from './src/main/ets/common/PLVJSONUtils';
8
9
  export { PLVPreferencesUtils } from './src/main/ets/common/PLVPreferencesUtils';
9
10
  export { PLVScheduledTask } from './src/main/ets/common/PLVScheduledTask';
10
11
  export { PLVSimpleBuffer } from './src/main/ets/common/PLVSimpleBuffer';
12
+ export { PLVSparseArray } from './src/main/ets/common/PLVSparseArray';
11
13
  export { PLVTextUtils } from './src/main/ets/common/PLVTextUtils';
12
14
  export { PLVUACreator } from './src/main/ets/common/PLVUACreator';
13
15
  export { default as PLVToastUtils } from './src/main/ets/common/PLVToastUtils';
package/ResourceTable.txt CHANGED
@@ -1,9 +1,10 @@
1
- string lib_name 0x0200000f
1
+ string lib_name 0x02000010
2
2
  string page_show 0x0200000e
3
3
  string plv_web_load_failed 0x02000000
4
4
  string plv_web_reload 0x02000001
5
5
  color plv_web_main_red_color 0x02000002
6
6
  color plv_web_reload_title_color 0x02000003
7
+ float page_text_font_size 0x0200000f
7
8
  float plv_web_failure_img_size 0x02000004
8
9
  float plv_web_large_border_radius 0x02000005
9
10
  float plv_web_loading_img_margin 0x02000006
Binary file
package/oh-package.json5 CHANGED
@@ -1 +1 @@
1
- {"name":"@polyvharmony/live-scenes-foundation","version":"1.2.0-rc.1","description":"polyv live-scenes-foundation","main":"Index.js","author":"POLYV","license":"MIT","dependencies":{"socket":"file:./libs/plvsocket.har","jsbridge":"file:./libs/plvjsbridge.har","@ohos/axios":"2.2.4","class-transformer":"0.5.1","@pura/harmony-utils":"1.1.0","@ohos/crypto-js":"2.0.4","@ohos-port/xlog":"1.2.0"},"types":"Index.d.ets","artifactType":"obfuscation","metadata":{"workers":["./src/main/ets/modules/log/PLVXLogWorker.js"],"sourceRoots":["./src/main"],"debug":false,"useNormalizedOHMUrl":true},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":true}
1
+ {"name":"@polyvharmony/live-scenes-foundation","version":"1.3.0-rc.1","description":"polyv live-scenes-foundation","main":"Index.js","author":"POLYV","license":"MIT","dependencies":{"socket":"file:./libs/plvsocket.har","jsbridge":"file:./libs/plvjsbridge.har","@ohos/axios":"2.2.4","class-transformer":"file:./libs/plvclasstransformer.har","@pura/harmony-utils":"1.1.0","@ohos/crypto-js":"2.0.4","@ohos-port/xlog":"1.2.0"},"types":"Index.d.ets","artifactType":"obfuscation","metadata":{"workers":["./src/main/ets/modules/log/PLVXLogWorker.js"],"sourceRoots":["./src/main"],"debug":false,"useNormalizedOHMUrl":true},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":true}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@polyvharmony/live-scenes-foundation","version":"1.2.0-rc.1","description":"polyv live-scenes-foundation","main":"Index.js","author":"POLYV","license":"MIT","dependencies":{"socket":"file:./libs/plvsocket.har","jsbridge":"file:./libs/plvjsbridge.har","@ohos/axios":"2.2.4","class-transformer":"0.5.1","@pura/harmony-utils":"1.1.0","@ohos/crypto-js":"2.0.4","@ohos-port/xlog":"1.2.0"},"types":"Index.d.ets","artifactType":"obfuscation","metadata":{"workers":["./src/main/ets/modules/log/PLVXLogWorker.js"],"sourceRoots":["./src/main"],"debug":false,"useNormalizedOHMUrl":true},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":true}
1
+ {"name":"@polyvharmony/live-scenes-foundation","version":"1.3.0-rc.1","description":"polyv live-scenes-foundation","main":"Index.js","author":"POLYV","license":"MIT","dependencies":{"socket":"file:./libs/plvsocket.har","jsbridge":"file:./libs/plvjsbridge.har","@ohos/axios":"2.2.4","class-transformer":"file:./libs/plvclasstransformer.har","@pura/harmony-utils":"1.1.0","@ohos/crypto-js":"2.0.4","@ohos-port/xlog":"1.2.0"},"types":"Index.d.ets","artifactType":"obfuscation","metadata":{"workers":["./src/main/ets/modules/log/PLVXLogWorker.js"],"sourceRoots":["./src/main"],"debug":false,"useNormalizedOHMUrl":true},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":true}
@@ -1,11 +1,33 @@
1
+ import { mediaquery, window } from '@kit.ArkUI';
1
2
  export type PLVCallback<T = void, R = void> = (data: T) => R;
2
3
  export type PLVCallback2<T1 = void, T2 = void, R = void> = (data1: T1, data2: T2) => R;
4
+ @Builder
5
+ export declare function PLVCustomBuilder<T = void>(data: T): void;
6
+ export declare class PLVMediaQueryListener {
7
+ listener: mediaquery.MediaQueryListener | undefined;
8
+ callback: PLVCallback<mediaquery.MediaQueryResult> | undefined;
9
+ constructor(listener: mediaquery.MediaQueryListener, callback: PLVCallback<mediaquery.MediaQueryResult>);
10
+ off(): void;
11
+ }
12
+ export declare class PLVAvoidAreaChangeListener {
13
+ windowClass: window.Window | undefined;
14
+ callback: PLVCallback<window.AvoidAreaOptions> | undefined;
15
+ constructor(h2: window.Window, callback: PLVCallback<window.AvoidAreaOptions>);
16
+ off(): void;
17
+ }
3
18
  export declare class PLVStateData<T> {
4
19
  data?: T;
5
20
  constructor(data?: T);
6
21
  copy(): PLVStateData<T>;
7
22
  copyValue(data?: T): PLVStateData<T>;
8
23
  }
24
+ export declare class PLVStatefulData<T> extends PLVStateData<T> {
25
+ isSuccess?: boolean;
26
+ error?: Error;
27
+ constructor(data?: T, isSuccess?: boolean, error?: Error);
28
+ static success<T>(data?: T): PLVStatefulData<T>;
29
+ static error<T>(error?: Error): PLVStatefulData<T>;
30
+ }
9
31
  export declare class PLVDisposable {
10
32
  private _dispose;
11
33
  isDispose(): boolean;
@@ -15,21 +37,24 @@ export declare class PLVPromiseValue<T> {
15
37
  value?: T;
16
38
  private promise?;
17
39
  private resolve?;
40
+ private callbacks;
18
41
  set(value: T): void;
19
- get(): Promise<T>;
42
+ observe(callback: PLVCallback<T>): void;
43
+ get(): T | Promise<T>;
44
+ clear(): void;
20
45
  }
21
46
  @Observed
22
47
  export declare class PLVLazyValue<T, P = void | undefined> {
23
48
  private _value?;
24
49
  private _callback;
25
- constructor(i2: PLVCallback<P | undefined, T>);
50
+ constructor(f2: PLVCallback<P | undefined, T>);
26
51
  get(param?: P): T;
27
52
  }
28
53
  @Observed
29
54
  export declare class PLVAsyncLazyValue<T, P = void | undefined> {
30
55
  private _value?;
31
56
  private _callback;
32
- constructor(h2: PLVCallback2<P | undefined, PLVCallback<T>>);
57
+ constructor(e2: PLVCallback2<P | undefined, PLVCallback<T>>);
33
58
  get(callback: PLVCallback<T>, param?: P): void;
34
59
  }
35
60
  export interface IPLVEventEmitter<T extends string = string> {
@@ -44,9 +69,9 @@ export declare class PLVEventNotify<T extends string = string> implements IPLVEv
44
69
  private tag;
45
70
  private events;
46
71
  private emitLogToFile;
47
- constructor(e2?: string | Object, f2?: boolean);
48
- on(event: T, callback: Function, c2?: string | Object): void;
49
- off(event: T, callback?: Function, a2?: string | Object): void;
72
+ constructor(c2?: string | Object, d2?: boolean);
73
+ on(event: T, callback: Function, a2?: string | Object): void;
74
+ off(event: T, callback?: Function, w1?: string | Object): void;
50
75
  emit(event: T, ...args: Object[]): void;
51
76
  clear(): void;
52
77
  }
@@ -1,15 +1,40 @@
1
- var u1 = (this && this.u1) || function (m2, target, key, desc) {
1
+ var u1 = (this && this.u1) || function (j2, target, key, desc) {
2
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
3
  if (typeof Reflect === "object" && typeof Reflect.v1 === "function")
4
- r = Reflect.v1(m2, target, key, desc);
4
+ r = Reflect.v1(j2, target, key, desc);
5
5
  else
6
- for (var n2 = m2.length - 1; n2 >= 0; n2--)
7
- if (d = m2[n2])
6
+ for (var k2 = j2.length - 1; k2 >= 0; k2--)
7
+ if (d = j2[k2])
8
8
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
9
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10
10
  };
11
11
  import PLVLogger from '../modules/log/PLVLogger';
12
12
  import PLVUtils from './PLVUtils';
13
+ export function PLVCustomBuilder(data, parent = null) {
14
+ const i2 = data;
15
+ }
16
+ export class PLVMediaQueryListener {
17
+ constructor(listener, callback) {
18
+ this.listener = listener;
19
+ this.callback = callback;
20
+ }
21
+ off() {
22
+ this.listener?.off("change", this.callback);
23
+ }
24
+ }
25
+ export class PLVAvoidAreaChangeListener {
26
+ constructor(h2, callback) {
27
+ this.windowClass = h2;
28
+ this.callback = callback;
29
+ }
30
+ off() {
31
+ try {
32
+ this.windowClass?.off("avoidAreaChange", this.callback);
33
+ }
34
+ catch (e) {
35
+ }
36
+ }
37
+ }
13
38
  export class PLVStateData {
14
39
  constructor(data) {
15
40
  this.data = data;
@@ -21,6 +46,19 @@ export class PLVStateData {
21
46
  return new PLVStateData(data);
22
47
  }
23
48
  }
49
+ export class PLVStatefulData extends PLVStateData {
50
+ constructor(data, isSuccess = true, error) {
51
+ super(data);
52
+ this.isSuccess = isSuccess;
53
+ this.error = error;
54
+ }
55
+ static success(data) {
56
+ return new PLVStatefulData(data, true);
57
+ }
58
+ static error(error) {
59
+ return new PLVStatefulData(undefined, false, error);
60
+ }
61
+ }
24
62
  export class PLVDisposable {
25
63
  constructor() {
26
64
  this._dispose = false;
@@ -33,27 +71,47 @@ export class PLVDisposable {
33
71
  }
34
72
  }
35
73
  export class PLVPromiseValue {
74
+ constructor() {
75
+ this.callbacks = [];
76
+ }
36
77
  set(value) {
37
78
  if (this.value == undefined) {
38
79
  this.resolve?.(value);
39
80
  }
81
+ if (this.value != value) {
82
+ this.callbacks.forEach(callback => {
83
+ callback(value);
84
+ });
85
+ }
40
86
  this.value = value;
41
87
  }
88
+ observe(callback) {
89
+ if (this.value != undefined) {
90
+ callback(this.value);
91
+ }
92
+ this.callbacks.push(callback);
93
+ }
42
94
  get() {
95
+ if (this.value != undefined) {
96
+ return this.value;
97
+ }
43
98
  if (!this.promise) {
44
- this.promise = PLVUtils.safePromise((k2, l2) => {
45
- this.resolve = k2;
99
+ this.promise = PLVUtils.safePromise((g2, reject) => {
100
+ this.resolve = g2;
46
101
  if (this.value != undefined) {
47
- k2(this.value);
102
+ g2(this.value);
48
103
  }
49
104
  });
50
105
  }
51
106
  return this.promise;
52
107
  }
108
+ clear() {
109
+ this.callbacks = [];
110
+ }
53
111
  }
54
112
  let PLVLazyValue = class PLVLazyValue {
55
- constructor(i2) {
56
- this._callback = i2;
113
+ constructor(f2) {
114
+ this._callback = f2;
57
115
  }
58
116
  get(param) {
59
117
  if (this._value == undefined) {
@@ -67,8 +125,8 @@ PLVLazyValue = u1([
67
125
  ], PLVLazyValue);
68
126
  export { PLVLazyValue };
69
127
  let PLVAsyncLazyValue = class PLVAsyncLazyValue {
70
- constructor(h2) {
71
- this._callback = h2;
128
+ constructor(e2) {
129
+ this._callback = e2;
72
130
  }
73
131
  get(callback, param) {
74
132
  if (this._value === undefined) {
@@ -87,28 +145,28 @@ PLVAsyncLazyValue = u1([
87
145
  ], PLVAsyncLazyValue);
88
146
  export { PLVAsyncLazyValue };
89
147
  export class PLVEventNotify {
90
- constructor(e2, f2 = true) {
148
+ constructor(c2, d2 = true) {
91
149
  this.tag = '[PLVEventNotify]';
92
150
  this.events = new Map();
93
151
  this.emitLogToFile = true;
94
- this.tag = PLVUtils.getClassTag(e2) || this.tag;
95
- this.emitLogToFile = f2;
152
+ this.tag = PLVUtils.getClassTag(c2) || this.tag;
153
+ this.emitLogToFile = d2;
96
154
  }
97
- on(event, callback, c2) {
98
- PLVLogger.info(PLVUtils.getClassTag(c2) || this.tag, `on event: ${event}`);
99
- const d2 = this.events.get(event) || [];
100
- d2.push(callback);
101
- this.events.set(event, d2);
155
+ on(event, callback, a2) {
156
+ PLVLogger.info(PLVUtils.getClassTag(a2) || this.tag, `on event: ${event}`);
157
+ const b2 = this.events.get(event) || [];
158
+ b2.push(callback);
159
+ this.events.set(event, b2);
102
160
  }
103
- off(event, callback, a2) {
104
- PLVLogger.info(PLVUtils.getClassTag(a2) || this.tag, `off event: ${event}`);
161
+ off(event, callback, w1) {
162
+ PLVLogger.info(PLVUtils.getClassTag(w1) || this.tag, `off event: ${event}`);
105
163
  if (callback) {
106
- const b2 = this.events.get(event) || [];
107
- const index = b2.indexOf(callback);
164
+ const z1 = this.events.get(event) || [];
165
+ const index = z1.indexOf(callback);
108
166
  if (index !== -1) {
109
- b2.splice(index, 1);
167
+ z1.splice(index, 1);
110
168
  }
111
- this.events.set(event, b2);
169
+ this.events.set(event, z1);
112
170
  }
113
171
  else {
114
172
  this.events.delete(event);
@@ -116,8 +174,8 @@ export class PLVEventNotify {
116
174
  }
117
175
  emit(event, ...args) {
118
176
  PLVLogger.info(this.tag, `emit event: ${event}, args: ${args}`, this.emitLogToFile);
119
- const w1 = this.events.get(event) || [];
120
- w1.forEach(callback => {
177
+ const v1 = this.events.get(event) || [];
178
+ v1.forEach(callback => {
121
179
  callback(...args);
122
180
  });
123
181
  }
@@ -5,6 +5,7 @@ export default class PLVCommonConstants {
5
5
  static readonly TAG: string;
6
6
  static readonly HARMONY_HEI_TI_FONT_FAMILY = "HarmonyHeiTi";
7
7
  static readonly FULL_PERCENT: string;
8
+ static readonly AUTO: string;
8
9
  static readonly CONTAINER: string;
9
10
  static readonly JS_PRE = "javascript:";
10
11
  static readonly LENGTH_SHORT = 2000;
@@ -3,6 +3,7 @@ export default class PLVCommonConstants {
3
3
  PLVCommonConstants.TAG = "[PLVLiveSDK]";
4
4
  PLVCommonConstants.HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
5
5
  PLVCommonConstants.FULL_PERCENT = '100%';
6
+ PLVCommonConstants.AUTO = 'auto';
6
7
  PLVCommonConstants.CONTAINER = '__container__';
7
8
  PLVCommonConstants.JS_PRE = 'javascript:';
8
9
  PLVCommonConstants.LENGTH_SHORT = 2000;
@@ -1,22 +1,22 @@
1
1
  export var PLVWebpageStatus;
2
- (function (u2) {
3
- u2["INIT"] = "init";
4
- u2["ERROR"] = "error";
5
- u2["FINISHED"] = "finished";
2
+ (function (n2) {
3
+ n2["INIT"] = "init";
4
+ n2["ERROR"] = "error";
5
+ n2["FINISHED"] = "finished";
6
6
  })(PLVWebpageStatus || (PLVWebpageStatus = {}));
7
7
  export var PLVFullScreenStatus;
8
- (function (t2) {
9
- t2["IDLE"] = "idle";
10
- t2["ENTER"] = "enter";
11
- t2["EXIT"] = "exit";
8
+ (function (m2) {
9
+ m2["IDLE"] = "idle";
10
+ m2["ENTER"] = "enter";
11
+ m2["EXIT"] = "exit";
12
12
  })(PLVFullScreenStatus || (PLVFullScreenStatus = {}));
13
13
  export var PLVPrintLogLevel;
14
- (function (s2) {
15
- s2[s2["ALL"] = 0] = "ALL";
16
- s2[s2["VERBOSE"] = 2] = "VERBOSE";
17
- s2[s2["DEBUG"] = 3] = "DEBUG";
18
- s2[s2["INFO"] = 4] = "INFO";
19
- s2[s2["WARN"] = 5] = "WARN";
20
- s2[s2["ERROR"] = 6] = "ERROR";
21
- s2[s2["NONE"] = 99] = "NONE";
14
+ (function (l2) {
15
+ l2[l2["ALL"] = 0] = "ALL";
16
+ l2[l2["VERBOSE"] = 2] = "VERBOSE";
17
+ l2[l2["DEBUG"] = 3] = "DEBUG";
18
+ l2[l2["INFO"] = 4] = "INFO";
19
+ l2[l2["WARN"] = 5] = "WARN";
20
+ l2[l2["ERROR"] = 6] = "ERROR";
21
+ l2[l2["NONE"] = 99] = "NONE";
22
22
  })(PLVPrintLogLevel || (PLVPrintLogLevel = {}));
@@ -1,4 +1,11 @@
1
+ import { ConfigurationConstant } from '@kit.AbilityKit';
2
+ import { window } from '@kit.ArkUI';
1
3
  export declare class PLVDeviceUtils {
2
4
  static getNavigationIndicatorHeight(): number;
3
5
  static getStatusBarHeight(): number;
6
+ static getWidth(): number;
7
+ static getHeight(): number;
8
+ static getMinDisplaySide(): number;
9
+ static setColorMode(colorMode: ConfigurationConstant.ColorMode): void;
10
+ static setWindowSystemBarProperties(systemBarProperties?: window.SystemBarProperties): void;
4
11
  }
@@ -1,4 +1,6 @@
1
- import { AppUtil } from '@pura/harmony-utils';
1
+ import { AppUtil, DisplayUtil } from '@pura/harmony-utils';
2
+ import PLVLogger from '../modules/log/PLVLogger';
3
+ const TAG = '[PLVDeviceUtils]';
2
4
  export class PLVDeviceUtils {
3
5
  static getNavigationIndicatorHeight() {
4
6
  return px2vp(AppUtil.getNavigationIndicatorHeight());
@@ -6,4 +8,29 @@ export class PLVDeviceUtils {
6
8
  static getStatusBarHeight() {
7
9
  return px2vp(AppUtil.getStatusBarHeight());
8
10
  }
11
+ static getWidth() {
12
+ return px2vp(DisplayUtil.getWidth());
13
+ }
14
+ static getHeight() {
15
+ return px2vp(DisplayUtil.getHeight());
16
+ }
17
+ static getMinDisplaySide() {
18
+ return Math.min(PLVDeviceUtils.getWidth(), PLVDeviceUtils.getHeight());
19
+ }
20
+ static setColorMode(colorMode) {
21
+ AppUtil.getContext().getApplicationContext().setColorMode(colorMode);
22
+ }
23
+ static setWindowSystemBarProperties(systemBarProperties) {
24
+ try {
25
+ let o2 = AppUtil.getMainWindow();
26
+ if (systemBarProperties) {
27
+ o2.setWindowSystemBarProperties(systemBarProperties).catch((error) => {
28
+ PLVLogger.error(TAG, `setWindowSystemBarProperties-error ~ code: ${error.code} -·- message: ${error.message}`);
29
+ });
30
+ }
31
+ }
32
+ catch (err) {
33
+ PLVLogger.error(TAG, JSON.stringify(err));
34
+ }
35
+ }
9
36
  }
@@ -4,18 +4,18 @@ import { PLVJSONObject } from './PLVType';
4
4
  export default class PLVJSONUtils {
5
5
  static safeStringify(value?: Object, replacer?: (this: object, key: string, value: object) => object | undefined): string;
6
6
  static safeParse(text?: string): object | undefined;
7
- static json2Bean<T>(f3: ClassConstructor<T>, g3: string): T | undefined;
7
+ static json2Bean<T>(z2: ClassConstructor<T>, a3: string): T | undefined;
8
8
  static bean2Json(data: Object | Array<Object | String | Number | Boolean> | null | undefined): string;
9
- static bean2Bean<T, V>(e3: T, plain: V): T | undefined;
10
- static httpData2Bean<T>(d3: T, plain: PLVHttpData<T>): T | undefined;
11
- static json2Map(c3: string): Map<string, Object>;
9
+ static bean2Bean<T, V>(w2: T, plain: V): T | undefined;
10
+ static httpData2Bean<T>(v2: T, plain: PLVHttpData<T>): T | undefined;
11
+ static json2Map(u2: string): Map<string, Object>;
12
12
  static object2Map(object: PLVJSONObject): Map<string, Object | undefined>;
13
13
  static map2json(map: Map<string, Object | undefined>): Record<string, Object>;
14
14
  static map2jsonStr(map: Map<string, Object>, replacer?: (this: object, key: string, value: object) => object | undefined): string;
15
- static toUnescapedData(a3: string): string;
16
- static toFillData<T extends y11>(v2: ClassConstructor<T> | T, w2: string | Object | undefined): T | undefined;
15
+ static toUnescapedData(t2: string): string;
16
+ static toFillData<T extends v8>(q2: ClassConstructor<T> | T, r2: string | Object | undefined): T | undefined;
17
17
  }
18
- interface y11 {
18
+ interface v8 {
19
19
  fill(): void;
20
20
  }
21
21
  export {};
@@ -16,9 +16,9 @@ export default class PLVJSONUtils {
16
16
  return undefined;
17
17
  }
18
18
  }
19
- static json2Bean(f3, g3) {
19
+ static json2Bean(z2, a3) {
20
20
  try {
21
- return plainToClass(f3, JSON.parse(g3), {
21
+ return plainToClass(z2, JSON.parse(a3), {
22
22
  enableImplicitConversion: false, exposeDefaultValues: true
23
23
  });
24
24
  }
@@ -37,9 +37,9 @@ export default class PLVJSONUtils {
37
37
  return "";
38
38
  }
39
39
  }
40
- static bean2Bean(e3, plain) {
40
+ static bean2Bean(w2, plain) {
41
41
  try {
42
- return plainToClassFromExist(e3, plain, {
42
+ return plainToClassFromExist(w2, plain, {
43
43
  enableImplicitConversion: false, exposeDefaultValues: true
44
44
  });
45
45
  }
@@ -47,9 +47,9 @@ export default class PLVJSONUtils {
47
47
  return undefined;
48
48
  }
49
49
  }
50
- static httpData2Bean(d3, plain) {
50
+ static httpData2Bean(v2, plain) {
51
51
  try {
52
- plain.data = plainToClassFromExist(d3, plain.data, {
52
+ plain.data = plainToClassFromExist(v2, plain.data, {
53
53
  enableImplicitConversion: false, exposeDefaultValues: true
54
54
  });
55
55
  try {
@@ -63,8 +63,8 @@ export default class PLVJSONUtils {
63
63
  return undefined;
64
64
  }
65
65
  }
66
- static json2Map(c3) {
67
- return new Map(Object.entries(JSON.parse(c3)));
66
+ static json2Map(u2) {
67
+ return new Map(Object.entries(JSON.parse(u2)));
68
68
  }
69
69
  static object2Map(object) {
70
70
  return new Map(Object.entries(object));
@@ -81,23 +81,23 @@ export default class PLVJSONUtils {
81
81
  static map2jsonStr(map, replacer) {
82
82
  return PLVJSONUtils.safeStringify(PLVJSONUtils.map2json(map), replacer);
83
83
  }
84
- static toUnescapedData(a3) {
85
- if (!a3.includes('\\')) {
86
- return a3;
84
+ static toUnescapedData(t2) {
85
+ if (!t2.includes('\\')) {
86
+ return t2;
87
87
  }
88
- return a3.substring(1, a3.length - 1)
88
+ return t2.substring(1, t2.length - 1)
89
89
  .replace(/\\"/g, '"')
90
90
  .replace(/\\\\/g, '\\');
91
91
  }
92
- static toFillData(v2, w2) {
93
- let z2 = undefined;
94
- if (typeof w2 === 'string') {
95
- z2 = PLVJSONUtils.json2Bean(v2, w2);
92
+ static toFillData(q2, r2) {
93
+ let s2 = undefined;
94
+ if (typeof r2 === 'string') {
95
+ s2 = PLVJSONUtils.json2Bean(q2, r2);
96
96
  }
97
- else if (typeof w2 === 'object') {
98
- z2 = PLVJSONUtils.bean2Bean(v2, w2);
97
+ else if (typeof r2 === 'object') {
98
+ s2 = PLVJSONUtils.bean2Bean(q2, r2);
99
99
  }
100
- z2?.fill();
101
- return z2;
100
+ s2?.fill();
101
+ return s2;
102
102
  }
103
103
  }
@@ -1,5 +1,6 @@
1
1
  export declare class PLVNetUtils {
2
- static replaceUrl(k3: string, l3: Map<string, string | undefined>): string;
3
- static formatUrl(j3: string, record: Record<string, string | undefined>): string;
4
- static formatParams(params?: Record<string, string>): string;
2
+ static replaceUrl(h3: string, i3: Map<string, string | undefined>): string;
3
+ static formatUrl(g3: string, record: Record<string, string | undefined>): string;
4
+ static formatParams(params?: Record<string, string>, d3?: boolean): string;
5
+ static appendParams(b3: string, params?: Record<string, string>): string;
5
6
  }
@@ -1,29 +1,35 @@
1
1
  export class PLVNetUtils {
2
- static replaceUrl(k3, l3) {
3
- const m3 = /{(\w+?)}/g;
2
+ static replaceUrl(h3, i3) {
3
+ const j3 = /{(\w+?)}/g;
4
4
  let match;
5
- let n3 = k3;
6
- while ((match = m3.exec(k3)) !== null) {
5
+ let k3 = h3;
6
+ while ((match = j3.exec(h3)) !== null) {
7
7
  const key = match[1];
8
- const p3 = l3.get(key);
9
- if (p3 !== undefined) {
10
- n3 = n3.replace(match[0], p3);
8
+ const l3 = i3.get(key);
9
+ if (l3 !== undefined) {
10
+ k3 = k3.replace(match[0], l3);
11
11
  }
12
12
  }
13
- return n3;
13
+ return k3;
14
14
  }
15
- static formatUrl(j3, record) {
16
- return PLVNetUtils.replaceUrl(j3, new Map(Object.entries(record)));
15
+ static formatUrl(g3, record) {
16
+ return PLVNetUtils.replaceUrl(g3, new Map(Object.entries(record)));
17
17
  }
18
- static formatParams(params) {
19
- let h3 = '';
18
+ static formatParams(params, d3) {
19
+ let e3 = '';
20
20
  if (params) {
21
+ let f3 = true;
21
22
  Object.entries(params).forEach((value, index) => {
22
23
  if (value?.[0] && value?.[1]) {
23
- h3 += (index == 0 ? '?' : '&') + value?.[0] + '=' + value?.[1];
24
+ e3 += (f3 && !d3 ? '?' : '&') + value?.[0] + '=' + value?.[1];
25
+ f3 = false;
24
26
  }
25
27
  });
26
28
  }
27
- return h3;
29
+ return e3;
30
+ }
31
+ static appendParams(b3, params) {
32
+ const c3 = b3.includes('?');
33
+ return b3 + PLVNetUtils.formatParams(params, c3);
28
34
  }
29
35
  }