@lingxia/vue 0.10.0 → 0.11.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/hook.d.ts +14 -0
- package/dist/hook.js +24 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/dist/hook.d.ts
CHANGED
|
@@ -40,4 +40,18 @@ export interface LxChannelState<TData, TOut = TData> {
|
|
|
40
40
|
export declare function useLxChannel<TMethod extends (...args: any[]) => Promise<LxChannel<any, any>>>(method: MethodSource<TMethod>, options?: LxChannelOptions & {
|
|
41
41
|
params?: ParamsSource<MethodParams<TMethod>>;
|
|
42
42
|
}): LxChannelState<ChannelIn<TMethod>, ChannelOut<TMethod>>;
|
|
43
|
+
export interface LxPlatform {
|
|
44
|
+
os: string;
|
|
45
|
+
isIOS: boolean;
|
|
46
|
+
isMacOS: boolean;
|
|
47
|
+
isApple: boolean;
|
|
48
|
+
isAndroid: boolean;
|
|
49
|
+
isHarmony: boolean;
|
|
50
|
+
isWindows: boolean;
|
|
51
|
+
isDesktop: boolean;
|
|
52
|
+
isRunner: boolean;
|
|
53
|
+
}
|
|
54
|
+
export declare function usePlatform(): LxPlatform;
|
|
55
|
+
/** Effective product language selected by the host. */
|
|
56
|
+
export declare function useDisplayLanguage(): string;
|
|
43
57
|
export {};
|
package/dist/hook.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { onUnmounted, reactive, ref, unref, watch, } from "vue";
|
|
2
|
+
import { getDisplayLanguage } from "@lingxia/bridge";
|
|
2
3
|
import { getMethodKey, invokeMethod, resolveParams, stableParamKey, toBridgeError, } from "@lingxia/bridge/invocation";
|
|
3
4
|
import { ensurePageBridgeSubscription, getPageActions, subscribePageData, } from "@lingxia/page-runtime";
|
|
4
5
|
function resolveMethod(source) {
|
|
@@ -191,3 +192,26 @@ export function useLxChannel(method, options) {
|
|
|
191
192
|
});
|
|
192
193
|
return { last, error, connecting, connected, send, close, reopen };
|
|
193
194
|
}
|
|
195
|
+
function readPlatform() {
|
|
196
|
+
const p = window.LingXiaBridge?.platform;
|
|
197
|
+
return {
|
|
198
|
+
os: p?.getOS() ?? "unknown",
|
|
199
|
+
isIOS: p?.isIOS() ?? false,
|
|
200
|
+
isMacOS: p?.isMacOS() ?? false,
|
|
201
|
+
isApple: p?.isApple() ?? false,
|
|
202
|
+
isAndroid: p?.isAndroid() ?? false,
|
|
203
|
+
isHarmony: p?.isHarmony() ?? false,
|
|
204
|
+
isWindows: p?.isWindows() ?? false,
|
|
205
|
+
isDesktop: p?.isDesktop() ?? false,
|
|
206
|
+
isRunner: p?.isRunner() ?? false,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
// Typed platform detection for pages, so they never reach for the window global
|
|
210
|
+
// or hand-roll an OS check. Fixed for the session, so it resolves once.
|
|
211
|
+
export function usePlatform() {
|
|
212
|
+
return readPlatform();
|
|
213
|
+
}
|
|
214
|
+
/** Effective product language selected by the host. */
|
|
215
|
+
export function useDisplayLanguage() {
|
|
216
|
+
return getDisplayLanguage();
|
|
217
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useLxPage, useLxStream, useLxChannel, type LxStreamOptions, type LxStreamState, type LxChannelOptions, type LxChannelState, } from "./hook.js";
|
|
1
|
+
export { useLxPage, useLxStream, useLxChannel, usePlatform, useDisplayLanguage, type LxStreamOptions, type LxStreamState, type LxChannelOptions, type LxChannelState, type LxPlatform, } from "./hook.js";
|
|
2
2
|
export { default as LxVideo } from "./LxVideo.vue";
|
|
3
3
|
export { default as LxMediaSwiper } from "./LxMediaSwiper.vue";
|
|
4
4
|
export { default as LxPicker } from "./LxPicker.vue";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useLxPage, useLxStream, useLxChannel, } from "./hook.js";
|
|
1
|
+
export { useLxPage, useLxStream, useLxChannel, usePlatform, useDisplayLanguage, } from "./hook.js";
|
|
2
2
|
export { default as LxVideo } from "./LxVideo.vue";
|
|
3
3
|
export { default as LxMediaSwiper } from "./LxMediaSwiper.vue";
|
|
4
4
|
export { default as LxPicker } from "./LxPicker.vue";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxia/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "LingXia Vue runtime and components for lxapp pages",
|
|
6
6
|
"type": "module",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"prepublishOnly": "npm run build"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@lingxia/bridge": "^0.
|
|
23
|
-
"@lingxia/elements": "^0.
|
|
24
|
-
"@lingxia/page-runtime": "^0.
|
|
22
|
+
"@lingxia/bridge": "^0.11.1",
|
|
23
|
+
"@lingxia/elements": "^0.11.1",
|
|
24
|
+
"@lingxia/page-runtime": "^0.11.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"vue": ">=3.5.0"
|