9 Commits

Author SHA1 Message Date
16c77ccdc8 refactor: use capacitor types for native plugins (#27755)
Issue number: Internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Ionic currently detects and uses Capacitor APIs for different plugins
(haptics, status bar and keyboard). This implementation does not have
type safety and can result in unexpected behaviors.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Adds `@capacitor/core`, `@capacitor/keyboard`, `@capacitor/haptics`
and `@capacitor/status-bar` as dev dependencies. These should _only_ be
used with `import type { }`.
- Refactors the plugin usages to be typed against the plugin packages,
while using a duplicate enum when needing a value. This allows us to not
bundle the capacitor plugins with Ionic Framework.
- Introduces a `getCapacitor()` function for interacting with the
`window.Capacitor` object through a typed object.

**How does it work?**

The idea is we want the type safety from the Capacitor packages, without
directly bundling that source code within Ionic Framework. This means we
use the Capacitor deps where a type is needed, but clone any enums where
a value is referenced. If a Capacitor dep changes the supported values,
Typescript will fail to compile and that will signal to use to update
our enum values to match any changes.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev-build: `7.1.2-dev.11688696027.1c4d4ad1`

Tested against a demo app for some of the core behavior:
https://github.com/sean-perkins/capacitor-ionic-plugins-demo
2023-07-14 15:27:28 +00:00
d10509f840 fix: import paths
The `win` utility was moved to the browser/ folder.
2023-06-01 13:05:00 -04:00
0a0345a84a refactor(many): use utils import (#27160) 2023-04-12 13:25:14 -07:00
a6c9e55adc fix(modal): status bar style defaults to app settings (#26291)
Resolves #26173
2022-11-21 16:10:57 -05:00
377c4f597b fix(modal): status bar color now correct with sheet modal (#25424)
resolves #20501
2022-06-13 14:08:57 -04:00
c10df52f39 fix(modal): backdrop animation when backdropBreakpoint is 1 (#25430)
Resolves #25402
2022-06-13 13:37:11 -04:00
5676bab316 lint(eslint): migrate to eslint and prettier (#25046) 2022-04-04 11:12:53 -04:00
414f24685c fix(modal): sheet animation works correctly if breakpoints value does not include 1 (#23927) 2021-09-14 15:27:59 -04:00
12216d378d feat(modal): add bottom sheet functionality (#23828)
resolves #21039
2021-08-31 15:19:19 -04:00