@capacitor/clipboard 1.0.6 → 4.0.0-beta.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/CHANGELOG.md CHANGED
@@ -3,6 +3,51 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 4.0.0-beta.0 (2022-06-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * add es2017 lib to tsconfig ([#180](https://github.com/ionic-team/capacitor-plugins/issues/180)) ([2c3776c](https://github.com/ionic-team/capacitor-plugins/commit/2c3776c38ca025c5ee965dec10ccf1cdb6c02e2f))
12
+ * correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
13
+ * inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
14
+ * remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
15
+ * **clipboard:** prevent NotAllowedError on first method invocation ([#342](https://github.com/ionic-team/capacitor-plugins/issues/342)) ([ab8eecb](https://github.com/ionic-team/capacitor-plugins/commit/ab8eecb873999d6f4321218c60b45335998189eb))
16
+ * support deprecated types from Capacitor 2 ([#139](https://github.com/ionic-team/capacitor-plugins/issues/139)) ([2d7127a](https://github.com/ionic-team/capacitor-plugins/commit/2d7127a488e26f0287951921a6db47c49d817336))
17
+
18
+
19
+ ### Features
20
+
21
+ * add commonjs output format ([#179](https://github.com/ionic-team/capacitor-plugins/issues/179)) ([8e9e098](https://github.com/ionic-team/capacitor-plugins/commit/8e9e09862064b3f6771d7facbc4008e995d9b463))
22
+ * Clipboard plugin ([fd89544](https://github.com/ionic-team/capacitor-plugins/commit/fd895448fd7c6d105716b31eb4fe42762328513a))
23
+ * set targetSDK default value to 31 ([#824](https://github.com/ionic-team/capacitor-plugins/issues/824)) ([3ee10de](https://github.com/ionic-team/capacitor-plugins/commit/3ee10de98067984c1a4e75295d001c5a895c47f4))
24
+ * set targetSDK default value to 32 ([#970](https://github.com/ionic-team/capacitor-plugins/issues/970)) ([fa70d96](https://github.com/ionic-team/capacitor-plugins/commit/fa70d96f141af751aae53ceb5642c46b204f5958))
25
+ * Upgrade gradle to 7.4 ([#826](https://github.com/ionic-team/capacitor-plugins/issues/826)) ([5db0906](https://github.com/ionic-team/capacitor-plugins/commit/5db0906f6264287c4f8e69dbaecf19d4d387824b))
26
+ * Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0))
27
+
28
+
29
+
30
+
31
+
32
+ ## [1.0.8](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/clipboard@1.0.7...@capacitor/clipboard@1.0.8) (2022-03-03)
33
+
34
+ **Note:** Version bump only for package @capacitor/clipboard
35
+
36
+
37
+
38
+
39
+
40
+ ## [1.0.7](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/clipboard@1.0.6...@capacitor/clipboard@1.0.7) (2022-01-19)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
46
+
47
+
48
+
49
+
50
+
6
51
  ## [1.0.6](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/clipboard@1.0.5...@capacitor/clipboard@1.0.6) (2021-11-03)
7
52
 
8
53
  **Note:** Version bump only for package @capacitor/clipboard
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'clipboard/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '12.0'
14
+ s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/README.md CHANGED
@@ -23,7 +23,7 @@ const writeToClipboard = async () => {
23
23
  const checkClipboard = async () => {
24
24
  const { type, value } = await Clipboard.read();
25
25
 
26
- alert(`Got ${type} from clipboard: ${value}`);
26
+ console.log(`Got ${type} from clipboard: ${value}`);
27
27
  };
28
28
  ```
29
29
 
@@ -1,8 +1,8 @@
1
1
  ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,17 +11,17 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:4.2.1'
14
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
15
  }
16
16
  }
17
17
 
18
18
  apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
22
  defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
25
  versionCode 1
26
26
  versionName "1.0"
27
27
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -36,14 +36,13 @@ android {
36
36
  abortOnError false
37
37
  }
38
38
  compileOptions {
39
- sourceCompatibility JavaVersion.VERSION_1_8
40
- targetCompatibility JavaVersion.VERSION_1_8
39
+ sourceCompatibility JavaVersion.VERSION_11
40
+ targetCompatibility JavaVersion.VERSION_11
41
41
  }
42
42
  }
43
43
 
44
44
  repositories {
45
45
  google()
46
- jcenter()
47
46
  mavenCentral()
48
47
  }
49
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface ClipboardPlugin {\n /**\n * Write a value to the clipboard (the \"copy\" action)\n *\n * @since 1.0.0\n */\n write(options: WriteOptions): Promise<void>;\n\n /**\n * Read a value from the clipboard (the \"paste\" action)\n *\n * @since 1.0.0\n */\n read(): Promise<ReadResult>;\n}\n\n/**\n * Represents the data to be written to the clipboard.\n *\n * @since 1.0.0\n */\nexport interface WriteOptions {\n /**\n * Text value to copy.\n *\n * @since 1.0.0\n */\n string?: string;\n\n /**\n * Image in [Data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format to copy.\n *\n * @since 1.0.0\n */\n image?: string;\n\n /**\n * URL string to copy.\n *\n * @since 1.0.0\n */\n url?: string;\n\n /**\n * User visible label to accompany the copied data (Android Only).\n *\n * @since 1.0.0\n */\n label?: string;\n}\n\n/**\n * Represents the data read from the clipboard.\n *\n * @since 1.0.0\n */\nexport interface ReadResult {\n /**\n * Data read from the clipboard.\n *\n * @since 1.0.0\n */\n value: string;\n\n /**\n * Type of data in the clipboard.\n *\n * @since 1.0.0\n */\n type: string;\n}\n\n/**\n * @deprecated Use `WriteOptions`.\n * @since 1.0.0\n */\nexport type ClipboardWrite = WriteOptions;\n\n/**\n * @deprecated Use `ReadResult`.\n * @since 1.0.0\n */\nexport type ClipboardReadResult = ReadResult;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,SAAS,GAAG,cAAc,CAAkB,WAAW,EAAE;IAC7D,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,YAAY,EAAE;CAC9B,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,SAAS,GAAG,cAAc,CAAkB,WAAW,EAAE;IAC7D,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,YAAY,EAAE;CAC9B,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { ClipboardPlugin } from './definitions';\nimport { ClipboardWeb } from './web';\n\nconst Clipboard = registerPlugin<ClipboardPlugin>('Clipboard', {\n web: () => new ClipboardWeb(),\n});\n\nexport * from './definitions';\nexport { Clipboard };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAa5C,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC,KAAK,CAAC,KAAK,CAAC,OAAqB;QAC/B,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC5D,MAAM,IAAI,CAAC,WAAW,CAAC,6CAA6C,CAAC,CAAC;SACvE;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;YAChC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,GAAG,EAAE;YACtB,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SACnC;aAAM,IAAI,OAAO,CAAC,KAAK,EAAE;YACxB,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE;gBACxC,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;oBACvD,MAAM,kBAAkB,GAAG,IAAI,aAAa,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;oBACpE,MAAM,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;iBACvD;gBAAC,OAAO,GAAG,EAAE;oBACZ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;YAC7C,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAChC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;gBAC1B,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;aACrC;iBAAM;gBACL,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;aAClC;YACD,MAAM,CAAC,SAAS,GAAG,GAAG,EAAE;gBACtB,MAAM,CAAC,GAAG,MAAM,CAAC,MAAgB,CAAC;gBAClC,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,CAAC,CAAC;YACF,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE;gBACnB,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { ClipboardPlugin, ReadResult, WriteOptions } from './definitions';\n\ndeclare global {\n interface Clipboard {\n read(): Promise<any>;\n write(data: any[]): Promise<any>;\n }\n}\n\ndeclare let ClipboardItem: any;\n\nexport class ClipboardWeb extends WebPlugin implements ClipboardPlugin {\n async write(options: WriteOptions): Promise<void> {\n if (typeof navigator === 'undefined' || !navigator.clipboard) {\n throw this.unavailable('Clipboard API not available in this browser');\n }\n\n if (options.string !== undefined) {\n await this.writeText(options.string);\n } else if (options.url) {\n await this.writeText(options.url);\n } else if (options.image) {\n if (typeof ClipboardItem !== 'undefined') {\n try {\n const blob = await (await fetch(options.image)).blob();\n const clipboardItemInput = new ClipboardItem({ [blob.type]: blob });\n await navigator.clipboard.write([clipboardItemInput]);\n } catch (err) {\n throw new Error('Failed to write image');\n }\n } else {\n throw this.unavailable(\n 'Writing images to the clipboard is not supported in this browser',\n );\n }\n } else {\n throw new Error('Nothing to write');\n }\n }\n\n async read(): Promise<ReadResult> {\n if (typeof navigator === 'undefined' || !navigator.clipboard) {\n throw this.unavailable('Clipboard API not available in this browser');\n }\n\n if (typeof ClipboardItem !== 'undefined') {\n try {\n const clipboardItems = await navigator.clipboard.read();\n const type = clipboardItems[0].types[0];\n const clipboardBlob = await clipboardItems[0].getType(type);\n const data = await this._getBlobData(clipboardBlob, type);\n return { value: data, type };\n } catch (err) {\n return this.readText();\n }\n } else {\n return this.readText();\n }\n }\n\n private async readText() {\n if (\n typeof navigator === 'undefined' ||\n !navigator.clipboard ||\n !navigator.clipboard.readText\n ) {\n throw this.unavailable(\n 'Reading from clipboard not supported in this browser',\n );\n }\n\n const text = await navigator.clipboard.readText();\n return { value: text, type: 'text/plain' };\n }\n\n private async writeText(text: string) {\n if (\n typeof navigator === 'undefined' ||\n !navigator.clipboard ||\n !navigator.clipboard.writeText\n ) {\n throw this.unavailable(\n 'Writting to clipboard not supported in this browser',\n );\n }\n\n await navigator.clipboard.writeText(text);\n }\n\n private _getBlobData(clipboardBlob: Blob, type: string): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n if (type.includes('image')) {\n reader.readAsDataURL(clipboardBlob);\n } else {\n reader.readAsText(clipboardBlob);\n }\n reader.onloadend = () => {\n const r = reader.result as string;\n resolve(r);\n };\n reader.onerror = e => {\n reject(e);\n };\n });\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/clipboard",
3
- "version": "1.0.6",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "The Clipboard API enables copy and pasting to/from the system clipboard.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
32
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
33
33
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
34
  "verify:web": "npm run build",
35
35
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -45,10 +45,10 @@
45
45
  "publish:cocoapod": "pod trunk push ./CapacitorClipboard.podspec --allow-warnings"
46
46
  },
47
47
  "devDependencies": {
48
- "@capacitor/android": "^3.0.0",
49
- "@capacitor/core": "^3.0.0",
48
+ "@capacitor/android": "next",
49
+ "@capacitor/core": "next",
50
50
  "@capacitor/docgen": "0.0.18",
51
- "@capacitor/ios": "^3.0.0",
51
+ "@capacitor/ios": "next",
52
52
  "@ionic/eslint-config": "^0.3.0",
53
53
  "@ionic/prettier-config": "~1.0.1",
54
54
  "@ionic/swiftlint-config": "^1.1.2",
@@ -61,7 +61,7 @@
61
61
  "typescript": "~4.1.5"
62
62
  },
63
63
  "peerDependencies": {
64
- "@capacitor/core": "^3.0.0"
64
+ "@capacitor/core": "next"
65
65
  },
66
66
  "prettier": "@ionic/prettier-config",
67
67
  "swiftlint": "@ionic/swiftlint-config",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "64df93225736e9dfad336562f5e53e5a2243052b"
82
+ "gitHead": "fd7db8285f72990522da0adc889514c9804b6dae"
83
83
  }