@capawesome/capacitor-screen-orientation 7.1.0 → 8.0.1
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/CapawesomeCapacitorScreenOrientation.podspec +1 -1
- package/Package.swift +2 -2
- package/README.md +10 -1
- package/android/build.gradle +10 -10
- package/dist/esm/definitions.d.ts +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +10 -10
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/Package.swift
CHANGED
|
@@ -3,14 +3,14 @@ import PackageDescription
|
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
5
|
name: "CapawesomeCapacitorScreenOrientation",
|
|
6
|
-
platforms: [.iOS(.
|
|
6
|
+
platforms: [.iOS(.v15)],
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
9
|
name: "CapawesomeCapacitorScreenOrientation",
|
|
10
10
|
targets: ["ScreenOrientationPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Capacitor plugin to lock/unlock the screen orientation.
|
|
|
4
4
|
|
|
5
5
|
<div class="capawesome-z29o10a">
|
|
6
6
|
<a href="https://cloud.capawesome.io/" target="_blank">
|
|
7
|
-
<img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-
|
|
7
|
+
<img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png?t=1" />
|
|
8
8
|
</a>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
@@ -28,6 +28,15 @@ Missing a feature? Just [open an issue](https://github.com/capawesome-team/capac
|
|
|
28
28
|
|
|
29
29
|
Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
|
|
30
30
|
|
|
31
|
+
## Compatibility
|
|
32
|
+
|
|
33
|
+
| Plugin Version | Capacitor Version | Status |
|
|
34
|
+
| -------------- | ----------------- | -------------- |
|
|
35
|
+
| 8.x.x | >=8.x.x | Active support |
|
|
36
|
+
| 7.x.x | 7.x.x | Deprecated |
|
|
37
|
+
| 6.x.x | 6.x.x | Deprecated |
|
|
38
|
+
| 5.x.x | 5.x.x | Deprecated |
|
|
39
|
+
|
|
31
40
|
## Installation
|
|
32
41
|
|
|
33
42
|
```bash
|
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
@@ -11,18 +11,18 @@ buildscript {
|
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
apply plugin: 'com.android.library'
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
|
-
namespace "io.capawesome.capacitorjs.plugins.screenorientation"
|
|
22
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
21
|
+
namespace = "io.capawesome.capacitorjs.plugins.screenorientation"
|
|
22
|
+
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
23
23
|
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -30,11 +30,11 @@ android {
|
|
|
30
30
|
buildTypes {
|
|
31
31
|
release {
|
|
32
32
|
minifyEnabled false
|
|
33
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
lintOptions {
|
|
37
|
-
abortOnError false
|
|
37
|
+
abortOnError = false
|
|
38
38
|
}
|
|
39
39
|
compileOptions {
|
|
40
40
|
sourceCompatibility JavaVersion.VERSION_21
|
|
@@ -62,7 +62,7 @@ export declare enum OrientationType {
|
|
|
62
62
|
/**
|
|
63
63
|
* Callback to receive the screen orientation change notifications.
|
|
64
64
|
*/
|
|
65
|
-
export
|
|
65
|
+
export type ScreenOrientationChangeListener = (change: ScreenOrientationChange) => void;
|
|
66
66
|
export interface ScreenOrientationChange {
|
|
67
67
|
/**
|
|
68
68
|
* The current orientation type.
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,OAAO,oBACX,SAAQ,SAAS;IAKjB;QACE,KAAK,EAAE,CAAC;QA8CF,4BAAuB,GAAG,KAAK,IAAI,EAAE;YAC3C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAClD,MAAM,WAAW,GAA4B;gBAC3C,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB,CAAC;YACF,IAAI,CAAC,eAAe,CAAC,yBAAyB,EAAE,WAAW,CAAC,CAAC;QAC/D,CAAC,CAAC;QAnDA,IAAI;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,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AAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC/B,CAAC;QACD,QAAQ,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAChC,KAAK,mBAAmB;gBACtB,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,iBAAiB,EAAE,CAAC;YACrD,KAAK,qBAAqB;gBACxB,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,mBAAmB,EAAE,CAAC;YACvD,KAAK,oBAAoB;gBACvB,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,kBAAkB,EAAE,CAAC;YACtD;gBACE,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,gBAAgB,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;IAUO,qBAAqB;QAC3B,MAAM,IAAI,CAAC,WAAW,CACpB,uDAAuD,CACxD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n GetCurrentOrientationResult,\n LockOptions,\n ScreenOrientationChange,\n ScreenOrientationPlugin,\n} from './definitions';\nimport { OrientationType } from './definitions';\n\nexport class ScreenOrientationWeb\n extends WebPlugin\n implements ScreenOrientationPlugin\n{\n private readonly isSupported: boolean;\n\n constructor() {\n super();\n try {\n this.isSupported = 'orientation' in screen;\n } catch {\n this.isSupported = false;\n }\n\n if (this.isSupported) {\n screen.orientation.addEventListener(\n 'change',\n this.handleOrientationChange,\n );\n }\n }\n\n public async lock(options: LockOptions): Promise<void> {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n const type = options?.type ?? screen.orientation.type;\n await screen.orientation.lock(type);\n }\n\n public async unlock(): Promise<void> {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n\n public async getCurrentOrientation(): Promise<GetCurrentOrientationResult> {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n\n private handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent: ScreenOrientationChange = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n\n private throwUnsupportedError(): never {\n throw this.unavailable(\n 'Screen Orientation API not available in this browser.',\n );\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -59,7 +59,7 @@ class ScreenOrientationWeb extends core.WebPlugin {
|
|
|
59
59
|
if (!this.isSupported) {
|
|
60
60
|
this.throwUnsupportedError();
|
|
61
61
|
}
|
|
62
|
-
const type = (_a = options === null || options ===
|
|
62
|
+
const type = (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : screen.orientation.type;
|
|
63
63
|
await screen.orientation.lock(type);
|
|
64
64
|
}
|
|
65
65
|
async unlock() {
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var OrientationType;\n(function (OrientationType) {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n OrientationType[\"LANDSCAPE\"] = \"landscape\";\n /**\n * The orientation is in the primary landscape mode.\n */\n OrientationType[\"LANDSCAPE_PRIMARY\"] = \"landscape-primary\";\n /**\n * The orientation is in the secondary landscape mode.\n */\n OrientationType[\"LANDSCAPE_SECONDARY\"] = \"landscape-secondary\";\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n OrientationType[\"PORTRAIT\"] = \"portrait\";\n /**\n * The orientation is in the primary portrait mode.\n */\n OrientationType[\"PORTRAIT_PRIMARY\"] = \"portrait-primary\";\n /**\n * The orientation is in the secondary portrait mode.\n */\n OrientationType[\"PORTRAIT_SECONDARY\"] = \"portrait-secondary\";\n})(OrientationType || (OrientationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ScreenOrientation = registerPlugin('ScreenOrientation', {\n web: () => import('./web').then(m => new m.ScreenOrientationWeb()),\n});\nexport * from './definitions';\nexport { ScreenOrientation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { OrientationType } from './definitions';\nexport class ScreenOrientationWeb extends WebPlugin {\n constructor() {\n super();\n this.handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n try {\n this.isSupported = 'orientation' in screen;\n }\n catch (_a) {\n this.isSupported = false;\n }\n if (this.isSupported) {\n screen.orientation.addEventListener('change', this.handleOrientationChange);\n }\n }\n async lock(options) {\n var _a;\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n const type = (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : screen.orientation.type;\n await screen.orientation.lock(type);\n }\n async unlock() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n async getCurrentOrientation() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Orientation API not available in this browser.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["OrientationType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B;AACA;AACA;AACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;AAC9C;AACA;AACA;AACA,IAAI,eAAe,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AAC9D;AACA;AACA;AACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB;AAClE;AACA;AACA;AACA,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,UAAU;AAC5C;AACA;AACA;AACA,IAAI,eAAe,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;AAC5D;AACA;AACA;AACA,IAAI,eAAe,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;AAChE,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;;ACzBxC,MAAC,iBAAiB,GAAGC,mBAAc,CAAC,mBAAmB,EAAE;AAC9D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;AACtE,CAAC;;ACDM,MAAM,oBAAoB,SAASC,cAAS,CAAC;AACpD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE;AACf,QAAQ,IAAI,CAAC,uBAAuB,GAAG,YAAY;AACnD,YAAY,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE;AAC7D,YAAY,MAAM,WAAW,GAAG;AAChC,gBAAgB,IAAI,EAAE,MAAM,CAAC,IAAI;AACjC,aAAa;AACb,YAAY,IAAI,CAAC,eAAe,CAAC,yBAAyB,EAAE,WAAW,CAAC;AACxE,
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var OrientationType;\n(function (OrientationType) {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n OrientationType[\"LANDSCAPE\"] = \"landscape\";\n /**\n * The orientation is in the primary landscape mode.\n */\n OrientationType[\"LANDSCAPE_PRIMARY\"] = \"landscape-primary\";\n /**\n * The orientation is in the secondary landscape mode.\n */\n OrientationType[\"LANDSCAPE_SECONDARY\"] = \"landscape-secondary\";\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n OrientationType[\"PORTRAIT\"] = \"portrait\";\n /**\n * The orientation is in the primary portrait mode.\n */\n OrientationType[\"PORTRAIT_PRIMARY\"] = \"portrait-primary\";\n /**\n * The orientation is in the secondary portrait mode.\n */\n OrientationType[\"PORTRAIT_SECONDARY\"] = \"portrait-secondary\";\n})(OrientationType || (OrientationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ScreenOrientation = registerPlugin('ScreenOrientation', {\n web: () => import('./web').then(m => new m.ScreenOrientationWeb()),\n});\nexport * from './definitions';\nexport { ScreenOrientation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { OrientationType } from './definitions';\nexport class ScreenOrientationWeb extends WebPlugin {\n constructor() {\n super();\n this.handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n try {\n this.isSupported = 'orientation' in screen;\n }\n catch (_a) {\n this.isSupported = false;\n }\n if (this.isSupported) {\n screen.orientation.addEventListener('change', this.handleOrientationChange);\n }\n }\n async lock(options) {\n var _a;\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n const type = (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : screen.orientation.type;\n await screen.orientation.lock(type);\n }\n async unlock() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n async getCurrentOrientation() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Orientation API not available in this browser.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["OrientationType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B;AACA;AACA;AACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;AAC9C;AACA;AACA;AACA,IAAI,eAAe,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AAC9D;AACA;AACA;AACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB;AAClE;AACA;AACA;AACA,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,UAAU;AAC5C;AACA;AACA;AACA,IAAI,eAAe,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;AAC5D;AACA;AACA;AACA,IAAI,eAAe,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;AAChE,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;;ACzBxC,MAAC,iBAAiB,GAAGC,mBAAc,CAAC,mBAAmB,EAAE;AAC9D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;AACtE,CAAC;;ACDM,MAAM,oBAAoB,SAASC,cAAS,CAAC;AACpD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE;AACf,QAAQ,IAAI,CAAC,uBAAuB,GAAG,YAAY;AACnD,YAAY,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE;AAC7D,YAAY,MAAM,WAAW,GAAG;AAChC,gBAAgB,IAAI,EAAE,MAAM,CAAC,IAAI;AACjC,aAAa;AACb,YAAY,IAAI,CAAC,eAAe,CAAC,yBAAyB,EAAE,WAAW,CAAC;AACxE,QAAQ,CAAC;AACT,QAAQ,IAAI;AACZ,YAAY,IAAI,CAAC,WA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,qBAAqB;AACtC,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,mBAAmB,EAAE;AACpE,YAAY,KAAK,oBAAoB;AACrC,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,kBAAkB,EAAE;AACnE,YAAY;AACZ,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,gBAAgB,EAAE;AACjE;AACA,IAAI;AACJ,IAAI,qBAAqB,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,uDAAuD,CAAC;AACvF,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -58,7 +58,7 @@ var capacitorScreenOrientation = (function (exports, core) {
|
|
|
58
58
|
if (!this.isSupported) {
|
|
59
59
|
this.throwUnsupportedError();
|
|
60
60
|
}
|
|
61
|
-
const type = (_a = options === null || options ===
|
|
61
|
+
const type = (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : screen.orientation.type;
|
|
62
62
|
await screen.orientation.lock(type);
|
|
63
63
|
}
|
|
64
64
|
async unlock() {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var OrientationType;\n(function (OrientationType) {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n OrientationType[\"LANDSCAPE\"] = \"landscape\";\n /**\n * The orientation is in the primary landscape mode.\n */\n OrientationType[\"LANDSCAPE_PRIMARY\"] = \"landscape-primary\";\n /**\n * The orientation is in the secondary landscape mode.\n */\n OrientationType[\"LANDSCAPE_SECONDARY\"] = \"landscape-secondary\";\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n OrientationType[\"PORTRAIT\"] = \"portrait\";\n /**\n * The orientation is in the primary portrait mode.\n */\n OrientationType[\"PORTRAIT_PRIMARY\"] = \"portrait-primary\";\n /**\n * The orientation is in the secondary portrait mode.\n */\n OrientationType[\"PORTRAIT_SECONDARY\"] = \"portrait-secondary\";\n})(OrientationType || (OrientationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ScreenOrientation = registerPlugin('ScreenOrientation', {\n web: () => import('./web').then(m => new m.ScreenOrientationWeb()),\n});\nexport * from './definitions';\nexport { ScreenOrientation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { OrientationType } from './definitions';\nexport class ScreenOrientationWeb extends WebPlugin {\n constructor() {\n super();\n this.handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n try {\n this.isSupported = 'orientation' in screen;\n }\n catch (_a) {\n this.isSupported = false;\n }\n if (this.isSupported) {\n screen.orientation.addEventListener('change', this.handleOrientationChange);\n }\n }\n async lock(options) {\n var _a;\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n const type = (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : screen.orientation.type;\n await screen.orientation.lock(type);\n }\n async unlock() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n async getCurrentOrientation() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Orientation API not available in this browser.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["OrientationType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,eAAe,EAAE;IAC5B;IACA;IACA;IACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;IAC9C;IACA;IACA;IACA,IAAI,eAAe,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;IAC9D;IACA;IACA;IACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB;IAClE;IACA;IACA;IACA,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,UAAU;IAC5C;IACA;IACA;IACA,IAAI,eAAe,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;IAC5D;IACA;IACA;IACA,IAAI,eAAe,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;IAChE,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;;ACzBxC,UAAC,iBAAiB,GAAGC,mBAAc,CAAC,mBAAmB,EAAE;IAC9D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;IACtE,CAAC;;ICDM,MAAM,oBAAoB,SAASC,cAAS,CAAC;IACpD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE;IACf,QAAQ,IAAI,CAAC,uBAAuB,GAAG,YAAY;IACnD,YAAY,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE;IAC7D,YAAY,MAAM,WAAW,GAAG;IAChC,gBAAgB,IAAI,EAAE,MAAM,CAAC,IAAI;IACjC,aAAa;IACb,YAAY,IAAI,CAAC,eAAe,CAAC,yBAAyB,EAAE,WAAW,CAAC;IACxE,
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var OrientationType;\n(function (OrientationType) {\n /**\n * The orientation is either landscape-primary or landscape-secondary.\n */\n OrientationType[\"LANDSCAPE\"] = \"landscape\";\n /**\n * The orientation is in the primary landscape mode.\n */\n OrientationType[\"LANDSCAPE_PRIMARY\"] = \"landscape-primary\";\n /**\n * The orientation is in the secondary landscape mode.\n */\n OrientationType[\"LANDSCAPE_SECONDARY\"] = \"landscape-secondary\";\n /**\n * The orientation is either portrait-primary or portrait-secondary.\n */\n OrientationType[\"PORTRAIT\"] = \"portrait\";\n /**\n * The orientation is in the primary portrait mode.\n */\n OrientationType[\"PORTRAIT_PRIMARY\"] = \"portrait-primary\";\n /**\n * The orientation is in the secondary portrait mode.\n */\n OrientationType[\"PORTRAIT_SECONDARY\"] = \"portrait-secondary\";\n})(OrientationType || (OrientationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst ScreenOrientation = registerPlugin('ScreenOrientation', {\n web: () => import('./web').then(m => new m.ScreenOrientationWeb()),\n});\nexport * from './definitions';\nexport { ScreenOrientation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { OrientationType } from './definitions';\nexport class ScreenOrientationWeb extends WebPlugin {\n constructor() {\n super();\n this.handleOrientationChange = async () => {\n const result = await this.getCurrentOrientation();\n const changeEvent = {\n type: result.type,\n };\n this.notifyListeners('screenOrientationChange', changeEvent);\n };\n try {\n this.isSupported = 'orientation' in screen;\n }\n catch (_a) {\n this.isSupported = false;\n }\n if (this.isSupported) {\n screen.orientation.addEventListener('change', this.handleOrientationChange);\n }\n }\n async lock(options) {\n var _a;\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n const type = (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : screen.orientation.type;\n await screen.orientation.lock(type);\n }\n async unlock() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n screen.orientation.unlock();\n }\n async getCurrentOrientation() {\n if (!this.isSupported) {\n this.throwUnsupportedError();\n }\n switch (screen.orientation.type) {\n case 'landscape-primary':\n return { type: OrientationType.LANDSCAPE_PRIMARY };\n case 'landscape-secondary':\n return { type: OrientationType.LANDSCAPE_SECONDARY };\n case 'portrait-secondary':\n return { type: OrientationType.PORTRAIT_SECONDARY };\n default:\n return { type: OrientationType.PORTRAIT_PRIMARY };\n }\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Orientation API not available in this browser.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["OrientationType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,eAAe,EAAE;IAC5B;IACA;IACA;IACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;IAC9C;IACA;IACA;IACA,IAAI,eAAe,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;IAC9D;IACA;IACA;IACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB;IAClE;IACA;IACA;IACA,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,UAAU;IAC5C;IACA;IACA;IACA,IAAI,eAAe,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;IAC5D;IACA;IACA;IACA,IAAI,eAAe,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;IAChE,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;;ACzBxC,UAAC,iBAAiB,GAAGC,mBAAc,CAAC,mBAAmB,EAAE;IAC9D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;IACtE,CAAC;;ICDM,MAAM,oBAAoB,SAASC,cAAS,CAAC;IACpD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE;IACf,QAAQ,IAAI,CAAC,uBAAuB,GAAG,YAAY;IACnD,YAAY,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE;IAC7D,YAAY,MAAM,WAAW,GAAG;IAChC,gBAAgB,IAAI,EAAE,MAAM,CAAC,IAAI;IACjC,aAAa;IACb,YAAY,IAAI,CAAC,eAAe,CAAC,yBAAyB,EAAE,WAAW,CAAC;IACxE,QAAQ,CAAC;IACT,QAAQ,IAAI;IACZ,YAAY,IAAI,CAAC,WAA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qBAAqB;IACtC,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,mBAAmB,EAAE;IACpE,YAAY,KAAK,oBAAoB;IACrC,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,kBAAkB,EAAE;IACnE,YAAY;IACZ,gBAAgB,OAAO,EAAE,IAAI,EAAEA,uBAAe,CAAC,gBAAgB,EAAE;IACjE;IACA,IAAI;IACJ,IAAI,qBAAqB,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,uDAAuD,CAAC;IACvF,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/capacitor-screen-orientation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"description": "Capacitor plugin to lock/unlock the screen orientation.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -63,23 +63,23 @@
|
|
|
63
63
|
"prepublishOnly": "npm run build"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@capacitor/android": "
|
|
67
|
-
"@capacitor/cli": "
|
|
68
|
-
"@capacitor/core": "
|
|
69
|
-
"@capacitor/docgen": "0.3.
|
|
70
|
-
"@capacitor/ios": "
|
|
66
|
+
"@capacitor/android": "8.0.0",
|
|
67
|
+
"@capacitor/cli": "8.0.0",
|
|
68
|
+
"@capacitor/core": "8.0.0",
|
|
69
|
+
"@capacitor/docgen": "0.3.1",
|
|
70
|
+
"@capacitor/ios": "8.0.0",
|
|
71
71
|
"@ionic/eslint-config": "0.4.0",
|
|
72
72
|
"@ionic/swiftlint-config": "2.0.0",
|
|
73
73
|
"eslint": "8.57.0",
|
|
74
74
|
"prettier": "3.4.2",
|
|
75
75
|
"prettier-plugin-java": "2.6.7",
|
|
76
|
-
"rimraf": "6.
|
|
77
|
-
"rollup": "4.
|
|
76
|
+
"rimraf": "6.1.2",
|
|
77
|
+
"rollup": "4.53.3",
|
|
78
78
|
"swiftlint": "2.0.0",
|
|
79
|
-
"typescript": "
|
|
79
|
+
"typescript": "5.9.3"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@capacitor/core": ">=
|
|
82
|
+
"@capacitor/core": ">=8.0.0"
|
|
83
83
|
},
|
|
84
84
|
"swiftlint": "@ionic/swiftlint-config",
|
|
85
85
|
"eslintConfig": {
|