@symbiote-native/screen-orientation 0.1.0 → 0.2.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.
@@ -1,2 +1,2 @@
1
1
  export { ScreenOrientationService } from './services/screen-orientation.service';
2
- export { lockAsync, lockPlatformAsync, unlockAsync, getOrientationAsync, getOrientationLockAsync, getPlatformOrientationLockAsync, supportsOrientationLockAsync, addOrientationChangeListener, removeOrientationChangeListeners, removeOrientationChangeListener, Orientation, OrientationLock, SizeClassIOS, WebOrientationLock, WebOrientation, type PlatformOrientationInfo, type ScreenOrientationInfo, type OrientationChangeEvent, type OrientationChangeListener, type ScreenOrientationState, type EventSubscription, } from '../core';
2
+ export * from '../core';
@@ -1,4 +1,4 @@
1
1
  // ScreenOrientationService is the Angular-only lifecycle half; the free functions and event
2
2
  // subscription plumbing all live in core, shared with React/Vue.
3
3
  export { ScreenOrientationService } from './services/screen-orientation.service/index.js';
4
- export { lockAsync, lockPlatformAsync, unlockAsync, getOrientationAsync, getOrientationLockAsync, getPlatformOrientationLockAsync, supportsOrientationLockAsync, addOrientationChangeListener, removeOrientationChangeListeners, removeOrientationChangeListener, Orientation, OrientationLock, SizeClassIOS, WebOrientationLock, WebOrientation, } from '../core/index.js';
4
+ export * from '../core/index.js';
@@ -23,6 +23,13 @@ export async function lockAsync(orientationLock) {
23
23
  await expoScreenOrientation.lockAsync(orientationLock);
24
24
  _lastOrientationLock = orientationLock;
25
25
  }
26
+ // UPSTREAM-BUG(expo): .vendors/expo/packages/expo-screen-orientation/src/ScreenOrientation.ts:81
27
+ // and :112 - TWO falsy traps, and Android's SCREEN_ORIENTATION_LANDSCAPE is 0: the truthiness
28
+ // check skips the assignment, and even with that one fixed, !platformOrientationParam still
29
+ // rejects the assigned 0. Fixing only the first trap changes nothing.
30
+ // The caller gets a TypeError and the call never reaches native, so landscape cannot be locked
31
+ // on Android through this API.
32
+ // Ported verbatim for parity; do NOT fix without recording a deliberate divergence.
26
33
  /** Locks the screen to a platform-specific orientation param — Android constant, iOS
27
34
  * orientation array, or web `WebOrientationLock`. */
28
35
  export async function lockPlatformAsync(options) {
@@ -1,2 +1,2 @@
1
1
  export { useScreenOrientation } from './hooks/use-screen-orientation';
2
- export { lockAsync, lockPlatformAsync, unlockAsync, getOrientationAsync, getOrientationLockAsync, getPlatformOrientationLockAsync, supportsOrientationLockAsync, addOrientationChangeListener, removeOrientationChangeListeners, removeOrientationChangeListener, Orientation, OrientationLock, SizeClassIOS, WebOrientationLock, WebOrientation, type PlatformOrientationInfo, type ScreenOrientationInfo, type OrientationChangeEvent, type OrientationChangeListener, type ScreenOrientationState, type EventSubscription, } from '../core';
2
+ export * from '../core';
@@ -1,3 +1,3 @@
1
1
  // @symbiote-native/screen-orientation/react: the React entry over the framework-agnostic core.
2
2
  export { useScreenOrientation } from './hooks/use-screen-orientation/index.js';
3
- export { lockAsync, lockPlatformAsync, unlockAsync, getOrientationAsync, getOrientationLockAsync, getPlatformOrientationLockAsync, supportsOrientationLockAsync, addOrientationChangeListener, removeOrientationChangeListeners, removeOrientationChangeListener, Orientation, OrientationLock, SizeClassIOS, WebOrientationLock, WebOrientation, } from '../core/index.js';
3
+ export * from '../core/index.js';
@@ -0,0 +1,2 @@
1
+ export { useScreenOrientation } from './runes/use-screen-orientation.svelte';
2
+ export * from '../core';
@@ -0,0 +1,5 @@
1
+ // @symbiote-native/screen-orientation/svelte: the Svelte entry over the framework-agnostic core —
2
+ // mirrors the lifecycle-bucket naming convention of adapters/svelte/src/runes (never
3
+ // `hooks`/`composables`, those are React's and Vue's terms).
4
+ export { useScreenOrientation } from './runes/use-screen-orientation.svelte';
5
+ export * from '../core/index.js';
@@ -0,0 +1,4 @@
1
+ import { type ScreenOrientationState } from '../../core';
2
+ export declare function useScreenOrientation(): {
3
+ readonly current: ScreenOrientationState;
4
+ };
@@ -0,0 +1,35 @@
1
+ // Svelte lifecycle wiring over the framework-agnostic core (core/screen-orientation.ts). Seeds the
2
+ // initial value with one-shot getOrientationAsync()/getOrientationLockAsync() calls before the
3
+ // first native event fires, mirroring packages/network's useNetworkState.
4
+ //
5
+ // `.svelte.ts` extension: runes ($state/$effect) only work there outside a `.svelte` component;
6
+ // `runes/` is Svelte's name for the lifecycle bucket (React's `hooks/`, Vue's `composables/`).
7
+ // Returns a boxed getter, not a bare `$state`: Svelte 5 reactivity is lexically scoped to the
8
+ // declaring module and doesn't survive being returned raw from a plain function, so the caller
9
+ // reads `.current` like unwrapping Vue's `Ref` via `.value`.
10
+ import { addOrientationChangeListener, getOrientationAsync, getOrientationLockAsync, Orientation, OrientationLock, } from '../../core/index.js';
11
+ export function useScreenOrientation() {
12
+ let screenOrientation = $state({
13
+ orientation: Orientation.UNKNOWN,
14
+ orientationLock: OrientationLock.UNKNOWN,
15
+ });
16
+ $effect(() => {
17
+ // Write-only touches of `screenOrientation`, so the effect has no dependency on it and runs
18
+ // once per mount - the twin of Vue's onMounted/onUnmounted pair.
19
+ Promise.all([getOrientationAsync(), getOrientationLockAsync()]).then(([orientation, orientationLock]) => {
20
+ screenOrientation = { orientation, orientationLock };
21
+ });
22
+ const subscription = addOrientationChangeListener(event => {
23
+ screenOrientation = {
24
+ orientation: event.orientationInfo.orientation,
25
+ orientationLock: event.orientationLock,
26
+ };
27
+ });
28
+ return () => subscription.remove();
29
+ });
30
+ return {
31
+ get current() {
32
+ return screenOrientation;
33
+ },
34
+ };
35
+ }
@@ -1,2 +1,2 @@
1
1
  export { useScreenOrientation } from './composables/use-screen-orientation';
2
- export { lockAsync, lockPlatformAsync, unlockAsync, getOrientationAsync, getOrientationLockAsync, getPlatformOrientationLockAsync, supportsOrientationLockAsync, addOrientationChangeListener, removeOrientationChangeListeners, removeOrientationChangeListener, Orientation, OrientationLock, SizeClassIOS, WebOrientationLock, WebOrientation, type PlatformOrientationInfo, type ScreenOrientationInfo, type OrientationChangeEvent, type OrientationChangeListener, type ScreenOrientationState, type EventSubscription, } from '../core';
2
+ export * from '../core';
@@ -1,3 +1,3 @@
1
1
  // @symbiote-native/screen-orientation/vue: the Vue entry over the framework-agnostic core.
2
2
  export { useScreenOrientation } from './composables/use-screen-orientation/index.js';
3
- export { lockAsync, lockPlatformAsync, unlockAsync, getOrientationAsync, getOrientationLockAsync, getPlatformOrientationLockAsync, supportsOrientationLockAsync, addOrientationChangeListener, removeOrientationChangeListeners, removeOrientationChangeListener, Orientation, OrientationLock, SizeClassIOS, WebOrientationLock, WebOrientation, } from '../core/index.js';
3
+ export * from '../core/index.js';
@@ -1,2 +1,2 @@
1
1
  export { ScreenOrientationService } from './services/screen-orientation.service';
2
- export { lockAsync, lockPlatformAsync, unlockAsync, getOrientationAsync, getOrientationLockAsync, getPlatformOrientationLockAsync, supportsOrientationLockAsync, addOrientationChangeListener, removeOrientationChangeListeners, removeOrientationChangeListener, Orientation, OrientationLock, SizeClassIOS, WebOrientationLock, WebOrientation, type PlatformOrientationInfo, type ScreenOrientationInfo, type OrientationChangeEvent, type OrientationChangeListener, type ScreenOrientationState, type EventSubscription, } from '../core';
2
+ export * from '../core';
@@ -1,5 +1,5 @@
1
1
  // ScreenOrientationService is the Angular-only lifecycle half; the free functions and event
2
2
  // subscription plumbing all live in core, shared with React/Vue.
3
3
  export { ScreenOrientationService } from './services/screen-orientation.service';
4
- export { lockAsync, lockPlatformAsync, unlockAsync, getOrientationAsync, getOrientationLockAsync, getPlatformOrientationLockAsync, supportsOrientationLockAsync, addOrientationChangeListener, removeOrientationChangeListeners, removeOrientationChangeListener, Orientation, OrientationLock, SizeClassIOS, WebOrientationLock, WebOrientation, } from '../core';
4
+ export * from '../core';
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,iEAAiE;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,+BAA+B,EAC/B,4BAA4B,EAC5B,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,WAAW,EACX,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,cAAc,GAOf,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,iEAAiE;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,cAAc,SAAS,CAAC"}
@@ -24,10 +24,10 @@ export class ScreenOrientationService {
24
24
  }, { injector: this.injector });
25
25
  return screenOrientation.asReadonly();
26
26
  }
27
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ScreenOrientationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
28
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ScreenOrientationService, providedIn: 'root' });
27
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ScreenOrientationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
28
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ScreenOrientationService, providedIn: 'root' });
29
29
  }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ScreenOrientationService, decorators: [{
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ScreenOrientationService, decorators: [{
31
31
  type: Injectable,
32
32
  args: [{ providedIn: 'root' }]
33
33
  }] });
@@ -23,6 +23,13 @@ export async function lockAsync(orientationLock) {
23
23
  await expoScreenOrientation.lockAsync(orientationLock);
24
24
  _lastOrientationLock = orientationLock;
25
25
  }
26
+ // UPSTREAM-BUG(expo): .vendors/expo/packages/expo-screen-orientation/src/ScreenOrientation.ts:81
27
+ // and :112 - TWO falsy traps, and Android's SCREEN_ORIENTATION_LANDSCAPE is 0: the truthiness
28
+ // check skips the assignment, and even with that one fixed, !platformOrientationParam still
29
+ // rejects the assigned 0. Fixing only the first trap changes nothing.
30
+ // The caller gets a TypeError and the call never reaches native, so landscape cannot be locked
31
+ // on Android through this API.
32
+ // Ported verbatim for parity; do NOT fix without recording a deliberate divergence.
26
33
  /** Locks the screen to a platform-specific orientation param — Android constant, iOS
27
34
  * orientation array, or web `WebOrientationLock`. */
28
35
  export async function lockPlatformAsync(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"screen-orientation.js","sourceRoot":"","sources":["../../src/core/screen-orientation.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,2FAA2F;AAC3F,qFAAqF;AACrF,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAA0B,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAkC,MAAM,iBAAiB,CAAC;AACxF,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,GAInB,MAAM,SAAS,CAAC;AAEjB,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAE/C,IAAI,6BAA6B,GAAwB,EAAE,CAAC;AAC5D,IAAI,oBAAoB,GAAoB,eAAe,CAAC,OAAO,CAAC;AAEpE,iDAAiD;AACjD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,eAAgC;IAC9D,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,CAAC;QACrC,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACxD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,eAA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ACvC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC,CACF,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACvD,uBAAuB,EAAE;YACzB,mBAAmB,EAAE;SACtB,CAAC,CAAC;QACH,QAAQ,CAAC,EAAE,eAAe,EAAE,EAAE,WAAW,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbiote-native/screen-orientation",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "expo-screen-orientation wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, and Angular adapters. Orientation locking (lockAsync/lockPlatformAsync/unlockAsync), the current orientation and lock, and an auto-updating orientation-change hook/composable/service.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,6 +30,10 @@
30
30
  "types": "./build/react/index.d.ts",
31
31
  "default": "./build/react/index.js"
32
32
  },
33
+ "./svelte": {
34
+ "types": "./build/svelte/index.d.ts",
35
+ "default": "./build/svelte/index.js"
36
+ },
33
37
  "./angular": {
34
38
  "types": "./build-ngc/angular/index.d.ts",
35
39
  "react-native": "./build-ngc/angular/index.js",
@@ -53,15 +57,17 @@
53
57
  "expo-modules-core": "57.0.5"
54
58
  },
55
59
  "peerDependencies": {
60
+ "@symbiote-native/angular": ">=0.6.2",
56
61
  "@symbiote-native/engine": ">=0.1.7",
62
+ "@symbiote-native/react": ">=0.2.8",
63
+ "@symbiote-native/svelte": ">=0.1.0",
64
+ "@symbiote-native/vue": ">=0.3.8",
57
65
  "@angular/core": ">=20",
58
66
  "@vue/runtime-core": "^3.5.13",
59
67
  "react": ">=19.0.0",
60
68
  "react-native": ">=0.86",
61
- "vue": ">=3.5.0",
62
- "@symbiote-native/angular": "0.6.2",
63
- "@symbiote-native/react": "0.2.8",
64
- "@symbiote-native/vue": "0.3.8"
69
+ "svelte": ">=5.56.0",
70
+ "vue": ">=3.5.0"
65
71
  },
66
72
  "peerDependenciesMeta": {
67
73
  "@symbiote-native/angular": {
@@ -70,6 +76,9 @@
70
76
  "@symbiote-native/react": {
71
77
  "optional": true
72
78
  },
79
+ "@symbiote-native/svelte": {
80
+ "optional": true
81
+ },
73
82
  "@symbiote-native/vue": {
74
83
  "optional": true
75
84
  },
@@ -82,24 +91,29 @@
82
91
  "react": {
83
92
  "optional": true
84
93
  },
94
+ "svelte": {
95
+ "optional": true
96
+ },
85
97
  "vue": {
86
98
  "optional": true
87
99
  }
88
100
  },
89
101
  "devDependencies": {
90
- "@angular/compiler": "^22",
91
- "@angular/compiler-cli": "^22",
92
- "@angular/core": "^22",
102
+ "@angular/compiler": "~22.0.8",
103
+ "@angular/compiler-cli": "~22.0.8",
104
+ "@angular/core": "~22.0.8",
93
105
  "@types/node": "^26.0.0",
94
106
  "@types/react": "^19.2.0",
95
107
  "@vue/runtime-core": "^3.5.13",
96
108
  "react": "19.2.3",
109
+ "svelte": "^5.56.0",
97
110
  "typescript": "~6.0.0",
98
- "@symbiote-native/angular": "0.6.2",
99
- "@symbiote-native/engine": "0.1.7",
100
- "@symbiote-native/react": "0.2.8",
111
+ "@symbiote-native/angular": "0.7.0",
112
+ "@symbiote-native/engine": "0.2.0",
113
+ "@symbiote-native/react": "0.3.0",
114
+ "@symbiote-native/svelte": "0.2.0",
101
115
  "@symbiote-native/test-utils": "0.1.6",
102
- "@symbiote-native/vue": "0.3.8"
116
+ "@symbiote-native/vue": "0.4.0"
103
117
  },
104
118
  "scripts": {
105
119
  "typecheck": "tsc --build",
@@ -1,26 +1,4 @@
1
1
  // ScreenOrientationService is the Angular-only lifecycle half; the free functions and event
2
2
  // subscription plumbing all live in core, shared with React/Vue.
3
3
  export { ScreenOrientationService } from './services/screen-orientation.service';
4
- export {
5
- lockAsync,
6
- lockPlatformAsync,
7
- unlockAsync,
8
- getOrientationAsync,
9
- getOrientationLockAsync,
10
- getPlatformOrientationLockAsync,
11
- supportsOrientationLockAsync,
12
- addOrientationChangeListener,
13
- removeOrientationChangeListeners,
14
- removeOrientationChangeListener,
15
- Orientation,
16
- OrientationLock,
17
- SizeClassIOS,
18
- WebOrientationLock,
19
- WebOrientation,
20
- type PlatformOrientationInfo,
21
- type ScreenOrientationInfo,
22
- type OrientationChangeEvent,
23
- type OrientationChangeListener,
24
- type ScreenOrientationState,
25
- type EventSubscription,
26
- } from '../core';
4
+ export * from '../core';
@@ -34,6 +34,13 @@ export async function lockAsync(orientationLock: OrientationLock): Promise<void>
34
34
  _lastOrientationLock = orientationLock;
35
35
  }
36
36
 
37
+ // UPSTREAM-BUG(expo): .vendors/expo/packages/expo-screen-orientation/src/ScreenOrientation.ts:81
38
+ // and :112 - TWO falsy traps, and Android's SCREEN_ORIENTATION_LANDSCAPE is 0: the truthiness
39
+ // check skips the assignment, and even with that one fixed, !platformOrientationParam still
40
+ // rejects the assigned 0. Fixing only the first trap changes nothing.
41
+ // The caller gets a TypeError and the call never reaches native, so landscape cannot be locked
42
+ // on Android through this API.
43
+ // Ported verbatim for parity; do NOT fix without recording a deliberate divergence.
37
44
  /** Locks the screen to a platform-specific orientation param — Android constant, iOS
38
45
  * orientation array, or web `WebOrientationLock`. */
39
46
  export async function lockPlatformAsync(options: PlatformOrientationInfo): Promise<void> {
@@ -1,26 +1,4 @@
1
1
  // @symbiote-native/screen-orientation/react: the React entry over the framework-agnostic core.
2
2
 
3
3
  export { useScreenOrientation } from './hooks/use-screen-orientation';
4
- export {
5
- lockAsync,
6
- lockPlatformAsync,
7
- unlockAsync,
8
- getOrientationAsync,
9
- getOrientationLockAsync,
10
- getPlatformOrientationLockAsync,
11
- supportsOrientationLockAsync,
12
- addOrientationChangeListener,
13
- removeOrientationChangeListeners,
14
- removeOrientationChangeListener,
15
- Orientation,
16
- OrientationLock,
17
- SizeClassIOS,
18
- WebOrientationLock,
19
- WebOrientation,
20
- type PlatformOrientationInfo,
21
- type ScreenOrientationInfo,
22
- type OrientationChangeEvent,
23
- type OrientationChangeListener,
24
- type ScreenOrientationState,
25
- type EventSubscription,
26
- } from '../core';
4
+ export * from '../core';
@@ -0,0 +1,6 @@
1
+ // @symbiote-native/screen-orientation/svelte: the Svelte entry over the framework-agnostic core —
2
+ // mirrors the lifecycle-bucket naming convention of adapters/svelte/src/runes (never
3
+ // `hooks`/`composables`, those are React's and Vue's terms).
4
+
5
+ export { useScreenOrientation } from './runes/use-screen-orientation.svelte';
6
+ export * from '../core';
@@ -0,0 +1,48 @@
1
+ // Svelte lifecycle wiring over the framework-agnostic core (core/screen-orientation.ts). Seeds the
2
+ // initial value with one-shot getOrientationAsync()/getOrientationLockAsync() calls before the
3
+ // first native event fires, mirroring packages/network's useNetworkState.
4
+ //
5
+ // `.svelte.ts` extension: runes ($state/$effect) only work there outside a `.svelte` component;
6
+ // `runes/` is Svelte's name for the lifecycle bucket (React's `hooks/`, Vue's `composables/`).
7
+ // Returns a boxed getter, not a bare `$state`: Svelte 5 reactivity is lexically scoped to the
8
+ // declaring module and doesn't survive being returned raw from a plain function, so the caller
9
+ // reads `.current` like unwrapping Vue's `Ref` via `.value`.
10
+ import {
11
+ addOrientationChangeListener,
12
+ getOrientationAsync,
13
+ getOrientationLockAsync,
14
+ Orientation,
15
+ OrientationLock,
16
+ type EventSubscription,
17
+ type ScreenOrientationState,
18
+ } from '../../core';
19
+
20
+ export function useScreenOrientation(): { readonly current: ScreenOrientationState } {
21
+ let screenOrientation = $state<ScreenOrientationState>({
22
+ orientation: Orientation.UNKNOWN,
23
+ orientationLock: OrientationLock.UNKNOWN,
24
+ });
25
+
26
+ $effect(() => {
27
+ // Write-only touches of `screenOrientation`, so the effect has no dependency on it and runs
28
+ // once per mount - the twin of Vue's onMounted/onUnmounted pair.
29
+ Promise.all([getOrientationAsync(), getOrientationLockAsync()]).then(
30
+ ([orientation, orientationLock]) => {
31
+ screenOrientation = { orientation, orientationLock };
32
+ },
33
+ );
34
+ const subscription: EventSubscription = addOrientationChangeListener(event => {
35
+ screenOrientation = {
36
+ orientation: event.orientationInfo.orientation,
37
+ orientationLock: event.orientationLock,
38
+ };
39
+ });
40
+ return () => subscription.remove();
41
+ });
42
+
43
+ return {
44
+ get current(): ScreenOrientationState {
45
+ return screenOrientation;
46
+ },
47
+ };
48
+ }
@@ -0,0 +1,6 @@
1
+ // Pulls in svelte's ambient global declarations ($state/$effect/...) for this package's tsc
2
+ // program. adapters/svelte gets these for free because render.ts does a real value import from
3
+ // 'svelte' (any file in a program importing a module loads its ambient globals for the whole
4
+ // program); this package has no such import, so a triple-slash reference does the same job
5
+ // explicitly rather than relying on an incidental side-effect.
6
+ /// <reference types="svelte" />
package/src/vue/index.ts CHANGED
@@ -1,26 +1,4 @@
1
1
  // @symbiote-native/screen-orientation/vue: the Vue entry over the framework-agnostic core.
2
2
 
3
3
  export { useScreenOrientation } from './composables/use-screen-orientation';
4
- export {
5
- lockAsync,
6
- lockPlatformAsync,
7
- unlockAsync,
8
- getOrientationAsync,
9
- getOrientationLockAsync,
10
- getPlatformOrientationLockAsync,
11
- supportsOrientationLockAsync,
12
- addOrientationChangeListener,
13
- removeOrientationChangeListeners,
14
- removeOrientationChangeListener,
15
- Orientation,
16
- OrientationLock,
17
- SizeClassIOS,
18
- WebOrientationLock,
19
- WebOrientation,
20
- type PlatformOrientationInfo,
21
- type ScreenOrientationInfo,
22
- type OrientationChangeEvent,
23
- type OrientationChangeListener,
24
- type ScreenOrientationState,
25
- type EventSubscription,
26
- } from '../core';
4
+ export * from '../core';