@lingxia/vue 0.14.0 → 0.15.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.
package/dist/hook.d.ts CHANGED
@@ -50,7 +50,13 @@ export interface LxPlatform {
50
50
  isAndroid: boolean;
51
51
  isHarmony: boolean;
52
52
  isWindows: boolean;
53
+ /**
54
+ * Form factor, not OS. This, not `isMacOS`/`isWindows`, is what a layout
55
+ * decision is usually about: the Runner reports macOS while simulating a
56
+ * phone, and a narrowed desktop window is still a desktop.
57
+ */
53
58
  isDesktop: boolean;
59
+ isMobile: boolean;
54
60
  isRunner: boolean;
55
61
  }
56
62
  export declare function usePlatform(): LxPlatform;
package/dist/hook.js CHANGED
@@ -207,6 +207,7 @@ export function useLxChannel(method, options) {
207
207
  }
208
208
  function readPlatform() {
209
209
  const p = window.LingXiaBridge?.platform;
210
+ const desktop = p?.isDesktop() ?? false;
210
211
  return {
211
212
  os: p?.getOS() ?? "unknown",
212
213
  isIOS: p?.isIOS() ?? false,
@@ -215,12 +216,16 @@ function readPlatform() {
215
216
  isAndroid: p?.isAndroid() ?? false,
216
217
  isHarmony: p?.isHarmony() ?? false,
217
218
  isWindows: p?.isWindows() ?? false,
218
- isDesktop: p?.isDesktop() ?? false,
219
+ isDesktop: desktop,
220
+ // Derived, not read, so that a host too old to answer `isMobile` reports
221
+ // one of the two rather than neither.
222
+ isMobile: p?.isMobile?.() ?? !desktop,
219
223
  isRunner: p?.isRunner() ?? false,
220
224
  };
221
225
  }
222
226
  // 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.
227
+ // or hand-roll an OS check. Fixed for the session, so it resolves once — the
228
+ // Runner re-serves the page when its simulated device changes form factor.
224
229
  export function usePlatform() {
225
230
  return readPlatform();
226
231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxia/vue",
3
- "version": "0.14.0",
3
+ "version": "0.15.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.14.0",
23
- "@lingxia/elements": "~0.14.0",
24
- "@lingxia/page-runtime": "~0.14.0"
22
+ "@lingxia/bridge": "~0.15.0",
23
+ "@lingxia/elements": "~0.15.0",
24
+ "@lingxia/page-runtime": "~0.15.0"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "vue": ">=3.5.0"