@lingxia/vue 0.11.1 → 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;
@@ -52,6 +54,6 @@ export interface LxPlatform {
52
54
  isRunner: boolean;
53
55
  }
54
56
  export declare function usePlatform(): LxPlatform;
55
- /** Effective product language selected by the host. */
56
- export declare function useDisplayLanguage(): string;
57
+ /** Effective product language selected by the host; follows a change. */
58
+ export declare function useDisplayLanguage(): Readonly<Ref<string>>;
57
59
  export {};
package/dist/hook.js CHANGED
@@ -1,7 +1,7 @@
1
- import { onUnmounted, reactive, ref, unref, watch, } from "vue";
2
- import { getDisplayLanguage } from "@lingxia/bridge";
1
+ import { onUnmounted, getCurrentInstance, reactive, ref, shallowRef, unref, watch, } from "vue";
2
+ import { getDisplayLanguage, subscribeDisplayLanguage } from "@lingxia/bridge";
3
3
  import { getMethodKey, invokeMethod, resolveParams, stableParamKey, toBridgeError, } from "@lingxia/bridge/invocation";
4
- import { ensurePageBridgeSubscription, getPageActions, subscribePageData, } from "@lingxia/page-runtime";
4
+ import { ensurePageBridgeSubscription, getPageActions, getPageChromeLayout, subscribePageChromeLayout, subscribePageData, } from "@lingxia/page-runtime";
5
5
  function resolveMethod(source) {
6
6
  return unref(source);
7
7
  }
@@ -26,6 +26,19 @@ export function useLxPage() {
26
26
  ensureReactiveSnapshot();
27
27
  return { data: reactiveSnapshot, actions: getPageActions() };
28
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
+ }
29
42
  export function useLxStream(method, options) {
30
43
  const data = ref((options?.reduce ? options.initial : undefined));
31
44
  const result = ref(undefined);
@@ -211,7 +224,16 @@ function readPlatform() {
211
224
  export function usePlatform() {
212
225
  return readPlatform();
213
226
  }
214
- /** Effective product language selected by the host. */
227
+ /** Effective product language selected by the host; follows a change. */
215
228
  export function useDisplayLanguage() {
216
- return getDisplayLanguage();
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;
217
239
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export { useLxPage, useLxStream, useLxChannel, usePlatform, useDisplayLanguage, type LxStreamOptions, type LxStreamState, type LxChannelOptions, type LxChannelState, type LxPlatform, } 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, usePlatform, useDisplayLanguage, } 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.11.1",
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.11.1",
23
- "@lingxia/elements": "^0.11.1",
24
- "@lingxia/page-runtime": "^0.11.1"
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"