@lingxia/vue 0.10.0 → 0.12.0

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.
@@ -62,7 +62,6 @@ const render = () => h(
62
62
  delta: props.delta,
63
63
  query: props.query,
64
64
  appId: props.appId,
65
- path: props.path,
66
65
  envVersion: props.envVersion,
67
66
  targetVersion: props.targetVersion,
68
67
  phoneNumber: props.phoneNumber,
package/dist/hook.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { type Ref } from "vue";
2
2
  import type { LxChannel, LxBridgeError, LxStream } from "@lingxia/bridge";
3
3
  import { type ChannelIn, type ChannelOut, type MethodParams, type ParamsSource, type StreamData, type StreamResult } from "@lingxia/bridge/invocation";
4
- import { type ActionMap, type Snapshot } from "@lingxia/page-runtime";
4
+ import { type ActionMap, type PageChromeLayoutSnapshot, type Snapshot } from "@lingxia/page-runtime";
5
5
  type MethodSource<T> = T | Ref<T>;
6
6
  export declare function useLxPage<TData = Snapshot, TActions extends ActionMap = ActionMap>(): {
7
7
  data: TData;
8
8
  actions: TActions;
9
9
  };
10
+ /** Reactive native page-chrome geometry for View layout. */
11
+ export declare function useLxPageChrome(): Readonly<Ref<PageChromeLayoutSnapshot>>;
10
12
  export interface LxStreamOptions<TData, TReduced> {
11
13
  params?: unknown | (() => unknown);
12
14
  manual?: boolean;
@@ -40,4 +42,18 @@ export interface LxChannelState<TData, TOut = TData> {
40
42
  export declare function useLxChannel<TMethod extends (...args: any[]) => Promise<LxChannel<any, any>>>(method: MethodSource<TMethod>, options?: LxChannelOptions & {
41
43
  params?: ParamsSource<MethodParams<TMethod>>;
42
44
  }): LxChannelState<ChannelIn<TMethod>, ChannelOut<TMethod>>;
45
+ export interface LxPlatform {
46
+ os: string;
47
+ isIOS: boolean;
48
+ isMacOS: boolean;
49
+ isApple: boolean;
50
+ isAndroid: boolean;
51
+ isHarmony: boolean;
52
+ isWindows: boolean;
53
+ isDesktop: boolean;
54
+ isRunner: boolean;
55
+ }
56
+ export declare function usePlatform(): LxPlatform;
57
+ /** Effective product language selected by the host; follows a change. */
58
+ export declare function useDisplayLanguage(): Readonly<Ref<string>>;
43
59
  export {};
package/dist/hook.js CHANGED
@@ -1,6 +1,7 @@
1
- import { onUnmounted, reactive, ref, unref, watch, } from "vue";
1
+ import { onUnmounted, getCurrentInstance, reactive, ref, shallowRef, unref, watch, } from "vue";
2
+ import { getDisplayLanguage, subscribeDisplayLanguage } from "@lingxia/bridge";
2
3
  import { getMethodKey, invokeMethod, resolveParams, stableParamKey, toBridgeError, } from "@lingxia/bridge/invocation";
3
- import { ensurePageBridgeSubscription, getPageActions, subscribePageData, } from "@lingxia/page-runtime";
4
+ import { ensurePageBridgeSubscription, getPageActions, getPageChromeLayout, subscribePageChromeLayout, subscribePageData, } from "@lingxia/page-runtime";
4
5
  function resolveMethod(source) {
5
6
  return unref(source);
6
7
  }
@@ -25,6 +26,19 @@ export function useLxPage() {
25
26
  ensureReactiveSnapshot();
26
27
  return { data: reactiveSnapshot, actions: getPageActions() };
27
28
  }
29
+ /** Reactive native page-chrome geometry for View layout. */
30
+ export function useLxPageChrome() {
31
+ const layout = shallowRef(getPageChromeLayout());
32
+ if (!getCurrentInstance()) {
33
+ console.warn("useLxPageChrome() must be called during component setup");
34
+ return layout;
35
+ }
36
+ const unsubscribe = subscribePageChromeLayout((next) => {
37
+ layout.value = next;
38
+ });
39
+ onUnmounted(unsubscribe);
40
+ return layout;
41
+ }
28
42
  export function useLxStream(method, options) {
29
43
  const data = ref((options?.reduce ? options.initial : undefined));
30
44
  const result = ref(undefined);
@@ -191,3 +205,35 @@ export function useLxChannel(method, options) {
191
205
  });
192
206
  return { last, error, connecting, connected, send, close, reopen };
193
207
  }
208
+ function readPlatform() {
209
+ const p = window.LingXiaBridge?.platform;
210
+ return {
211
+ os: p?.getOS() ?? "unknown",
212
+ isIOS: p?.isIOS() ?? false,
213
+ isMacOS: p?.isMacOS() ?? false,
214
+ isApple: p?.isApple() ?? false,
215
+ isAndroid: p?.isAndroid() ?? false,
216
+ isHarmony: p?.isHarmony() ?? false,
217
+ isWindows: p?.isWindows() ?? false,
218
+ isDesktop: p?.isDesktop() ?? false,
219
+ isRunner: p?.isRunner() ?? false,
220
+ };
221
+ }
222
+ // Typed platform detection for pages, so they never reach for the window global
223
+ // or hand-roll an OS check. Fixed for the session, so it resolves once.
224
+ export function usePlatform() {
225
+ return readPlatform();
226
+ }
227
+ /** Effective product language selected by the host; follows a change. */
228
+ export function useDisplayLanguage() {
229
+ const language = shallowRef(getDisplayLanguage());
230
+ if (!getCurrentInstance()) {
231
+ console.warn("useDisplayLanguage() must be called during component setup");
232
+ return language;
233
+ }
234
+ const unsubscribe = subscribeDisplayLanguage(() => {
235
+ language.value = getDisplayLanguage();
236
+ });
237
+ onUnmounted(unsubscribe);
238
+ return language;
239
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export { useLxPage, useLxStream, useLxChannel, type LxStreamOptions, type LxStreamState, type LxChannelOptions, type LxChannelState, } from "./hook.js";
1
+ export { useLxPage, useLxPageChrome, 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";
5
5
  export { default as LxNavigator } from "./LxNavigator.vue";
6
6
  export type { LxVideoProps, LxMediaSwiperProps, LxPickerProps, LxNavigatorProps, LxNavigatorEvent, } from "./types.js";
7
+ export type { LxPageChrome, PageChromeLayoutListener, PageChromeLayoutSnapshot, PageChromeRect, } from "@lingxia/page-runtime";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { useLxPage, useLxStream, useLxChannel, } from "./hook.js";
1
+ export { useLxPage, useLxPageChrome, 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/dist/types.d.ts CHANGED
@@ -36,7 +36,6 @@ export interface LxNavigatorProps {
36
36
  delta?: number;
37
37
  query?: NavigatorQuery;
38
38
  appId?: string;
39
- path?: string;
40
39
  envVersion?: NavigatorEnvVersion;
41
40
  targetVersion?: string;
42
41
  phoneNumber?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxia/vue",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
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.10.0",
23
- "@lingxia/elements": "^0.10.0",
24
- "@lingxia/page-runtime": "^0.10.0"
22
+ "@lingxia/bridge": "~0.12.0",
23
+ "@lingxia/elements": "~0.12.0",
24
+ "@lingxia/page-runtime": "~0.12.0"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "vue": ">=3.5.0"
@@ -31,7 +31,7 @@
31
31
  "@lingxia/elements": "file:../lingxia-elements",
32
32
  "@lingxia/page-runtime": "file:../lingxia-page-runtime",
33
33
  "typescript": "^5.7.2",
34
- "vue": "^3.5.0"
34
+ "vue": "^3.5.41"
35
35
  },
36
36
  "files": [
37
37
  "dist"