@capacitor/haptics 8.0.0-nightly-20250925T150602.0 → 8.0.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.
@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
9
9
  s.license = package['license']
10
10
  s.homepage = 'https://capacitorjs.com'
11
11
  s.author = package['author']
12
- s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
12
+ s.source = { :git => 'https://github.com/ionic-team/capacitor-haptics.git', :tag => 'v' + package['version'] }
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'haptics/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
package/Package.swift CHANGED
@@ -10,7 +10,7 @@ let package = Package(
10
10
  targets: ["HapticsPlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
14
14
  ],
15
15
  targets: [
16
16
  .target(
@@ -1,9 +1,9 @@
1
1
  ext {
2
2
  capacitorVersion = System.getenv('CAPACITOR_VERSION')
3
3
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
4
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
5
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
6
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
4
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
5
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
6
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
7
7
  }
8
8
 
9
9
  buildscript {
@@ -11,11 +11,11 @@ buildscript {
11
11
  google()
12
12
  mavenCentral()
13
13
  maven {
14
- url "https://plugins.gradle.org/m2/"
14
+ url = "https://plugins.gradle.org/m2/"
15
15
  }
16
16
  }
17
17
  dependencies {
18
- classpath 'com.android.tools.build:gradle:8.7.2'
18
+ classpath 'com.android.tools.build:gradle:8.13.0'
19
19
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
20
20
  classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
21
21
  }
@@ -25,13 +25,13 @@ buildscript {
25
25
  apply plugin: 'com.android.library'
26
26
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
27
27
  apply plugin: 'io.github.gradle-nexus.publish-plugin'
28
- apply from: file('../../scripts/android/publish-root.gradle')
29
- apply from: file('../../scripts/android/publish-module.gradle')
28
+ apply from: file('../scripts/android/publish-root.gradle')
29
+ apply from: file('../scripts/android/publish-module.gradle')
30
30
  }
31
31
 
32
32
  android {
33
- namespace "com.capacitorjs.plugins.haptics"
34
- compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
33
+ namespace = "com.capacitorjs.plugins.haptics"
34
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
35
35
  defaultConfig {
36
36
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
37
37
  targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
@@ -46,7 +46,7 @@ android {
46
46
  }
47
47
  }
48
48
  lintOptions {
49
- abortOnError false
49
+ abortOnError = false
50
50
  }
51
51
  compileOptions {
52
52
  sourceCompatibility JavaVersion.VERSION_21
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { registerPlugin } from '@capacitor/core';
2
2
  const Haptics = registerPlugin('Haptics', {
3
- web: () => import('./web').then(m => new m.HapticsWeb()),
3
+ web: () => import('./web').then((m) => new m.HapticsWeb()),
4
4
  });
5
5
  export * from './definitions';
6
6
  export { Haptics };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACvD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CACzD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { HapticsPlugin } from './definitions';\n\nconst Haptics = registerPlugin<HapticsPlugin>('Haptics', {\n web: () => import('./web').then(m => new m.HapticsWeb()),\n});\n\nexport * from './definitions';\nexport { Haptics };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACvD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CAC3D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { HapticsPlugin } from './definitions';\n\nconst Haptics = registerPlugin<HapticsPlugin>('Haptics', {\n web: () => import('./web').then((m) => new m.HapticsWeb()),\n});\n\nexport * from './definitions';\nexport { Haptics };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAQ9D,MAAM,OAAO,UAAW,SAAQ,SAAS;IAAzC;;QACE,qBAAgB,GAAG,KAAK,CAAC;IA0D3B,CAAC;IAxDC,KAAK,CAAC,MAAM,CAAC,OAAuB;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;QACtD,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA6B;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC;QAC3D,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAwB;QACpC,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,GAAG,CAAC;QAC1C,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC/B;IACH,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAEO,gBAAgB,CAAC,QAAqB,WAAW,CAAC,KAAK;QAC7D,IAAI,KAAK,KAAK,WAAW,CAAC,MAAM,EAAE;YAChC,OAAO,CAAC,EAAE,CAAC,CAAC;SACb;aAAM,IAAI,KAAK,KAAK,WAAW,CAAC,KAAK,EAAE;YACtC,OAAO,CAAC,EAAE,CAAC,CAAC;SACb;QACD,OAAO,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAEO,sBAAsB,CAC5B,OAAyB,gBAAgB,CAAC,OAAO;QAEjD,IAAI,IAAI,KAAK,gBAAgB,CAAC,OAAO,EAAE;YACrC,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;SAC7B;aAAM,IAAI,IAAI,KAAK,gBAAgB,CAAC,KAAK,EAAE;YAC1C,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;SACrB;QACD,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC;IAEO,kBAAkB,CAAC,OAAiB;QAC1C,IAAI,SAAS,CAAC,OAAO,EAAE;YACrB,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;SACpE;IACH,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport { ImpactStyle, NotificationType } from './definitions';\nimport type {\n HapticsPlugin,\n ImpactOptions,\n NotificationOptions,\n VibrateOptions,\n} from './definitions';\n\nexport class HapticsWeb extends WebPlugin implements HapticsPlugin {\n selectionStarted = false;\n\n async impact(options?: ImpactOptions): Promise<void> {\n const pattern = this.patternForImpact(options?.style);\n this.vibrateWithPattern(pattern);\n }\n\n async notification(options?: NotificationOptions): Promise<void> {\n const pattern = this.patternForNotification(options?.type);\n this.vibrateWithPattern(pattern);\n }\n\n async vibrate(options?: VibrateOptions): Promise<void> {\n const duration = options?.duration || 300;\n this.vibrateWithPattern([duration]);\n }\n\n async selectionStart(): Promise<void> {\n this.selectionStarted = true;\n }\n\n async selectionChanged(): Promise<void> {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n\n async selectionEnd(): Promise<void> {\n this.selectionStarted = false;\n }\n\n private patternForImpact(style: ImpactStyle = ImpactStyle.Heavy): number[] {\n if (style === ImpactStyle.Medium) {\n return [43];\n } else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n\n private patternForNotification(\n type: NotificationType = NotificationType.Success,\n ): number[] {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n } else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n\n private vibrateWithPattern(pattern: number[]) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n } else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG9D,MAAM,OAAO,UAAW,SAAQ,SAAS;IAAzC;;QACE,qBAAgB,GAAG,KAAK,CAAC;IAwD3B,CAAC;IAtDC,KAAK,CAAC,MAAM,CAAC,OAAuB;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;QACtD,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA6B;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAA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tB,CAAC;QACD,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC;IAEO,kBAAkB,CAAC,OAAiB;QAC1C,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport { ImpactStyle, NotificationType } from './definitions';\nimport type { HapticsPlugin, ImpactOptions, NotificationOptions, VibrateOptions } from './definitions';\n\nexport class HapticsWeb extends WebPlugin implements HapticsPlugin {\n selectionStarted = false;\n\n async impact(options?: ImpactOptions): Promise<void> {\n const pattern = this.patternForImpact(options?.style);\n this.vibrateWithPattern(pattern);\n }\n\n async notification(options?: NotificationOptions): Promise<void> {\n const pattern = this.patternForNotification(options?.type);\n this.vibrateWithPattern(pattern);\n }\n\n async vibrate(options?: VibrateOptions): Promise<void> {\n const duration = options?.duration || 300;\n this.vibrateWithPattern([duration]);\n }\n\n async selectionStart(): Promise<void> {\n this.selectionStarted = true;\n }\n\n async selectionChanged(): Promise<void> {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n\n async selectionEnd(): Promise<void> {\n this.selectionStarted = false;\n }\n\n private patternForImpact(style: ImpactStyle = ImpactStyle.Heavy): number[] {\n if (style === ImpactStyle.Medium) {\n return [43];\n } else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n\n private patternForNotification(type: NotificationType = NotificationType.Success): number[] {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n } else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n\n private vibrateWithPattern(pattern: number[]) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n } else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n"]}
@@ -46,7 +46,7 @@ exports.NotificationType = void 0;
46
46
  })(exports.NotificationType || (exports.NotificationType = {}));
47
47
 
48
48
  const Haptics = core.registerPlugin('Haptics', {
49
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.HapticsWeb()),
49
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.HapticsWeb()),
50
50
  });
51
51
 
52
52
  class HapticsWeb extends core.WebPlugin {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between large, heavy user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then(m => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,WAAW,EAAE;AACxB;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACpC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;AAC1BC;AACX,CAAC,UAAU,gBAAgB,EAAE;AAC7B;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;AAC3C;AACA;AACA;AACA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E;AAC/B,YAAY,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;AACtC,QAAQ;AACR,aAAa;AACb,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC;AAC9E,QAAQ;AACR,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between large, heavy user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then((m) => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,WAAW,EAAE;AACxB;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACpC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;AAC1BC;AACX,CAAC,UAAU,gBAAgB,EAAE;AAC7B;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;AAC3C;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;AAC3C;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,OAAO,CAAC,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AC,0CAA0C,CAAC;AAC9E,QAAQ;AACR,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -45,7 +45,7 @@ var capacitorHaptics = (function (exports, core) {
45
45
  })(exports.NotificationType || (exports.NotificationType = {}));
46
46
 
47
47
  const Haptics = core.registerPlugin('Haptics', {
48
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.HapticsWeb()),
48
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.HapticsWeb()),
49
49
  });
50
50
 
51
51
  class HapticsWeb extends core.WebPlugin {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between large, heavy user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then(m => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,WAAW,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;IAClC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACpC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;IAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;AAC1BC;IACX,CAAC,UAAU,gBAAgB,EAAE;IAC7B;IACA;IACA;IACA;IACA;IACA,IAA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B,CAAC,OAAO,EAAE;IAChC,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE;IAC/B,YAAY,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;IACtC,QAAQ;IACR,aAAa;IACb,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC;IAC9E,QAAQ;IACR,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between large, heavy user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then((m) => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,WAAW,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;IAClC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACpC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;IAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;AAC1BC;IACX,CAAC,UAAU,gBAAgB,EAAE;IAC7B;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;IAC3C;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;I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;IACtC,QAAQ;IACR,aAAa;IACb,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC;IAC9E,QAAQ;IACR,IAAI;IACJ;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/haptics",
3
- "version": "8.0.0-nightly-20250925T150602.0",
3
+ "version": "8.0.0",
4
4
  "description": "The Haptics API provides physical feedback to the user through touch or vibration.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -19,10 +19,10 @@
19
19
  "license": "MIT",
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "https://github.com/ionic-team/capacitor-plugins"
22
+ "url": "https://github.com/ionic-team/capacitor-haptics"
23
23
  },
24
24
  "bugs": {
25
- "url": "https://github.com/ionic-team/capacitor-plugins/issues"
25
+ "url": "https://github.com/ionic-team/capacitor-haptics/issues"
26
26
  },
27
27
  "keywords": [
28
28
  "capacitor",
@@ -37,7 +37,7 @@
37
37
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
38
38
  "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
39
39
  "eslint": "eslint . --ext ts",
40
- "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
40
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
41
41
  "swiftlint": "node-swiftlint",
42
42
  "docgen": "docgen --api HapticsPlugin --output-readme README.md --output-json dist/docs.json",
43
43
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
@@ -47,23 +47,30 @@
47
47
  "publish:cocoapod": "pod trunk push ./CapacitorHaptics.podspec --allow-warnings"
48
48
  },
49
49
  "devDependencies": {
50
- "@capacitor/android": "next",
51
- "@capacitor/core": "next",
52
- "@capacitor/docgen": "0.2.2",
53
- "@capacitor/ios": "next",
50
+ "@capacitor/android": "^8.0.0",
51
+ "@capacitor/core": "^8.0.0",
52
+ "@capacitor/docgen": "^0.3.0",
53
+ "@capacitor/ios": "^8.0.0",
54
54
  "@ionic/eslint-config": "^0.4.0",
55
- "@ionic/prettier-config": "~1.0.1",
56
- "@ionic/swiftlint-config": "^1.1.2",
55
+ "@ionic/prettier-config": "^4.0.0",
56
+ "@ionic/swiftlint-config": "^2.0.0",
57
+ "@semantic-release/changelog": "^6.0.3",
58
+ "@semantic-release/exec": "^7.1.0",
59
+ "@semantic-release/git": "^10.0.1",
60
+ "@semantic-release/github": "^12.0.2",
61
+ "@semantic-release/npm": "^13.1.2",
62
+ "@types/node": "^24.10.1",
57
63
  "eslint": "^8.57.0",
58
- "prettier": "~2.3.0",
59
- "prettier-plugin-java": "~1.0.2",
60
- "rimraf": "^6.0.1",
61
- "rollup": "^4.26.0",
62
- "swiftlint": "^1.0.1",
63
- "typescript": "~4.1.5"
64
+ "prettier": "^3.6.2",
65
+ "prettier-plugin-java": "^2.7.7",
66
+ "rimraf": "^6.1.2",
67
+ "rollup": "^4.53.3",
68
+ "semantic-release": "^25.0.2",
69
+ "swiftlint": "^2.0.0",
70
+ "typescript": "^5.9.3"
64
71
  },
65
72
  "peerDependencies": {
66
- "@capacitor/core": "next"
73
+ "@capacitor/core": ">=8.0.0"
67
74
  },
68
75
  "prettier": "@ionic/prettier-config",
69
76
  "swiftlint": "@ionic/swiftlint-config",
@@ -80,6 +87,5 @@
80
87
  },
81
88
  "publishConfig": {
82
89
  "access": "public"
83
- },
84
- "gitHead": "c0151b2fd21f3b4c6a5efe675ef81f0202b356ec"
90
+ }
85
91
  }