@lingxia/vue 0.13.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 +6 -0
- package/dist/hook.js +7 -2
- package/dist/types.d.ts +75 -3
- package/package.json +4 -4
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:
|
|
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/dist/types.d.ts
CHANGED
|
@@ -1,13 +1,85 @@
|
|
|
1
1
|
import type { CSSProperties } from 'vue';
|
|
2
|
-
import type { LxMediaSwiperAttributes, LxVideoAttributes } from '@lingxia/elements';
|
|
3
2
|
import type { LxNavigatorEvent, NavigatorEnvVersion, NavigatorOpenType, NavigatorQuery, NavigatorTarget } from '@lingxia/elements';
|
|
4
|
-
export interface LxVideoProps
|
|
3
|
+
export interface LxVideoProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
src?: string;
|
|
6
|
+
poster?: string;
|
|
7
|
+
objectFit?: 'cover' | 'contain' | 'fill' | 'fit';
|
|
8
|
+
contentRotate?: 0 | 90 | 180 | 270;
|
|
9
|
+
autoplay?: boolean;
|
|
10
|
+
loop?: boolean;
|
|
11
|
+
muted?: boolean;
|
|
12
|
+
controls?: boolean;
|
|
13
|
+
progressBar?: boolean;
|
|
14
|
+
live?: boolean;
|
|
15
|
+
volume?: string | number;
|
|
16
|
+
qualities?: Array<{
|
|
17
|
+
label: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
}>;
|
|
20
|
+
playbackRates?: number[];
|
|
5
21
|
class?: string;
|
|
6
22
|
style?: CSSProperties;
|
|
23
|
+
onPlayRequest?: (event: Event) => void;
|
|
24
|
+
onPlay?: (event: Event) => void;
|
|
25
|
+
onPlaying?: (event: Event) => void;
|
|
26
|
+
onPause?: (event: Event) => void;
|
|
27
|
+
onStop?: (event: Event) => void;
|
|
28
|
+
onEnded?: (event: Event) => void;
|
|
29
|
+
onTimeUpdate?: (event: Event) => void;
|
|
30
|
+
onError?: (event: Event) => void;
|
|
31
|
+
onLoadedMetadata?: (event: Event) => void;
|
|
32
|
+
onFullscreenChange?: (event: Event) => void;
|
|
33
|
+
onWaiting?: (event: Event) => void;
|
|
34
|
+
onQualityChange?: (event: Event) => void;
|
|
35
|
+
onRateChange?: (event: Event) => void;
|
|
36
|
+
pageBindings?: Record<string, string>;
|
|
7
37
|
}
|
|
8
|
-
|
|
38
|
+
type LxMediaSwiperItem = {
|
|
39
|
+
id?: string;
|
|
40
|
+
type: 'image';
|
|
41
|
+
src: string;
|
|
42
|
+
} | {
|
|
43
|
+
id?: string;
|
|
44
|
+
type: 'video';
|
|
45
|
+
src: string;
|
|
46
|
+
poster?: string;
|
|
47
|
+
controls?: boolean;
|
|
48
|
+
muted?: boolean;
|
|
49
|
+
};
|
|
50
|
+
export interface LxMediaSwiperProps {
|
|
51
|
+
id?: string;
|
|
52
|
+
items?: LxMediaSwiperItem[];
|
|
53
|
+
index?: number;
|
|
54
|
+
initialIndex?: number;
|
|
55
|
+
loop?: boolean;
|
|
56
|
+
autoplay?: boolean;
|
|
57
|
+
interval?: number;
|
|
58
|
+
animation?: 'slide' | 'none';
|
|
59
|
+
animationDuration?: number;
|
|
60
|
+
direction?: 'horizontal' | 'vertical';
|
|
61
|
+
contentRotate?: 0 | 90 | 180 | 270;
|
|
62
|
+
objectFit?: 'cover' | 'contain' | 'fill' | 'fit';
|
|
63
|
+
controls?: boolean;
|
|
64
|
+
muted?: boolean;
|
|
65
|
+
dots?: boolean | {
|
|
66
|
+
color?: string;
|
|
67
|
+
activeColor?: string;
|
|
68
|
+
};
|
|
69
|
+
swipeEnabled?: boolean;
|
|
70
|
+
peek?: number | {
|
|
71
|
+
previous?: number;
|
|
72
|
+
next?: number;
|
|
73
|
+
};
|
|
9
74
|
class?: string;
|
|
10
75
|
style?: CSSProperties;
|
|
76
|
+
onChange?: (event: Event) => void;
|
|
77
|
+
onTransitionEnd?: (event: Event) => void;
|
|
78
|
+
onEndReached?: (event: Event) => void;
|
|
79
|
+
onTap?: (event: Event) => void;
|
|
80
|
+
onVideoEnded?: (event: Event) => void;
|
|
81
|
+
onError?: (event: Event) => void;
|
|
82
|
+
pageBindings?: Record<string, string>;
|
|
11
83
|
}
|
|
12
84
|
export interface LxPickerProps {
|
|
13
85
|
columns?: string[][] | [string[], Record<string, string[]>];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxia/vue",
|
|
3
|
-
"version": "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.
|
|
23
|
-
"@lingxia/elements": "~0.
|
|
24
|
-
"@lingxia/page-runtime": "~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"
|